Quickstart
This guide will help you quickly run your first MCP server using FastAPI-MCP.
If you haven’t already installed FastAPI-MCP, follow the installation instructions.
Creating a basic MCP server
To create a basic MCP server, import or create a FastAPI app, wrap it with the FastApiMCP
class and mount the MCP to your existing application:
For more usage examples, see Examples section in the project.
Running the server
By running your FastAPI, your MCP will run at https://app.base.url/mcp
.
For example, by using uvicorn, add to your code:
and run the server using python fastapi_mcp_server.py
, which will serve you the MCP at http://localhost:8000/mcp
.
Connecting a client to the MCP server
Once your FastAPI app with MCP integration is running, you would want to connect it to an MCP client.
Connecting to the MCP Server using SSE
For any MCP client supporting SSE, you will simply need to provide the MCP url.
All the most popular MCP clients (Claude Desktop, Cursor & Windsurf) use the following config format:
Connecting to the MCP Server using mcp-remote
If you want to support authentication, or your MCP client does not support SSE, we recommend using mcp-remote
as a bridge.