
Graphql
io.github.Docat0209由 GitHub 帳號 Docat0209 發布v0.1.4更新於 Oct 27, 2026
Turn any GraphQL API into MCP tools. Zero config, zero code.
概覽
透過內省 GraphQL 端點的結構定義,把每個查詢與變更自動變成 MCP 工具,讓助理直接呼叫。
- 可以做什麼
- 透過內省探索 GraphQL 端點的查詢與變更,並把每個操作公開為獨立工具
- 以扁平化的簡單參數呼叫查詢與變更,不需巢狀輸入物件
- 用包含/排除規則與工具名稱前綴限制要公開哪些操作
- 自動裁切陣列、限制巢狀深度與總長度,控制過大的回應
- 將內省結構定義快取到本機以加快啟動,並可強制重新整理
- 標示或封鎖 delete、remove、drop、purge 等破壞性變更
- 適用情境
- 適合讓助理直接使用某個 GraphQL API 而不必自行撰寫伺服器,例如公開的國家資訊 API 或需要權杖的 GitHub GraphQL API。適用於以讀取為主的探索,搭配安全設定也可進行受控的變更操作。
- 執行需求
- 透過 npx(Node.js)在本機以 stdio 程序執行,另有 SSE 傳輸選項。需要 GraphQL 端點網址及連線該端點的網路。驗證為選用,以命令列參數傳入:Bearer 權杖、API 金鑰(放在標頭或查詢參數)或自訂標頭。
安裝
在 SourceWeft 中
- 開啟 儀表板中的 Graphql,將其新增到工作區。
- 為需要使用其工具的對話啟用該服務。
Desktop only,透過 STDIO。 STDIO 服務會啟動本機處理程序,因此需要 SourceWeft 桌面主機。
其他 MCP 客戶端
參照 儲存庫 中的啟動說明。
README
graphql-to-mcp
[npm version] [npm downloads] [License: MIT]
Turn any GraphQL API into MCP tools — zero config, zero code.
Point graphql-to-mcp at a GraphQL endpoint and it auto-generates one MCP tool per query/mutation via introspection. Works with Claude Desktop, Cursor, Windsurf, and any MCP client.
Quick Start
Try it now — no install needed:
Or add to Claude Desktop / Cursor config:
That's it. Claude can now query countries, continents, and languages.
Features
- Zero config — just provide a GraphQL endpoint URL
- Auto-introspection — discovers all queries and mutations automatically
- Flat parameter schemas — nested
inputobjects are flattened for better LLM accuracy - Smart truncation — large responses are intelligently pruned (array slicing + depth limiting)
- Auth support — Bearer tokens, API keys (header or query)
- Retry logic — automatic retries on 429/5xx with exponential backoff
- Include/exclude filters — expose only the operations you want
- Schema caching — skip re-introspection with
--schema-cachefor faster startup - Mutation safety — auto-detect destructive mutations (
delete*,remove*, etc.) and warn or block them
Usage
CLI
Claude Desktop / Cursor Config
Programmatic
How It Works
- Introspect — Fetches the GraphQL schema via introspection query
- Flatten — Nested
InputObjecttypes are flattened into simple key-value parameters (e.g.,input.name→input_name) - Generate — Each query/mutation becomes an MCP tool with a flat JSON Schema
- Execute — When an LLM calls a tool, the flat args are reconstructed into proper GraphQL variables and sent to your endpoint
Why Flat Schemas?
LLMs are significantly better at filling flat key-value parameters than deeply nested JSON objects. By flattening InputObject types, we get:
- Higher accuracy in parameter filling
- Fewer hallucinated nested structures
- Better compatibility across different LLM providers
Options
Smart Truncation
GraphQL APIs can return large payloads that overwhelm LLM context windows. graphql-to-mcp automatically:
- Slices arrays to 20 items (with metadata showing total count)
- Prunes depth beyond 5 levels (with object/array summaries)
- Hard truncates at 50K characters as a safety net
Schema Caching
Introspection queries can be slow on large schemas. Use --schema-cache to save the introspection result locally:
The cache file stores the endpoint URL and timestamp. If you point at a different endpoint, it automatically re-introspects.
Mutation Safety
By default, graphql-to-mcp detects destructive mutations and adds warnings to their descriptions. This helps LLMs understand the risk before executing them.
Detected patterns: delete*, remove*, drop*, clear*, truncate*, destroy*, purge*, reset* (case-insensitive).
Use with REST APIs Too
Pair with mcp-openapi to give Claude access to both REST and GraphQL APIs:
Related
- mcp-openapi — Same zero-config approach for REST/OpenAPI APIs
License
MIT
來源:README.md,提交 3c6934d
工具
0版本歷史
1- v0.1.4最新Sep 16, 2026
評分
已滿足適用檢查項的 50%
該評分衡量此收錄條目的完整程度,依據註冊中心條目、端點與公開來源計算得出。它不是對伺服器本身的評價,也不表示伺服器安全或目前可用:可連通性是帶日期的檢查結果,評分也不包含安裝量或使用者評價。
- 近 30 天內可連通25 分
請保持端點能夠回應 MCP 握手;SourceWeft 每 30 天探測一次。
- 已宣告認證方式10 分
請在註冊中心條目中宣告憑證請求標頭,或保持端點能夠回應探測,以便判定其認證方式。
- 已列出工具15 分
請讓伺服器在無憑證時回應 tools/list,或發布可在沙箱中無憑證啟動的軟體包。
- 描述必需15 分
- 圖示10 分
- 文件15 分
- 授權條款10 分