Skip to main content
Glama
vkmech999

fastapi-mcp-server

by vkmech999

fastapi-mcp-server ⚡

Turn any FastAPI app into a Claude-compatible MCP server instantly by reading its OpenAPI spec

What it does

Point this tool at any running FastAPI app and it will:

  1. Fetch the OpenAPI spec automatically from /openapi.json

  2. Parse every endpoint — paths, methods, parameters, request bodies

  3. Dynamically register one MCP tool per endpoint

  4. Claude can now call any endpoint using natural language

Zero manual tool writing. Zero code changes to your existing FastAPI app.

Related MCP server: mcpify

Demo

User: "Create a task titled Push code to GitHub with high priority"
Claude: [calls post_tasks tool]
        → Task created successfully ✅

User: "Mark task 2 as completed"
Claude: [calls put_tasks_task_id tool]
        → Task updated ✅

User: "Show me all tasks"
Claude: [calls get_tasks tool]
        → Returns all tasks ✅

Architecture

Your FastAPI App (running)
        ↓
fastapi-mcp-server fetches /openapi.json
        ↓
OpenAPIParser extracts all endpoints
        ↓
One MCP tool registered per endpoint
        ↓
Claude calls tools using natural language
        ↓
MCP server makes real HTTP requests to your API
        ↓
Results returned to Claude

Tech Stack

  • Python 3.12

  • FastAPI + Pydantic

  • MCP (Model Context Protocol)

  • httpx

  • OpenAPI 3.x

Setup

1. Clone and install

git clone https://github.com/vkmech999/fastapi-mcp-server.git
cd fastapi-mcp-server
python3 -m venv venv
source venv/bin/activate
pip install -r requirements.txt

2. Configure environment

cp .env.example .env
# Set TARGET_API_URL to your FastAPI app
# Set AUTH_TYPE if your API requires authentication

3. Connect to Claude Desktop

Add to ~/Library/Application Support/Claude/claude_desktop_config.json:

{
  "mcpServers": {
    "fastapi-mcp-server": {
      "command": "/path/to/venv/bin/python3",
      "args": ["-m", "mcp_server.server"],
      "env": {
        "TARGET_API_URL": "http://localhost:8000",
        "AUTH_TYPE": "none",
        "PYTHONPATH": "/path/to/fastapi-mcp-server"
      }
    }
  }
}

4. Use it in Claude Desktop

"List all available endpoints"
"Get all tasks"
"Create a new user named John with email john@example.com"
"Delete task with ID 3"

Authentication Support

Auth Type

Use Case

Config

none

Public APIs

AUTH_TYPE=none

bearer

JWT / OAuth2

AUTH_TYPE=bearer + AUTH_TOKEN=eyJ...

api_key

Third-party APIs

AUTH_TYPE=api_key + AUTH_TOKEN=sk-... + AUTH_HEADER=X-API-Key

basic

Legacy systems

AUTH_TYPE=basic + AUTH_USERNAME + AUTH_PASSWORD

MCP Tools

Tool

Description

list_api_endpoints

Discover all registered endpoint tools

get_*

Auto-generated GET endpoint tools

post_*

Auto-generated POST endpoint tools

put_*

Auto-generated PUT endpoint tools

delete_*

Auto-generated DELETE endpoint tools

Running Tests

pytest tests/test_server.py -v

Author

Vivek Kumar — Senior Python Full Stack Developer
LinkedIn · GitHub

F
license - not found
-
quality - not tested
C
maintenance

Maintenance

Maintainers
Response time
Release cycle
Releases (12mo)
Commit activity

Resources

Unclaimed servers have limited discoverability.

Looking for Admin?

If you are the server author, to access and configure the admin panel.

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/vkmech999/fastapi-mcp-server'

If you have feedback or need assistance with the MCP directory API, please join our Discord server