Skip to main content

fastmcp.server.providers.aggregate

AggregateProvider for combining multiple providers into one. This module provides AggregateProvider, a utility class that presents multiple providers as a single unified provider. Useful when you want to combine custom providers without creating a full FastMCP server. Example:

Classes

AggregateProvider

Utility provider that combines multiple providers into one. Components are aggregated from all providers. For get_* operations, providers are queried in parallel and the highest version is returned. When adding providers with a namespace, wrap_transform() is used to apply the Namespace transform. This means namespace transformation is handled by the wrapped provider, not by AggregateProvider. Errors from individual providers are logged and skipped (graceful degradation). Methods:

add_provider

Add a provider with optional namespace. If the provider is a FastMCP server, it’s automatically wrapped in FastMCPProvider to ensure middleware is invoked correctly. Args:
  • provider: The provider to add.
  • namespace: Optional namespace prefix. When set:
  • Tools become “namespace_toolname”
  • Resources become “protocol://namespace/path”
  • Prompts become “namespace_promptname”

get_tasks

Get all task-eligible components from all providers.

lifespan

Combine lifespans of all providers.