Skip to content

Commit 3d00dab

Browse files
committed
fix(gateway): Phase 1 — Surfacing list_* paths
Restore get_advertised_prompts_for_grants and get_advertised_resources_for_grants in facade.rs; wire list_prompts, get_prompt, list_resources, and read_resource to filter through surfaced feature IDs (list_tools already fixed in 93e6bef). Autonomous decisions: - Used get_fetchable_prompts / get_readable_resources as invokable base — matches dev branch and existing facade aliases Signed-off-by: crimsonsunset <jsangio1@gmail.com>
1 parent 9306bcf commit 3d00dab

2 files changed

Lines changed: 56 additions & 4 deletions

File tree

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

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -934,11 +934,13 @@ impl ServerHandler for McpMuxGatewayHandler {
934934
.resolve_routing(session_id_owned.as_deref(), &oauth_ctx.client_id)
935935
.await?;
936936

937+
// Get advertised (surfaced) prompts only — full fetchable set is reachable
938+
// via mcpmux meta-tools; non-surfaced prompts stay off prompts/list.
937939
let prompts = self
938940
.services
939941
.pool_services
940942
.feature_service
941-
.get_prompts_for_grants(&space_id.to_string(), &feature_set_ids)
943+
.get_advertised_prompts_for_grants(&space_id.to_string(), &feature_set_ids)
942944
.await
943945
.map_err(|e| McpError::internal_error(format!("Failed to get prompts: {}", e), None))?;
944946

@@ -995,7 +997,7 @@ impl ServerHandler for McpMuxGatewayHandler {
995997
.services
996998
.pool_services
997999
.feature_service
998-
.get_prompts_for_grants(&space_id.to_string(), &feature_set_ids)
1000+
.get_advertised_prompts_for_grants(&space_id.to_string(), &feature_set_ids)
9991001
.await
10001002
.map_err(|e| {
10011003
McpError::internal_error(format!("Failed to verify authorization: {}", e), None)
@@ -1049,11 +1051,13 @@ impl ServerHandler for McpMuxGatewayHandler {
10491051
.resolve_routing(session_id_owned.as_deref(), &oauth_ctx.client_id)
10501052
.await?;
10511053

1054+
// Get advertised (surfaced) resources only — full readable set is reachable
1055+
// via mcpmux meta-tools; non-surfaced resources stay off resources/list.
10521056
let resources = self
10531057
.services
10541058
.pool_services
10551059
.feature_service
1056-
.get_resources_for_grants(&space_id.to_string(), &feature_set_ids)
1060+
.get_advertised_resources_for_grants(&space_id.to_string(), &feature_set_ids)
10571061
.await
10581062
.map_err(|e| {
10591063
McpError::internal_error(format!("Failed to get resources: {}", e), None)
@@ -1107,7 +1111,7 @@ impl ServerHandler for McpMuxGatewayHandler {
11071111
.services
11081112
.pool_services
11091113
.feature_service
1110-
.get_resources_for_grants(&space_id.to_string(), &feature_set_ids)
1114+
.get_advertised_resources_for_grants(&space_id.to_string(), &feature_set_ids)
11111115
.await
11121116
.map_err(|e| {
11131117
McpError::internal_error(format!("Failed to verify authorization: {}", e), None)

crates/mcpmux-gateway/src/pool/features/facade.rs

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,30 @@ impl FeatureService {
144144
.await
145145
}
146146

147+
/// Resources promoted into client `resources/list` (surfaced backend resources only).
148+
pub async fn get_advertised_resources_for_grants(
149+
&self,
150+
space_id: &str,
151+
feature_set_ids: &[String],
152+
) -> Result<Vec<ServerFeature>> {
153+
if feature_set_ids.is_empty() {
154+
return Ok(Vec::new());
155+
}
156+
157+
let readable = self
158+
.get_readable_resources_for_grants(space_id, feature_set_ids)
159+
.await?;
160+
let surfaced_ids = self
161+
.resolution
162+
.resolve_surfaced_feature_ids(feature_set_ids)
163+
.await?;
164+
165+
Ok(readable
166+
.into_iter()
167+
.filter(|f| surfaced_ids.contains(&f.id.to_string()))
168+
.collect())
169+
}
170+
147171
/// Resolve granted feature sets to prompts fetchable via search/fetch ACL.
148172
pub async fn get_fetchable_prompts_for_grants(
149173
&self,
@@ -153,6 +177,30 @@ impl FeatureService {
153177
self.get_prompts_for_grants(space_id, feature_set_ids).await
154178
}
155179

180+
/// Prompts promoted into client `prompts/list` (surfaced backend prompts only).
181+
pub async fn get_advertised_prompts_for_grants(
182+
&self,
183+
space_id: &str,
184+
feature_set_ids: &[String],
185+
) -> Result<Vec<ServerFeature>> {
186+
if feature_set_ids.is_empty() {
187+
return Ok(Vec::new());
188+
}
189+
190+
let fetchable = self
191+
.get_fetchable_prompts_for_grants(space_id, feature_set_ids)
192+
.await?;
193+
let surfaced_ids = self
194+
.resolution
195+
.resolve_surfaced_feature_ids(feature_set_ids)
196+
.await?;
197+
198+
Ok(fetchable
199+
.into_iter()
200+
.filter(|f| surfaced_ids.contains(&f.id.to_string()))
201+
.collect())
202+
}
203+
156204
/// Catalog tools in the Space that require binding a FeatureSet before invoke.
157205
pub async fn list_inactive_discovery_tools(
158206
&self,

0 commit comments

Comments
 (0)