
hannesj/mcp-graphql-schema 是从 https://github.com/hannesj/mcp-graphql-schema. 导入的 MCP 服务器候选
概览
hannesj/mcp-graphql-schema 是从 https://github.com/hannesj/mcp-graphql-schema. 导入的 MCP 服务器候选
概述(AI 翻译)
一个模型上下文协议(MCP)服务器,将GraphQL模式信息暴露给大型语言模型(LLM),如Claude。该服务器允许LLM通过一套专用工具探索和理解GraphQL模式。
特色
- 加载通过命令行参数指定的任何 GraphQL 模式文件
- 探索查询、变异和订阅字段
- 查找详细的类型定义
- 利用模式匹配搜索类型和字段
- 获取简化字段信息,包括类型和参数
- 过滤掉内部 GraphQL 类型以获得更清晰的结果
用途
命令行
运行MCP服务器并使用特定的模式文件:
通过Smithery安装
通过Smithery自动安装GraphQL Schema for Claude Desktop:
Claude桌面集成
要在 Claude Desktop 中使用此 MCP 服务器,请编辑您的 claude_desktop_config.json 配置文件:
配置文件的位置:
- macOS/Linux:
~/Library/Application Support/Claude/claude_desktop_config.json - 窗口:
$env:AppData\Claude\claude_desktop_config.json
Claude 代码集成
要使用该MCP服务器配合Claude代码CLI,请遵循以下步骤:
本页由 AI 翻译,技术细节请以原文为准。
README
以下为原文 README 节选,完整内容请查看原文。
GraphQL Schema Model Context Protocol Server
A Model Context Protocol (MCP) server that exposes GraphQL schema information to Large Language Models (LLMs) like Claude. This server allows an LLM to explore and understand GraphQL schemas through a set of specialized tools.
Features
- Load any GraphQL schema file specified via command line argument
- Explore query, mutation, and subscription fields
- Look up detailed type definitions
- Search for types and fields using pattern matching
- Get simplified field information including types and arguments
- Filter out internal GraphQL types for cleaner results
Usage
Command Line
Run the MCP server with a specific schema file:
# 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 --help
Installing via Smithery
To install GraphQL Schema for Claude Desktop automatically via Smithery:
npx -y @smithery/cli install @hannesj/mcp-graphql-schema --client claude
Claude Desktop Integration
To use this MCP server with Claude Desktop, edit your claude_desktop_config.json configuration file:
{
"mcpServers": {
"GraphQL Schema": {
"command": "npx",
"args": ["-y", "mcp-graphql-schema", "/ABSOLUTE/PATH/TO/schema.graphqls"]
}
}
}
Location of the configuration file:
- macOS/Linux:
~/Library/Application Support/Claude/claude_desktop_config.json - Windows:
$env:AppData\Claude\claude_desktop_config.json
Claude Code Integration
To use this MCP server with Claude Code CLI, follow these steps:
-
Add the GraphQL Schema MCP server to 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 -
Verify the MCP server is registered
# List all configured servers claude mcp list # Get details for your GraphQL schema server claude mcp get graphql-schema -
Remove the server if needed
claude mcp remove graphql-schema -
Use the tool in Claude Code
Once configured, you can invoke the tool in your Claude Code session by asking questions about the GraphQL schema.
Tips:
- Use the
-sor--scopeflag withproject(default) orglobalto specify where the configuration is stored - Add multiple MCP servers for different schemas with different names (e.g., main API schema, Shopify schema)
安装
npx -y mcp-graphql-schema /ABSOLUTE/PATH/TO/schema.graphqls配置
{
"mcpServers": {
"GraphQL Schema": {
"command": "npx",
"args": ["-y", "mcp-graphql-schema", "/ABSOLUTE/PATH/TO/schema.graphqls"]
}
}
}