Apollo MCP Server for GraphQL API Orchestration
Orchestrate GraphQL APIs with the Apollo MCP server to expose operations as MCP tools and enable AI models to access and integrate your APIs.
npx -y @apollographql/apollo-mcp-serverOverview
Apollo MCP Server is a Model Context Protocol (MCP) server that exposes GraphQL operations as MCP tools. It sits in front of one or more GraphQL services and publishes a curated set of operations (queries, mutations, subscriptions) so that MCP-aware clients — including language models, agents, and tooling — can discover and invoke those operations programmatically.
This server is useful when you want AI models or orchestrators to safely interact with your GraphQL APIs without giving full schema access. You define which operations are available, how inputs map to GraphQL variables, and runtime policies; the MCP server handles operation execution, authentication, and the MCP lifecycle so clients can focus on higher-level orchestration and reasoning.
Features
- Exposes GraphQL operations as MCP tools (discoverable and invokable by MCP clients)
- Declarative operation definitions (queries, variables mapping, descriptions)
- Runs as a standalone Rust binary or container for easy deployment
- Integrates with existing Apollo graph infrastructure
- Configurable authentication and network options
- Intended for use with LLMs, agents, and MCP inspector tools
Installation / Configuration
Minimum prerequisites:
- Rust toolchain to build from source (optional)
- Docker (optional, for containerized deployment)
Build from source:
# Clone the repository and build (requires Rust and Cargo)
# Run the built binary (example path)
Run with Docker (example):
# Build or pull a released image, then run with a config file mounted
Example minimal YAML configuration (config.yaml):
# config.yaml
server:
listen: 0.0.0.0:8080
tls: false
graphql:
endpoint: "https://my-graph.example.com/graphql"
headers:
Authorization: "Bearer ${GRAPH_API_TOKEN}"
tools:
- id: getUser
operation: |
query GetUser($id: ID!) {
user(id: $id) {
id
name
email
}
}
variables:
id: "$input.userId"
description: "Retrieve a user by id"
Configuration reference (summary):
| Key | Purpose | Example |
|---|---|---|
| server.listen | Address and port to bind | 0.0.0.0:8080 |
| graphql.endpoint | Upstream GraphQL endpoint | https://my-graph.example.com/graphql |
| graphql.headers | Headers forwarded to GraphQL service | Authorization: Bearer … |
| tools | Array of operation definitions exposed as MCP tools | See example above |
Refer to the project documentation for the full config schema and advanced options (authentication, metrics, TLS, and policies).
Available Tools / Resources
- Operation definitions: Each tool maps to a GraphQL operation bundled with metadata (id, description, input → GraphQL variable mapping).
- Discovery: MCP clients can discover published tools through the standard MCP discovery flow implemented by the server.
- Execution: Invocations are handled by the MCP server which executes queries against the configured GraphQL endpoint and returns results to the client.
- Inspector & clients: Use existing MCP clients (MCP Inspector, agent SDKs, or LLM connectors) to connect, list, and call tools.
Example operation definition (JSON style):
Use Cases
- LLM-driven API composition: Allow a language model to call targeted GraphQL operations to fetch data, create resources, or update records as part of a multi-step reasoning flow without exposing the full schema.
- Agent orchestration: Provide an agent with a curated set of tools (e.g., searchProducts, addToCart, checkout) so workflows can be executed reliably and auditable through the MCP server.
- Secure surface for third-party access: Expose only approved operations to external systems or contractors while hiding sensitive parts of the schema.
- Human-in-the-loop inspection: Combine the MCP server with inspector tools to review available operations, test queries, and observe payloads during development.
Concrete example:
- Task: “An LLM should create a new user and then fetch the new user’s profile.”
- LLM discovers tools getUser and createUser through MCP discovery.
- LLM calls createUser with input; the MCP server executes the mutation and returns the created user id.
- LLM calls getUser with the returned id to display or reason about the profile.
Contributing and Licensing
Contributions are welcome — see the repository’s CONTRIBUTING.md for guidelines. The project is licensed under the MIT License; consult the LICENSE file in the repository.
For full documentation, advanced configuration, and the latest releases, visit the GitHub repo: https://github.com/apollographql/apollo-mcp-server/ and the official docs linked from that repository.