GraphQL MCP Server

GraphQL MCP Server

Automatically discovers and exposes any GraphQL API as MCP tools with zero configuration.

Category
访问服务器

README

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-documentinglist_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

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
mcp-server-qdrant

mcp-server-qdrant

这个仓库展示了如何为向量搜索引擎 Qdrant 创建一个 MCP (Managed Control Plane) 服务器的示例。

官方
精选
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选