Skip to main content
Glama

mcp-graphql-schema

by hannesj

GraphQL 模式模型上下文协议服务器

一个模型上下文协议 (MCP) 服务器,用于将 GraphQL 模式信息暴露给 Claude 等大型语言模型 (LLM)。该服务器允许 LLM 通过一组专用工具探索和理解 GraphQL 模式。

特征

  • 通过命令行参数加载指定的任何 GraphQL 模式文件
  • 探索查询、变异和订阅字段
  • 查找详细的类型定义
  • 使用模式匹配搜索类型和字段
  • 获取简化的字段信息,包括类型和参数
  • 过滤内部 GraphQL 类型以获得更清晰的结果

用法

命令行

使用特定的模式文件运行 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 --help

Claude 桌面集成

要将此 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.json
  • Windows: $env:AppData\Claude\claude_desktop_config.json

克劳德代码集成

要将此 MCP 服务器与 Claude Code CLI 一起使用,请按照以下步骤操作:

  1. 将 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
  2. 验证 MCP 服务器是否已注册
    # List all configured servers claude mcp list # Get details for your GraphQL schema server claude mcp get graphql-schema
  3. 如果需要,删除服务器
    claude mcp remove graphql-schema
  4. 使用 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".
-
security - not tested
A
license - permissive license
-
quality - not tested

local-only server

The server can only run on the client's local machine because it depends on local resources.

一个 MCP 服务器,用于向 Claude 等 LLM 公开 GraphQL 模式信息。该服务器允许 LLM 通过一组专用工具探索和理解大型 GraphQL 模式,而无需将整个模式加载到上下文中。

  1. 特征
    1. 用法
      1. 命令行
      2. Claude 桌面集成
      3. 克劳德代码集成
    2. MCP 工具
      1. 示例

        Related MCP Servers

        • A
          security
          A
          license
          A
          quality
          MCP for working with GraphQL servers.
          Last updated -
          2
          733
          170
          TypeScript
          MIT License
          • Apple
        • -
          security
          F
          license
          -
          quality
          A 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 context
          Last updated -
          37
          5
          JavaScript
          • Apple
          • Linux
        • -
          security
          A
          license
          -
          quality
          A Model Context Protocol server that enables LLMs to interact with GraphQL APIs by providing schema introspection and query execution capabilities.
          Last updated -
          733
          1
          MIT License
          • Apple
        • -
          security
          F
          license
          -
          quality
          A Model Context Protocol server that enables LLMs to interact with GraphQL APIs by providing schema introspection and query execution capabilities.
          Last updated -
          9
          TypeScript
          • Apple
          • Linux

        View all related MCP servers

        MCP directory API

        We provide all the information about MCP servers via our MCP API.

        curl -X GET 'https://glama.ai/api/mcp/v1/servers/hannesj/mcp-graphql-schema'

        If you have feedback or need assistance with the MCP directory API, please join our Discord server