Integrations
Uses Axios to send requests to GraphQL endpoints, allowing for authenticated API interactions with configurable authorization tokens.
Acts as a bridge to any GraphQL API, providing tools to introspect schemas and execute arbitrary queries or mutations against the target GraphQL endpoint.
Built on Node.js to implement the Model Context Protocol server functionality, enabling GraphQL API interactions through standard I/O.
mcp4gql - GraphQL MCP 服务器
该项目是一个实现了模型上下文协议 (MCP) 的 Node.js/TypeScript 服务器。它充当桥梁,允许 MCP 客户端(例如 Cursor)与目标 GraphQL API 进行交互。
特征
- **MCP 服务器:**从
@modelcontextprotocol/sdk
实现 MCPServer
类。 - **Stdio Transport:**通过标准输入/输出与客户端通信。
- **GraphQL 客户端:**使用
axios
向配置的 GraphQL 端点发送请求。 - **通用 GraphQL 工具:**向 MCP 客户端公开以下工具:
introspectGraphQLSchema
:使用自省获取目标 GraphQL API 模式。executeGraphQLOperation
:针对目标 API 执行任意 GraphQL 查询或变异,以query
、可选variables
和可选operationName
作为输入。
配置
服务器需要以下环境变量:
GRAPHQL_ENDPOINT
:目标 GraphQL API 的 URL。AUTH_TOKEN
:用于使用 GraphQL API 进行身份验证的可选Authorization: Bearer <token>
标头的承载令牌。
客户端配置
为了允许 Cursor 或 Claude Desktop 等客户端使用此服务器提供的工具,您需要配置它们以运行npx
命令。
光标
- 转至光标 MCP 设置(光标 > 设置 > 光标设置 > MCP)
- 转至 + 添加新的全局 MCP 服务器
- 将以下内容添加到您的 Cursor MCP 配置中:Copy
克劳德桌面
- 打开 Claude 桌面设置(Claude > 设置)。
- 转到开发人员>编辑配置。
- 添加到配置:Copy
配置完成后,MCP 客户端应该能够列出并调用此服务器提供的introspectGraphQLSchema
和executeGraphQLOperation
工具(如有需要)。请务必在配置中设置所需的环境变量( GRAPHQL_ENDPOINT
以及可选的AUTH_TOKEN
),以便服务器能够连接到您的 API。
You must be authenticated.
GraphQL MCP 服务器充当桥梁,允许 MCP 客户端(如 Cursor 或 Claude Desktop)通过标准工具与目标 GraphQL API 交互,以进行模式自省和操作执行。
Related Resources
Related MCP Servers
- AsecurityAlicenseAqualityMCP for working with GraphQL servers.Last updated -2536103TypeScriptMIT License
- -securityFlicense-qualityAn MCP server that enables graph database interactions with Neo4j, allowing users to access and manipulate graph data through natural language commands.Last updated -Python
- -securityFlicense-qualityA MCP server that exposes GraphQL schema information to LLMs like Claude. This server allows an LLM to explore and understand large GraphQL schemas through a set of specialized tools, without needing to load the whole schema into the contextLast updated -141JavaScript
- -securityAlicense-qualityA Model Context Protocol server that enables LLMs to interact with GraphQL APIs by providing schema introspection and query execution capabilities.Last updated -5361MIT License