What is mcp4gql?
mcp4gql is a Node.js/TypeScript server that implements the Model Context Protocol (MCP), acting as a bridge for MCP clients like Cursor to interact with a target GraphQL API. It is intended for developers who want to query and introspect GraphQL APIs through MCP-compatible tools.
How to use mcp4gql?
Configure the environment variables GRAPHQL_ENDPOINT (the target GraphQL API URL) and optionally AUTH_TOKEN (a bearer token). Then configure an MCP client such as Cursor or Claude Desktop to run the server via npx, passing those environment variables. The server communicates over stdio and exposes the tools introspectGraphQLSchema and executeGraphQLOperation to the client.
Key features of mcp4gql
- Implements the MCP Server class from
@modelcontextprotocol/sdk
- Communicates with clients via standard input/output (stdio transport)
- Uses
axios to send requests to the configured GraphQL endpoint
- Exposes
introspectGraphQLSchema tool for fetching the API schema
- Exposes
executeGraphQLOperation tool for running queries or mutations
Use cases of mcp4gql
- Exploring a GraphQL API’s schema from within an MCP-enabled editor
- Running ad-hoc GraphQL queries or mutations without leaving the development environment
- Automating GraphQL operations through MCP workflows in Cursor or Claude Desktop
评论