run.mdx•6.21 kB
---
title: Running the Apollo MCP Server
---
There are multiple ways to run the Apollo MCP server.
- If you have an existing GraphQL API deployed, use the standalone MCP server binary to get started quickly.
- If you use Docker in your developer workflow, use the Apollo MCP Server Docker image.
- If you are running your GraphQL API locally with Rover, you can use the Rover CLI's `rover dev` command to run the MCP server alongside your local graph.
- If you are using the Apollo Runtime Container, you can use the container to run both the MCP server and the Apollo Router in a single container.
## With the Rover CLI
The Rover CLI is a tool for working with GraphQL APIs locally.
You can use the [`rover dev`](/rover/commands/dev) command of Rover CLI `v0.35` or later to run an Apollo MCP Server instance alongside your local graph. Use the `--mcp` flag to start an MCP server and provide an optional configuration file.
```sh
rover dev --mcp <PATH/TO/CONFIG> [...other rover dev flags]
```
For more information, see the [Rover CLI documentation](/rover).
## Standalone MCP server binary
To install or upgrade to the **latest release** of Apollo MCP Server:
<Tabs>
<Tab label="Linux / MacOS">
```terminal showLineNumbers=false
curl -sSL https://mcp.apollo.dev/download/nix/latest | sh
```
</Tab>
<Tab label="Windows">
```terminal showLineNumbers=false
iwr 'https://mcp.apollo.dev/download/win/latest' | iex
```
</Tab>
</Tabs>
To install or upgrade to a **specific version** of Apollo MCP Server (recommended for CI environments to ensure predictable behavior):
<Tabs>
<Tab label="Linux / MacOS">
```terminal showLineNumbers=false
# Note the `v` prefixing the version number
curl -sSL https://mcp.apollo.dev/download/nix/v1.2.1 | sh
```
</Tab>
<Tab label="Windows">
```terminal showLineNumbers=false
# Note the `v` prefixing the version number
iwr 'https://mcp.apollo.dev/download/win/v1.2.1' | iex
```
</Tab>
</Tabs>
To install or upgrade to a specific version of Apollo MCP Server that is a **release candidate** (recommended for those that want to test early builds):
<Tabs>
<Tab label="Linux / MacOS">
```terminal showLineNumbers=false
# Note the `v` prefixing the version number and the `-rc` suffix
curl -sSL https://mcp.apollo.dev/download/nix/v1.2.1-rc.1 | sh
```
</Tab>
<Tab label="Windows">
```terminal showLineNumbers=false
# Note the `v` prefixing the version number and the `-rc` suffix
iwr 'https://mcp.apollo.dev/download/win/v1.2.1-rc.1' | iex
```
</Tab>
</Tabs>
You can configure the Apollo MCP server using a [YAML configuration file](/apollo-mcp-server/config-file).
If the file is not provided, environment variables for your Apollo graph credentials (`APOLLO_GRAPH_REF` and `APOLLO_KEY`) are required for the server to run.
After installing the MCP server, you can run it using the following command:
```sh showLineNumbers=false
./apollo-mcp-server [OPTIONS] <PATH/TO/CONFIG/FILE>
```
### CLI options
| Option | Description |
| :-------------- | :------------------------ |
| `-h, --help` | Print help information |
| `-V, --version` | Print version information |
## With Docker
A container is built for the Apollo MCP Server with every release at `ghcr.io/apollographql/apollo-mcp-server`.
To download the **latest release** Docker container of Apollo MCP Server:
```bash
docker image pull ghcr.io/apollographql/apollo-mcp-server:latest
```
To download a **specific version** of Apollo MCP Server (recommended for CI environments to ensure predictable behavior):
```bash
# Note the `v` prefixing the version number
docker image pull ghcr.io/apollographql/apollo-mcp-server:v1.2.1
```
To download a specific version of Apollo MCP Server that is a release candidate:
```bash
# Note the `v` prefixing the version number and the `-rc` suffix
docker image pull ghcr.io/apollographql/apollo-mcp-server:v1.2.1-rc.1
```
<Note>
The container sets a few defaults for ease of use:
- **Working Directory is `/data`**: Make sure to mount static schemas / operations to this location
using the volume flag when running [(`-v` / `--volume`)](https://docs.docker.com/reference/cli/docker/container/run/#volume).
- **HTTP Streamable Transport on port 8000**: Make sure to export container port 8000 for HTTP Streamable connections to
the MCP server using the port flag when running [(`-p` / `--port`)](https://docs.docker.com/reference/cli/docker/container/run/#publish)
</Note>
Run the following Docker command to start the MCP Server, replacing the values for the paths to the config file and project root with your own:
```sh showLineNumbers=false
docker run \
-it --rm \
--name apollo-mcp-server \
-p 8000:8000 \
-v <PATH/TO/CONFIG/FILE>:/config.yaml \
-v <PATH/TO/PROJECT/ROOT>:/data \
--pull always \
ghcr.io/apollographql/apollo-mcp-server:latest /config.yaml
```
This command:
- Starts an MCP Server in a Docker container
- Maps configuration files into the proper place for the Apollo MCP Server container
- Forwards port 8000 for accessing the MCP Server
## With the Apollo Runtime Container
The Apollo Runtime Container runs both the MCP Server and the [Apollo Router](https://www.apollographql.com/docs/graphos/routing) in a single container. It's useful for local development, testing, and production deployments.
The Apollo Runtime container includes all services necessary to serve GraphQL and MCP requests, including the Router and MCP Server. It is the easiest way to operate a GraphQL API with MCP support.
To serve both MCP and GraphQL requests, both port `4000` and `8000` will need to be exposed. An example command which retrieves the schema from Uplink is:
```bash title="Docker" {3, 6}
docker run \
-p 4000:4000 \
-p 8000:8000 \
--env APOLLO_GRAPH_REF="<your-graph-ref>" \
--env APOLLO_KEY="<your-graph-api-key>" \
--env MCP_ENABLE=1 \
--rm \
ghcr.io/apollographql/apollo-runtime:latest
```
To learn more, review the [Apollo Runtime container documentation](/graphos/routing/self-hosted/containerization/docker).