apollo-mcp-server
Guide for using Apollo MCP Server to connect AI agents with GraphQL APIs. Use this skill when: (1) setting up or configuring Apollo MCP Server, (2) defining MCP tools from GraphQL operations, (3) using introspection tools (introspect, search, validate, execute, explorer), (4) configuring authentication, CORS, health checks, or telemetry, (5) writing Rhai scripts for request lifecycle hooks, (6) defining MCP prompts, (7) troubleshooting MCP server connectivity or tool execution issues, (8) building MCP Apps for interactive UI experiences, (9) deploying Apollo MCP Server to production.
- License 许可
- MIT
- 最近更新
- 2026-11-14
- Stars
- ★ 12
- Forks
- 5
01 前言 Front Matter
- name
- apollo-mcp-server
- license
- MIT
- metadata
- { "author": "apollographql", "version": "1.3.0" }
- description
- Guide for using Apollo MCP Server to connect AI agents with GraphQL APIs. Use this skill when: (1) setting up or configuring Apollo MCP Server, (2) defining MCP tools from GraphQL operations, (3) using introspection tools (introspect, search, validate, execute, explorer), (4) configuring authentication, CORS, health checks, or telemetry, (5) writing Rhai scripts for request lifecycle hooks, (6) defining MCP prompts, (7) troubleshooting MCP server connectivity or tool execution issues, (8) building MCP Apps for interactive UI experiences, (9) deploying Apollo MCP Server to production.
- allowed-tools
- Bash(rover:*) Bash(npx:*) Read Write Edit Glob Grep
- compatibility
- Works with Claude Code, Claude Desktop, Cursor.
02 资源文件 11
- 参考文档references/auth.md6.1 KB
- 参考文档references/best-practices.md7.9 KB
- 参考文档references/configuration.md9.0 KB
- 参考文档references/deploy.md4.8 KB
- 参考文档references/error-handling.md4.7 KB
- 参考文档references/mcp-apps.md6.9 KB
- 参考文档references/prompts.md2.4 KB
- 参考文档references/rhai-scripting.md5.2 KB
- 参考文档references/telemetry.md5.7 KB
- 参考文档references/tools.md5.1 KB
- 参考文档references/troubleshooting.md5.3 KB
03 SKILL.md 正文
Apollo MCP Server Guide
Apollo MCP Server exposes GraphQL operations as MCP tools, enabling AI agents to interact with GraphQL APIs through the Model Context Protocol.
Quick Start
Step 1: Install
# Linux / MacOS
curl -sSL https://mcp.apollo.dev/download/nix/latest | sh
# Windows
iwr 'https://mcp.apollo.dev/download/win/latest' | iex
Step 2: Configure
Create config.yaml in your project root:
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.
The server watches the config file for changes and automatically restarts with updated configuration.
Step 3: Connect
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):
{
"mcpServers": {
"graphql-api": {
"command": "./apollo-mcp-server",
"args": ["./config.yaml"]
}
}
}
Built-in 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 |
explorer |
Open operation in Apollo Explorer | Generate Explorer URLs (requires GraphOS graph ref) |
Defining Custom Tools
MCP tools are created from GraphQL operations:
1. Operation Files (Recommended)
operations:
source: local
paths:
- ./operations/
2. Operation Collections
operations:
source: collection
id: your-collection-id
3. Persisted Queries
operations:
source: manifest
path: ./persisted-query-manifest.json
4. Schema Introspection
operations:
source: introspect
5. GraphOS Uplink
operations:
source: uplink
Reference Files
- Tools - Introspection tools, explorer, minify notation, tool annotations
- Configuration - All configuration options including tasks and caching
- Authentication - OAuth 2.1, scopes, token validation, rate limiting, per-operation scopes
- Rhai Scripting - Lifecycle hooks and built-in functions
- MCP Prompts - Reusable prompt templates
- MCP Apps - Interactive mini-applications for MCP-compatible hosts
- Deployment - Docker, Kubernetes, Apollo Runtime Container, scaling
- Error Handling - Protocol errors, tool errors, GraphQL error mapping
- Best Practices - Security guidance, mutation gating, tool poisoning, token passthrough
- Telemetry - OpenTelemetry metrics, traces, and dashboards
- Troubleshooting - Common issues and solutions
Key Rules
Security
Security: Sensitive operations. Configure authentication before exposing to AI agents. Use
headersfor API keys, OAuth for user-scoped access.
- Disable introspection tools in production (they are disabled by default)
- Use
overrides.mutation_modeto control mutation exposure
Authentication
# Static header
headers:
Authorization: "Bearer ${env.API_TOKEN}"
# Dynamic header forwarding
forward_headers:
- x-tenant-id
# OAuth (streamable_http transport)
transport:
type: streamable_http
auth:
servers:
- https://auth.example.com
audiences:
- https://api.example.com
scopes:
- read
scope_mode: require_all
Schema Sources
# Local file
schema:
source: local
path: ./schema.graphql
# Federated graphs (uplink)
schema:
source: uplink
# Non-federated graphs (graphos)
schema:
source: graphos
Mutations
Control mutation behavior via overrides.mutation_mode:
| Mode | Predefined mutations | Ad hoc mutations (execute) |
|---|---|---|
none |
Skipped | Rejected |
explicit |
Exposed | Rejected |
all |
Exposed | Allowed |
MCP Apps
Build interactive UI experiences inside MCP Apps-compatible hosts (e.g., ChatGPT). Define tools with @tool and @prefetch directives on GraphQL operations. Configure the apps directory:
apps:
path: ./apps
MCP Tasks
Return async task handles for slow GraphQL calls. Clients poll tasks/get for results:
tasks:
enabled: true
detach_after_ms: 1000
Token Optimization
Enable minification to reduce token usage:
introspection:
introspect:
minify: true
search:
minify: true
Common Patterns
GraphOS Cloud Schema
graphos:
apollo_key: ${env.APOLLO_KEY}
apollo_graph_ref: my-graph@production
schema:
source: uplink # federated graphs; use graphos for non-federated graphs
Local Development
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
Production Setup
transport:
type: streamable_http
auth:
servers:
- https://auth.example.com
audiences:
- https://api.example.com
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}
schema:
source: uplink # federated graphs; use graphos for non-federated graphs
health_check:
enabled: true
telemetry:
exporters:
metrics:
otlp:
endpoint: https://your-metrics-endpoint
protocol: http/protobuf
tracing:
otlp:
endpoint: https://your-traces-endpoint
protocol: http/protobuf
Docker
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}
schema:
source: uplink # federated graphs; use graphos for non-federated graphs
health_check:
enabled: true
Ground Rules
- ALWAYS configure authentication before exposing to AI agents
- ALWAYS use
mutation_mode: explicitormutation_mode: nonein shared environments - ALWAYS review
overrides.required_scopeskeys after tool changes - NEVER expose introspection tools with write access to production data
- NEVER place
authat the top level — it must be nested undertransport - NEVER assume
mutation_modeprovides per-invocation approval (it is a configuration gate) - PREFER operation files over ad-hoc execute for predictable behavior
- PREFER streamable_http transport for remote and multi-client deployments
- PREFER contract variants when using persisted queries or introspection with GraphOS
- USE
schema.source: graphosfor non-federated graphs (uplink only serves federated graphs) - USE stdio only when the MCP client launches the server process directly
- USE GraphOS Studio collections for team collaboration
- USE
disable_auth_token_passthrough: truewhen your API does not need the caller's token
04 同仓库更多 Skills
zarr-python
Stores and queries chunked N-D scientific arrays with Zarr-Python 3, including codecs, sharding, S3/GCS storage, and NumPy/Dask/Xarray integration. Use for array layout, bounded I/O, format migration, or scientific metadata preservation.
yeet
Publish local changes to GitHub by confirming scope, committing intentionally, pushing the branch, and opening a draft PR through the GitHub app from this plugin, with `gh` used only as a fallback where connector coverage is insufficient.
xarray
N-dimensional labeled arrays and datasets in Python. Built on top of NumPy and Dask. It introduces labels in the form of dimensions, coordinates, and attributes on top of raw NumPy-like arrays, making data analysis in physical sciences more intuitive and less error-prone. Use for working with multi-dimensional scientific data, NetCDF/GRIB/Zarr files, climate/weather/oceanographic datasets, remote sensing, geospatial imaging, large out-of-memory datasets with Dask, and labeled array operations.
writing-mstest-tests
Use when asked to fix, rewrite, update, improve, modernize, show corrected code for, or explain existing MSTest tests or MSTest-specific configuration. Use for "review" when corrected code or edits are wanted, even for one pasted assertion or passing tests with bad failure output. Covers expected/actual labels; generic Boolean, collection, string, numeric, null, identity, exception, hard-cast, and object[] checks; TestContext/lifecycle; timeout/cancellation; OS/CI conditions, retry, cleanup, parallelization, MSTest.Sdk project setup, and MSTESTxxxx. Honor the installed MSTest version. DO NOT USE to design new test cases (code-testing), perform report-only audits, create project files rather than explain MSTest setup, run tests, migrate frameworks, or handle non-MSTest/non-.NET code.
wgs-prs
End-to-end WGS to polygenic risk score pipeline. Takes paired-end FASTQ files (or a pre-existing VCF) through nf-core/sarek for variant calling, applies VCF QC (normalisation, hard filtering, Ti/Tv and Het/Hom checks), then computes polygenic risk scores via the PGS Catalog. Fills the FASTQ to VCF gap upstream of the gwas-prs skill.
webapp-testing
Toolkit for interacting with and testing local web applications using Playwright. Supports verifying frontend functionality, debugging UI behavior, capturing browser screenshots, and viewing browser logs.