Skip to content

Conversation

@Kludex
Copy link
Member

@Kludex Kludex commented Jan 16, 2026

Summary

  • Moves transport-specific parameters (host, port, json_response, stateless_http, event_store, retry_interval, sse_path, message_path, streamable_http_path, transport_security) from the FastMCP constructor to run(), sse_app(), and streamable_http_app()
  • Adds @overload decorators to run() for proper type hints per transport type
  • Moves DNS rebinding auto-configuration from constructor to the transport app methods

This improves the API by separating server configuration from transport configuration. Transport parameters are now only relevant where they're used.

BREAKING CHANGE: Transport-specific parameters must now be passed to run() or the transport app methods instead of the FastMCP constructor.

Test plan

  • All 334 FastMCP tests pass
  • All pre-commit checks pass
  • Updated all example files
  • Updated migration docs

🤖 Generated with Claude Code

… to run()

Transport-specific parameters like `host`, `port`, `json_response`, `stateless_http`,
`event_store`, `retry_interval`, `sse_path`, `message_path`, `streamable_http_path`,
and `transport_security` no longer belong in the FastMCP constructor since they are
irrelevant when using stdio transport.

These parameters are now passed to `run()`, `sse_app()`, or `streamable_http_app()`
depending on the transport being used. The `run()` method uses `@overload` decorators
to provide proper type hints for each transport type.

DNS rebinding auto-configuration logic has been moved from the constructor to
`sse_app()` and `streamable_http_app()` methods where it can use the actual host
parameter.

BREAKING CHANGE: Transport-specific parameters must now be passed to run() or
the transport app methods instead of the FastMCP constructor.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
maxisbey
maxisbey previously approved these changes Jan 16, 2026
@Kludex Kludex merged commit 8adb5bd into main Jan 16, 2026
25 of 26 checks passed
@Kludex Kludex deleted the move-specific-parameters-to-run-fastmcp branch January 16, 2026 15:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants