If you add endpoints to your FastAPI app after creating the MCP server, you’ll need to refresh the server to include them:
Copy
from fastapi import FastAPIfrom fastapi_mcp import FastApiMCPapp = FastAPI()mcp = FastApiMCP(app)mcp.mount_http()# Add new endpoints after MCP server creation@app.get("/new/endpoint/", operation_id="new_endpoint")async def new_endpoint(): return {"message": "Hello, world!"}# Refresh the MCP server to include the new endpointmcp.setup_server()