Transform your FastAPI routes to agent-friendly, context-efficient MCP
View on GitHub ↗Turn any FastAPI router into a GraphQL query layer + MCP server — zero decorators, zero model changes.
FastAPIMCP was named RouterMCP through 0.8. The old import still works as a deprecated alias (removed at 1.0) — switch to FastAPIMCP.
Contents — Why · How it works · Capability boundaries · Installation · Usage · Authentication · Observability · Hardening · Demo · Development · Status
Existing FastAPI→MCP bridges map one tool per endpoint: dozens of tools, no composition, whole-payload responses. fastapi-gql-mcp instead derives a GraphQL schema from your routes (Apollo's "GraphQL as the MCP contract" pattern), so agents get:
- a constant tool set (2 in simple mode, up to 6 with progressive disclosure) — never one tool per endpoint; discovery tools and graphqlquery carry the readOnlyHint MCP annotation, graphqlmutation the destructiveHint, so agents can auto-run reads and confirm writes - field-level selection — fetch { id name }, not the whole payload - composition — combine several routes in one query; a failing route nulls only its own field - your docs, verbatim — docstrings and description= metadata travel into the schema the agent reads - real auth — queries run through the actual ASGI app, so Depends, middleware and headers apply; pass credentials via per-caller header passthrough - nothing disappears — if a route works over HTTP, it stays callable here: untyped responses, serialization-filtered responses and unions degrade to a documented raw-JSON field (with a startup notice naming the cause and the fix), and - None routes become Boolean success fields — migrat
From the project README.
Add the radar badge to your README — it shows your project was picked up by MCP Radar and links to this page:
[](https://mcp.liqiwa.com/s/KLR-Pattern--fastapi-gql-mcp.html)
Stop your AI from making things up — it proposes, deterministic tools decide, every claim checked against ground truth with evidence. Grounded facts and context survive resets. Reverse engineering is
SysikNagibator/AiPCGive the agent "this" and he gets a real PC.
CacheCarti/dmoera-mcpdMoERA Creator Studio MCP Server: build, backtest, and deploy crypto trading strategies via AI agents
dontpayfull/AInotateAnnotated screenshots for AI agents: Skitch-style arrows, numbered steps, boxes, labels, solid redaction
limoaCatherine/game-studio-harnessDeployable Cursor game-studio harness: rules, skills, crafts, and MCP wiring. 可部署的游戏工作室 Harness:规则、技能、工艺与 MCP 接线。不含工作室数据、密钥或 DCC 程序。
mienetic/mnema🧠 Mnema — Long-term memory for AI via MCP × Vector DB. Pluggable backends, hybrid search, Auto Dream consolidation, CLI + REST API + SDK.
The top new MCP servers of the week, every Monday. No spam, unsubscribe anytime.