60e0ffc959
Upgrade checks / Notify on failure (push) Has been cancelled
Upgrade checks / Close issue on success (push) Has been cancelled
Schema Crash Test / Real-world schema crash test (232K schemas) (push) Has been cancelled
Run static analysis / static_analysis (push) Has been cancelled
Tests / Tests: Python 3.10 on ubuntu-latest (push) Has been cancelled
Tests / Tests: Python 3.13 on ubuntu-latest (push) Has been cancelled
Tests / Tests: Python 3.10 on windows-latest (push) Has been cancelled
Tests / Tests with lowest-direct dependencies (push) Has been cancelled
Tests / MCP conformance tests (push) Has been cancelled
Tests / Integration tests (push) Has been cancelled
Tests / Package install smoke (push) Has been cancelled
Upgrade checks / Static analysis (push) Has been cancelled
Upgrade checks / Tests: Python 3.10 on ubuntu-latest (push) Has been cancelled
Upgrade checks / Tests: Python 3.13 on ubuntu-latest (push) Has been cancelled
Upgrade checks / Tests: Python 3.10 on windows-latest (push) Has been cancelled
Upgrade checks / Integration tests (push) Has been cancelled
Update MCPServerConfig Schema / update-config-schema (push) Has been cancelled
Update SDK Documentation / update-sdk-docs (push) Has been cancelled
FastMCP Tasks Example
Demonstrates background task execution with Docket, including progress tracking, distributed backends, and CLI worker management.
Setup
# From the fastmcp root directory
uv sync
# Start Redis
cd examples/tasks
docker compose up -d
# Load environment (or source .envrc manually)
direnv allow
# Run the server
fastmcp run server.py
For single-process mode without Redis, set FASTMCP_DOCKET_URL=memory:// (note: CLI workers won't work).
Running the Client
# Background execution with progress callbacks
python examples/tasks/client.py --duration 10
# Immediate execution (blocks)
python examples/tasks/client.py immediate --duration 5
Starting Additional Workers
With Redis, you can run additional workers to process tasks in parallel:
fastmcp tasks worker server.py
# Configure via environment:
export FASTMCP_DOCKET_CONCURRENCY=20
fastmcp tasks worker server.py
Backend options:
memory://- Single-process only (default)redis://- Distributed, multi-process (Redis or Valkey)
Environment Variables
| Variable | Default | Description |
|---|---|---|
FASTMCP_DOCKET_URL |
memory:// |
Docket backend URL |