Task Manager MCP Server
README.md
# MCP + FastAPI demo
Small example showing how a normal FastAPI REST API becomes an MCP server
that an LLM client (Claude Desktop, Claude Code, etc.) can call as tools.
## What's here
- `main.py` — a tiny "Tasks" REST API (`/tasks`, `/tasks/{id}`, ...) built
with plain FastAPI, plus 3 lines at the bottom that wrap it with
[`fastapi-mcp`](https://github.com/tadata-org/fastapi-mcp).
- `fastapi-mcp` introspects your routes (via their `operation_id`) and
auto-generates an MCP tool for each one — no separate tool definitions
to hand-write. It mounts an MCP endpoint at `/mcp` alongside your
normal REST routes.
## How MCP fits in
MCP (Model Context Protocol) is a standard way for an LLM client to
discover and call "tools" exposed by a server. Normally you'd hand-write
a tool schema for each capability. `fastapi-mcp` skips that by reusing
the OpenAPI schema FastAPI already generates from your Pydantic models
and route signatures — so each REST endpoint becomes both a normal HTTP
route *and* an MCP tool, for free.
## Run it
```bash
cd ~/mcp-fastapi-demo
python3 -m venv .venv
source .venv/bin/activate
pip install -r requirements.txt
uvicorn main:app --reload
```
- REST API + docs: http://127.0.0.1:8000/docs
- MCP endpoint: http://127.0.0.1:8000/mcp
## Try it as a normal REST API first
```bash
curl -X POST http://127.0.0.1:8000/tasks -H 'Content-Type: application/json' -d '{"title": "learn MCP"}'
curl http://127.0.0.1:8000/tasks
```
## Connect an MCP client
### Option A: MCP Inspector (fastest way to poke at it)
```bash
npx @modelcontextprotocol/inspector
```
Point it at `http://127.0.0.1:8000/mcp` as an SSE/HTTP server and you'll
see `list_tasks`, `create_task`, `get_task`, `complete_task`,
`delete_task` show up as callable tools — one per FastAPI route.
### Option B: Claude Desktop
Add to your Claude Desktop MCP config (`claude_desktop_config.json`):
```json
{
"mcpServers": {
"tasks": {
"url": "http://127.0.0.1:8000/mcp"
}
}
}
```
Restart Claude Desktop, and you should be able to ask it to list/create
tasks — it'll call your FastAPI endpoints under the hood.
## Key takeaway
`operation_id` in each `@app.get/post/...` decorator becomes the MCP
tool name, and the `summary` becomes its description. Add a new FastAPI
route with an `operation_id` and it automatically becomes a new MCP tool
— that's the whole trick.
This server cannot be deployed
Maintenance
ActivitySlowing
ResponsivenessNo issues