Skip to content

feat!: use new config file for MCP #28

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Jul 29, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ ARG S6_OVERLAY_VERSION=3.2.1.0
# renovate: datasource=github-releases depName=apollographql/router
ARG APOLLO_ROUTER_VERSION=2.4.0
# renovate: datasource=github-releases depName=apollographql/apollo-mcp-server
ARG APOLLO_MCP_SERVER_VERSION=0.5.2
ARG APOLLO_MCP_SERVER_VERSION=0.6.0

LABEL org.opencontainers.image.version=0.0.8
LABEL org.opencontainers.image.vendor="Apollo GraphQL"
Expand Down
12 changes: 1 addition & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ If you wish to enable it for testing purposes then set the environment variable
...
```

See [below](#configuring-using-environment-variables) for information on configuring the MCP Server
See the example [config file](config/mcp_config.yaml) for information on configuring the MCP Server.

## Configuring Using Local Files

Expand Down Expand Up @@ -149,14 +149,4 @@ these are as follows:
|----------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `APOLLO_KEY` | A valid API Key for Apollo Studio |
| `APOLLO_GRAPH_REF` | The Graph Ref in Apollo Studio referenced by the Router and MCP Server |
| `MCP_ALLOW_MUTATIONS` | Possible values: `none`, don't allow any mutations, `explicit` allow explicit mutations, but don't allow the LLM to build them, `all` Allow the LLM to build mutations |
| `MCP_COLLECTION` | The ID of an operation collection to use as the source for operations (requires `APOLLO_KEY`). |
| `MCP_DISABLE_TYPE_DESCRIPTION` | Disable operation root field types in tool description |
| `MCP_DISABLE_SCHEMA_DESCRIPTION` | Disable schema type definitions referenced by all fields returned by the operation in the tool description |
| `MCP_ENABLE` | Enable the MCP Server |
| `MCP_EXPLORER` | Expose a tool that returns the URL to open a GraphQL operation in Apollo Explorer (requires `APOLLO_GRAPH_REF`) |
| `MCP_HEADERS` | A list of comma separated, key value pairs (separated by `:`s), of headers to send to the GraphQL endpoint |
| `MCP_INTROSPECTION` | Enable the `--introspection` option for the MCP Server |
| `MCP_LOG_LEVEL` | Change the level at which the MCP Server logs, possible values: `ERROR`, `WARN`, `INFO`, `DEBUG`, `TRACE` |
| `MCP_SSE` | Use SSE as the transport protocol rather than streamable HTTP |
| `MCP_UPLINK_MANIFEST` | Enable use of Uplink to get the persisted queries (Requires `APOLLO_KEY` and `APOLLO_GRAPH_REF`) |
55 changes: 55 additions & 0 deletions config/mcp_config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
# yaml-language-server: $schema=https://github.com/apollographql/apollo-mcp-server/releases/download/v0.6.0/config.schema.json

################################################################################
# Example MCP configuration
#
# Note: Refer to the official documentation for info on what should be present
# https://www.apollographql.com/docs/apollo-mcp-server/command-reference
################################################################################

# If you have custom scalars that you wish to use in your operations / schema, use the following
# configuration
#
# ```yaml
# custom_scalars: /config/custom_scalars.graphql
# ```

# Use uplink for operations
#
# Note: If you wish to use files inside the container instead, use the following configuration:
#
# ```yaml
# operations:
# source: local
# paths:
# - /config/operations
# ```
#
# Note: If you wish to use a persisted query manifest instead, use the following configuration:
#
# ```yaml
# operations:
# source: manifest
# path: /config/persisted_queries_manifest.json
# ```
operations:
source: uplink

# Use uplink for schema information
#
# Note: If you wish to use a file inside the container instead, use the following configuration:
#
# ```yaml
# schema:
# source: local
# path: /config/api_schema.graphql
# ```
schema:
source: uplink

# Configure the MCP server to listen for streamable HTTP messages on port 5000
# for all addresses
transport:
type: streamable_http
address: "0.0.0.0"
port: 5000
71 changes: 5 additions & 66 deletions s6_service_definitions/mcp/run
Original file line number Diff line number Diff line change
Expand Up @@ -3,72 +3,11 @@
# Set our working directory
cd /opt || exit

if [ -v MCP_ENABLE ]; then

if [[ -f /config/api_schema.graphql ]]; then
ARGS+=(--schema /config/api_schema.graphql)
fi

if [[ -f /config/custom_scalars.graphql ]]; then
ARGS+=(--custom-scalars-config /config/custom_scalars.graphql)
fi

if [[ -v MCP_HEADERS ]]; then
IFS=',' read -ra HEADERS <<< "$MCP_HEADERS"
for header in "${HEADERS[@]}"; do
ARGS+=(--header "$header")
done
fi

if [[ -v MCP_SSE ]]; then
ARGS+=(--sse-address 0.0.0.0)
else
ARGS+=(--http-address 0.0.0.0)
fi

if [[ -v MCP_INTROSPECTION ]]; then
ARGS+=(--introspection)
fi

if [[ -v MCP_UPLINK_MANIFEST ]]; then
ARGS+=(--uplink-manifest)
fi

if [[ -v MCP_COLLECTION ]]; then
ARGS+=(--collection "$MCP_COLLECTION")
fi

# Only pass through operations if the folder contains files
if [ "$(ls -A /config/operations)" ]; then
ARGS+=(--operations /config/operations)
fi
# See documentation for available options
# https://www.apollographql.com/docs/apollo-mcp-server/command-reference

if [[ -v MCP_EXPLORER ]]; then
ARGS+=(--explorer)
fi

if [[ -f /config/persisted_queries_manifest.json ]]; then
ARGS+=(--manifest /config/persisted_queries_manifest.json)
fi

if [[ -v MCP_DISABLE_TYPE_DESCRIPTION ]]; then
ARGS+=(--disable-type-description)
fi

if [[ -v MCP_DISABLE_SCHEMA_DESCRIPTION ]]; then
ARGS+=(--disable-schema-description)
fi

if [[ -v MCP_ALLOW_MUTATIONS ]]; then
ARGS+=(--allow-mutations "$MCP_ALLOW_MUTATIONS")
fi

if [[ -v MCP_LOG_LEVEL ]]; then
ARGS+=(--log "$MCP_LOG_LEVEL")
fi

exec /opt/apollo-mcp-server "${ARGS[@]}"
if [ -v MCP_ENABLE ]; then
exec /opt/apollo-mcp-server "/config/mcp_config.yaml"
else
while true; do sleep 10000; done
while true; do sleep 10000; done
fi