diff --git a/.changesets/breaking_defalut_port_8000.md b/.changesets/breaking_defalut_port_8000.md new file mode 100644 index 00000000..9a890292 --- /dev/null +++ b/.changesets/breaking_defalut_port_8000.md @@ -0,0 +1,20 @@ +### Change default port from 5000 to 8000 - @DaleSeo PR #417 + +The default server port has been changed from `5000` to `8000` to avoid conflicts with common development tools and services that typically use port 5000 (such as macOS AirPlay, Flask development servers, and other local services). + +**Migration**: If you were relying on the default port 5000, you can continue using it by explicitly setting the port in your configuration file or command line arguments. + +- Before + +```yaml +transport: + type: streamable_http +``` + +- After + +```yaml +transport: + type: streamable_http + port: 5000 +``` \ No newline at end of file diff --git a/crates/apollo-mcp-server/src/server.rs b/crates/apollo-mcp-server/src/server.rs index cdbd72e3..03283b8d 100644 --- a/crates/apollo-mcp-server/src/server.rs +++ b/crates/apollo-mcp-server/src/server.rs @@ -94,7 +94,7 @@ impl Transport { } fn default_port() -> u16 { - 5000 + 8000 } fn default_stateful_mode() -> bool { diff --git a/docs/source/config-file.mdx b/docs/source/config-file.mdx index a65a7cc4..7694f246 100644 --- a/docs/source/config-file.mdx +++ b/docs/source/config-file.mdx @@ -170,7 +170,7 @@ The available fields depend on the value of the nested `type` key: | :-------------- | :-------------------- | :--------- | :------------------------------------------------------------------------ | | `type` | `"streamable_http"` | | Host the MCP server on the configuration, using streamable HTTP messages. | | `address` | `127.0.0.1` (default) | `IpAddr` | The IP address to bind to | -| `port` | `5000` (default) | `u16` | The port to bind to | +| `port` | `8000` (default) | `u16` | The port to bind to | | `stateful_mode` | `true` (default) | `bool` | Flag to enable or disable stateful mode and session management. | ##### SSE (Deprecated, use StreamableHTTP) @@ -179,7 +179,7 @@ The available fields depend on the value of the nested `type` key: | :-------- | :-------------------- | :--------- | :--------------------------------------------------------------------------------------------------------------- | | `type` | `"sse"` | | Host the MCP server on the supplied config, using SSE for communication. Deprecated in favor of `StreamableHTTP` | | `address` | `127.0.0.1` (default) | `IpAddr` | The IP address to bind to | -| `port` | `5000` (default) | `u16` | The port to bind to | +| `port` | `8000` (default) | `u16` | The port to bind to | ### Auth diff --git a/docs/source/cors.mdx b/docs/source/cors.mdx index aeaea24b..0e4461d4 100644 --- a/docs/source/cors.mdx +++ b/docs/source/cors.mdx @@ -26,7 +26,7 @@ The following snippet includes an example of each option (use either `allow_any_ ```yaml title="mcp.yaml" transport: type: streamable_http - port: 5000 + port: 8000 cors: # Enable CORS support @@ -207,7 +207,7 @@ Here's a simple example of connecting to Apollo MCP Server from a browser: ```javascript async function connectToMCP() { - const response = await fetch("http://127.0.0.1:5000/mcp", { + const response = await fetch("http://127.0.0.1:8000/mcp", { method: "POST", headers: { Accept: "application/json, text/event-stream", diff --git a/docs/source/debugging.mdx b/docs/source/debugging.mdx index b5014db1..8276b6dd 100644 --- a/docs/source/debugging.mdx +++ b/docs/source/debugging.mdx @@ -65,7 +65,7 @@ schema: transport: type: streamable_http address: 127.0.0.1 - port: 5000 + port: 8000 ``` ```sh @@ -81,6 +81,6 @@ npx @modelcontextprotocol/inspector 1. In a browser, go to the URL returned by Inspector, then fill in the details: - **Transport Type**: Select `Streamable HTTP` - - **URL**: Enter `http://127.0.0.1:5000/mcp`, where the port must match the `transport.port` option + - **URL**: Enter `http://127.0.0.1:8000/mcp`, where the port must match the `transport.port` option 1. Click **Connect** and **List Tools**. You should see the tools for the operations you provided. diff --git a/docs/source/deploy.mdx b/docs/source/deploy.mdx index fd5246fb..0308915a 100644 --- a/docs/source/deploy.mdx +++ b/docs/source/deploy.mdx @@ -19,12 +19,12 @@ For most production deployments, use the all-in-one [Apollo Runtime Container](/ ### Deploy the Apollo Runtime Container -The Apollo Runtime Container includes all services necessary to serve GraphQL and MCP requests, including Apollo Router and Apollo MCP Server. Both port `4000` (GraphQL) and `5000` (MCP) are exposed. +The Apollo Runtime Container includes all services necessary to serve GraphQL and MCP requests, including Apollo Router and Apollo MCP Server. Both port `4000` (GraphQL) and `8000` (MCP) are exposed. ```bash title="Deploy with GraphOS (Recommended)" docker run \ -p 4000:4000 \ - -p 5050:5000 \ + -p 8000:8000 \ --env APOLLO_GRAPH_REF="" \ --env APOLLO_KEY="" \ --env MCP_ENABLE=1 \ @@ -52,7 +52,7 @@ Use the standalone Apollo MCP Server container if you already have a GraphQL API Apollo MCP Server is available as a standalone Docker container. Container images are downloadable using the image `ghcr.io/apollographql/apollo-mcp-server`. -By default, the container expects all schema and operation files to be present in the `/data` directory within the container and that clients use Streamable HTTP transport on container port `5050`. +By default, the container expects all schema and operation files to be present in the `/data` directory within the container and that clients use Streamable HTTP transport on container port `8000`. Here's an example `docker run` command that runs Apollo MCP Server for an example using [TheSpaceDevs graph](https://thespacedevs-production.up.railway.app/): @@ -71,7 +71,7 @@ schema: docker run \ -it --rm \ --name apollo-mcp-server \ - -p 5050:5000 \ + -p 8000:8000 \ -v /mcp_config.yaml:/config.yaml \ -v $PWD/graphql/TheSpaceDevs:/data \ --pull always \ diff --git a/docs/source/guides/auth-auth0.mdx b/docs/source/guides/auth-auth0.mdx index 5768e551..43103c07 100644 --- a/docs/source/guides/auth-auth0.mdx +++ b/docs/source/guides/auth-auth0.mdx @@ -31,7 +31,7 @@ This guide uses [Auth0](https://auth0.com/) as the Identity Provider. 1. In your dashboard, navigate to **Applications** -> **APIs**. 1. Click **Create API**. 1. Give it a friendly name like `MCP Auth API`. -1. For the **Identifier** field, Auth0 recommends using a URL. This identifier is used in the MCP server configuration later as the `audience` property. For this guide, use `http://localhost:5000/mcp-example`. +1. For the **Identifier** field, Auth0 recommends using a URL. This identifier is used in the MCP server configuration later as the `audience` property. For this guide, use `http://localhost:8000/mcp-example`. 1. Leave the defaults for the rest of the fields and click **Create**. 1. Navigate to your dashboard **Settings**. 1. Under **General** -> **API Authorization Settings**, set the **Default Audience** to the `Identifier` you chose. @@ -89,14 +89,14 @@ Configure the MCP server to use the Auth0 instance for authentication. - https:// # Fill in your Auth0 domain audiences: - # Fill in your Auth0 Identifier - resource: http://127.0.0.1:5000/mcp + resource: http://127.0.0.1:8000/mcp scopes: - read:users # Adjust scopes as needed ``` 1. Replace the `` with your own Auth0 domain from earlier. -1. Replace the `` with the matching `Identifier` you set when creating the Auth0 API. In this guide, you used `http://localhost:5000/mcp-example`. +1. Replace the `` with the matching `Identifier` you set when creating the Auth0 API. In this guide, you used `http://localhost:8000/mcp-example`. Your MCP server is now configured to use Auth0 for authentication. @@ -188,7 +188,7 @@ You need a graph's credentials and a valid GraphOS plan to use the router's auth The browser should open automatically with a proxy auth token. -1. In the MCP Inspector, select `Streamable HTTP` as the Transport Type and enter `http://127.0.0.1:5000/mcp` as the URL. +1. In the MCP Inspector, select `Streamable HTTP` as the Transport Type and enter `http://127.0.0.1:8000/mcp` as the URL. 1. Click **Connect**. This triggers the OAuth flow, and you are redirected to the Auth0 login page. 1. Log in with the credentials you set up in the Auth0 connection and allow MCP Inspector access. 1. After you connect, the browser redirects back to MCP Inspector. @@ -241,7 +241,7 @@ Then, continue with the following steps: | "What would you like to configure?" | "Add Extension" | | "What type of extension would you like to add?" | "Command Line Extension" | | "What's the name of this extension?" | "mcp-auth-quickstart" | -| "What command should be run?" | `npx mcp-remote http://127.0.0.1:5000/mcp` | +| "What command should be run?" | `npx mcp-remote http://127.0.0.1:8000/mcp` | | Other prompts (timeout, description, environment variables) | Use the default values | 1. To start Goose, type `goose`. This will open a browser window and send you through the auth flow. @@ -255,8 +255,8 @@ Then, continue with the following steps: #### MCP Server Won't Start -- **Error**: "Port 5000 is already in use" - - Solution: Kill any existing processes using port 5000 or specify a different port with the `transport.port` option or `APOLLO_MCP_TRANSPORT__PORT` env variable +- **Error**: "Port 8000 is already in use" + - Solution: Kill any existing processes using port 8000 or specify a different port with the `transport.port` option or `APOLLO_MCP_TRANSPORT__PORT` env variable - **Error**: "Failed to load supergraph configuration" - Solution: Verify you're running the command from the repo root directory - Solution: Check that the path to `supergraph.yaml` is correct @@ -269,7 +269,7 @@ Then, continue with the following steps: - **Error**: "Failed to connect to server" - Solution: Ensure the MCP server is running (check terminal output) - - Solution: Verify you're using the correct URL (`http://127.0.0.1:5000/mcp`) + - Solution: Verify you're using the correct URL (`http://127.0.0.1:8000/mcp`) - Solution: Check if your firewall is blocking the connection ### Infinite loop during OAuth flow diff --git a/docs/source/health-checks.mdx b/docs/source/health-checks.mdx index 519122a4..83f0e137 100644 --- a/docs/source/health-checks.mdx +++ b/docs/source/health-checks.mdx @@ -15,7 +15,7 @@ Health checks are only available when using the `streamable_http` transport and transport: type: streamable_http address: 127.0.0.1 - port: 5000 + port: 8000 health_check: enabled: true path: /health diff --git a/docs/source/quickstart.mdx b/docs/source/quickstart.mdx index 834f8eab..bd565ac0 100644 --- a/docs/source/quickstart.mdx +++ b/docs/source/quickstart.mdx @@ -61,12 +61,12 @@ You can start your MCP server locally with `rover dev`. -1. You should see some output indicating that the GraphQL server is running at `http://localhost:4000` and the MCP server is running at `http://127.0.0.1:5050`. +1. You should see some output indicating that the GraphQL server is running at `http://localhost:4000` and the MCP server is running at `http://127.0.0.1:8000`. 1. In a new terminal window, run the MCP Inspector to verify the server is running: ```terminal showLineNumbers=false - npx @modelcontextprotocol/inspector http://127.0.0.1:5050/mcp --transport http + npx @modelcontextprotocol/inspector http://127.0.0.1:8000/mcp --transport http ``` 1. This will automatically open your browser to `http://127.0.0.1:6274`. @@ -94,7 +94,7 @@ Copy the configuration: "command": "npx", "args": [ "mcp-remote", - "http://127.0.0.1:5050/mcp" + "http://127.0.0.1:8000/mcp" ] } } @@ -107,7 +107,7 @@ Copy the configuration: Install using the CLI: ```bash -claude mcp add apollo-mcp npx mcp-remote http://127.0.0.1:5050/mcp +claude mcp add apollo-mcp npx mcp-remote http://127.0.0.1:8000/mcp ``` @@ -127,7 +127,7 @@ Or install manually: 1. Go to **Cursor Settings** → **MCP** → **Add new MCP Server** 2. Name: `Apollo MCP` (choose a title) 3. Command: `npx` -4. Arguments: `["mcp-remote", "http://127.0.0.1:5050/mcp"]` +4. Arguments: `["mcp-remote", "http://127.0.0.1:8000/mcp"]` @@ -147,13 +147,13 @@ default: command: npx args: - mcp-remote - - http://127.0.0.1:5050/mcp + - http://127.0.0.1:8000/mcp ``` Or use the Goose CLI to add the MCP server: ```bash -goose mcp add apollo-mcp npx mcp-remote http://127.0.0.1:5050/mcp +goose mcp add apollo-mcp npx mcp-remote http://127.0.0.1:8000/mcp ``` @@ -161,7 +161,7 @@ goose mcp add apollo-mcp npx mcp-remote http://127.0.0.1:5050/mcp 1. Go to **Advanced settings** → **Extensions** → **Add custom extension** 2. Name: `Apollo MCP` 3. Type: **STDIO** -4. Command: `npx mcp-remote http://127.0.0.1:5050/mcp` +4. Command: `npx mcp-remote http://127.0.0.1:8000/mcp` @@ -176,7 +176,7 @@ Edit `~/.config/opencode/opencode.json`: "command": [ "npx", "mcp-remote", - "http://127.0.0.1:5050/mcp" + "http://127.0.0.1:8000/mcp" ], "enabled": true } @@ -189,7 +189,7 @@ Edit `~/.config/opencode/opencode.json`: 1. Go to **Windsurf Settings → MCP → Add new MCP Server** 2. Name: `Apollo MCP` 3. Command: `npx` -4. Arguments: `["mcp-remote", "http://127.0.0.1:5050/mcp"]` +4. Arguments: `["mcp-remote", "http://127.0.0.1:8000/mcp"]` Alternatively, edit your Windsurf configuration file directly: @@ -200,7 +200,7 @@ Alternatively, edit your Windsurf configuration file directly: "command": "npx", "args": [ "mcp-remote", - "http://127.0.0.1:5050/mcp" + "http://127.0.0.1:8000/mcp" ] } } @@ -265,7 +265,7 @@ Your project includes a pre-configured `mcp.Dockerfile` for easy deployment. Thi 1. Run locally: ```bash - docker run -p 4000:4000 -p 5050:5000 \ + docker run -p 4000:4000 -p 8000:8000 \ -e APOLLO_KEY=$APOLLO_KEY \ -e APOLLO_GRAPH_REF=$APOLLO_GRAPH_REF \ -e MCP_ENABLE=1 \ @@ -280,7 +280,7 @@ Your project includes a pre-configured `mcp.Dockerfile` for easy deployment. Thi | ---------------------------- | ------------------------------- | -------- | | `APOLLO_KEY` | Your graph's API key | Yes | | `APOLLO_GRAPH_REF` | Your graph reference | Yes | -| `APOLLO_MCP_TRANSPORT__PORT` | MCP server port (default: 5000) | No | +| `APOLLO_MCP_TRANSPORT__PORT` | MCP server port (default: 8000) | No | | `APOLLO_ROUTER_PORT` | Router port (default: 4000) | No | For more deployment options, see the [Deploy the MCP Server](/apollo-mcp-server/deploy) page. @@ -312,7 +312,7 @@ After deploying, update your MCP client configuration to use the deployed URL: **Connection refused errors:** - Confirm the server is running on the correct port -- Verify firewall settings allow connections to localhost:5050 +- Verify firewall settings allow connections to localhost:8000 - For remote connections, ensure the host is set to `0.0.0.0` in your config **Authentication issues:** diff --git a/docs/source/run.mdx b/docs/source/run.mdx index 83bfe95c..e0a0ff0c 100644 --- a/docs/source/run.mdx +++ b/docs/source/run.mdx @@ -117,7 +117,7 @@ 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 5000**: Make sure to export container port 5000 for HTTP Streamable connections to +- **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) @@ -128,7 +128,7 @@ Run the following Docker command to start the MCP Server, replacing the values f docker run \ -it --rm \ --name apollo-mcp-server \ - -p 5000:5000 \ + -p 8000:8000 \ -v :/config.yaml \ -v :/data \ --pull always \ @@ -139,7 +139,7 @@ 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 5000 for accessing the MCP Server +- Forwards port 8000 for accessing the MCP Server ## With the Apollo Runtime Container @@ -147,12 +147,12 @@ The Apollo Runtime Container runs both the MCP Server and the [Apollo Router](ht 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 `5000` will need to be exposed. An example command which retrieves the schema from Uplink is: +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 5000:5000 \ + -p 8000:8000 \ --env APOLLO_GRAPH_REF="" \ --env APOLLO_KEY="" \ --env MCP_ENABLE=1 \ diff --git a/flake.nix b/flake.nix index 48a84835..57ea4b8d 100644 --- a/flake.nix +++ b/flake.nix @@ -174,7 +174,7 @@ # Image configuration # See: https://github.com/moby/moby/blob/46f7ab808b9504d735d600e259ca0723f76fb164/image/spec/spec.md#container-runconfig-field-descriptions config = let - http-port = 5000; + http-port = 8000; in { # Provide default options that can be unset / overridden by the end-user Env = [ diff --git a/graphql/TheSpaceDevs/README.md b/graphql/TheSpaceDevs/README.md index 61be134c..c54190cb 100644 --- a/graphql/TheSpaceDevs/README.md +++ b/graphql/TheSpaceDevs/README.md @@ -38,28 +38,22 @@ Here is an example configuration you can use _(Note: you must provide your fill "thespacedevs": { "command": "/Users/michaelwatson/Documents/GitHub/apollographql/apollo-mcp-server/target/debug/apollo-mcp-server", "args": [ - "--directory", - "/Users/michaelwatson/Documents/GitHub/apollographql/apollo-mcp-server/graphql/TheSpaceDevs", - "--schema", - "api.graphql", - "--operations", - "operations", - "--endpoint", - "https://thespacedevs-production.up.railway.app/", - "--introspection" + "graphql/TheSpaceDevs/config.yaml" ] } } } ``` -## Using Server-Side-Events (SSE) with Apollo MCP server +## Using Streamable HTTP with Apollo MCP server -There are operations located at `./operations/*.graphql` for you to use in your configuration. You can provide a set of operations in your MCP configuration along with the `--introspection` option that enables the LLM to generate a dynamic operation along with the ability to execute it. +There are operations located at `./operations/*.graphql` for you to use in your configuration. You can provide a set of operations in your MCP configuration that enables the LLM to generate a dynamic operation along with the ability to execute it. -### Running SSE with `rover dev` +### Running with `rover dev` -**_Coming soon_** +```BASH +rover dev --supergraph-config supergraph.yaml --mcp config.yaml +``` ### Running Apollo MCP server Docker image @@ -69,16 +63,13 @@ There are operations located at `./operations/*.graphql` for you to use in your docker run \ -it --rm \ --name apollo-mcp-server \ - -p 5000:5000 \ + -p 8000:8000 \ + -v $PWD/graphql/TheSpaceDevs/config.yaml:/config.yaml \ -v $PWD/graphql/TheSpaceDevs:/data \ - ghcr.io/apollographql/apollo-mcp-server:latest \ - --http-port 5000 \ - --schema api.graphql \ - --operations operations \ - --endpoint https://thespacedevs-production.up.railway.app/ + ghcr.io/apollographql/apollo-mcp-server:latest /config.yaml ``` -2. Add the MCP SSE port to your MCP Server configuration for the client appliction you are running. If you are running locally, the server link will be `http://127.0.0.1:5000/sse`. +2. Add the MCP port to your MCP Server configuration for the client application you are running. If you are running locally, the server link will be `http://127.0.0.1:8000/mcp`. _Note: Claude Desktop currently doesn't support SSE_ @@ -86,8 +77,11 @@ _Note: Claude Desktop currently doesn't support SSE_ { "mcpServers": { "thespacedevs": { - "type": "sse", - "url": "http://127.0.0.1:5000/sse>" + "command": "npx", + "args": [ + "mcp-remote", + "http://127.0.0.1:8000/mcp" + ] } } } @@ -103,80 +97,9 @@ Here is an example configuration you can use _(Note: you must provide your fill "thespacedevs": { "command": "/Users/michaelwatson/Documents/GitHub/apollographql/apollo-mcp-server/target/debug/apollo-mcp-server", "args": [ - "--directory", - "/Users/michaelwatson/Documents/GitHub/apollographql/apollo-mcp-server/graphql/TheSpaceDevs", - "--schema", - "api.graphql", - "--operations", - "operations", - "--endpoint", - "https://thespacedevs-production.up.railway.app/", - "--introspection" + "graphql/TheSpaceDevs/config.yaml" ] } } } ``` - -## Using Persisted Queries - GraphOS Scale and Enterprise tiers only - -You can configure the Apollo MCP server to use [Persisted Queries with GraphOS](https://www.apollographql.com/docs/graphos/routing/security/persisted-queries). In order to do this, you'll have to setup GraphOS and run a router instance configured to that persisted query list: - -1. Create a new graph in [GraphOS](https://studio.apollographql.com/org) -2. Publish the `api.schema` to the graph you created, _you should see a modal pop up with the command information you need - make sure to save the API key as you'll use it again_ - -``` -APOLLO_KEY=service:my-new-graph:V9_dIUACHIQh5VnhW21SXg \ - rover subgraph publish my-new-graph@current \ - --schema ./api.graphql \ - --name thespacedevs \ - --routing-url https://thespacedevs-production.up.railway.app/ -``` - -3. Create a new [Persisted Queries List (PQL)](https://www.apollographql.com/docs/graphos/platform/security/persisted-queries#1-pql-creation-and-linking) for the newly created graph in GraphOS. Make sure to link it to your current variant. -4. Publish operations to PQL in GraphOS - -``` -rover persisted-queries publish \ - --graph-id my-new-graph \ - --list-id "PQL-ID" \ - --manifest ./persisted_queries/apollo.json -``` - -_Note: If you added new operations to the operations folder, you'll need to re-generate the persisted queries manifest. There is a VS Code Task you can use in the command palette "Tasks: Run Task" that runs the following command:_ - -``` -npx @apollo/generate-persisted-query-manifest \ - generate-persisted-query-manifest \ - --config persisted_queries.config.json -``` - -5. In the command invoking or starting up your Apollo MCP Server with SSE, you'll need to export your `APOLLO_KEY` from the second step along with `APOLLO_GRAPH_REF=my-new-graph@current`. - -```bash -export APOLLO_KEY=service:my-new-graph:V9_dIUACHIQh5VnhW21SXg -export APOLLO_GRAPH_REF=my-new-graph@current -``` - -6. Modify your Apollo MCP Server configuration to use the manifest option instead of operations. - -```json -{ - "mcpServers": { - "thespacedevs": { - "command": "/Users/michaelwatson/Documents/GitHub/apollographql/apollo-mcp-server/target/debug/apollo-mcp-server", - "args": [ - "--directory", - "/Users/michaelwatson/Documents/GitHub/apollographql/mcp-apollo/graphql/TheSpaceDevs", - "--schema", - "api.graphql", - "--manifest", - "persisted_queries/apollo.json", - "--endpoint", - "https://thespacedevs-production.up.railway.app/", - "--introspection" - ] - } - } -} -``` \ No newline at end of file