Back to Fastmcp

mcp_operations

docs/python-sdk/fastmcp-server-mixins-mcp_operations.mdx

3.2.4802 B
Original Source

fastmcp.server.mixins.mcp_operations

MCP protocol handler setup and wire-format handlers for FastMCP Server.

Classes

MCPOperationsMixin <sup><a href="https://github.com/PrefectHQ/fastmcp/blob/main/src/fastmcp/server/mixins/mcp_operations.py#L44" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>

Mixin providing MCP protocol handler setup and wire-format handlers.

Note: Methods registered with SDK decorators (e.g., _list_tools_mcp, _call_tool_mcp) cannot use self: FastMCP type hints because the SDK's get_type_hints() fails to resolve FastMCP at runtime (it's only available under TYPE_CHECKING). When type hints fail to resolve, the SDK falls back to calling handlers with no arguments. These methods use untyped self to avoid this issue.