diff --git a/CHANGELOG.md b/CHANGELOG.md index 0771ed9d..2762aafe 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,6 +13,11 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm ### 📚 Documentation --> +## [UNRELEASED] + +### ❗ BREAKING ❗ +- split out the execute tool into separate --execute-introspection flag, `--introspection` is now `--introspection --execute-introspection` + ## [0.2.0] - 2025-05-21 ### 🚀 Features diff --git a/crates/apollo-mcp-server/src/main.rs b/crates/apollo-mcp-server/src/main.rs index 450212d7..1148b8a2 100644 --- a/crates/apollo-mcp-server/src/main.rs +++ b/crates/apollo-mcp-server/src/main.rs @@ -61,10 +61,14 @@ struct Args { #[arg(long)] sse_port: Option, - /// Expose the schema to the MCP client through `introspect` and `execute` tools - #[arg(long, short = 'i')] + /// Expose the schema to the MCP client through `introspect` tool + #[arg(long, short = 'i', required_if_eq("execute_introspection", "true"))] introspection: bool, + /// Allow the use of the `execute` tool with operations build from the schema tool + #[arg(long)] + execute_introspection: bool, + /// Enable use of uplink to get the schema and persisted queries (requires APOLLO_KEY and APOLLO_GRAPH_REF) #[arg(long, short = 'u')] uplink: bool, @@ -173,6 +177,7 @@ async fn main() -> anyhow::Result<()> { .explorer(args.explorer) .headers(default_headers) .introspection(args.introspection) + .execute_introspection(args.execute_introspection) .mutation_mode(args.allow_mutations) .disable_type_description(args.disable_type_description) .disable_schema_description(args.disable_schema_description) diff --git a/crates/apollo-mcp-server/src/server.rs b/crates/apollo-mcp-server/src/server.rs index 92bd604d..501f00f6 100644 --- a/crates/apollo-mcp-server/src/server.rs +++ b/crates/apollo-mcp-server/src/server.rs @@ -44,6 +44,7 @@ pub struct Server { endpoint: String, headers: HeaderMap, introspection: bool, + execute_introspection: bool, explorer: bool, custom_scalar_map: Option, mutation_mode: MutationMode, @@ -70,6 +71,7 @@ impl Server { endpoint: String, headers: Headers, introspection: bool, + execute_introspection: bool, explorer: bool, custom_scalar_map: Option, mutation_mode: MutationMode, @@ -88,6 +90,7 @@ impl Server { endpoint, headers, introspection, + execute_introspection, explorer, custom_scalar_map, mutation_mode, @@ -189,6 +192,7 @@ struct Configuring { endpoint: String, headers: HeaderMap, introspection: bool, + execute_introspection: bool, explorer: bool, custom_scalar_map: Option, mutation_mode: MutationMode, @@ -205,6 +209,7 @@ impl Configuring { endpoint: self.endpoint, headers: self.headers, introspection: self.introspection, + execute_introspection: self.execute_introspection, explorer: self.explorer, custom_scalar_map: self.custom_scalar_map, mutation_mode: self.mutation_mode, @@ -228,6 +233,7 @@ impl Configuring { endpoint: self.endpoint, headers: self.headers, introspection: self.introspection, + execute_introspection: self.execute_introspection, explorer: self.explorer, custom_scalar_map: self.custom_scalar_map, mutation_mode: self.mutation_mode, @@ -243,6 +249,7 @@ struct SchemaConfigured { endpoint: String, headers: HeaderMap, introspection: bool, + execute_introspection: bool, explorer: bool, custom_scalar_map: Option, mutation_mode: MutationMode, @@ -269,6 +276,7 @@ impl SchemaConfigured { endpoint: self.endpoint, headers: self.headers, introspection: self.introspection, + execute_introspection: self.execute_introspection, explorer: self.explorer, custom_scalar_map: self.custom_scalar_map, mutation_mode: self.mutation_mode, @@ -284,6 +292,7 @@ struct OperationsConfigured { endpoint: String, headers: HeaderMap, introspection: bool, + execute_introspection: bool, explorer: bool, custom_scalar_map: Option, mutation_mode: MutationMode, @@ -301,6 +310,7 @@ impl OperationsConfigured { endpoint: self.endpoint, headers: self.headers, introspection: self.introspection, + execute_introspection: self.execute_introspection, explorer: self.explorer, custom_scalar_map: self.custom_scalar_map, mutation_mode: self.mutation_mode, @@ -329,6 +339,7 @@ struct Starting { endpoint: String, headers: HeaderMap, introspection: bool, + execute_introspection: bool, explorer: bool, custom_scalar_map: Option, mutation_mode: MutationMode, @@ -362,7 +373,9 @@ impl Starting { serde_json::to_string_pretty(&operations)? ); - let execute_tool = self.introspection.then(|| Execute::new(self.mutation_mode)); + let execute_tool = self + .execute_introspection + .then(|| Execute::new(self.mutation_mode)); let root_query_type = self .introspection @@ -698,6 +711,7 @@ impl StateMachine { endpoint: server.endpoint, headers: server.headers, introspection: server.introspection, + execute_introspection: server.execute_introspection, explorer: server.explorer, custom_scalar_map: server.custom_scalar_map, mutation_mode: server.mutation_mode, diff --git a/docs/source/command-reference.mdx b/docs/source/command-reference.mdx index 07cf9d5e..1436b6ab 100644 --- a/docs/source/command-reference.mdx +++ b/docs/source/command-reference.mdx @@ -62,12 +62,13 @@ apollo-mcp-server [OPTIONS] --directory | :-------------------------------------------------- |:-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | `-d, --directory ` | The working directory to use. Defaults the current working directory. | | `-s, --schema ` | The path to the GraphQL API schema file. | -| `-c, --custom-scalars-config ` | The path to the GraphQL custom_scalars_config file. [Learn more](/apollo-mcp-server/guides/#custom-scalars). | +| `-c, --custom-scalars-config ` | The path to the GraphQL custom_scalars_config file. [Learn more](/apollo-mcp-server/guides/#custom-scalars). | | `-e, --endpoint ` | The GraphQL endpoint the server will invoke.
[default: `http://127.0.0.1:4000`] | | `--header ` | Headers to send to the endpoint. | | `--sse-port ` | Start the server using the SSE transport on the given port (default: 5000). | | `--sse-address ` | The IP address to bind the SSE server to (default: 127.0.0.1). | -| `-i, --introspection` | Expose the schema to the MCP client through `introspect` and `execute` tools. [Learn more](/apollo-mcp-server/guides/#from-schema-introspection). | +| `-i, --introspection` | Expose the schema to the MCP client through the `introspect` tool. [Learn more](/apollo-mcp-server/guides/#from-schema-introspection). | +| `--execute-introspection` | Expose the schema to the MCP client through the `execute` tool. [Learn more](/apollo-mcp-server/guides/#from-schema-introspection). | | `-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). | | `-x, --explorer` | Expose a tool to open queries in Apollo Explorer (requires `APOLLO_KEY` and `APOLLO_GRAPH_REF`). | | `-o, --operations [...]` | Operation files to expose as MCP tools. [Learn more](/apollo-mcp-server/guides/#from-operation-schema-files). | @@ -93,6 +94,7 @@ The mapping of `rover dev` options to MCP Server options: | `--mcp-sse-port ` | `--sse-port ` | | `--mcp-sse-address
` | `--sse-address
` | | `--mcp-introspection` | `-i, --introspection` | +| `--mcp-execute-introspection` | `--execute-introspection` | | `--mcp-uplink` | `-u, --uplink` | | `--mcp-operations [...]` | `-o, --operations [...]` | | `--mcp-header ` | `--header ` | diff --git a/docs/source/guides/index.mdx b/docs/source/guides/index.mdx index 79c09d5a..563e387b 100644 --- a/docs/source/guides/index.mdx +++ b/docs/source/guides/index.mdx @@ -164,7 +164,7 @@ Use the `--header` option when running the MCP Server to pass the header to the For use cases where not all operations can be pre-defined, Apollo MCP Server supports tool creation based on introspection of the graph schema. This allows AI agents to explore a graph and execute operations dynamically. -To enable these schema-aware tools, run the MCP Server with the `--introspection` option, which exposes two new tools: +To enable these schema-aware tools, run the MCP Server with the `--introspection` option, which exposes the introspect tool, and `--execute-introspection` which enables the execute tool * `introspect` - returns information about schema types * `execute` - executes an operation on the GraphQL endpoint diff --git a/graphql/TheSpaceDevs/README.md b/graphql/TheSpaceDevs/README.md index 9243f96d..3bf36668 100644 --- a/graphql/TheSpaceDevs/README.md +++ b/graphql/TheSpaceDevs/README.md @@ -28,7 +28,7 @@ npx @modelcontextprotocol/inspector This option is typically used when you have built the source repository and use the binary outputs in the `target/build/*` folder. -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 along with the `--introspection` option that enables the LLM to generate a dynamic operation. Here is an example configuration you can use _(Note: you must provide your fill path to the binary in the command. Make sure to replace the command with the path to where you cloned the repository)_: @@ -55,7 +55,7 @@ Here is an example configuration you can use _(Note: you must provide your fill ## Using Server-Side-Events (SSE) 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 along with the `--introspection` option that enables the LLM to generate a dynamic operation. ### Running SSE with `rover dev`