Skip to content

[Bug] fastmcp run silently drops --path, --stateless and --log-level for SDK MCPServer (v1) servers #5869

Closed

Description

@BlueX888

Summary

fastmcp run accepts --path, --stateless and --log-level for every server type, but silently drops all three when the target module exposes the SDK mcp.server.mcpserver.MCPServer (v1) instead of FastMCP. The server serves the SDK defaults (/mcp for HTTP, /sse for SSE) and remains stateful, while docs/cli/running.mdx documents --path generically for HTTP. Host and port are forwarded correctly, so the omission is easy to miss.

Reproduction (current main, offline)

# v1_server.py exposes mcp.server.mcpserver.MCPServer
fastmcp run v1_server.py --transport http --path /custom --stateless

With the SDK runners patched to capture kwargs, observed:

http kwargs: {'host': '0.0.0.0', 'port': 9123}
sse  kwargs: {'host': '0.0.0.0', 'port': 9123}

path and stateless are absent (and log_level is likewise ignored). Expected: /custom served in stateless mode for HTTP, and /custom for SSE.

Root cause

fastmcp_slim/fastmcp/cli/run.py:242-243 calls run_v1_server_async(server, host=host, port=port, transport=transport), omitting the already-parsed path, stateless and log_level. run_v1_server_async (same file, ~316-341) has no parameters for them and only builds host/port kwargs. Existing v1 tests assert only the runner method and host/port, so the gap is uncovered.

Suggested fix

Thread path, stateless and log_level into run_v1_server_async and pass the SDK's supported kwargs (streamable_http_path, stateless_http for HTTP/streamable-http; sse_path for SSE). Apply log_level through the SDK server's settings if supported; otherwise document the limitation rather than faking it. Only pass non-None values so SDK defaults are preserved.

Tests

A fix with CLI tests is ready: HTTP/SSE runner kwargs asserted, stateless_http=True only when requested, defaults unchanged when flags are absent. I'll open the linked PR with red/green evidence.

Activity

  1. added
    bugSomething isn't working. Reports of errors, unexpected behavior, or broken functionality.
    cliRelated to FastMCP CLI commands (run, dev, install) or CLI functionality.
    on Oct 19, 2026
  2. added a commit that references this issue on Nov 10, 2026
    6dcec21
  3. added a commit that references this issue on Nov 10, 2026
    95c9608
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working. Reports of errors, unexpected behavior, or broken functionality.cliRelated to FastMCP CLI commands (run, dev, install) or CLI functionality.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions