Skip to main content
Glama

mcp-graphql

铁匠徽章

模型上下文协议 (MLM) 服务器,使 LLM 能够与 GraphQL API 交互。此实现提供了架构自检和查询执行功能,允许模型动态发现和使用 GraphQL API。

用法

使用正确的端点运行mcp-graphql ,它将自动尝试检查您的查询。

命令行参数

争论

描述

默认

--endpoint

GraphQL 端点 URL

http://localhost:4000/graphql

--headers

包含请求标头的 JSON 字符串

{}

--enable-mutations

启用变异操作(默认禁用)

false

--name

MCP 服务器的名称

mcp-graphql

--schema

本地 GraphQL 模式文件的路径(可选)

-

示例

# Basic usage with a local GraphQL server npx mcp-graphql --endpoint http://localhost:3000/graphql # Using with custom headers npx mcp-graphql --endpoint https://api.example.com/graphql --headers '{"Authorization":"Bearer token123"}' # Enable mutation operations npx mcp-graphql --endpoint http://localhost:3000/graphql --enable-mutations # Using a local schema file instead of introspection npx mcp-graphql --endpoint http://localhost:3000/graphql --schema ./schema.graphql

Related MCP server: NebulaGraph MCP Server

可用工具

该服务器提供两个主要工具:

  1. introspect-schema :此工具用于检索 GraphQL 架构。如果您无法将架构作为资源访问,请首先使用此工具。它使用本地架构文件或自省查询。

  2. query-graphql :针对端点执行 GraphQL 查询。默认情况下,除非指定--enable-mutations否则变更功能处于禁用状态。

资源

  • graphql-schema :服务器将 GraphQL 架构公开为客户端可以访问的资源。这可以是本地架构文件,也可以是基于自省查询的。

安装

通过 Smithery 安装

要通过Smithery自动为 Claude Desktop 安装 GraphQL MCP Toolkit:

npx -y @smithery/cli install mcp-graphql --client claude

手动安装

可以手动安装到 Claude 中:

{ "mcpServers": { "mcp-graphql": { "command": "npx", "args": ["mcp-graphql", "--endpoint", "http://localhost:3000/graphql"] } } }

安全注意事项

出于安全考虑,更改功能默认处于禁用状态,以防止 LLM 修改您的数据库或服务数据。在生产环境中启用更改之前,请仔细考虑。

为您自己的服务器进行定制

这是一个非常通用的实现,它允许完全自省,并允许用户执行任何操作(包括修改)。如果您需要更具体的实现,我建议您创建自己的 MCP 并锁定调用工具,以便客户端仅输入特定的查询字段和/或变量。您可以将其用作参考。

-
security - not tested
F
license - not found
-
quality - not tested

Latest Blog Posts

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/kailashAppDev/graphql-mcp-toolkit'

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