Skip to content

Remove 3.x deprecated module shims and dead parameters - #4447

Merged
jlowin merged 9 commits into
mainfrom
remove/module-shims
Jul 7, 2026
Merged

Remove 3.x deprecated module shims and dead parameters#4447
jlowin merged 9 commits into
mainfrom
remove/module-shims

Conversation

@jlowin

@jlowin jlowin commented Jul 7, 2026

Copy link
Copy Markdown
Member

First batch of FastMCP 4.0 deprecation removals: the pure re-export shims and dead surface deprecated in the 3.x line, all with replacements long shipped. Removed: the fastmcp.server.proxy shim (3.0 → fastmcp.server.providers.proxy), the four fastmcp.server.openapi shims including the deprecated FastMCPOpenAPI class (3.0 → OpenAPIProvider), the experimental openapi shims (2.14), the fastmcp.server.apps/server.app shims (3.2 → fastmcp.apps — a shorter deprecation window, noted deliberately for 4.0), the deprecated PromptToolMiddleware/ResourceToolMiddleware pair (3.1 → PromptsAsTools/ResourcesAsTools transforms), and the no-op sse_read_timeout parameter on StreamableHttpTransport.

Two things the sweep surfaced along the way: tool_injection.py also houses the non-deprecated ToolInjectionMiddleware base class, which stays (removal was scoped to the two deprecated subclasses), and mcp_config.py was still passing the no-op sse_read_timeout into the streamable transport — that dead argument is gone too, while the SSE transport's legitimate use of the config field is untouched.

Upgrade-guide entries now state the removals with their migration paths, and the v4 change register gained a "Removed in 4.0" section. Net: ~740 lines deleted.

Label: breaking change, v4.

@jlowin jlowin added the v4 label Jul 7, 2026
@marvin-context-protocol marvin-context-protocol Bot added enhancement Improvement to existing functionality. For issues and smaller PR improvements. breaking change Breaks backward compatibility. Requires minor version bump. Critical for maintainer attention. labels Jul 7, 2026

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 9617c9db2a

ℹ️ 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".

)

# Re-export from new canonical location
from fastmcp.server.providers.openapi import ( # noqa: E402

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Update tags example before dropping the OpenAPI shim

With this shim gone, a repo-wide search still finds examples/tags_example.py importing MCPType and RouteMap from fastmcp.server.openapi; in a normal dev/example environment with FastAPI installed, running that example now fails at import time because the module no longer exists. Please update the example to import from fastmcp.server.providers.openapi as part of this removal.

Useful? React with 👍 / 👎.

Comment on lines -10 to -11
from fastmcp.apps.config import AppConfig as AppConfig
from fastmcp.apps.config import ResourceCSP as ResourceCSP

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Update QR app example before dropping the apps shim

After deleting this compatibility module, examples/apps/qr_server/qr_server.py still imports AppConfig and ResourceCSP from fastmcp.server.apps; once the example's declared qrcode dependency is installed, the server fails before startup with ModuleNotFoundError. Please switch that example to from fastmcp.apps import AppConfig, ResourceCSP before removing the shim.

Useful? React with 👍 / 👎.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: f216142807

ℹ️ 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".

**Module import paths for proxy and OpenAPI**

The proxy and OpenAPI modules have moved under `providers` to reflect v3's provider-based architecture:
The proxy and OpenAPI modules moved under `providers` to reflect v3's provider-based architecture. The old `fastmcp.server.proxy` and `fastmcp.server.openapi` compatibility shims were **removed in 4.0** — import from the `providers` location instead:

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Move removed shims out of deprecated features

This now documents fastmcp.server.proxy / fastmcp.server.openapi as removed, but it still lives under ### Deprecated Features, whose intro says these still work and only emit warnings. In a 4.0 upgrade those imports now raise ModuleNotFoundError, so readers can wrongly treat a required migration as optional cleanup; please move this subsection to a breaking/removed-features section or adjust the section intro.

Useful? React with 👍 / 👎.

jlowin added 9 commits July 7, 2026 07:53
Tier 2 aggressive-window removal: these shims were deprecated in 3.2,
a shorter deprecation window than the usual policy. Canonical imports
are fastmcp.apps / fastmcp.FastMCPApp.
Use the PromptsAsTools / ResourcesAsTools transforms instead. The
non-deprecated ToolInjectionMiddleware base class is retained.
Tier 2 aggressive-window removal: the parameter was a deprecated no-op
on the streamable-HTTP transport (the SDK v2 client no longer supports
it). SSETransport still accepts sse_read_timeout.
@jlowin
jlowin force-pushed the remove/module-shims branch from f216142 to 14373cc Compare July 7, 2026 11:54
@jlowin
jlowin merged commit bf3a079 into main Jul 7, 2026
14 of 15 checks passed
@jlowin
jlowin deleted the remove/module-shims branch July 7, 2026 11:59

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 14373cc60b

ℹ️ 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".


### `FastMCP` server methods and `mount()` kwargs

The following `FastMCP` methods and parameters, deprecated since 3.0, are removed:

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Align removal notes with implemented removals

This says the FastMCP methods/kwargs are already hard-removed, but this tree still defines the deprecated implementations for add_tool_transformation, import_server, mount(prefix/as_proxy), and as_proxy in fastmcp_slim/fastmcp/server/server.py (and deprecated tests still exercise import_server). In the 4.0 upgrade notes this turns still-working warning-only APIs into mandatory migrations on paper, while the actual removals in this commit are limited to the shim modules/middleware/http arg; please either land these removals in this batch or keep this subsection as future/deprecated.

Useful? React with 👍 / 👎.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

breaking change Breaks backward compatibility. Requires minor version bump. Critical for maintainer attention. enhancement Improvement to existing functionality. For issues and smaller PR improvements. v4

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant