mcp-graphql is a Model Context Protocol server that enables LLMs to interact with GraphQL APIs. Version 2.0.4 is the latest stable release. It provides schema introspection and query execution tools, allowing AI agents to discover and query GraphQL endpoints dynamically. Key differentiators: supports local schema files as alternative to live introspection, disables mutations by default for safety, and uses environment variables for configuration (command-line args removed in v1.0.0). Other MCP GraphQL servers exist but this one focuses on simplicity and security with minimal setup.
npm install mcp-graphqlNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Shows how to start the MCP server with environment variables and connect using the SDK to list tools and call introspect-schema.
Switch to environment variables: ENDPOINT=http://... npx mcp-graphql
If you rely on SCHEMA, consider migrating to live introspection or provide a local file path.
Set ALLOW_MUTATIONS=true in environment if need mutations, otherwise leave false.
Use single quotes around JSON: HEADERS='{"Authorization":"Bearer token"}'Always set ENDPOINT explicitly.
Use npx mcp-graphql or install globally: npm install -g mcp-graphql && mcp-graphql
Set ENDPOINT environment variable, e.g., ENDPOINT=http://localhost:3000/graphql npx mcp-graphql
Ensure HEADERS is a valid JSON string, e.g., HEADERS='{"Authorization":"Bearer token"}'