Connect plugin MCP servers over launcher-provided Unix sockets (#64828)

## Why

A launcher that already hosts an MCP server needs a way for Codex to
use it without starting a separate subprocess for the plugin.

## What changed

The stdio app server accepts socket bindings from its immediate parent
on Unix. A binding applies to a local plugin's stdio MCP server only
when the plugin ID, server name, and binding ID match a single entry.
Codex uses the stdio wire protocol over the socket and retains the
original declaration for policy checks.

Before sending MCP traffic, Codex requires a user-owned socket
directory with mode `0700` and verifies the listener's PID and UID.

## Testing

Add tests for binding scope and ambiguous matches, and for rejecting
unexpected listener PIDs, insecure directory permissions, symlinked
socket directories, and relative socket paths.

GitOrigin-RevId: 3d669dd59a0812b04727e4a1e458774007f054ba
This commit is contained in:
Charlie Marsh
2026-11-30 23:34:32 +00:00
committed by copyberry
parent 515cfeceba
commit b0b5cfcab8
16 changed files with 441 additions and 9 deletions
@@ -94,6 +94,7 @@ use codex_feedback::CodexFeedback;
use codex_goal_extension::GoalService;
use codex_home::CodexHomeUserInstructionsProvider;
use codex_login::AuthManager;
use codex_mcp::ParentMcpBindings;
use codex_models_manager::manager::ModelCatalogSettings;
use codex_otel::auth_storage::AuthStorageOriginator;
use codex_protocol::ThreadId;
@@ -424,6 +425,12 @@ impl MessageProcessor {
None,
)
.with_guardian_policy_loader(Arc::new(config_manager.clone()));
let manager = match rpc_transport {
AppServerRpcTransport::Stdio => {
manager.with_parent_mcp_bindings(ParentMcpBindings::from_launcher())
}
AppServerRpcTransport::Websocket | AppServerRpcTransport::InProcess => manager,
};
match code_mode_session_provider {
Some(provider) => manager.with_code_mode_session_provider(provider),
None => manager,