graphql-mcp
Enables interaction with GraphQL APIs by exposing GraphQL operations as MCP tools, including schema introspection, validation, search, and execution.
Click on "Install Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@graphql-mcpExecute the GetUser query with id 123"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
Experimental PoC
graphql-mcp
An MCP (Model Context Protocol) server that exposes GraphQL operations as tools for AI models. Point it at any GraphQL endpoint and a schema, and it turns your operations into typed MCP tools — with schema exploration tools, hot reload, OAuth resource-server auth, MCP prompts, MCP Apps widgets, and OpenTelemetry built in.
Configuration is plain TypeScript — no YAML, no env-var templating; read
process.env directly in your config file.
Quick start
npm install graphql-mcp # or pnpm add / vp addCreate graphql-mcp.config.ts:
import { defineConfig } from "graphql-mcp";
export default defineConfig({
endpoint: "http://localhost:4000/graphql",
schema: { source: "local", path: "./schema.graphql" },
operations: { source: "local", paths: ["./operations"] },
tools: {
introspect: { enabled: true },
search: { enabled: true },
validate: { enabled: true },
execute: { enabled: true },
},
});Run it:
graphql-mcp # stdio transport (default)
graphql-mcp path/to/config.ts # explicit config pathLocal schema files, operation files, prompt files, and the config file itself
are watched: edits hot reload without dropping connected sessions (config
changes trigger a validated in-process restart; SIGHUP forces one).
Related MCP server: mcp4gql
How operations become tools
Every named GraphQL operation in your operation files becomes one MCP tool:
The tool name is the operation name; leading
#comments become the tool description (otherwise one is generated from schema descriptions plus the tree-shaken SDL of the types the operation touches).The input schema is derived from the operation's variables (non-null variables are required; input objects, enums, lists, and custom scalars are fully expanded).
#comments before individual variables override their descriptions.Queries are annotated read-only and idempotent; mutations destructive. Mutations are skipped unless
overrides.mutationModeisexplicitorall.Fields marked
@privateare stripped from the query sent downstream and filtered out of the structured result the model sees (the full response is preserved in_meta.structuredContentfor the host client).
Operation sources: local (watched .graphql files/directories), manifest
(a local apollo-persisted-query-manifest v1 JSON file), or none.
Schema tools
Four individually toggleable tools under tools:
Tool | What it does |
| Returns the SDL for a named type, recursing to a |
| Full-text search over type names, descriptions, and fields; returns tree-shaken SDL along scored paths from the root types. |
| Validates an operation against the schema without executing it. |
| Executes an ad hoc operation written by the model (mutations only when |
Each accepts an optional hint appended to its description.
Transports
stdio(default) — for local MCP clients.http— streamable HTTP on/mcpwith per-session state (or stateless viastatefulMode: false), CORS, Host/Origin validation against DNS rebinding, a/healthendpoint (?live/?ready), and graceful shutdown.
OAuth 2.1 resource server
Nest auth under the HTTP transport to require bearer tokens:
transport: {
type: "http",
port: 8000,
auth: {
servers: ["https://auth.example.com"], // OIDC/OAuth discovery + JWKS
audiences: ["my-api"],
scopes: ["read:graphql"],
scopeMode: "require_all",
},
},
overrides: {
requiredScopes: { DeleteUser: ["admin"] }, // per-operation step-up
},The server publishes RFC 9728 protected-resource metadata at
/.well-known/oauth-protected-resource, answers challenges with
WWW-Authenticate (including insufficient_scope), and passes validated
tokens through to the GraphQL endpoint (disable with
disableAuthTokenPassthrough).
Prompts and MCP Apps
prompts: { directory: "./prompts" }serves Markdown files with YAML frontmatter (name,description,arguments) as MCP prompts, with{{arg}}substitution and hot reload.apps: { directory: "./apps" }serves MCP Apps: each subdirectory with an.application-manifest.jsoncontributes aui://widget/...HTML resource and entrypoint tools backed by GraphQL operations, including prefetch operations, extra inputs/outputs, CSP and widget settings, and OpenAI-Apps-SDK/MCP-Apps targeting via?appTarget=or client capabilities.
Telemetry
telemetry: {
serviceName: "my-graphql-mcp",
exporters: {
metrics: { otlp: { protocol: "http/protobuf" } },
tracing: { otlp: { endpoint: "http://collector:4318/v1/traces" } },
},
},Emits graphql_mcp.operation.count / graphql_mcp.operation.duration
metrics and per-tool-call spans, with configurable attribute omission,
export interval, and sampler.
Config reference
Top-level keys (all optional except schema):
Key | Purpose |
| Target GraphQL URL (default |
|
|
|
|
|
|
| Enable/configure |
|
|
| Static headers and client headers forwarded to GraphQL. |
| HTTP transport policies. |
| MCP identity and initialize instructions. |
| Inline map of scalar name to JSON Schema, or a path to a JSON file. |
| Prompt and MCP App directories. |
|
|
| OpenTelemetry metrics/tracing via OTLP. |
The config is validated with helpful errors; unknown keys are rejected. See examples/graphql-mcp.config.ts for a commented full example.
Development
vp install # install dependencies
vp check # format, lint, type check
vp test # run the test suite
vp pack # build dist/ (library + CLI)Acknowledgements
The behavior of this server is a TypeScript reimplementation inspired by the MIT-licensed Apollo MCP Server (Rust), excluding its GraphOS-specific functionality.
License
MIT
This server cannot be installed
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Related MCP Servers
- Alicense-qualityFmaintenanceA 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 context6047MIT
- AlicenseAqualityDmaintenanceGraphQL MCP Server that acts as a bridge allowing MCP clients (like Cursor or Claude Desktop) to interact with target GraphQL APIs through standard tools for schema introspection and operation execution.293MIT
- Alicense-qualityDmaintenanceA universal MCP server that connects any REST API to AI assistants via OpenAPI or Postman specifications. It enables dynamic tool creation with GraphQL-style field selection and automatic schema inference for efficient data retrieval.95Inno Setup
- Flicense-qualityDmaintenanceThis MCP server exposes approved GraphQL operations from an Apollo GraphQL API as AI-accessible tools. It sits between MCP clients and the GraphQL API, translating tool calls into GraphQL queries and returning results in MCP format.
Related MCP Connectors
MCP server for AI agents to plan, verify, and deploy Cloudflare-native apps.
MCP (Model Context Protocol) server for Appwrite
MCP server providing access to the Scorecard API to evaluate and optimize LLM systems.
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/simoncrypta/graphql-mcp'
If you have feedback or need assistance with the MCP directory API, please join our Discord server