Skip to content

Commit 28e51fd

Browse files
committed
split execute and instrospection
1 parent bdfc33f commit 28e51fd

File tree

2 files changed

+14
-2
lines changed

2 files changed

+14
-2
lines changed

crates/apollo-mcp-server/src/main.rs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,10 +62,14 @@ struct Args {
6262
#[arg(long)]
6363
sse_port: Option<u16>,
6464

65-
/// Expose the schema to the MCP client through `introspect` and `execute` tools
65+
/// Expose the schema to the MCP client through `introspect` tool
6666
#[arg(long, short = 'i')]
6767
introspection: bool,
6868

69+
/// Allow the use of the `execute` tool with operations build from the schema tool
70+
#[arg(long)]
71+
execute_introspection: bool,
72+
6973
/// Enable use of uplink to get the schema and persisted queries (requires APOLLO_KEY and APOLLO_GRAPH_REF)
7074
#[arg(long, short = 'u')]
7175
uplink: bool,
@@ -160,6 +164,7 @@ async fn main() -> anyhow::Result<()> {
160164
.explorer(args.explorer)
161165
.headers(default_headers)
162166
.introspection(args.introspection)
167+
.execute_introspection(args.execute_introspection)
163168
.mutation_mode(args.allow_mutations)
164169
.disable_type_description(args.disable_type_description)
165170
.disable_schema_description(args.disable_schema_description)

crates/apollo-mcp-server/src/server.rs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ pub struct Server {
4646
endpoint: String,
4747
headers: HeaderMap,
4848
introspection: bool,
49+
execute_introspection: bool,
4950
explorer: bool,
5051
custom_scalar_map: Option<CustomScalarMap>,
5152
mutation_mode: MutationMode,
@@ -72,6 +73,7 @@ impl Server {
7273
endpoint: String,
7374
headers: Headers,
7475
introspection: bool,
76+
execute_introspection: bool,
7577
explorer: bool,
7678
custom_scalar_map: Option<CustomScalarMap>,
7779
mutation_mode: MutationMode,
@@ -90,6 +92,7 @@ impl Server {
9092
endpoint,
9193
headers,
9294
introspection,
95+
execute_introspection,
9396
explorer,
9497
custom_scalar_map,
9598
mutation_mode,
@@ -138,6 +141,7 @@ struct Starting {
138141
endpoint: String,
139142
headers: HeaderMap,
140143
introspection: bool,
144+
execute_introspection: bool,
141145
explorer: bool,
142146
custom_scalar_map: Option<CustomScalarMap>,
143147
mutation_mode: MutationMode,
@@ -179,7 +183,9 @@ impl Starting {
179183
)
180184
.await?;
181185

182-
let execute_tool = self.introspection.then(|| Execute::new(self.mutation_mode));
186+
let execute_tool = self
187+
.execute_introspection
188+
.then(|| Execute::new(self.mutation_mode));
183189

184190
let root_query_type = self
185191
.introspection
@@ -399,6 +405,7 @@ impl StateMachine {
399405
endpoint: server.endpoint,
400406
headers: server.headers,
401407
introspection: server.introspection,
408+
execute_introspection: server.execute_introspection,
402409
explorer: server.explorer,
403410
custom_scalar_map: server.custom_scalar_map,
404411
mutation_mode: server.mutation_mode,

0 commit comments

Comments
 (0)