fastapi-gql-mcp: one GraphQL MCP surface cuts tool tokens from ~11k to ~2.5k and stops payload bloat

tangkikodo · reddit · 2026-10-05

The author of fastapi-gql-mcp addresses two context costs when exposing FastAPI apps via MCP: one-tool-per-endpoint catalogs (10,950 tokens at 100 routes) and huge list responses (1-2 MB per call, with community threads showing MCP tools wasting 40% of Claude's context).

The fix: derive a GraphQL schema from the FastAPI app (no decorators, no model changes) and expose a tiny constant MCP toolset — getschema + graphqlquery, or a 4-layer drill-down (listdomains → listqueries → getqueryschema → graphqlquery) for large APIs.

Repo includes benchmark methodology and a reproduce script. Install via pip install fastapi-gql-mcp.

Original post →

More from coding & agent

coding & agent channel →