Skip to content

[6/8] Wire remote MCP stdio through executor#17974

Open
aibrahim-oai wants to merge 1 commit intoopenai:dev/remote-mcp-executor-stdiofrom
aibrahim-oai:dev/remote-mcp-stdio
Open

[6/8] Wire remote MCP stdio through executor#17974
aibrahim-oai wants to merge 1 commit intoopenai:dev/remote-mcp-executor-stdiofrom
aibrahim-oai:dev/remote-mcp-stdio

Conversation

@aibrahim-oai
Copy link
Copy Markdown
Collaborator

@aibrahim-oai aibrahim-oai commented Apr 15, 2026

Summary

  • Use the MCP server environment setting to choose local or executor stdio at client startup.
  • Keep remote streamable HTTP unsupported until the low-level network API lands.

Stack

o  #18027 [8/8] Fail exec client operations after disconnect
│
o  #18025 [7/8] Cover MCP stdio tests with executor placement
│
@  #17974 [6/8] Wire remote MCP stdio through executor
│
o  #17987 [5/8] Add executor process transport for MCP stdio
│
o  #17986 [4/8] Abstract MCP stdio server launching
│
o  #18020 [3/8] Add pushed exec process events
│
o  #17985 [2/8] Support piped stdin in exec process API
│
o  #17984 [1/8] Add MCP server environment config
│
o  main

@aibrahim-oai aibrahim-oai force-pushed the dev/remote-mcp-stdio branch from 3fdfd5a to e356123 Compare April 15, 2026 18:46
Copy link
Copy Markdown
Contributor

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 3fdfd5a3a1

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread codex-rs/rmcp-client/src/rmcp_client.rs Outdated
Comment on lines +1096 to +1097
let argv = executor_stdio_argv(program, args)?;
let env = executor_stdio_env(envs)?;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Resolve remote stdio command before invoking exec backend

The remote stdio path builds argv directly from program/args and never runs program_resolver::resolve. On Windows, Command::new("npx")-style invocations can fail without extension/PATHEXT resolution (the same case local stdio already handles). This makes MCP servers that work locally fail when environment = "remote".

Useful? React with 👍 / 👎.

@aibrahim-oai aibrahim-oai force-pushed the dev/remote-mcp-stdio branch from e356123 to 675e1ea Compare April 15, 2026 18:56
Copy link
Copy Markdown
Contributor

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Some(duration) => time::timeout(duration, transport)
.await
.map_err(|_| anyhow!("timed out handshaking with MCP server after {duration:?}"))?
.map_err(|err| anyhow!("handshaking with MCP server failed: {err}"))?,

P1 Badge Terminate executor MCP process on handshake failure

The executor-backed stdio process is started before MCP initialization, but handshake is wrapped in time::timeout. On timeout/error, this path returns without calling ExecProcess::terminate, so the child can continue running orphaned on the executor for the rest of the session. The local stdio path has kill_on_drop semantics; this new remote path does not.

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@aibrahim-oai aibrahim-oai force-pushed the dev/remote-mcp-stdio branch 2 times, most recently from 6778f3a to 7e8dc3c Compare April 15, 2026 19:20
Copy link
Copy Markdown
Contributor

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 7e8dc3c3ba

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread codex-rs/rmcp-client/src/rmcp_client.rs Outdated
Comment on lines +997 to +1000
StdioTransportInner::Executor { transport } => (
service::serve_client(client_service, transport).boxed(),
None,
None,
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Terminate executor stdio process when client init fails

RmcpClient::connect_pending_transport keeps no cleanup guard for StdioTransportInner::Executor (process_group_guard is None). If service::serve_client(...) fails or times out during MCP initialize, rmcp drops the transport without invoking close(), so the executor-started MCP child is left running. Repeated startup retries can leak remote processes until the whole exec session is torn down.

Useful? React with 👍 / 👎.

@aibrahim-oai aibrahim-oai force-pushed the dev/remote-mcp-stdio branch 3 times, most recently from 8044335 to e703917 Compare April 15, 2026 19:48
@aibrahim-oai aibrahim-oai changed the title Prototype remote MCP stdio transport Wire remote MCP stdio through executor Apr 15, 2026
@aibrahim-oai aibrahim-oai changed the base branch from main to dev/remote-mcp-executor-stdio April 15, 2026 19:49
Copy link
Copy Markdown
Contributor

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: e703917e5e

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

submit_id,
tx_event,
SandboxPolicy::new_read_only_policy(),
None,
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Pass executor environment into MCP snapshot startup

collect_mcp_snapshot_with_detail/collect_mcp_server_status_snapshot_with_detail now hard-code environment to None when creating McpConnectionManager. Any MCP server configured with environment = "remote" will always fail with “requires an executor environment” in snapshot/status APIs (including app-server status calls), even when an executor environment exists in the caller.

Useful? React with 👍 / 👎.

Comment on lines +1534 to +1541
let exec_environment = exec_environment.ok_or_else(|| {
StartupOutcomeError::from(anyhow!(
"remote MCP server `{server_name}` requires an executor environment"
))
})?;
Arc::new(ExecutorStdioTransportRuntime::new(
exec_environment.get_exec_backend(),
remote_stdio_cwd,
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Enforce remote backend before using remote MCP runtime

The Remote branch only checks that exec_environment is Some, then uses get_exec_backend() directly. A local Environment (default case) still satisfies this and silently runs environment = "remote" MCP servers on the local backend, violating expected remote placement/isolation semantics. Validate Environment::is_remote() (or equivalent) before selecting the remote runtime.

Useful? React with 👍 / 👎.

@aibrahim-oai aibrahim-oai changed the title Wire remote MCP stdio through executor [5/5] Wire remote MCP stdio through executor Apr 15, 2026
@aibrahim-oai aibrahim-oai force-pushed the dev/remote-mcp-stdio branch 2 times, most recently from c686550 to 0ffdf16 Compare April 15, 2026 21:48
@aibrahim-oai aibrahim-oai force-pushed the dev/remote-mcp-executor-stdio branch from fdb0d74 to 377fd73 Compare April 15, 2026 21:48
@aibrahim-oai aibrahim-oai force-pushed the dev/remote-mcp-stdio branch from 0ffdf16 to a01f83a Compare April 15, 2026 21:57
@aibrahim-oai aibrahim-oai force-pushed the dev/remote-mcp-executor-stdio branch from 377fd73 to c468eef Compare April 15, 2026 21:57
Use the MCP server environment setting to choose local stdio or executor-backed stdio at client startup time.

Co-authored-by: Codex <noreply@openai.com>
@aibrahim-oai aibrahim-oai force-pushed the dev/remote-mcp-stdio branch from a01f83a to d997af8 Compare April 15, 2026 22:47
@aibrahim-oai aibrahim-oai force-pushed the dev/remote-mcp-executor-stdio branch from c468eef to 83e867a Compare April 15, 2026 22:47
@aibrahim-oai aibrahim-oai changed the title [5/5] Wire remote MCP stdio through executor [6/6] Wire remote MCP stdio through executor Apr 15, 2026
@aibrahim-oai aibrahim-oai changed the title [6/6] Wire remote MCP stdio through executor [6/7] Wire remote MCP stdio through executor Apr 15, 2026
@aibrahim-oai aibrahim-oai changed the title [6/7] Wire remote MCP stdio through executor [6/8] Wire remote MCP stdio through executor Apr 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant