3.0.0
LocalProvider stores components that you define directly on your server. When you use @mcp.tool, @mcp.resource, or @mcp.prompt, you’re adding components to your server’s LocalProvider.
How It Works
Every FastMCP server has aLocalProvider as its first provider. Components registered via decorators or direct methods are stored here:
LocalProvider is registered first, your directly-defined components win ties against mounted or proxied components with the same identifier and version. A higher version from another provider still wins; see Provider Order.
Component Registration
Using Decorators
The most common way to register components:Using Direct Methods
You can also add pre-built component objects:Removing Components
Remove components by name or URI. Each call removes every version unless you passversion=, and raises KeyError when nothing matches:
Duplicate Handling
When you try to add a component that already exists, the behavior depends on theon_duplicate setting. A FastMCP server defaults to "warn"; a standalone LocalProvider defaults to "error".
Configure this when creating the server:
Component Visibility
New in version3.0.0
Components can be dynamically enabled or disabled at runtime. Disabled components don’t appear in listings and can’t be called.
Standalone LocalProvider
You can create a LocalProvider independently and attach it to multiple servers:- Sharing components across servers
- Testing components in isolation
- Building reusable component libraries
enable() and disable(). See Visibility for details.