diff --git a/Dockerfile b/Dockerfile index f86c619..2241dfb 100644 --- a/Dockerfile +++ b/Dockerfile @@ -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" diff --git a/README.md b/README.md index a4339f3..431b02b 100644 --- a/README.md +++ b/README.md @@ -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 @@ -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`) | diff --git a/config/mcp_config.yaml b/config/mcp_config.yaml new file mode 100644 index 0000000..ebc466a --- /dev/null +++ b/config/mcp_config.yaml @@ -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 diff --git a/s6_service_definitions/mcp/run b/s6_service_definitions/mcp/run index 5a00c08..33dd7f3 100755 --- a/s6_service_definitions/mcp/run +++ b/s6_service_definitions/mcp/run @@ -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 -