Freeze plugin roots in MCP tool attribution (#41117)

## Why

Plugin MCP trust decisions must describe the exact host-discovered server
registration. Looking up a plugin again by ID can resolve a different root.

## What changed

- Retain the host plugin root in MCP catalog attribution and connection identity.
- Reconnect an MCP server when its attributed plugin root changes.
- Pass the retained root through tool lifecycle attribution and use it directly
  when building trusted tool context.

## Testing

Add coverage for catalog identity, connection reconciliation, lifecycle
attribution, and rejecting a different root associated with the same plugin ID.

GitOrigin-RevId: bc92743dd40ab44065a07c3ea972b4956ef8351f
This commit is contained in:
felixxia-oai authored and copyberry committed 2026-08-27 11:27:50 +00:00
1 parent 6c59264b14
commit aa89cf62bb
11 files changed
+279 -38

No files matched your search

+2 -1
View File
@@ -5533,7 +5533,8 @@ async fn rebuild_preserving_session_layers_refreshes_plugin_derived_mcp_config()
.plugin_attributions_by_server_name(),
HashMap::from([(
"sample".to_string(),
McpPluginAttribution::new("sample@test".to_string(), "sample".to_string()),
McpPluginAttribution::new("sample@test".to_string(), "sample".to_string())
.with_host_root(PathUri::from_host_native_path(&plugin_root)?),
)])
);
+2 -1
View File
@@ -1702,7 +1702,8 @@ impl Config {
plugin.config_name.clone(),
plugin.display_name().to_string(),
)
};
}
.with_host_root(PathUri::from_abs_path(&plugin.root));
for (name, plugin_server) in plugin_mcp_servers {
catalog.register(McpServerRegistration::from_plugin(
name,