Skip to content

Commit 1fa757f

Browse files
authored
Merge pull request #298 from apollographql/fix-missing-token-propagation
fix: Add missing token propagation for execute tool
2 parents d860e7e + c1fb704 commit 1fa757f

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
### fix: Add missing token propagation for execute tool - @DaleSeo PR #298
2+
3+
The execute tool is not forwarding JWT authentication tokens to upstream GraphQL endpoints, causing authentication failures when using this tool with protected APIs.

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

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -210,6 +210,11 @@ impl ServerHandler for Running {
210210
EXECUTE_TOOL_NAME => {
211211
let mut headers = self.headers.clone();
212212
if let Some(axum_parts) = context.extensions.get::<axum::http::request::Parts>() {
213+
// Optionally extract the validated token and propagate it to upstream servers if present
214+
if let Some(token) = axum_parts.extensions.get::<ValidToken>() {
215+
headers.typed_insert(token.deref().clone());
216+
}
217+
213218
// Forward the mcp-session-id header if present
214219
if let Some(session_id) = axum_parts.headers.get("mcp-session-id") {
215220
headers.insert("mcp-session-id", session_id.clone());

0 commit comments

Comments
 (0)