You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
|`-d, --directory <DIRECTORY>`| The working directory to use. |
20
-
|`-s, --schema <SCHEMA>`| The path to the GraphQL API schema file. |
21
-
|`-c, --custom-scalars-config <CUSTOM_SCALARS_CONFIG>`| The path to the GraphQL custom_scalars_config file. |
19
+
|`-d, --directory <DIRECTORY>`| The working directory to use. **Required**|
20
+
|`-s, --schema <SCHEMA>`| The path to the GraphQL API schema file. **Required**|
21
+
|`-c, --custom-scalars-config <CUSTOM_SCALARS_CONFIG>`| The path to the GraphQL custom_scalars_config file. [Learn more](/apollo-mcp-server/guides/#custom-scalars).|
22
22
|`-e, --endpoint <ENDPOINT>`| The GraphQL endpoint the server will invoke.<br />[default: `http://127.0.0.1:4000`]|
23
23
|`--header <HEADERS>`| Headers to send to the endpoint. |
24
24
|`--sse-port <SSE_PORT>`| Start the server using the SSE transport on the given port. |
25
-
|`-i, --introspection`| Expose the schema to the MCP client through `schema` and `execute` tools. |
26
-
|`-u, --uplink`| Enable use of uplink to get the schema and persisted queries (requires `APOLLO_KEY` and `APOLLO_GRAPH_REF`). |
25
+
|`-i, --introspection`| Expose the schema to the MCP client through `schema` and `execute` tools. [Learn more](/apollo-mcp-server/guides/#from-schema-introspection). |
26
+
|`-u, --uplink`| Enable use of uplink to get the schema and persisted queries (requires `APOLLO_KEY` and `APOLLO_GRAPH_REF`). [Learn more](/apollo-mcp-server/guides/#from-graphos-managed-persisted-queries). |
27
27
|`-x, --explorer`| Expose a tool to open queries in Apollo Explorer (requires `APOLLO_KEY` and `APOLLO_GRAPH_REF`). |
28
-
|`-o, --operations [<OPERATIONS>...]`| Operation files to expose as MCP tools. |
28
+
|`-o, --operations [<OPERATIONS>...]`| Operation files to expose as MCP tools. [Learn more](/apollo-mcp-server/guides/#from-operation-schema-files).|
29
29
|`--manifest <MANIFEST>`| The path to the persisted query manifest containing operations. |
30
30
|`-m, --allow-mutations <ALLOW_MUTATIONS>`|[default: `none`]<br /><br />Possible values:<ul><li>`none`: Don't allow any mutations</li><li>`explicit`: Allow explicit mutations, but don't allow the LLM to build them</li><li>`all`: Allow the LLM to build mutations</li></ul> |
31
31
|`-h, --help`| Print help (see a summary with `-h`). |
32
32
33
+
### Mapping rover dev options
34
+
35
+
You can use the [`rover dev`](/rover/commands/dev) command of Rover CLI v0.31 or later to run an Apollo MCP Server instance for local development.
36
+
37
+
Running `rover dev --mcp` starts an MCP server. Additional options, `--mcp*`, directly configure the MCP server.
38
+
39
+
The mapping of `rover dev` options to MCP server options:
40
+
41
+
|`rover dev` option | Equivalent MCP Server option |
Copy file name to clipboardExpand all lines: docs/source/get-started/index.mdx
+91-24
Original file line number
Diff line number
Diff line change
@@ -7,55 +7,93 @@ subtitle: Run Apollo MCP Server
7
7
8
8
Let's run Apollo MCP Server for the first time. You will:
9
9
- Understand an MCP server example.
10
-
- Run an MCP server locally, using the example and Apollo Rover CLI.
11
-
- Connect an MCP client and inspect and/or run the tools.
10
+
- Run an MCP server for the example.
11
+
- Connect MCP Inspector and inspect the tools.
12
+
- Connect an MCP client and run the tools.
12
13
13
14
## Prerequisites
14
15
15
-
- Install [Apollo Rover CLI](/rover/getting-started) v0.30 or later.
16
16
- Clone the [Apollo MCP Server repo](https://github.com/apollographql/apollo-mcp-server).
17
17
18
18
## Understand MCP server example
19
19
20
-
This guide uses an MCP example from the Apollo MCP Server repo. The example uses APIs from [The Space Devs](https://thespacedevs.com/), and it defines a federated graph and the GraphQL operations of the graph to expose as MCP tools. It also has files for configuring MCP tools from reading persisted queries registered with the graph.
20
+
This guide uses an MCP example from the Apollo MCP Server repo. The example uses APIs from [The Space Devs](https://thespacedevs.com/), and it defines a federated graph and the GraphQL operations of the graph to expose as MCP tools.
21
21
22
-
Let's walk through the example files, located in the repo in `graphql/TheSpaceDevs`:
22
+
Let's walk through the example files. They're located in the repo in `graphql/TheSpaceDevs/`:
23
23
-`supergraph.yaml` is a [supergraph configuration file](/rover/commands/supergraphs#yaml-configuration-file) for the Rover CLI.
24
24
- The `operations/` directory has `*.graphql`operations schema files. Each file defines a GraphQL operation on the graph, and Apollo MCP Server creates an MCP tool from each operation file it's given.
25
-
- The `persisted_queries/` directory has a persisted queries manifest (PQM) file. It defines the operations that've been registered with the graph and that can be read by the MCP server to create corresponding tools.
25
+
- The `persisted_queries/` directory has a persisted query manifest (PQM) file. It defines the operations that've been registered with the graph as persisted queries and that can be read and turned into tools by the MCP server.
26
26
27
27
## Run MCP server example
28
28
29
-
You can run the Apollo MCP Server together with a graph in a local development environment with a single `rover dev` command.
29
+
Choose one of the options for running an MCP example:
30
30
31
+
- Running `rover dev` to start an MCP server using the SSE transport
32
+
- Running a local binary of the MCP server using the stdio transport
33
+
34
+
Both use [MCP Inspector](https://modelcontextprotocol.io/docs/tools/inspector) to connect to and inspect the running server.
35
+
<br/>
36
+
37
+
<Tabs>
38
+
39
+
<Tablabel="rover dev + SSE">
40
+
41
+
You can run the Apollo MCP Server together with a graph in a local development environment with a single `rover dev` command. Rover starts an MCP Server that communicates via SSE transport.
42
+
43
+
1. Install [Apollo Rover CLI](/rover/getting-started) v0.31 or later.
31
44
1. From the root directory of your local repo, run `rover dev` to start a local graph, using `--mcp*` options to start and configure an Apollo MCP Server.
32
45
33
46
```sh showLineNumbers=false
34
47
rover dev --supergraph-config ./graphql/TheSpaceDevs/supergraph.yaml \
-`--mcp-port` sets the port of the server's SSE transport
41
54
-`--mcp-operations` sets the list of operations
42
55
43
-
## Inspect MCP server
44
-
45
-
The [MCP Inspector](https://modelcontextprotocol.io/docs/tools/inspector) is a tool for testing and debugging MCP servers. Let's use it to validate our running server.
46
-
47
-
1. Install `npm`, if unavailable.
48
-
1. Run the Inspector from a new terminal, then go to its returned URL (for example, [`http://127.0.0.1:6274`](http://127.0.0.1:6274)).
56
+
1. Start MCP Inspector, then open a browser and go to [`http://127.0.0.1:6274`](http://127.0.0.1:6274):
49
57
50
-
```bash showLineNumbers=false
58
+
```sh
51
59
npx @modelcontextprotocol/inspector
52
60
```
53
61
54
-
1. Fill in the details:
62
+
1. Fill in the details in Inspector:
55
63
-**Transport Type**: Select `SSE`
56
64
-**URL**: Enter `http://localhost:5000/sse` (its port must match the `--mcp-port` of the server)
57
65
58
-
1. Click **Connect**, then click **List Tool**. Your operations should now be listed.
66
+
1. Click **Connect**, then click **List Tool**. Inspector should show the tools from your server.
67
+
68
+
<img
69
+
src="../images/mcp-getstarted-inspector.jpg"
70
+
alt="MCP Inspector connected to running Apollo MCP Server"
71
+
class="screenshot"
72
+
width="600"
73
+
/>
74
+
75
+
</Tab>
76
+
77
+
<Tablabel="Local binary + stdio">
78
+
79
+
You can run an Apollo MCP Server locally to communicate over stdio.
80
+
81
+
1. Download the binary of the latest version of Apollo MCP Server. Add it to your path.
82
+
1. Use MCP Inspector to run the Apollo MCP Server binary:
@@ -90,9 +153,13 @@ Connect an MCP client to your server and run its tools.
90
153
}
91
154
}
92
155
```
156
+
157
+
</CodeColumns>
158
+
93
159
1. Restart Claude, then check that your server's tools are available from the input box.
94
160
1. Ask a question that exercises the tools.
95
161
96
-
</Tab>
97
162
98
-
</Tabs>
163
+
## Next steps
164
+
165
+
- Try creating tools from operations in persisted queries, via [persisted query manifests](/apollo-mcp-server/guides/#from-persisted-query-manifests) or [GraphOS](/apollo-mcp-server/guides/#from-graphos-managed-persisted-queries).
Copy file name to clipboardExpand all lines: docs/source/guides/index.mdx
+5-8
Original file line number
Diff line number
Diff line change
@@ -128,26 +128,24 @@ If you register a persisted query with a specific client name instead of `null`,
128
128
Use the `--header` option when running the MCP server to pass the header to the router. The default name of the header expected by the router is `apollographql-client-name`. To use a different header name, configure `telemetry.apollo.client_name_header` in router YAML configuration.
129
129
130
130
131
-
### From introspection
131
+
### From schema introspection
132
132
133
-
You can optionally enable support for allowing an AI model to introspect the schema and formulate its own queries.
133
+
For use cases where not all operations can be pre-defined, Apollo MCP Server supports tool creation based on graph introspection. This allows AI agents to explore a graph and execute operations dynamically.
134
134
135
-
To enable this introspection mode, run the MCP server with the `--introspect` option.
136
-
137
-
Two new tools will be exposed by the server:
135
+
To enable these schema aware tools, run the MCP server with the `--introspection` option, which exposes two new tools:
138
136
139
137
*`schema` - returns the GraphQL schema
140
138
*`execute` - executes an operation on the GraphQL endpoint
141
139
142
-
The MCP client can then use these tools to provide schema information to the model, and allow the model to execute GraphQL operations based on that schema.
140
+
The MCP client can use these tools to provide schema information to the model and its context window, and allow the model to execute GraphQL operations based on that schema.
143
141
144
142
<Tip>
145
143
146
144
Use a [contract variant](/graphos/platform/schema-management/delivery/contracts/overview) so you can control the parts of your graph that AI can introspect. [Learn more](/apollo-mcp-server/best-practices#use-contract-variants-to-control-ai-access-to-graphs)
147
145
148
146
</Tip>
149
147
150
-
### Adding context to tools
148
+
### Documenting tools
151
149
152
150
TODO
153
151
@@ -200,7 +198,6 @@ Starting MCP inspector...
200
198
201
199
1. In a browser, go to the URL returned by Inspector, then click **Connect** and **List Tools**. You should see the tools for the operations you provided.
202
200
203
-
204
201
### Debug over SSE transport
205
202
206
203
When running the MCP server over SSE transport, you can run MCP Inspector with the SSE transport.
0 commit comments