
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 分