blurrah/mcp-graphql logo

blurrah/mcp-graphql

Free

允许 AI 查询 GraphQL 服务器。

FreeFree tier
Type
Open Source

About blurrah/mcp-graphql

mcp-graphql is a Model Context Protocol (MCP) server that enables LLMs to interact with GraphQL APIs. It provides schema introspection and query execution capabilities, allowing models to dynamically discover and use GraphQL APIs. The server exposes the GraphQL schema as a resource and offers two main tools: introspect-schema (to retrieve the schema) and query-graphql (to execute queries). Mutations are disabled by default for security, but can be enabled via the ALLOW_MUTATIONS environment variable. Configuration is done via environment variables (ENDPOINT, HEADERS, ALLOW_MUTATIONS, NAME, SCHEMA) rather than command-line arguments as of version 1.0.0. The server can use either remote introspection or a local/URL-based schema file.

Key Features

Schema introspection: retrieve GraphQL schema via introspect-schema tool or as a resource
GraphQL query execution: execute queries against the endpoint via query-graphql tool
Mutation support: optionally enable mutations (disabled by default as a security measure)
Environment variable configuration: ENDPOINT, HEADERS, ALLOW_MUTATIONS, NAME, SCHEMA
Support for local schema files or schema URLs instead of automatic introspection
Easy installation via npx or Smithery for Claude Desktop

Pros & Cons

Pros
  • Open source and free to use
  • Simple setup with environment variables
  • Schema introspection allows dynamic API discovery without prior knowledge
  • Includes built-in security measure (mutations disabled by default)
  • Supports both remote introspection and local schema files
Cons
  • Limited to GraphQL APIs only
  • Mutation support requires explicit opt-in, which may be inconvenient for some use cases
  • Configuration changed to environment variables in version 1.0.0, which may break existing setups

Best For

Enabling LLMs to dynamically discover and query GraphQL APIsIntegrating AI assistants with GraphQL-based backendsSecurity-conscious deployments where mutations are disabled by default

FAQ

How do I enable mutations?
Set the ALLOW_MUTATIONS environment variable to true when running mcp-graphql, e.g., ALLOW_MUTATIONS=true npx mcp-graphql.
Can I use a local schema file instead of introspection?
Yes, you can specify a path to a local GraphQL schema file or a URL via the SCHEMA environment variable.
How do I pass custom headers?
Use the HEADERS environment variable with a JSON string containing headers, e.g., HEADERS='{"Authorization":"Bearer token123"}'.
Is it safe to use in production?
Mutations are disabled by default to prevent LLMs from modifying data. Consider carefully before enabling mutations in production environments.