GraphQL MCP Server
Allows interaction with the GitHub GraphQL API, providing tools to query repositories, search, and retrieve repository details.
Serves as a generic MCP server that turns any GraphQL API into Claude Code tools, allowing interaction with any GraphQL endpoint.
Allows interaction with any Hasura GraphQL API, enabling queries and mutations on your Hasura instance.
Allows interaction with the Shopify Admin GraphQL API, enabling tools to manage products and store data.
Allows interaction with the SpaceX GraphQL API, providing tools to query rockets, launches, and other SpaceX data.
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 MCP Serversearch for repositories with keyword 'MCP' and limit 5"
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.
GraphQL MCP Server
Turn any GraphQL API into Claude Code tools with zero coding
A generic Model Context Protocol (MCP) server that automatically converts your .graphql query files into tools Claude can use. Works with any GraphQL API - GitHub, Shopify, Hasura, or your own.
What It Does
Point it at any GraphQL endpoint (GitHub, Shopify, Hasura, etc.)
Drop
.graphqlquery files in a folderAutomatically exposes them as Claude Code tools
No MCP coding required - just write GraphQL queries and configure the endpoint.
Why Use This?
Token Savings
GraphQL lets you request only the fields you need, dramatically reducing response size:
API Type | Response Size | Tokens Used | Savings |
REST | 168 KB | ~42,000 | - |
GraphQL (minimal) | 500 bytes | ~125 | 99.7% |
GraphQL (targeted) | 5 KB | ~1,250 | 97% |
Convenience
Instead of writing custom MCP server code for each API, just:
Configure the endpoint
Write GraphQL queries
Done
Installation
Clone and build from source:
git clone https://github.com/Chakit22/graphql-mcp-server.git
cd graphql-mcp-server
npm install
npm run buildQuick Start
1. Create a project directory
mkdir my-graphql-mcp
cd my-graphql-mcp
mkdir operations2. Create config.json
{
"endpoint": "https://api.github.com/graphql",
"operationsDir": "./operations",
"headers": {
"Authorization": "Bearer YOUR_TOKEN_HERE"
},
"name": "my-mcp-server",
"version": "1.0.0"
}3. Create GraphQL query files
Create operations/GetRepository.graphql:
# @description Get repository information
query GetRepository($owner: String!, $name: String!) {
repository(owner: $owner, name: $name) {
name
description
stargazerCount
url
}
}4. Configure Claude Code
Add to ~/.config/claude-code/mcp_settings.json:
{
"mcpServers": {
"my-graphql-mcp": {
"command": "node",
"args": ["/path/to/graphql-mcp-server/dist/index.js"],
"env": {
"GRAPHQL_MCP_CONFIG": "/path/to/my-graphql-mcp/config.json"
}
}
}
}5. Restart Claude Code
The MCP server will automatically load your GraphQL operations as tools.
Configuration Reference
config.json
Field | Type | Required | Description |
| string | Yes | GraphQL API endpoint URL |
| string | Yes | Path to directory containing |
| object | No | HTTP headers (e.g., Authorization) |
| string | No | MCP server name (default: "graphql-mcp-server") |
| string | No | MCP server version (default: "1.0.0") |
Environment Variables
GRAPHQL_MCP_CONFIG: Path to config file (default:./config.json)
Writing GraphQL Operations
Basic Query
# @description Brief description shown in Claude
query OperationName($param1: String!, $param2: Int) {
field1
field2
}Features
@descriptioncomment: Appears in Claude's tool listVariables: Automatically become tool parameters
Type support: String, Int, Float, Boolean, ID, arrays
Required params: Variables ending with
!are required
Example: Search Query
# @description Search repositories by keyword
query SearchRepos($query: String!, $limit: Int!) {
search(query: $query, type: REPOSITORY, first: $limit) {
repositoryCount
edges {
node {
... on Repository {
name
url
stargazerCount
}
}
}
}
}Examples
SpaceX API (No Auth Required - Try This First!)
Perfect for testing - works immediately without API keys.
Config:
{
"endpoint": "https://spacex-production.up.railway.app/",
"operationsDir": "./operations",
"name": "spacex-mcp"
}Available Operations:
GetRockets- Get all SpaceX rocketsGetLaunches- Get recent launches
π Full example: examples/spacex/
GitHub API
Config:
{
"endpoint": "https://api.github.com/graphql",
"operationsDir": "./operations",
"headers": {
"Authorization": "Bearer ghp_YOUR_TOKEN"
}
}Available Operations:
GetRepository- Get repo detailsSearchRepositories- Search repos by keyword
π Full example: examples/github/
Shopify API
Config:
{
"endpoint": "https://YOUR_STORE.myshopify.com/admin/api/2024-01/graphql.json",
"operationsDir": "./operations",
"headers": {
"X-Shopify-Access-Token": "YOUR_TOKEN"
}
}Available Operations:
GetProducts- Get products with pagination
π Full example: examples/shopify/
Hasura / Self-Hosted
Config:
{
"endpoint": "http://localhost:8080/v1/graphql",
"operationsDir": "./operations",
"headers": {
"x-hasura-admin-secret": "YOUR_SECRET"
}
}How It Works
ββββββββββββ ββββββββββββββββ ββββββββββββββββββ
β Claude ββββββΆβ MCP Server ββββββΆβ GraphQL API β
β Code β β (this tool) β β (any endpoint) β
ββββββββββββ ββββββββββββββββ ββββββββββββββββββ
β
βΌ
Loads *.graphql
from operations/MCP server reads all
.graphqlfiles fromoperationsDirRegisters each as a Claude Code tool
When Claude calls a tool:
Sends GraphQL query to configured endpoint
Passes variables from Claude
Returns response to Claude
Development
# Install dependencies
npm install
# Build TypeScript
npm run build
# Run in dev mode (with auto-reload)
npm run dev
# Run built version
npm startTroubleshooting
"Configuration file not found"
Check
GRAPHQL_MCP_CONFIGenvironment variableEnsure
config.jsonexists in current directory or specified path
"No .graphql files found"
Check
operationsDirpath in configEnsure
.graphqlor.gqlfiles exist in that directory
"HTTP 401 Unauthorized"
Check
headers.Authorizationin configVerify your API token is valid
"GraphQL errors in response"
Test your query directly against the API first
Check variable types match the schema
Verify required fields are present
Requirements
Node.js 16+
A GraphQL API endpoint
Valid authentication credentials (if required by API)
License
MIT
Contributing
Contributions welcome! Please open an issue or PR.
Related Projects
This server cannot be installed
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Latest Blog Posts
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/Chakit22/graphql-mcp-server'
If you have feedback or need assistance with the MCP directory API, please join our Discord server