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.
Last updated: N/A
What is fastapi-mcp?
This is a demonstration of how to integrate a Model Context Protocol (MCP) server as a sub-application within a FastAPI web application. It provides a basic server setup and a client to illustrate communication with the MCP server.
How to use fastapi-mcp?
- Use Docker: Build the Docker image using
docker build -t fastapi-mcp .
and run it withdocker run -p 8000:8000 --net=host fastapi-mcp
. 2. Alternatively, set up a Python environment: Install dependencies usingpip install -r requirements.txt
, run the client withpython client/client.py
, and start the server usinguvicorn src.main:app
.
Key features of fastapi-mcp
FastAPI integration
Model Context Protocol implementation
Sample client for communication
Docker support
Sub-application mounting
Use cases of fastapi-mcp
Demonstrating MCP integration with FastAPI
Building web applications that utilize model context
Testing MCP client-server communication
Creating microservices with MCP
FAQ from fastapi-mcp
What is Model Context Protocol (MCP)?
What is Model Context Protocol (MCP)?
MCP is a protocol for managing model context in machine learning applications.
What is FastAPI?
What is FastAPI?
FastAPI is a modern, high-performance web framework for building APIs with Python.
How do I run the server?
How do I run the server?
You can run the server using Docker or by setting up a Python environment and using uvicorn.
How do I run the client?
How do I run the client?
Install the required dependencies and then execute the client script using python client/client.py
.
What is the known issue?
What is the known issue?
The MCP server can currently only be mounted on the root path ('/') due to limitations in the MCP Python SDK.