Skip to content

UI can't connect to local/http FastMCP instance (Firefox only) #1184

@rkz

Description

@rkz

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:

  1. 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=["*"],
            ),
        ],
    )
  1. Install uv and run uv run server.py.

  2. 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.

  1. 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:
Image

Environment:

  • OS: macOS
  • Browser: Firefox (only - working with Chrome)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions