Add process-local launch directories for shared MCP servers (#61444)

## What changed

- Add hidden app-server options `--plugin-mcp-launch-cwd` and `--mcp-launch-cwd` for host-supplied local stdio server launch directories without writing them to shared configuration.
- Apply these directories when both `mcp_shared_repl_cwd` and `mcp_connection_sharing` are enabled. For configured servers, require a matching executable and preserve any explicit working directory.
- Attach thread-specific sandbox state to direct MCP tool calls for servers advertising support, stripping caller-supplied sandbox and launcher metadata first.

## Testing

Add regression tests for launch-directory feature toggling and executable matching, and for direct MCP calls using each thread's sandbox working directory despite forged caller metadata.

GitOrigin-RevId: d7f78ea92163ec0ee9311f68ef17e87a6694b13b
This commit is contained in:
Charlie Marsh
2026-11-14 01:54:53 +00:00
committed by copyberry
parent 9825e4b2fe
commit e9919f4b4e
17 changed files with 378 additions and 45 deletions
+8
View File
@@ -290,6 +290,8 @@ pub enum Feature {
McpToolListChanged,
/// Discover and share eligible local stdio connections across chats.
McpConnectionSharing,
/// Use the app server's fixed launch directories for shared REPL servers.
McpSharedReplCwd,
/// Defer optional stdio server startup in regular chats with a warm tool catalog.
McpLazyStdioStartup,
/// Keep same-named HTTP servers discovered on different executors separate.
@@ -1768,6 +1770,12 @@ pub const FEATURES: &[FeatureSpec] = &[
stage: Stage::UnderDevelopment,
default_enabled: false,
},
FeatureSpec {
id: Feature::McpSharedReplCwd,
key: "mcp_shared_repl_cwd",
stage: Stage::UnderDevelopment,
default_enabled: false,
},
FeatureSpec {
id: Feature::McpLazyStdioStartup,
key: "mcp_lazy_stdio_startup",