mcp4gql
3
mcp4gql is a Node.js/TypeScript server facilitating interaction with GraphQL APIs through the Model Context Protocol. It enables MCP clients to send queries and perform operations on a target GraphQL endpoint. Key features include schema introspection and execution of GraphQL operations.
mcp4gql - GraphQL MCP Server
This project is a Node.js/TypeScript server implementing the Model Context Protocol (MCP) to enable MCP clients to interact with a GraphQL API.
Features
- MCP Server: Uses the MCP
Server
class from the@modelcontextprotocol/sdk
package. - Stdio Transport: Communicates with clients via stdin/stdout.
- GraphQL Client: Utilizes
axios
for sending requests. - Generic GraphQL Tools:
introspectGraphQLSchema
: Fetches the target GraphQL API schema.executeGraphQLOperation
: Executes queries or mutations against the API.
Configuration
Requires these environment variables:
GRAPHQL_ENDPOINT
: The API's URL.AUTH_TOKEN
: An optional bearer token for authentication.
Client Configuration
Cursor
Configure via Cursor MCP Settings to use npx
command for execution.
Claude Desktop
Edit settings to configure MCP server using npx
command.
Environment variables must be set for the server to interact with the API.