Fix #3372 check for valid server

Fix #3372 

Also, made a small refactoring to live dev startup to create live document before agents load.