feat: add dual WebMCP + Anthropic MCP server support
...
Browser WebMCP (navigator.modelContext):
- Rewrite mcpService.js with async polling for navigator.modelContext
injection (handles extension content-script timing race)
- Tools queued at call time and flushed when context becomes ready
- _doRegister() is now idempotent (auto-unregister before re-register)
- Normalize both 'execute' and 'callback' properties for cross-build compat
- WebMcpProvider: remove isActive() gate — always register tools
- Fix duplicate provider mount (was in both index.js and App.js)
- Add global tools (list_nodes, get_app_info) registered on every page
- Add swarm-specific tools in SwarmControlPage (get_swarm_status,
get_session_nodes, list_accessible_nodes) — moved useWebMcp() call to
after all state declarations to prevent TDZ crash in minified build
- Align all page tools (Nodes, Skills, Agents) to MCP execute/callback spec
Anthropic MCP SSE transport (NEW: ai-hub/app/api/routes/mcp.py):
- GET /api/v1/mcp/sse — SSE stream with endpoint event per spec
- POST /api/v1/mcp/messages — JSON-RPC 2.0 message dispatch (202 Accepted)
- Implements: initialize, ping, tools/list, tools/call
- Tools: list_nodes, get_app_info, get_node_details, list_agents, list_skills
- All DB queries run in thread pool (run_in_executor) — non-blocking
- Session registry uses asyncio.Queue per connection
Discovery:
- GET /.well-known/mcp/manifest.json — root-level discovery manifest
(mounted directly on FastAPI app, not under /api/v1 prefix)
- nginx.conf: add /.well-known/mcp location block before SPA catch-all
Backend:
- api.py: register MCP router under /mcp prefix
- app.py: mount well-known manifest at root
- models/__init__.py: export AgentTemplate, AgentInstance, AgentTrigger
Verified end-to-end: initialize → tools/list → tools/call all working
via SSE transport against https://ai.jerxie.com
Antigravity AI
committed
21 days ago