- Home
- MCP servers
- FastAPI
FastAPI
- python
0
GitHub Stars
python
Language
7 months ago
First Indexed
3 months ago
Catalog Refreshed
Documentation & install
Readme and setup notes from the catalogue, plus a client-ready config you can copy for your MCP host.
Installation
Add the following to your MCP client configuration file.
Configuration
View docs{
"mcpServers": {
"teeps-heisenberg-mcp-server-fast-mcp": {
"command": "python",
"args": [
"mcp_server.py"
],
"env": {
"PYTHONPATH": "."
}
}
}
}You can run a focused MCP server that exposes your FastAPI endpoints as tools and connect it to Gemini CLI for natural language interactions. This lets you ask for health checks, user and task management, and calculations using simple commands while the MCP routes requests to your FastAPI backend.
How to use
You interact with the MCP server through Gemini CLI. Start the MCP server locally, then configure Gemini to communicate with it. Once set up, you can ask Gemini to perform actions such as checking health, listing users and tasks, creating or updating records, or performing calculations. Gemini will route your natural language requests to the corresponding MCP tools exposed by the server.
How to install
Prerequisites you need before starting:
• Python 3.8 or higher
• Node.js and npm (for Gemini CLI)
• All Python dependencies listed in requirements.txt
Step by step commands to set up and run the server and client
# 1. Install Python dependencies
pip install -r requirements.txt
# 2. Start the FastAPI application (one terminal)
python app.py
# or use uvicorn directly
uvicorn app:app --reload --host 0.0.0.0 --port 8000
# 3. Install Gemini CLI globally
npm install -g @google/gemini-cli@latest
Configure Gemini CLI to connect to your MCP server. The following configuration snippet shows a local stdio configuration that runs the MCP server script with Python, using the current directory on the Python path.
{
"mcpServers": {
"fastapi_mcp": {
"command": "python",
"args": ["mcp_server.py"],
"env": {
"PYTHONPATH": "."
}
}
}
}
Additional steps to start and verify
- Verify MCP server configuration in Gemini CLI. This ensures Gemini can discover and list the MCP server you configured.
gemini mcp list
Notes on running locally
If you start the FastAPI app in one terminal and the MCP server in another, confirm that the MCP server can reach the API at the expected URL (for the HTTP path) or through its local endpoints. Use the health and data endpoints to validate responses during testing.
Available tools
get_health
Check API health status through the MCP server.
get_users
Retrieve all users from the API.
get_user
Get a specific user by ID.
create_user
Create a new user with provided data.
delete_user
Delete a user by ID.
get_tasks
Retrieve all tasks.
get_task
Get a specific task by ID.
create_task
Create a new task with given details.
complete_task
Mark a task as completed.
delete_task
Delete a task by ID.
calculate
Perform mathematical calculations (add, subtract, multiply, divide).