-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Closed
Labels
bugSomething isn't working. Reports of errors, unexpected behavior, or broken functionality.Something isn't working. Reports of errors, unexpected behavior, or broken functionality.httpRelated to HTTP transport, networking, or web server functionality.Related to HTTP transport, networking, or web server functionality.serverRelated to FastMCP server implementation or server-side functionality.Related to FastMCP server implementation or server-side functionality.
Description
Description
I use FastMCP.as_proxy all the time, but recently I built a new server and made it with acting as a proxy. For certain servers (http streamable at least), Tool execution is substantially slower. Repo:
- Launch server as is.
- Open inspector with
npx @modelcontextprotocol/inspector - Connect via Streamable HTTP to
http://localhost:8000/mcp - List tools
- Run the single tool.
Response is instant.
Now swap lines 15 and 16 (so FastMCP.as_proxy... is active).
Create an mcp_test.json in the same directory as the script, then run the same test. Every tool (local and remote) will be much slower to respond.
{
"mcpServers": {
"deepwiki": {
"url": "https://mcp.deepwiki.com/mcp",
"transport": "http"
},
"time": {
"command": "uvx",
"args": [
"mcp-server-time"
]
}
}
}Example Code
import json
from datetime import datetime
from pathlib import Path
from zoneinfo import ZoneInfo
from fastmcp import FastMCP
# MARK: Config
config_path = Path("mcp_test.json")
with config_path.open(encoding="utf-8") as f:
config = json.load(f)
# MARK: FastMCP
# mcp = FastMCP.as_proxy(config, name="Slow MCP", include_fastmcp_meta=False)
mcp = FastMCP(name="Fast MCP", include_fastmcp_meta=False)
@mcp.tool
def custom_get_current_time():
"""Get current time in LA with DST information."""
now = datetime.now(ZoneInfo("America/Los_Angeles"))
is_dst = bool(now.dst() and now.dst().total_seconds() != 0) if now.dst() else False
result = {"timezone": "America/Los_Angeles", "datetime": now.isoformat(), "is_dst": is_dst}
return json.dumps(result, indent=2)
if __name__ == "__main__":
mcp.run(transport="http", host="127.0.0.1", port=8000)Version Information
FastMCP version: 2.11.3
MCP version: 1.13.1
Python version: 3.12.10
Platform: Windows-11-10.0.26100-SP0
Metadata
Metadata
Assignees
Labels
bugSomething isn't working. Reports of errors, unexpected behavior, or broken functionality.Something isn't working. Reports of errors, unexpected behavior, or broken functionality.httpRelated to HTTP transport, networking, or web server functionality.Related to HTTP transport, networking, or web server functionality.serverRelated to FastMCP server implementation or server-side functionality.Related to FastMCP server implementation or server-side functionality.