apollo-mcp-server by apollographql/skills
npx skills add https://github.com/apollographql/skills --skill apollo-mcp-serverApollo MCP 服务器将 GraphQL 操作作为 MCP 工具公开,使 AI 代理能够通过模型上下文协议与 GraphQL API 交互。
# Linux / MacOS
curl -sSL https://mcp.apollo.dev/download/nix/latest | sh
# Windows
iwr 'https://mcp.apollo.dev/download/win/latest' | iex
在项目根目录创建 config.yaml:
# config.yaml
transport:
type: streamable_http
schema:
source: local
path: ./schema.graphql
operations:
source: local
paths:
- ./operations/
introspection:
introspect:
enabled: true
search:
enabled: true
validate:
enabled: true
execute:
enabled: true
启动服务器:
apollo-mcp-server ./config.yaml
MCP 端点位于 http://127.0.0.1:8000/mcp(streamable_http 默认值:地址 ,端口 )。GraphQL 端点默认为 — 如果您的 API 在其他地方运行,请使用 键覆盖。
广告位招租
在这里展示您的产品或服务
触达数万 AI 开发者,精准高效
127.0.0.18000http://localhost:4000/endpoint添加到您的 MCP 客户端配置中:
Streamable HTTP(推荐):
Claude Desktop (claude_desktop_config.json):
{
"mcpServers": {
"graphql-api": {
"command": "npx",
"args": ["mcp-remote", "http://127.0.0.1:8000/mcp"]
}
}
}
Claude Code:
claude mcp add graphql-api -- npx mcp-remote http://127.0.0.1:8000/mcp
Stdio(客户端直接启动服务器):
Claude Desktop (claude_desktop_config.json) 或 Claude Code (.mcp.json):
{
"mcpServers": {
"graphql-api": {
"command": "./apollo-mcp-server",
"args": ["./config.yaml"]
}
}
}
Apollo MCP 服务器提供四种内省工具:
| 工具 | 用途 | 使用时机 |
|---|---|---|
introspect | 详细探索模式类型 | 需要类型定义、字段、关系时 |
search | 在模式中查找类型 | 寻找特定类型或字段时 |
validate | 检查操作有效性 | 在执行操作之前 |
execute | 运行即席 GraphQL 操作 | 测试或执行一次性查询时 |
MCP 工具从 GraphQL 操作创建。有三种方法:
operations:
source: local
paths:
- ./operations/
# operations/users.graphql
query GetUser($id: ID!) {
user(id: $id) {
id
name
email
}
}
mutation CreateUser($input: CreateUserInput!) {
createUser(input: $input) {
id
name
}
}
每个命名的操作都会成为一个 MCP 工具。
operations:
source: collection
id: your-collection-id
使用 GraphOS Studio 来协作管理操作。
operations:
source: manifest
path: ./persisted-query-manifest.json
适用于具有预批准操作的生产环境。
特定主题的详细文档:
headers 配置来设置 API 密钥和令牌overrides.mutation_mode: explicit 以要求对变更操作进行确认# 静态请求头
headers:
Authorization: "Bearer ${env.API_TOKEN}"
# 动态请求头转发
forward_headers:
- x-forwarded-token
# OAuth(streamable_http 传输方式)
transport:
type: streamable_http
auth:
servers:
- https://auth.example.com/.well-known/openid-configuration
audiences:
- https://api.example.com
启用简化表示以减少令牌使用:
introspection:
introspect:
minify: true
search:
minify: true
简化输出使用紧凑表示法:
通过 overrides 部分控制变更操作行为:
overrides:
mutation_mode: all # 直接执行变更操作
# mutation_mode: explicit # 需要明确确认
# mutation_mode: none # 阻止所有变更操作(默认)
# schema.source 默认为 uplink — 当配置了 graphos 时可以省略
graphos:
apollo_key: ${env.APOLLO_KEY}
apollo_graph_ref: my-graph@production
transport:
type: streamable_http
schema:
source: local
path: ./schema.graphql
introspection:
introspect:
enabled: true
search:
enabled: true
validate:
enabled: true
execute:
enabled: true
overrides:
mutation_mode: all
transport:
type: streamable_http
endpoint: https://api.production.com/graphql
operations:
source: manifest
path: ./persisted-query-manifest.json
graphos:
apollo_key: ${env.APOLLO_KEY}
apollo_graph_ref: ${env.APOLLO_GRAPH_REF}
headers:
Authorization: "Bearer ${env.API_TOKEN}"
health_check:
enabled: true
transport:
type: streamable_http
address: 0.0.0.0
port: 8000
endpoint: ${env.GRAPHQL_ENDPOINT}
graphos:
apollo_key: ${env.APOLLO_KEY}
apollo_graph_ref: ${env.APOLLO_GRAPH_REF}
health_check:
enabled: true
mutation_mode: explicit 或 mutation_mode: none每周安装量
655
代码仓库
GitHub 星标数
31
首次出现
2026年1月23日
安全审计
安装于
claude-code591
opencode373
codex371
gemini-cli364
github-copilot363
cursor334
Apollo MCP Server exposes GraphQL operations as MCP tools, enabling AI agents to interact with GraphQL APIs through the Model Context Protocol.
# Linux / MacOS
curl -sSL https://mcp.apollo.dev/download/nix/latest | sh
# Windows
iwr 'https://mcp.apollo.dev/download/win/latest' | iex
Create config.yaml in your project root:
# config.yaml
transport:
type: streamable_http
schema:
source: local
path: ./schema.graphql
operations:
source: local
paths:
- ./operations/
introspection:
introspect:
enabled: true
search:
enabled: true
validate:
enabled: true
execute:
enabled: true
Start the server:
apollo-mcp-server ./config.yaml
The MCP endpoint is available at http://127.0.0.1:8000/mcp (streamable_http defaults: address 127.0.0.1, port 8000). The GraphQL endpoint defaults to http://localhost:4000/ — override with the endpoint key if your API runs elsewhere.
Add to your MCP client configuration:
Streamable HTTP (recommended):
Claude Desktop (claude_desktop_config.json):
{
"mcpServers": {
"graphql-api": {
"command": "npx",
"args": ["mcp-remote", "http://127.0.0.1:8000/mcp"]
}
}
}
Claude Code:
claude mcp add graphql-api -- npx mcp-remote http://127.0.0.1:8000/mcp
Stdio (client launches the server directly):
Claude Desktop (claude_desktop_config.json) or Claude Code (.mcp.json):
{
"mcpServers": {
"graphql-api": {
"command": "./apollo-mcp-server",
"args": ["./config.yaml"]
}
}
}
Apollo MCP Server provides four introspection tools:
| Tool | Purpose | When to Use |
|---|---|---|
introspect | Explore schema types in detail | Need type definitions, fields, relationships |
search | Find types in schema | Looking for specific types or fields |
validate | Check operation validity | Before executing operations |
execute | Run ad-hoc GraphQL operations | Testing or one-off queries |
MCP tools are created from GraphQL operations. Three methods:
operations:
source: local
paths:
- ./operations/
# operations/users.graphql
query GetUser($id: ID!) {
user(id: $id) {
id
name
email
}
}
mutation CreateUser($input: CreateUserInput!) {
createUser(input: $input) {
id
name
}
}
Each named operation becomes an MCP tool.
operations:
source: collection
id: your-collection-id
Use GraphOS Studio to manage operations collaboratively.
operations:
source: manifest
path: ./persisted-query-manifest.json
For production environments with pre-approved operations.
Detailed documentation for specific topics:
headers configuration for API keys and tokensoverrides.mutation_mode: explicit to require confirmation for mutations# Static header
headers:
Authorization: "Bearer ${env.API_TOKEN}"
# Dynamic header forwarding
forward_headers:
- x-forwarded-token
# OAuth (streamable_http transport)
transport:
type: streamable_http
auth:
servers:
- https://auth.example.com/.well-known/openid-configuration
audiences:
- https://api.example.com
Enable minification to reduce token usage:
introspection:
introspect:
minify: true
search:
minify: true
Minified output uses compact notation:
Control mutation behavior via the overrides section:
overrides:
mutation_mode: all # Execute mutations directly
# mutation_mode: explicit # Require explicit confirmation
# mutation_mode: none # Block all mutations (default)
# schema.source defaults to uplink — can be omitted when graphos is configured
graphos:
apollo_key: ${env.APOLLO_KEY}
apollo_graph_ref: my-graph@production
transport:
type: streamable_http
schema:
source: local
path: ./schema.graphql
introspection:
introspect:
enabled: true
search:
enabled: true
validate:
enabled: true
execute:
enabled: true
overrides:
mutation_mode: all
transport:
type: streamable_http
endpoint: https://api.production.com/graphql
operations:
source: manifest
path: ./persisted-query-manifest.json
graphos:
apollo_key: ${env.APOLLO_KEY}
apollo_graph_ref: ${env.APOLLO_GRAPH_REF}
headers:
Authorization: "Bearer ${env.API_TOKEN}"
health_check:
enabled: true
transport:
type: streamable_http
address: 0.0.0.0
port: 8000
endpoint: ${env.GRAPHQL_ENDPOINT}
graphos:
apollo_key: ${env.APOLLO_KEY}
apollo_graph_ref: ${env.APOLLO_GRAPH_REF}
health_check:
enabled: true
mutation_mode: explicit or mutation_mode: none in shared environmentsWeekly Installs
655
Repository
GitHub Stars
31
First Seen
Jan 23, 2026
Security Audits
Gen Agent Trust HubPassSocketWarnSnykWarn
Installed on
claude-code591
opencode373
codex371
gemini-cli364
github-copilot363
cursor334
React 组合模式指南:Vercel 组件架构最佳实践,提升代码可维护性
102,200 周安装
mcporter - MCP 服务器命令行工具,快速调用、管理和生成代码
816 周安装
Salesforce CRM 集成指南:使用 Membrane CLI 连接与自动化操作
824 周安装
Railway CLI 环境配置管理指南:创建、切换、编辑与变量解析
824 周安装
Shopify Liquid主题开发标准:CSS、JS、HTML最佳实践与BEM命名规范
827 周安装
Google Drive API 集成指南:使用 Membrane CLI 实现云端文件管理与自动化
827 周安装
创始人销售指南:16位专家见解,助你建立可复制的早期销售流程 | Founder-Sales
827 周安装