fastapi-mcp
by KimiJL
This is a simple example web application demonstrating a Model Context Protocol (MCP) server mounted on an existing FastAPI server. It includes a sample client for communication.
View on GitHub
Last updated: N/A
Description
Simple example web app + client showing Model Context Protocol server mounted on an existing fastapi server
Files
./src/main.py -> main fastapi server app
./src/mcp.py -> mcp sub server app logic
./client/client.py -> sample client showing some communication logic using mcp client lib
Set up
Using Docker to start server
docker build -t fastapi-mcp .
docker run -p 8000:8000 --net=host fastapi-mcp
Set up python environment & run client
pip install -r requirements.txt
python client/client.py
# to run server as well without docker
uvicorn src.main:app
Known Issues
MCP server can only be mounted on root '/'
Limitations on MCP python sdk that currently only allows for MCP server to work when mounted on root /