Skip to content

Commit 7aea0ef

Browse files
feat!: use new config file for MCP (#28)
* feat!: use new config file for MCP This commit updates the MCP run script to use the new config file instead of arguments to comply with breaking changes in the MCP server. BREAKING: Certain environment variables are now ignored. Co-authored-by: jonathanrainer <[email protected]>
1 parent 818a71e commit 7aea0ef

File tree

4 files changed

+62
-78
lines changed

4 files changed

+62
-78
lines changed

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ ARG S6_OVERLAY_VERSION=3.2.1.0
66
# renovate: datasource=github-releases depName=apollographql/router
77
ARG APOLLO_ROUTER_VERSION=2.4.0
88
# renovate: datasource=github-releases depName=apollographql/apollo-mcp-server
9-
ARG APOLLO_MCP_SERVER_VERSION=0.5.2
9+
ARG APOLLO_MCP_SERVER_VERSION=0.6.0
1010

1111
LABEL org.opencontainers.image.version=0.0.8
1212
LABEL org.opencontainers.image.vendor="Apollo GraphQL"

README.md

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ If you wish to enable it for testing purposes then set the environment variable
5050
...
5151
```
5252

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

5555
## Configuring Using Local Files
5656

@@ -149,14 +149,4 @@ these are as follows:
149149
|----------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
150150
| `APOLLO_KEY` | A valid API Key for Apollo Studio |
151151
| `APOLLO_GRAPH_REF` | The Graph Ref in Apollo Studio referenced by the Router and MCP Server |
152-
| `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 |
153-
| `MCP_COLLECTION` | The ID of an operation collection to use as the source for operations (requires `APOLLO_KEY`). |
154-
| `MCP_DISABLE_TYPE_DESCRIPTION` | Disable operation root field types in tool description |
155-
| `MCP_DISABLE_SCHEMA_DESCRIPTION` | Disable schema type definitions referenced by all fields returned by the operation in the tool description |
156152
| `MCP_ENABLE` | Enable the MCP Server |
157-
| `MCP_EXPLORER` | Expose a tool that returns the URL to open a GraphQL operation in Apollo Explorer (requires `APOLLO_GRAPH_REF`) |
158-
| `MCP_HEADERS` | A list of comma separated, key value pairs (separated by `:`s), of headers to send to the GraphQL endpoint |
159-
| `MCP_INTROSPECTION` | Enable the `--introspection` option for the MCP Server |
160-
| `MCP_LOG_LEVEL` | Change the level at which the MCP Server logs, possible values: `ERROR`, `WARN`, `INFO`, `DEBUG`, `TRACE` |
161-
| `MCP_SSE` | Use SSE as the transport protocol rather than streamable HTTP |
162-
| `MCP_UPLINK_MANIFEST` | Enable use of Uplink to get the persisted queries (Requires `APOLLO_KEY` and `APOLLO_GRAPH_REF`) |

config/mcp_config.yaml

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
# yaml-language-server: $schema=https://github.com/apollographql/apollo-mcp-server/releases/download/v0.6.0/config.schema.json
2+
3+
################################################################################
4+
# Example MCP configuration
5+
#
6+
# Note: Refer to the official documentation for info on what should be present
7+
# https://www.apollographql.com/docs/apollo-mcp-server/command-reference
8+
################################################################################
9+
10+
# If you have custom scalars that you wish to use in your operations / schema, use the following
11+
# configuration
12+
#
13+
# ```yaml
14+
# custom_scalars: /config/custom_scalars.graphql
15+
# ```
16+
17+
# Use uplink for operations
18+
#
19+
# Note: If you wish to use files inside the container instead, use the following configuration:
20+
#
21+
# ```yaml
22+
# operations:
23+
# source: local
24+
# paths:
25+
# - /config/operations
26+
# ```
27+
#
28+
# Note: If you wish to use a persisted query manifest instead, use the following configuration:
29+
#
30+
# ```yaml
31+
# operations:
32+
# source: manifest
33+
# path: /config/persisted_queries_manifest.json
34+
# ```
35+
operations:
36+
source: uplink
37+
38+
# Use uplink for schema information
39+
#
40+
# Note: If you wish to use a file inside the container instead, use the following configuration:
41+
#
42+
# ```yaml
43+
# schema:
44+
# source: local
45+
# path: /config/api_schema.graphql
46+
# ```
47+
schema:
48+
source: uplink
49+
50+
# Configure the MCP server to listen for streamable HTTP messages on port 5000
51+
# for all addresses
52+
transport:
53+
type: streamable_http
54+
address: "0.0.0.0"
55+
port: 5000

s6_service_definitions/mcp/run

Lines changed: 5 additions & 66 deletions
Original file line numberDiff line numberDiff line change
@@ -3,72 +3,11 @@
33
# Set our working directory
44
cd /opt || exit
55

6-
if [ -v MCP_ENABLE ]; then
7-
8-
if [[ -f /config/api_schema.graphql ]]; then
9-
ARGS+=(--schema /config/api_schema.graphql)
10-
fi
11-
12-
if [[ -f /config/custom_scalars.graphql ]]; then
13-
ARGS+=(--custom-scalars-config /config/custom_scalars.graphql)
14-
fi
15-
16-
if [[ -v MCP_HEADERS ]]; then
17-
IFS=',' read -ra HEADERS <<< "$MCP_HEADERS"
18-
for header in "${HEADERS[@]}"; do
19-
ARGS+=(--header "$header")
20-
done
21-
fi
22-
23-
if [[ -v MCP_SSE ]]; then
24-
ARGS+=(--sse-address 0.0.0.0)
25-
else
26-
ARGS+=(--http-address 0.0.0.0)
27-
fi
28-
29-
if [[ -v MCP_INTROSPECTION ]]; then
30-
ARGS+=(--introspection)
31-
fi
32-
33-
if [[ -v MCP_UPLINK_MANIFEST ]]; then
34-
ARGS+=(--uplink-manifest)
35-
fi
36-
37-
if [[ -v MCP_COLLECTION ]]; then
38-
ARGS+=(--collection "$MCP_COLLECTION")
39-
fi
40-
41-
# Only pass through operations if the folder contains files
42-
if [ "$(ls -A /config/operations)" ]; then
43-
ARGS+=(--operations /config/operations)
44-
fi
6+
# See documentation for available options
7+
# https://www.apollographql.com/docs/apollo-mcp-server/command-reference
458

46-
if [[ -v MCP_EXPLORER ]]; then
47-
ARGS+=(--explorer)
48-
fi
49-
50-
if [[ -f /config/persisted_queries_manifest.json ]]; then
51-
ARGS+=(--manifest /config/persisted_queries_manifest.json)
52-
fi
53-
54-
if [[ -v MCP_DISABLE_TYPE_DESCRIPTION ]]; then
55-
ARGS+=(--disable-type-description)
56-
fi
57-
58-
if [[ -v MCP_DISABLE_SCHEMA_DESCRIPTION ]]; then
59-
ARGS+=(--disable-schema-description)
60-
fi
61-
62-
if [[ -v MCP_ALLOW_MUTATIONS ]]; then
63-
ARGS+=(--allow-mutations "$MCP_ALLOW_MUTATIONS")
64-
fi
65-
66-
if [[ -v MCP_LOG_LEVEL ]]; then
67-
ARGS+=(--log "$MCP_LOG_LEVEL")
68-
fi
69-
70-
exec /opt/apollo-mcp-server "${ARGS[@]}"
9+
if [ -v MCP_ENABLE ]; then
10+
exec /opt/apollo-mcp-server "/config/mcp_config.yaml"
7111
else
72-
while true; do sleep 10000; done
12+
while true; do sleep 10000; done
7313
fi
74-

0 commit comments

Comments
 (0)