Use this file to discover all available pages before exploring further.
New in version 2.2.0As your application grows, you’ll want to split it into focused servers — one for weather, one for calendar, one for admin — and combine them into a single server that clients connect to. That’s what mount() does.When you mount a server, all its tools, resources, and prompts become available through the parent. The connection is live: add a tool to the child after mounting, and it’s immediately visible through the parent.
from fastmcp import FastMCPweather = FastMCP("Weather")@weather.tooldef get_forecast(city: str) -> str: """Get weather forecast for a city.""" return f"Sunny in {city}"@weather.resource("data://cities")def list_cities() -> list[str]: """List supported cities.""" return ["London", "Paris", "Tokyo"]main = FastMCP("MainApp")main.mount(weather)# main now serves get_forecast and data://cities
Mount remote HTTP servers or subprocess-based MCP servers using create_proxy():
from fastmcp import FastMCPfrom fastmcp.server import create_proxymcp = FastMCP("Orchestrator")# Mount a remote HTTP server (URLs work directly)mcp.mount(create_proxy("http://api.example.com/mcp"), namespace="api")# Mount local Python scripts (file paths work directly)mcp.mount(create_proxy("./my_server.py"), namespace="local")
Because mount() creates a live link, you can add components to a child server after mounting and they’ll be immediately available through the parent:
main = FastMCP("Main")main.mount(dynamic_server, namespace="dynamic")# Add a tool AFTER mounting - it's accessible through main@dynamic_server.tooldef added_later() -> str: return "Added after mounting!"
New in version 3.0.0Parent server tag filters apply recursively to mounted servers:
api_server = FastMCP("API")@api_server.tool(tags={"production"})def prod_endpoint() -> str: return "Production data"@api_server.tool(tags={"development"})def dev_endpoint() -> str: return "Debug data"# Mount with production filterprod_app = FastMCP("Production")prod_app.mount(api_server, namespace="api")prod_app.enable(tags={"production"}, only=True)# Only prod_endpoint (namespaced as api_prod_endpoint) is visible
New in version 3.0.0When mounting multiple servers with the same namespace (or no namespace), the most recently mounted server takes precedence for conflicting component names: