mirror of
https://github.com/openai/codex.git
synced 2026-11-12 21:20:34 +00:00
Expose deferred MCP servers in resource listings (#60423)
## Why Aggregate resource listings omitted dormant MCP servers, leaving callers without their names for explicit queries. ## What changed Include a sorted `deferredServers` list in aggregate `list_mcp_resources` and `list_mcp_resource_templates` results alongside resources from ready servers. Apply the listing filters to deferred servers and omit the field when empty. Discovery leaves dormant servers unstarted; callers can query them by passing `server` explicitly. ## Testing Extend the resource discovery scenario for direct calls and Code Mode to verify deferred server names, confirm discovery leaves the server unstarted, and then list and read resources by server name. GitOrigin-RevId: f95b8beb64bb1329f4ae3245e8c375614fcb3360
This commit is contained in:
@@ -31,6 +31,7 @@ use serde_json::Value as JsonValue;
|
||||
use crate::McpConfig;
|
||||
use crate::McpServerPermissions;
|
||||
use crate::binding_clients::McpBindingClients;
|
||||
use crate::binding_clients::McpResourceListing;
|
||||
use crate::client_tool_catalog::ToolCatalogSnapshot;
|
||||
use crate::connection_manager::McpConnectionSet;
|
||||
use crate::rmcp_client::ManagedClient;
|
||||
@@ -52,7 +53,7 @@ impl McpBinding {
|
||||
pub fn empty(config: Arc<McpConfig>) -> Self {
|
||||
Self::new(
|
||||
Arc::new(McpConnectionSet::empty(config.prefix_mcp_tool_names)),
|
||||
Arc::new(McpBindingClients::new(HashMap::new())),
|
||||
Arc::new(McpBindingClients::default()),
|
||||
config,
|
||||
/*plugins_available*/ false,
|
||||
Vec::new(),
|
||||
@@ -130,7 +131,7 @@ impl McpBinding {
|
||||
pub async fn list_all_resources(
|
||||
&self,
|
||||
include_server: impl Fn(&str) -> bool,
|
||||
) -> HashMap<String, Vec<Resource>> {
|
||||
) -> McpResourceListing<Resource> {
|
||||
self.clients.list_all_resources(include_server).await
|
||||
}
|
||||
|
||||
@@ -154,7 +155,7 @@ impl McpBinding {
|
||||
pub async fn list_all_resource_templates(
|
||||
&self,
|
||||
include_server: impl Fn(&str) -> bool,
|
||||
) -> HashMap<String, Vec<ResourceTemplate>> {
|
||||
) -> McpResourceListing<ResourceTemplate> {
|
||||
self.clients
|
||||
.list_all_resource_templates(|server| {
|
||||
include_server(server) && !self.connections.skips_resource_template_listing(server)
|
||||
|
||||
Reference in New Issue
Block a user