fastmcp.server.tasks.config
TaskConfig for MCP SEP-1686 background task execution modes.
This module defines the configuration for how tools, resources, and prompts
handle task-augmented execution as specified in SEP-1686.
Classes
TaskMeta
Metadata for task-augmented execution requests.
When passed to call_tool/read_resource/get_prompt, signals that
the operation should be submitted as a background task.
Attributes:
ttl: Client-requested TTL in milliseconds. If None, uses server default.fn_key: Docket routing key. Auto-derived from component name if None.
TaskConfig
Configuration for MCP background task execution (SEP-1686).
Controls how a component handles task-augmented requests:
- “forbidden”: Component does not support task execution. Clients must not request task augmentation; server returns -32601 if they do.
- “optional”: Component supports both synchronous and task execution. Client may request task augmentation or call normally.
- “required”: Component requires task execution. Clients must request task augmentation; server returns -32601 if they don’t.
from_bool
value: True for “optional” mode, False for “forbidden” mode.
- TaskConfig with appropriate mode.
supports_tasks
- True if mode is “optional” or “required”, False if “forbidden”.
validate_function
- fastmcp[tasks] to be installed (pydocket)
- Async functions
fn: The function to validate (handles callable classes and staticmethods).name: Name for error messages.
ImportError: If task execution is enabled but pydocket not installed.ValueError: If task execution is enabled but function is sync.

