Remove deprecated FastMCP() constructor kwargs#3148
Conversation
Replace 16 deprecated kwargs with **kwargs catch that raises TypeError with specific migration instructions. Transport methods now read from fastmcp.settings directly. Delete ExperimentalSettings (dead code).
WalkthroughThis PR removes multiple deprecated FastMCP constructor kwargs and centralizes removal checks via a _REMOVED_KWARGS checker; FastMCP.init signature no longer accepts legacy transport/server, tag-filtering, tool-serialization, and transformation kwargs. Tag filtering is applied post-proxy-creation via enable/disable calls. The MCP Apps decorator parameter is renamed from Possibly related PRs
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
🧪 Generate unit tests (beta)
No actionable comments were generated in the recent review. 🎉 Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
@coderabbitai review |
✅ Actions performedReview triggered.
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 29a37a8432
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
src/fastmcp/mcp_config.py
Outdated
| exclude_tags=self.exclude_tags, | ||
| ) | ||
|
|
||
| if self.include_tags: |
There was a problem hiding this comment.
Handle empty include_tags when configuring proxy filters
Using a truthiness check here changes behavior for include_tags=set(): the filter is now skipped entirely, so the proxy exposes all components, whereas the previous path (FastMCP(..., include_tags=set())) still applied allowlist mode and resulted in no components being enabled. This can silently broaden access when config generation produces an empty include list; check for is not None instead so an explicit empty set remains an explicit filter.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (1)
src/fastmcp/server/mixins/transport.py (1)
240-242:port orwill swallow an explicitport=0(OS-assigned port)
port = port or fastmcp.settings.porttreats0as falsy. If a caller passesport=0to let the OS assign a port, it silently falls back to the settings default. This is likely a pre-existing issue, but worth noting since the function signature acceptsint | None.Suggested fix
- host = host or fastmcp.settings.host - port = port or fastmcp.settings.port + host = host if host is not None else fastmcp.settings.host + port = port if port is not None else fastmcp.settings.port
FastMCP v1 conflated server identity, transport config, and global settings into a single
FastMCP()constructor — v2 deprecated the transport params but kept them for backwards compat, resulting in a 34-parameter__init__with a_deprecated_settingsindirection layer bridging old kwargs to transport methods.This removes all 16 deprecated kwargs and replaces them with a
**kwargscatch that raisesTypeErrorwith specific migration instructions. Users passinghost=get told to userun_http_async(host=...)orFASTMCP_HOST; users passinginclude_tags=get told to useserver.enable(tags=..., only=True). Environment variables continue to work — transport methods now read directly fromfastmcp.settingsinstead of the deleted per-instance_deprecated_settings.Also deletes
ExperimentalSettings(dead code) and fixesmcp_config.pywhich was passinginclude_tags/exclude_tagsthroughcreate_proxy()to the now-strict constructor.