mirror of
https://github.com/GNS3/gns3-server.git
synced 2026-11-24 22:54:34 +02:00
Upgrade MCP SDK to 2.3 and switch transport from SSE to Streamable HTTP
- Drop the unused fastmcp wrapper pin (mcp-requirements.txt) and depend on the official SDK directly: mcp>=2.3,<3. The code only ever imported mcp.server.* modules; fastmcp was pulled in solely as a dependency vehicle and its <4 pin kept mcp locked at 1.x. - Migrate to the SDK 2.x API: FastMCP -> MCPServer (mcp.server.mcpserver); transport_security moves from the constructor into streamable_http_app(). - Replace the deprecated SSE transport (spec-deprecated 2025-06-18) with Streamable HTTP at POST/GET/DELETE /v3/mcp/transport, mounted at /v3/mcp. - Run the StreamableHTTP session manager in the FastAPI lifespan (Starlette does not execute mounted sub-app lifespans), entered before startup finishes so no request passes the MCP ready gate first. - Authenticate every request (the SSE wrapper only checked the opening GET and trusted POSTs by session). Add a 5-minute TTL cache for API-key resolutions so the stricter per-request check does not cost a bcrypt round on every call. - Update docs to the new endpoint, auth flow, and client configuration. Wire-format verified unchanged against SDK 1.30 (structured output auto-detection and content conversion are byte-identical for the list[dict] returns used by all tool handlers).
This commit is contained in:
1 parent
a5e98e2109
commit
fe1b2a5cb0
8 files changed
+160
-70
No files matched your search
@@ -87,7 +87,7 @@ try:
|
||||
# namespace — it would shadow the gns3server.agent.mcp subpackage.
|
||||
import importlib
|
||||
|
||||
importlib.import_module("mcp.server.fastmcp")
|
||||
importlib.import_module("mcp.server.mcpserver")
|
||||
MCP_AVAILABLE = True
|
||||
except ImportError:
|
||||
# MCP dependencies not installed, disable MCP feature
|
||||
|
||||
Reference in new issue
Block a user