Skip to main content

GraphQL MCP Server

Python License MCP

A dynamic Model Context Protocol (MCP) server that automatically discovers and generates tools from any GraphQL API schema. Point it at any GraphQL endpoint and it instantly exposes every query and mutation as an MCP tool — zero manual configuration.


Documentation

For full documentation, guides, and examples, visit:

https://nife.io/mcp_opensource


Installation

pip install graphql-mcp-server

Configuration

There are four ways to configure the server. They are applied in priority order — higher entries win:

Priority Method Best for
1 CLI arguments One-off runs, testing
2 Environment variables Docker, CI/CD, shell scripts
3 .env file Local development
4 Defaults Nothing required by default

Method 1 — CLI Arguments

graphql-mcp-server --endpoint https://api.example.com/graphql --token mytoken

All available flags:

--endpoint URL       GraphQL API endpoint (required if not set via env)
--token TOKEN        API access token for authentication
--mode stdio|http    Server mode (default: stdio)
--port PORT          HTTP port, only used in http mode (default: 8080)
--host HOST          HTTP host, only used in http mode (default: 0.0.0.0)
--log-level LEVEL    Logging level: DEBUG, INFO, WARNING, ERROR (default: INFO)
--env-file PATH      Path to a custom .env file
--version            Show version and exit

Method 2 — Environment Variables

export GRAPHQL_ENDPOINT=https://api.example.com/graphql
export API_ACCESS_TOKEN=your_token_here
export MCP_MODE=stdio

graphql-mcp-server

Method 3 — .env File

Create a .env file in your working directory:

GRAPHQL_ENDPOINT=https://api.example.com/graphql
API_ACCESS_TOKEN=your_token_here
MCP_MODE=stdio
LOG_LEVEL=INFO

Then just run:

graphql-mcp-server

Method 4 — Claude Desktop Config (most common for MCP use)

No .env file needed. Pass everything via the env block in claude_desktop_config.json:

{
  "mcpServers": {
    "graphql": {
      "command": "graphql-mcp-server",
      "env": {
        "GRAPHQL_ENDPOINT": "https://api.example.com/graphql",
        "API_ACCESS_TOKEN": "your_token_here",
        "MCP_MODE": "stdio",
        "ENABLE_HTTP_ENDPOINT": "false"
      }
    }
  }
}

Claude Desktop injects the env block values directly into the process — this is the standard MCP pattern.


Environment Variable Reference

Variable Required Default Description
GRAPHQL_ENDPOINT Yes — GraphQL API URL
API_ACCESS_TOKEN No — Bearer token for auth
MCP_MODE No stdio stdio or http
ENABLE_HTTP_ENDPOINT No true Enable HTTP health/metrics endpoints
MCP_SERVER_PORT No 8080 HTTP server port
MCP_SERVER_HOST No 0.0.0.0 HTTP server host
LOG_LEVEL No INFO Logging verbosity
QUERY_TIMEOUT No 30 Request timeout in seconds
SCHEMA_CACHE_TTL No 3600 Schema cache TTL in seconds

Operating Modes

MCP Mode (stdio) — for Claude Desktop, Cursor, MCP clients

graphql-mcp-server --endpoint https://api.example.com/graphql --mode stdio

Communicates via stdin/stdout. No HTTP server is started. This is the default.

HTTP Mode — for Docker, Kubernetes, server deployments

graphql-mcp-server --endpoint https://api.example.com/graphql --mode http --port 8080

Starts an HTTP server with health and metrics endpoints:

  • GET /health — health check
  • GET /metrics — server metrics
  • GET /schema — schema summary
  • GET /tools — all generated tools

Docker

docker build -t graphql-mcp-server .

docker run -p 8080:8080 \
  -e GRAPHQL_ENDPOINT=https://api.example.com/graphql \
  -e API_ACCESS_TOKEN=your_token \
  -e MCP_MODE=http \
  graphql-mcp-server

Or with Docker Compose:

cp .env.example .env   # fill in your values
docker-compose up

Key Features

  • Zero config queries — auto-introspects any GraphQL schema and generates MCP tools
  • Dual mode — stdio for MCP clients, HTTP for server deployments
  • Flexible config — CLI args, env vars, .env file, or Claude Desktop env block
  • Production ready — Docker, Kubernetes, AWS ECS, Google Cloud Run compatible
  • Self-documenting — list_available_queries, get_schema_info, get_query_signature tools built in
  • Documentation — https://nife.io/mcp_opensource

Troubleshooting

[ERROR] GraphQL endpoint not configured

Set GRAPHQL_ENDPOINT via any method above. The most common fix:

graphql-mcp-server --endpoint https://your-api.com/graphql

Port already in use

Change the port:

graphql-mcp-server --mode http --port 9090

Docker container exits immediately

Make sure you're using HTTP mode:

docker run -e MCP_MODE=http -e GRAPHQL_ENDPOINT=... graphql-mcp-server

Metadata

Release files for graphql-mcp-server 1.0.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for graphql-mcp-server 1.0.3
File Size Uploaded Provenance Actions
graphql_mcp_server-1.0.3.tar.gz 19.1 kB Without provenance Details for graphql_mcp_server-1.0.3.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for graphql-mcp-server 1.0.3
File Interpreter ABI Platform Actions
graphql_mcp_server-1.0.3-py3-none-any.whl Python 3 none any Details for graphql_mcp_server-1.0.3-py3-none-any.whl

Total release size: 38.3 kB

Release files / graphql_mcp_server-1.0.3.tar.gz

Download URL graphql_mcp_server-1.0.3.tar.gz
Size 19.1 kB
Tags Source
SHA-256 checksum
How to use checksums
71b0580cc8d454b87ba66a6ffd65e676f9aed181958439ff4f1a3f0795669fe5
BLAKE2b-256 checksum
How to use checksums
e4759cbca1f0b85c71f101d6ebe7f84a9a1901bb324144fe6d84ade8e160618a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.6

Release files / graphql_mcp_server-1.0.3-py3-none-any.whl

Download URL graphql_mcp_server-1.0.3-py3-none-any.whl
Size 19.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
70ad726521b1044ae116c19c9c5a23689fae66392f9918180851790aa6fbff1a
BLAKE2b-256 checksum
How to use checksums
514b59a815e48a4f7f67b0e64725e5d06dead094ca52ea708045f0a6c4ca033e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.6

Security for graphql-mcp-server 1.0.3

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page