fast_mcp_template
This server does not currently have a deployable release on Glama. Follow the repository's setup instructions to install and configure it for your MCP client, including any required credentials and local dependencies.
fast_mcp_template
This is a GitHub template repository. Click Use this template → Create a new repository on github.com/ayushneo/fast_mcp_template, or:
gh repo create my-service --template ayushneo/fast_mcp_template --private --clone
Same layered CRUD/Docker/Poetry base as fastapi_template,
plus one thing: the app's own REST endpoints are exposed as MCP tools via
fastapi_mcp, so an MCP client
(Claude Desktop, Claude Code, any agent framework) can call them directly.
Generate a new repository from this template; delete items once you've read
how the wiring works.
Built by reading the actual fastapi_mcp source (its README's own code
sample is thinner than what's needed to get filtering/auth/transport right),
not from the surveyed blog posts — see "What was actually useful" below for
why most of those added nothing beyond fastapi_mcp's own docs.
File structure
Identical to fastapi_template/ (see that README for the full layout and its
own trade-offs table — those still apply here) plus:
fast_mcp_template/
├── app/
│ ├── core/
│ │ └── mcp.py -- NEW: builds + mounts the MCP server over this app's own routes
│ ├── api/v1/
│ │ └── items.py -- CHANGED: explicit operation_id on every route (see why below)
│ └── schemas/
│ └── item.py -- CHANGED: Field(..., description=...) on every field
└── tests/
└── test_mcp.py -- NEW: asserts the exposed tool set, no live MCP session neededRelated MCP server: openapi-mcp
The one architectural choice that matters here
There are two different things "add MCP to a FastAPI app" can mean:
(a) Expose the individual REST endpoints as MCP tools and let an external
MCP client do the reasoning about which to call, in what order — this is
what fastapi_mcp is actually built for (turn API endpoints into tools,
not wrap an agent), and what this template does.
(b) Wrap an internal agent loop as one meta-tool (ask_agent(question)
that reasons internally and returns a final answer) — simpler to wire, but
hides all tool-selection structure from the client; from the outside it's
one opaque tool.
This template builds (a). Notably, this repo already made and recorded the
exact same call independently, for the hand-rolled (non-fastapi_mcp)
version of this same decision, in react_mcp_server/react-mcp-server-spec.md
— same reasoning, arrived at twice without cross-referencing.
Trade-offs specific to the MCP layer
(General FastAPI trade-offs — models vs. schemas, error handling, pagination,
logging — are the same as fastapi_template and not repeated here.)
Decision | Options | Chosen, and why |
| Auto-generated (function name + path hash) vs. explicit on every route | Explicit, always — |
Tool descriptions | Minimal vs. | Detailed — this is the entire quality signal an MCP client (an LLM) has to decide whether/how to call a tool. There's no separate "tool doc" to write; the Pydantic field description is the doc. |
Transport |
| HTTP — the current, non-deprecated transport (verified against |
Exposure surface | Expose every endpoint vs. filter | Filtered — |
Auth | Build a custom auth bridge vs. | Not wired by default (no auth in this template at all, same as |
Where to build the MCP object | Inline in | A function ( |
What was actually useful from the surveyed sources
Source | Verdict |
tadata-org/fastapi_mcp (source, not just README) | The only one worth reading closely — this template's |
| Same "(a) not (b)" call, same |
modelcontextprotocol/servers | Reference server implementations (stdio-based tool servers), not FastAPI-specific — no additional guidance for this template's actual problem (exposing an existing HTTP API), so nothing was taken from it directly. |
The Medium/blog posts (Ruchi Awasthi, uselessai.in, Jayant Nehra) and mintmcp's blog | General MCP-concept explainers, largely restating what |
A live upstream bug, verified 2026-09-13
fastapi-mcp==0.4.0 (latest on PyPI) calls the mcp SDK's Server(name, description)
positionally; mcp>=2.0.0 made description keyword-only, so the combination
raises TypeError at import time. pyproject.toml pins mcp = "<2.0" to work
around it. Re-check this pin when bumping fastapi-mcp — the fix is on the
fastapi_mcp side, not something to route around with more code here.
Quick start
cp .env.example .env
poetry install
make migrate
make dev # fastapi dev app/main.py -- REST at /v1/items, docs at /docs, MCP at /mcp
make test # includes tests/test_mcp.pyPoint an MCP client (e.g. Claude Desktop's config, or mcp-remote) at
http://127.0.0.1:8000/mcp and confirm it lists create_item, get_item,
list_items, and health — but not delete_item.
Extending this template
Same as fastapi_template for adding a new resource (model → schema →
repository → service → route → one line in router.py) — the only addition
is: give the route an explicit operation_id, and write its schema field
descriptions for an LLM reader. It becomes an MCP tool automatically the
next time build_mcp() runs; no separate registration step.
Change Log
Date | Change | Author |
2026-09-13 | Forked from | Ayush Sood |
Contributing, security, license
See CONTRIBUTING.md, CODE_OF_CONDUCT.md, SECURITY.md. Released under the MIT License.
This server cannot be deployed
Maintenance
Related MCP Connectors
Streamable HTTP MCP gateway for NV oOS fleets — one API key, namespaced tools, quotas and policy.
Query, browse, and automate OmegaAI workspaces from any MCP client. Streamable HTTP with OAuth 2.0.
Remote MCP server exposing SMI Aware tools, resources, and skills over Streamable HTTP.
Host any HTTP API as MCP tools with a tamper-evident cross-agent settlement ledger.
Related MCP Servers
- AlicenseNot gradedqualityCmaintenanceEnables operating Dataiku DSS projects, datasets, and Agent tools from any MCP client over Streamable HTTP, with read-only by default and secure bearer-token authentication.Apache 2.0
- AlicenseNot gradedqualityBmaintenanceExposes selected operations of an existing REST/OpenAPI app as MCP tools with generated schemas, permission annotations, and a risk class, requiring explicit opt-in before anything is listed and a second flag for destructive calls. Enforces security-first guardrails such as environment-injected auth, a single confined base URL, timeouts, response caps, rate limiting, and a local test console for trying tools.MIT
- AlicenseNot gradedqualityAmaintenanceEnables testing and interacting with any REST API endpoints directly from development environments through MCP clients, including support for multiple HTTP methods, authentication methods, custom headers, SSL verification control, and response size limiting.5 npmISC
- AlicenseNot gradedqualityAmaintenanceEnables testing and interacting with REST API endpoints directly from MCP clients, supporting multiple HTTP methods, authentication methods, custom headers, and response size limits.5 npmISC