Problem Description
When using MCP servers with the pydantic fastmcp 2.0 library (https://github.com/jlowin/fastmcp), there's a compatibility issue with the agent's httpx request handling. The FastMCP 2.0 library returns different SSE endpoint data compared to the Anthropic MCP Python SDK's FastMCP version.
Current Behavior
FastMCP 2.0 (jlowin/fastmcp):
root@049f308b152b:/app# curl http://127.0.0.1:8001/sse
event: endpoint
data: /messages/?session_id=e4bfbe6166884fddb43043cc9048239c
Anthropic SDK FastMCP:
root@f371d2be39c2:/app# curl http://127.0.0.1:8000/sse
event: endpoint
data: /currenttime/messages/?session_id=80aaaf4ed25c48258d3b7a2537bad54c
Issue
The key difference is that FastMCP 2.0 does not include the mount point (e.g., currenttime) in the endpoint data, while the Anthropic SDK version does. The agent relies on this mount point information to properly route requests.
Why FastMCP 2.0 is Preferred
Despite this compatibility issue, FastMCP 2.0 provides significant advantages:
- Access to the Context object in MCP tools
- Ability to access underlying HTTP request information
- Support for auth headers and custom client information passed through headers
Required Changes
1. Agent-side httpx Monkey Patch
- Implement monkey patching of the httpx request method on the agent side
- Ensure the agent can properly handle FastMCP 2.0's endpoint format
- Maintain compatibility with mount point routing
2. Server Updates
- Update the fininfo server to use Pydantic FastMCP 2.0
- Ensure all existing functionality is preserved
- Leverage the new Context object capabilities where beneficial
3. Testing Requirements
- Test with both currenttime and fininfo servers
- Verify agent can communicate with both servers seamlessly
- Ensure no regression in existing functionality
Sub-Issue: Build Script Improvements
The build_and_run.sh script needs the following updates:
- Registry Files Copy: Copy
registry/servers/*.json files to /opt/mcpgateway/servers
- Faiss Index Cleanup: Delete faiss index files on every startup
These changes are needed as interim measures until true multi-tenancy is implemented for the gateway registry.
Acceptance Criteria
Labels
enhancement, bug, infrastructure
Problem Description
When using MCP servers with the pydantic fastmcp 2.0 library (https://github.com/jlowin/fastmcp), there's a compatibility issue with the agent's httpx request handling. The FastMCP 2.0 library returns different SSE endpoint data compared to the Anthropic MCP Python SDK's FastMCP version.
Current Behavior
FastMCP 2.0 (jlowin/fastmcp):
Anthropic SDK FastMCP:
Issue
The key difference is that FastMCP 2.0 does not include the mount point (e.g.,
currenttime) in the endpoint data, while the Anthropic SDK version does. The agent relies on this mount point information to properly route requests.Why FastMCP 2.0 is Preferred
Despite this compatibility issue, FastMCP 2.0 provides significant advantages:
Required Changes
1. Agent-side httpx Monkey Patch
2. Server Updates
3. Testing Requirements
Sub-Issue: Build Script Improvements
The
build_and_run.shscript needs the following updates:registry/servers/*.jsonfiles to/opt/mcpgateway/serversThese changes are needed as interim measures until true multi-tenancy is implemented for the gateway registry.
Acceptance Criteria
Labels
enhancement, bug, infrastructure