armstrong99/Model-Context-Protocol---Fast-API
3.2
If you are the rightful owner of Model-Context-Protocol---Fast-API and would like to certify it and/or have it hosted online, please leave a comment on the right or send an email to dayong@mcphub.com.
This project demonstrates the Model Context Protocol (MCP) using FastAPI to simulate interactions between a client server and an MCP action server.
MCP Demo with FastAPI
This is a toy project to demonstrate how Model Context Protocol (MCP) can work between:
- A Client Server (simulating an LLM/chatbot).
- A MCP Action Server (defining actions like "setup a meeting").
The goal is to mimic how an LLM might parse user intent and call out to an MCP server to perform specific actions.
🛠️ Requirements
- Python 3.9+
- Install dependencies:
pip install -r requirements.txt
🚀 Running the Servers
1. Start the MCP Action Server
This server exposes actions (e.g., setup_meeting).
python3 mcp_server/main.py
2. Start the Client Server
This simulates a chatbot that listens for prompts and calls the MCP server.
cd inference
python3 -m uvicorn main:app --host 0.0.0.0 --port 8000
💬 Example Usage
- Send a prompt to the client server:
curl -X POST "http://localhost:8000/prompt" \
-H "Content-Type: application/json" \
-d '{"prompt": "Please setup a meeting at 12PM"}'
-
The client server will:
- Parse the text.
- Detect intent ("setup meeting").
- Forward the request to the MCP Action Server.
- Return the MCP server’s response.
📂 Project Structure
.
├── mcp_server/main.py # MCP Action Server (provides supported actions)
├── inference/main.py # Client Server (simulates LLM / chatbot)
├── requirements.txt # Dependencies
⚡ Notes
- This is a toy demo — no real LLM is used.
- Instead of natural language understanding, it uses keyword matching to detect actions.
- You can extend
action_server.pyto support more actions (e.g.,do_xyz,send_sms).