Skip to content

2.14 deprecation removals#2329

Merged
jlowin merged 23 commits intomainfrom
2-14-deprecations
Dec 1, 2025
Merged

2.14 deprecation removals#2329
jlowin merged 23 commits intomainfrom
2-14-deprecations

Conversation

@jlowin
Copy link
Copy Markdown
Member

@jlowin jlowin commented Nov 1, 2025

This PR is a sink for all work related to 2.14 deprecations (closes #2176). Each deprecated issue should have a separate PR that gets merged into this branch, which must be periodically updated from main to fix conflicts. This branch should be ultimately merged with a merge commit, not a squash commit.

This branch should ONLY be merged ahead of 2.14's release, as the breaking changes should not be part of 2.13.x work.

@coderabbitai ignore

Note: #2175 is the most likely to create merge conflicts because it involves many file movements and risks missing enhancements to the experimental parser, so consider merging it later and separately from this branch

As a final check on this branch, review the tests/deprecated files / tests to make sure none were left residually

Closes #2176 (main issue)
Closes #2315 (via transitive #2185 / #2330)

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Nov 1, 2025

Important

Review skipped

Draft detected.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch 2-14-deprecations

Comment @coderabbitai help to get the list of available commands and usage tips.

@marvin-context-protocol marvin-context-protocol Bot added breaking change Breaks backward compatibility. Requires minor version bump. Critical for maintainer attention. enhancement Improvement to existing functionality. For issues and smaller PR improvements. labels Nov 1, 2025
@jlowin jlowin added the DON'T MERGE PR is not ready for merging. Used by authors to prevent premature merging. label Nov 1, 2025
@jlowin jlowin added this to the 2.14.0 Deprecations milestone Nov 1, 2025
jlowin added 14 commits November 1, 2025 12:07
* Remove test warnings (#2331)

* Create new branch and fix issue
* Remove deprecated run_sse_async method

* Update CLI and tests to use run_http_async(transport="sse")

- Change CLI to call run_http_async with transport="sse" instead of run_sse_async
- Update test to mock run_http_async with create=True for v1 servers

* Revert CLI changes - v1 servers do have run_sse_async

- Keep CLI calling run_sse_async() for v1 compatibility
- Update test to mock run_sse_async (which exists on v1)

* Remove unnecessary type ignore for run_sse_async

Method exists on v1 FastMCP class, no type error

* Remove unused imports after test deletion
* Remove deprecated client parameter from FastMCPProxy (#2333)

* Delete deprecated test_output_schema_false.py

Tests functionality that has been removed
…2342)

* Remove resource_prefix_format="protocol" support (fixes #2195)

Removes deprecated protocol format (prefix+resource://path) and keeps only
path format (resource://prefix/path). Since only one format remains:

- Removed resource_prefix_format from settings, FastMCP.__init__, and helpers
- Simplified add_resource_prefix, remove_resource_prefix, has_resource_prefix
- Removed MountedServer.resource_prefix_format field
- Deleted tests for protocol format

All resource prefixes now use path format exclusively.

* Clean up resource_prefix_format references

- Remove from test files
- Update documentation to remove protocol format section
- Move custom HTTP routes note to mounting section
- Remove resource_prefix_format from settings docs

* Use inline version note instead of badge for prefix format

* Remove obsolete test functions and update docs

- Delete test functions that no longer assert anything
- Remove proxy.mdx reference to deleted prefix format section

* Format error messages per ruff
* Remove deprecated from_client classmethod (fixes #2192)

* Remove unused Client import
@jlowin jlowin changed the title 2.14 deprecation removals [HOLD] 2.14 deprecation removals Nov 6, 2025
Resolved conflicts:
- docs/docs.json: Kept debug provider, removed bearer provider
- docs/python-sdk/fastmcp-server-server.mdx: Removed run_streamable_http_async
@marvin-context-protocol
Copy link
Copy Markdown
Contributor

Test Failure Analysis

Summary: All 5 test failures in tests/server/test_tool_exclude_args.py are caused by a NameError: name 'fastmcp' is not defined at line 272 in src/fastmcp/tools/tool.py.

Root Cause: The PR removed the import fastmcp statement (line 22 in the original file) as part of cleaning up deprecation-related code, but left behind a deprecation warning block (lines 272-284) that references fastmcp.settings.deprecation_warnings. When tests using exclude_args run, they trigger this warning code path, which fails because fastmcp is no longer imported.

Suggested Solution: Remove the deprecation warning block entirely (lines 272-284 in the PR branch). This aligns with the PR's purpose of removing deprecations for the 2.14 release.

Specifically, remove these lines from src/fastmcp/tools/tool.py:

if exclude_args and fastmcp.settings.deprecation_warnings:
    warnings.warn(
        "The \`exclude_args\` parameter will be deprecated in FastMCP 2.14. "
        "We recommend using dependency injection with \`Depends()\` instead, which provides "
        "better lifecycle management and is more explicit. "
        "\`exclude_args\` will continue to work until then. "
        "See https://gofastmcp.com/docs/servers/tools for examples.",
        DeprecationWarning,
        stacklevel=2,
    )

The exclude_args functionality itself should continue to work - only the warning about future deprecation needs to be removed, consistent with other deprecation removals in this PR.

Detailed Analysis

Failed Tests

All 5 failures are in tests/server/test_tool_exclude_args.py:

  • test_tool_exclude_args_in_tool_manager
  • test_tool_exclude_args_without_default_value_raises_error
  • test_add_tool_method_exclude_args
  • test_tool_functionality_with_exclude_args
  • test_exclude_args_with_non_serializable_type

Error Stack Trace

src/fastmcp/tools/tool.py:272: in from_function
    if exclude_args and fastmcp.settings.deprecation_warnings:
E   NameError: name 'fastmcp' is not defined

What Changed

The diff shows that line 22 originally had:

import fastmcp

This was removed in the PR, but line 272 still references it:

if exclude_args and fastmcp.settings.deprecation_warnings:

Similar Changes in This PR

The PR successfully removed other deprecation warnings:

  • Image import deprecation warning (src/fastmcp/__init__.py)
  • BearerAuthProvider deprecation (src/fastmcp/server/auth/providers/bearer.py)
  • Context.get_http_request() deprecation (src/fastmcp/server/context.py)
  • FastMCPProxy client parameter deprecation (src/fastmcp/server/proxy.py)
  • add_resource_fn deprecation (src/fastmcp/server/server.py)
  • run_sse_async deprecation (src/fastmcp/server/server.py)

The exclude_args warning should be removed following the same pattern.

Related Files
  • src/fastmcp/tools/tool.py: Contains the offending code at line 272
  • tests/server/test_tool_exclude_args.py: All 5 failing tests are in this file
  • src/fastmcp/__init__.py: Shows the pattern of removing import fastmcp as part of deprecation cleanup

@jlowin jlowin changed the title [HOLD] 2.14 deprecation removals 2.14 deprecation removals Dec 1, 2025
@jlowin jlowin removed the DON'T MERGE PR is not ready for merging. Used by authors to prevent premature merging. label Dec 1, 2025
@jlowin jlowin marked this pull request as ready for review December 1, 2025 18:54
@jlowin jlowin merged commit ee5f465 into main Dec 1, 2025
12 checks passed
@jlowin jlowin deleted the 2-14-deprecations branch December 1, 2025 19:11
@jlowin jlowin restored the 2-14-deprecations branch December 1, 2025 19:13
@jlowin
Copy link
Copy Markdown
Member Author

jlowin commented Dec 1, 2025

Leaving this branch undeleted so we can easily generate release notes from PRs merged into it. Once 2.14 is released, it can be deleted safely.

@marvin-context-protocol
Copy link
Copy Markdown
Contributor

Test Failure Analysis - Post-Merge Integration Test

Summary: The integration test test_call_tool_list_commits failed after merge due to GitHub Copilot MCP API rate limiting (HTTP 429).

Root Cause: This failure is caused by external API rate limiting, not by code changes in the PR:

  1. First test attempt timed out after 15 seconds
  2. Second attempt (via @pytest.mark.flaky) received 429 Too Many Requests from https://api.githubcopilot.com/mcp/
  3. The timeout left pytest in a bad state, causing a teardown KeyError

The test marked with @pytest.mark.flaky(retries=2, delay=1) indicates this is a known-flaky test that depends on external service availability.

Suggested Solution:

No code changes needed - this is an intermittent external service issue. The test design already accounts for flakiness with retry logic. Options to improve robustness:

  1. Increase retry delay: Change line 37 in tests/integration_tests/test_github_mcp_remote.py:

    @pytest.mark.flaky(retries=2, delay=5)  # Increase from 1s to 5s
  2. Add exponential backoff: Replace the simple retry with exponential backoff for rate-limited requests

  3. Skip on rate limit: Modify the test to gracefully skip when hitting rate limits rather than failing:

    except HTTPStatusError as e:
        if e.response.status_code == 429:
            pytest.skip("GitHub API rate limit exceeded")
        raise

Impact: This failure does not indicate any regression from the PR changes. The integration tests passed on retry initially, and the error occurred during cleanup after hitting external rate limits.

Detailed Analysis

Test Execution Timeline

  • 19:11:56 - Test started calling list_commits tool
  • After 15s - First attempt timed out, marked for retry
  • Retry - Second attempt got HTTP 429: Client error '429 Too Many Requests' for url 'https://api.githubcopilot.com/mcp/'
  • Teardown - Pytest cleanup failed with KeyError: <_pytest.stash.StashKey object at 0x7f9b2a01d700>

Error Stack Trace

httpx.HTTPStatusError: Client error '429 Too Many Requests' for url 'https://api.githubcopilot.com/mcp/'
For more information check: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429

The teardown error is a secondary issue caused by pytest's fixture cleanup after the timeout:

File ".venv/lib/python3.10/site-packages/_pytest/tmpdir.py", line 269, in tmp_path
    result_dict = request.node.stash[tmppath_result_key]
KeyError: <_pytest.stash.StashKey object at 0x7f9b2a01d700>

Test Results

  • 14 tests passed
  • 1 test retried (passed on second attempt)
  • 1 error (rate limit + teardown issue)
  • 1 warning (httpx deprecation for per-request cookies)
Related Files
  • tests/integration_tests/test_github_mcp_remote.py:100 - The failing test
  • tests/integration_tests/test_github_mcp_remote.py:37 - Flaky test decorator configuration

jlowin added a commit that referenced this pull request Dec 5, 2025
- Remove ExtendedEnvSettingsSource (FASTMCP_SERVER_ prefix support)
- Remove dependencies parameter from FastMCP.__init__
jlowin added a commit that referenced this pull request Dec 5, 2025
* Implement MCP background tasks (SEP-1686) using Docket

Adds support for background task execution via the MCP task protocol,
powered by Docket for task queue management.

- Tools, resources, and prompts can be marked with `task=True` to run async
- Progress dependency for tracking task progress
- CurrentDocket and CurrentWorker dependencies for advanced use cases
- Client API with `.call_tool(..., task=True)` returns task handles
- Task status notifications via subscriptions
- CLI worker command for distributed task processing

Configuration via environment:
- FASTMCP_ENABLE_DOCKET=true
- FASTMCP_ENABLE_TASKS=true
- FASTMCP_DOCKET_URL=redis://... (or memory:// for single-process)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>

* Fix tasks example import (TaskStatusResponse → GetTaskResult)

The example was using a non-existent TaskStatusResponse type.
Updated to use mcp.types.GetTaskResult which is what the
on_status_change callback actually receives.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>

* Fix env var name in Docket error messages

The error messages referenced FASTMCP_EXPERIMENTAL_ENABLE_DOCKET but the
actual setting is FASTMCP_ENABLE_DOCKET.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>

* Remove deprecated code re-added from pre-#2329 branch

- Remove ExtendedEnvSettingsSource (FASTMCP_SERVER_ prefix support)
- Remove dependencies parameter from FastMCP.__init__

* Replace fakeredis git pin with PyPI release

* Remove redundant fakeredis dev dep (pulled via pydocket)

---------

Co-authored-by: Claude <noreply@anthropic.com>
Co-authored-by: Jeremiah Lowin <153965+jlowin@users.noreply.github.com>
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.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

.env files don't work Tracking issue: deprecated features

1 participant