fastmcp.server.providers.fastmcp_provider
FastMCPProvider for wrapping FastMCP servers as providers.
This module provides the FastMCPProvider class that wraps a FastMCP server
and exposes its components through the Provider interface.
It also provides FastMCPProvider* component classes that delegate execution to
the wrapped server’s middleware, ensuring middleware runs when components are
executed.
Classes
FastMCPProviderTool
Tool that delegates execution to a wrapped server’s middleware.
When run() is called, this tool invokes the wrapped server’s
_call_tool_middleware() method, ensuring the server’s middleware
chain is executed.
Methods:
wrap
run
FastMCPProviderResource
Resource that delegates reading to a wrapped server’s read_resource().
When read() is called, this resource invokes the wrapped server’s
read_resource() method, ensuring the server’s middleware chain is executed.
Methods:
wrap
FastMCPProviderPrompt
Prompt that delegates rendering to a wrapped server’s render_prompt().
When render() is called, this prompt invokes the wrapped server’s
render_prompt() method, ensuring the server’s middleware chain is executed.
Methods:
wrap
render
FastMCPProviderResourceTemplate
Resource template that creates FastMCPProviderResources.
When create_resource() is called, this template creates a
FastMCPProviderResource that will invoke the wrapped server’s middleware
when read.
Methods:
wrap
create_resource
uri is the external/transformed URI (e.g., with namespace prefix).
We use _original_uri_template with params to construct the internal
URI that the nested server understands.

