loading…
Search for a command to run...
loading…
A generic MCP (Model Context Protocol) server that bridges any GraphQL API to Claude Code. It introspects your GraphQL schema and exposes each query and mutatio
A generic MCP (Model Context Protocol) server that bridges any GraphQL API to Claude Code. It introspects your GraphQL schema and exposes each query and mutation as an individual tool, letting Claude interact with your API directly.
npm version CI License: MIT Node.js >= 18
A generic MCP (Model Context Protocol) server that bridges any GraphQL API to Claude Code. It introspects your GraphQL schema and exposes each query and mutation as an individual tool, letting Claude interact with your API directly.
On startup the server will:
schema-introspection.json file in the working directory (fast, no network call)GRAPHQL_INTROSPECTION_URLquery__<name>) and one per mutation (mutation__<name>)execute_graphql fallback tool and a get_type_details explorer toolnpm install -g mcp-graphql-bridge
git clone https://github.com/murilopereira/mcp-graphql-bridge.git
cd mcp-graphql-bridge
npm install
npm run build
| Variable | Required | Description |
|---|---|---|
GRAPHQL_API_URL |
Yes | Endpoint used for queries and mutations |
GRAPHQL_INTROSPECTION_URL |
Yes | Endpoint used for schema introspection (can be the same as above) |
GRAPHQL_TOKEN |
Yes | Bearer token for authentication |
You can set these in a .env file at the project root:
GRAPHQL_API_URL=https://your-api.example.com/graphql
GRAPHQL_INTROSPECTION_URL=https://your-api.example.com/graphql
GRAPHQL_TOKEN=your-bearer-token
Or pass them directly via the claude mcp add command (see below).
By default the server introspects your schema live on startup — no file needed. Use this step only if your API has introspection disabled in production, or you want faster startup times:
curl -s -X POST https://your-api.example.com/graphql \
-H "Content-Type: application/json" \
-H "Authorization: Bearer your-bearer-token" \
-d '{"query":"{ __schema { queryType { fields { name description args { name description defaultValue type { kind name ofType { kind name ofType { kind name ofType { kind name } } } } } type { kind name ofType { kind name ofType { kind name } } } } } mutationType { fields { name description args { name description defaultValue type { kind name ofType { kind name ofType { kind name ofType { kind name } } } } } type { kind name ofType { kind name ofType { kind name } } } } } } }"}' \
> schema-introspection.json
If installed from npm:
claude mcp add --transport stdio \
--env GRAPHQL_API_URL=https://your-api.example.com/graphql \
--env GRAPHQL_INTROSPECTION_URL=https://your-api.example.com/graphql \
--env GRAPHQL_TOKEN=your-bearer-token \
graphql-bridge -- mcp-graphql-bridge
If cloned from source:
claude mcp add --transport stdio \
--env GRAPHQL_API_URL=https://your-api.example.com/graphql \
--env GRAPHQL_INTROSPECTION_URL=https://your-api.example.com/graphql \
--env GRAPHQL_TOKEN=your-bearer-token \
graphql-bridge -- node /absolute/path/to/mcp-graphql-bridge/dist/index.js
Important: Make sure to use
mcp-graphql-bridge/dist/index.js(the compiled output), notmcp-graphql-bridge/index.js. The TypeScript source must be built first withnpm run build, and the entry point is in thedist/folder.
.mcp.json)claude mcp add --transport stdio --scope project \
--env GRAPHQL_API_URL=https://your-api.example.com/graphql \
--env GRAPHQL_INTROSPECTION_URL=https://your-api.example.com/graphql \
--env GRAPHQL_TOKEN=your-bearer-token \
graphql-bridge -- mcp-graphql-bridge
Note: Use absolute paths. All
--envand--transportflags must come before the server name.
claude mcp list
Then in a Claude Code session, run /mcp to see available servers and tools.
| Tool | Description |
|---|---|
query__<name> |
One tool per GraphQL query field |
mutation__<name> |
One tool per GraphQL mutation field |
execute_graphql |
Generic fallback — run any query or mutation |
get_type_details |
Explore fields of a specific GraphQL type |
All per-operation tools accept a special __fields argument where you can provide a custom GraphQL selection set (e.g. { id name status }). If omitted, only scalar fields are returned.
docker build -t mcp-graphql-bridge .
claude mcp add --transport stdio \
--env GRAPHQL_API_URL=https://your-api.example.com/graphql \
--env GRAPHQL_INTROSPECTION_URL=https://your-api.example.com/graphql \
--env GRAPHQL_TOKEN=your-bearer-token \
graphql-bridge -- docker run -i --rm \
-e GRAPHQL_API_URL -e GRAPHQL_INTROSPECTION_URL -e GRAPHQL_TOKEN \
mcp-graphql-bridge
Note: The
-iflag (no-t) is required — it keeps stdin open for the MCP stdio protocol.
npm run dev # watch mode: rebuilds and restarts on file changes
npm run build # one-off TypeScript compile
npm start # run the compiled server
If you see an error like:
Error: Cannot find module '/path/to/mcp-graphql-bridge/index.js'
You are pointing to the wrong file. The TypeScript source must be compiled first, and the entry point is in the dist/ folder:
Correct path: /path/to/mcp-graphql-bridge/dist/index.js
Wrong path: /path/to/mcp-graphql-bridge/index.js
Fix:
npm run build (creates the dist/ folder)/dist/index.jsIf the server starts but shows "Schema introspection failed", your GraphQL API may have introspection disabled in production. Use the curl command in step 3 of Setup to pre-generate a schema-introspection.json file.
claude mcp list to verify the server is registered/mcp in a Claude Code session to see available toolsGRAPHQL_API_URL, GRAPHQL_INTROSPECTION_URL, GRAPHQL_TOKEN)Добавь это в claude_desktop_config.json и перезапусти Claude Desktop.
{
"mcpServers": {
"mcp-graphql-bridge": {
"command": "npx",
"args": []
}
}
}