fastmcp/tests/server/middleware
Chris Guidry 66aaf420c9
[2.14] SEP-1686 tasks (#2378)
* 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>
2025-12-04 20:10:35 -05:00
..
__init__.py Add single-component methods 2025-06-18 19:47:19 -04:00
test_caching.py [2.14] SEP-1686 tasks (#2378) 2025-12-04 20:10:35 -05:00
test_error_handling.py transform NotFoundError to standard MCP error (#2133) 2025-10-18 11:46:57 -04:00
test_initialization_middleware.py Expose InitializeResult to middleware (#2516) 2025-12-01 20:55:29 -05:00
test_logging.py [2.14] SEP-1686 tasks (#2378) 2025-12-04 20:10:35 -05:00
test_middleware.py Support initialize requests in middleware (#1546) 2025-10-05 10:20:13 -04:00
test_rate_limiting.py Support initialize requests in middleware (#1546) 2025-10-05 10:20:13 -04:00
test_timing.py Use lowercase namespace for fastmcp logger (#1791) 2025-09-26 12:13:02 -04:00
test_tool_injection.py Add ToolInjectionMiddleware + Tools for Read/List Resource/Prompt for Client Compat (#2142) 2025-10-24 18:06:58 -04:00