mcp-graphql-schema
GraphQL 模式模型上下文协议服务器
一个模型上下文协议 (MCP) 服务器,用于将 GraphQL 模式信息暴露给 Claude 等大型语言模型 (LLM)。该服务器允许 LLM 通过一组专用工具探索和理解 GraphQL 模式。
特征
通过命令行参数加载指定的任何 GraphQL 模式文件
探索查询、变异和订阅字段
查找详细的类型定义
使用模式匹配搜索类型和字段
获取简化的字段信息,包括类型和参数
过滤内部 GraphQL 类型以获得更清晰的结果
Related MCP server: mcp4gql
用法
命令行
使用特定的模式文件运行 MCP 服务器:
# Use the default schema.graphqls in current directory
npx -y mcp-graphql-schema
# Use a specific schema file (relative path)
npx -y mcp-graphql-schema ../schema.shopify.2025-01.graphqls
# Use a specific schema file (absolute path)
npx -y mcp-graphql-schema /absolute/path/to/schema.graphqls
# Show help
npx -y mcp-graphql-schema --helpClaude 桌面集成
要将此 MCP 服务器与 Claude Desktop 一起使用,请编辑您的claude_desktop_config.json配置文件:
{
"mcpServers": {
"GraphQL Schema": {
"command": "npx",
"args": ["-y", "mcp-graphql-schema", "/ABSOLUTE/PATH/TO/schema.graphqls"]
}
}
}配置文件的位置:
macOS/Linux:
~/Library/Application Support/Claude/claude_desktop_config.jsonWindows:
$env:AppData\Claude\claude_desktop_config.json
克劳德代码集成
要将此 MCP 服务器与 Claude Code CLI 一起使用,请按照以下步骤操作:
将 GraphQL Schema MCP 服务器添加到 Claude Code
# Basic syntax claude mcp add graphql-schema npx -y mcp-graphql-schema # Example with specific schema claude mcp add shopify-graphql-schema npx -y mcp-graphql-schema ~/Projects/work/schema.shopify.2025-01.graphqls验证 MCP 服务器是否已注册
# List all configured servers claude mcp list # Get details for your GraphQL schema server claude mcp get graphql-schema如果需要,删除服务器
claude mcp remove graphql-schema使用 Claude Code 中的工具
配置完成后,您可以通过询问有关 GraphQL 模式的问题在 Claude Code 会话中调用该工具。
尖端:
使用
-s或--scope标志与project(默认)或global指定配置的存储位置为具有不同名称的不同架构添加多个 MCP 服务器(例如,主 API 架构、Shopify 架构)
MCP 工具
该服务器为 LLM 与 GraphQL 模式交互提供了以下工具:
list-query-fields:列出 GraphQL 查询的所有可用根级字段get-query-field:获取 SDL 格式的特定查询字段的详细定义list-mutation-fields:列出 GraphQL 突变的所有可用根级字段get-mutation-field:获取 SDL 格式的特定突变字段的详细定义list-subscription-fields:列出 GraphQL 订阅的所有可用根级字段(如果存在于架构中)get-subscription-field:获取特定订阅字段的详细定义(如果存在于模式中)list-types:列出 GraphQL 模式中定义的所有类型(不包括内部类型)get-type:获取 SDL 格式的特定 GraphQL 类型的详细定义get-type-fields:获取特定 GraphQL 对象类型的字段及其类型的简化列表search-schema:按名称模式(不区分大小写的正则表达式)搜索模式中的类型或字段
示例
尝试的示例查询:
What query fields are available in this GraphQL schema?
Show me the details of the "user" query field.
What mutation operations can I perform in this schema?
List all types defined in this schema.
Show me the definition of the "Product" type.
List all fields of the "Order" type.
Search for types and fields related to "customer".This server cannot be deployed
Maintenance
Related MCP Connectors
The Grafbase MCP server sits in front of a GraphQL API and exposes an MCP protocol-compliant interface that allows AI agents and LLMs to explore and query GraphQL APIs using natural language. It provides tools to search schemas, introspect types and fields, and execute GraphQL queries while minimizing context bloat by returning only relevant schema subsets, with built-in support for authentication, authorization, and configurable access control.
An MCP server that provides an API to LLMs to manage their JumpCloud resources.
Repository knowledge graph MCP server for codebase understanding and debugging.
Related MCP Servers
- AlicenseNot gradedqualityFmaintenanceA MCP server that exposes OpenAPI schema information to LLMs like Claude. This server allows an LLM to explore and understand large OpenAPI schemas through a set of specialized tools, without needing to load the whole schema into the context48 npm49MIT
- AlicenseAqualityDmaintenanceGraphQL MCP Server that acts as a bridge allowing MCP clients (like Cursor or Claude Desktop) to interact with target GraphQL APIs through standard tools for schema introspection and operation execution.26 npm3MIT
- AlicenseAqualityDmaintenanceAn MCP server that provides tools for exploring large OpenAPI schemas without loading entire schemas into LLM context. Perfect for discovering and analyzing endpoints, data models, and API structure efficiently.914MIT
- AlicenseAqualityAmaintenanceA generic MCP (Model Context Protocol) server that bridges any GraphQL API to Claude Code. It introspects your GraphQL schema and exposes each query and mutation as an individual tool, letting Claude interact with your API directly.221 npm1MIT