Skip to main content
New in version 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 a LocalProvider as its first provider. Components registered via decorators or direct methods are stored here:
The LocalProvider is always queried first when clients request components, ensuring that your directly-defined components take precedence over those from mounted or proxied servers.

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:

Duplicate Handling

When you try to add a component that already exists, the behavior depends on the on_duplicate setting: Configure this when creating the server:

Component Visibility

New in version 3.0.0 Components can be dynamically enabled or disabled at runtime. Disabled components don’t appear in listings and can’t be called.
See Visibility for the full documentation on keys, tags, allowlist mode, and provider-level control.

Standalone LocalProvider

You can create a LocalProvider independently and attach it to multiple servers:
This is useful for:
  • Sharing components across servers
  • Testing components in isolation
  • Building reusable component libraries
Standalone providers also support visibility control with enable() and disable(). See Visibility for details.