Skip to content

Commit 5269a18

Browse files
committed
fix(gateway): apply session overrides in call_tool authorization
RoutingService::call_tool used resolve_feature_sets without session context, so session-enabled servers passed list_servers but failed at call time. Pass session_id and use get_tools_for_grants instead. Signed-off-by: crimsonsunset <jsangio1@gmail.com>
1 parent 2edcd29 commit 5269a18

2 files changed

Lines changed: 4 additions & 2 deletions

File tree

crates/mcpmux-gateway/src/mcp/handler.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -793,6 +793,7 @@ impl ServerHandler for McpMuxGatewayHandler {
793793
.call_tool(
794794
space_id,
795795
&feature_set_ids,
796+
session_id,
796797
&params.name,
797798
serde_json::to_value(params.arguments.unwrap_or_default()).unwrap_or_default(),
798799
)

crates/mcpmux-gateway/src/pool/routing.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -187,6 +187,7 @@ impl RoutingService {
187187
&self,
188188
space_id: Uuid,
189189
feature_set_ids: &[String],
190+
session_id: Option<&str>,
190191
tool_name: &str,
191192
arguments: Value,
192193
) -> Result<ToolCallResult> {
@@ -199,10 +200,10 @@ impl RoutingService {
199200
.await?
200201
.ok_or_else(|| anyhow!("Tool '{}' not found", tool_name))?;
201202

202-
// 2. Check if the tool is allowed by grants
203+
// 2. Check if the tool is allowed by grants (session overrides included)
203204
let allowed_features = self
204205
.feature_service
205-
.resolve_feature_sets(&space_id_str, feature_set_ids)
206+
.get_tools_for_grants(&space_id_str, feature_set_ids, session_id)
206207
.await?;
207208

208209
info!(

0 commit comments

Comments
 (0)