mirror of
https://github.com/GNS3/gns3-server.git
synced 2026-11-03 22:11:14 +02:00
fix: add MCP server ready check to prevent initialization errors
Add server ready state tracking for MCP service to prevent "Received request before initialization was complete" errors when clients connect before GNS3 server completes startup. Changes: - Add MCP server ready state management with wait/notify mechanism - Modify auth wrapper to wait for server initialization before accepting connections - Set MCP server ready flag after GNS3 startup completes This ensures MCP protocol initialization handshake only occurs after GNS3 server is fully initialized, preventing race conditions during server startup.
This commit is contained in:
2 files changed
+67
No files matched your search
@@ -84,6 +84,11 @@ async def startup(app: FastAPI) -> None:
|
||||
m = module.instance()
|
||||
m.port_manager = PortManager.instance()
|
||||
|
||||
# Mark MCP server as ready to accept connections
|
||||
from gns3server.api.routes.mcp import set_mcp_server_ready
|
||||
set_mcp_server_ready(True)
|
||||
log.info("GNS3 server startup completed")
|
||||
|
||||
|
||||
async def shutdown(app: FastAPI) -> None:
|
||||
"""
|
||||
|
||||
Reference in new issue
Block a user