Inspector Version
0.21.1
Describe the bug
Inspector's UI cannot connect to a basic MCP server scaffolded using FastMCP through HTTP transport. However, the CLI works.
To Reproduce:
- Create a local MCP at
server.py:
# /// script
# requires-python = ">=3.10"
# dependencies = [
# "fastmcp>=0.1.0",
# "starlette>=0.35.0",
# ]
# ///
from fastmcp import FastMCP
from starlette.middleware.cors import CORSMiddleware
from starlette.middleware import Middleware
mcp = FastMCP("MCP Server")
@mcp.tool
def greet(name: str) -> str:
return f"Hello, {name}!"
if __name__ == "__main__":
mcp.run(
transport="http",
middleware=[
Middleware(
CORSMiddleware,
allow_origins=["*"],
allow_credentials=True,
allow_methods=["*"],
allow_headers=["*"],
),
],
)
-
Install uv and run uv run server.py.
-
Run Inspector CLI:
npx -y @modelcontextprotocol/inspector --cli http://localhost:8000/mcp --transport http --method tools/call --tool-name greet --tool-arg name=John
It works.
- Run Inspector UI and try to connect. It fails claiming a session ID is missing during the second
notifications/initialized call. However a session ID was actually sent by the server earlier:
Environment:
- OS: macOS
- Browser: Firefox (only - working with Chrome)
Inspector Version
0.21.1
Describe the bug
Inspector's UI cannot connect to a basic MCP server scaffolded using FastMCP through HTTP transport. However, the CLI works.
To Reproduce:
server.py:Install uv and run
uv run server.py.Run Inspector CLI:
It works.
notifications/initializedcall. However a session ID was actually sent by the server earlier:Environment: