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:
Because the 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 pass version=, and raises KeyError when nothing matches:

Duplicate Handling

When you try to add a component that already exists, the behavior depends on the on_duplicate setting. A FastMCP server defaults to "warn"; a standalone LocalProvider defaults to "error". 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 names, tags, keys, 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.