Skip to content

[3/4] Add executor-backed RMCP HTTP client#18583

Merged
aibrahim-oai merged 64 commits into
mainfrom
dev/remote-mcp-http-client-full-ci
Apr 23, 2026
Merged

[3/4] Add executor-backed RMCP HTTP client#18583
aibrahim-oai merged 64 commits into
mainfrom
dev/remote-mcp-http-client-full-ci

Conversation

@aibrahim-oai
Copy link
Copy Markdown
Collaborator

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

Why

The RMCP layer needs a Streamable HTTP client that can talk either directly over reqwest or through the executor HTTP runner without duplicating MCP session logic higher in the stack. This PR adds that client-side transport boundary so remote Streamable HTTP MCP can reuse the same RMCP flow as the local path.

What

  • Add a shared rmcp-client/src/streamable_http/ module with:
    • transport_client.rs for the local-or-remote transport enum
    • local_client.rs for the direct reqwest implementation
    • remote_client.rs for the executor-backed implementation
    • common.rs for the small shared Streamable HTTP helpers
  • Teach RmcpClient to build Streamable HTTP transports in either local or remote mode while keeping the existing OAuth ownership in RMCP.
  • Translate remote POST, GET, and DELETE session operations into executor http/request calls.
  • Preserve RMCP session expiry handling and reconnect behavior for the remote transport.
  • Add remote transport coverage in rmcp-client/tests/streamable_http_remote.rs and keep the shared test support in rmcp-client/tests/streamable_http_test_support.rs.

Verification

  • cargo check -p codex-rmcp-client
  • online CI

Stack

  1. [1/4] Add executor HTTP request protocol #18581 protocol
  2. [2/4] Implement executor HTTP request runner #18582 runner
  3. [3/4] Add executor-backed RMCP HTTP client #18583 RMCP client
  4. [4/4] Honor Streamable HTTP MCP placement #18584 manager wiring and local/remote coverage
@aibrahim-oai
Copy link
Copy Markdown
Collaborator Author

aibrahim-oai commented Apr 19, 2026

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: d2f411733c

ℹ️ 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/streamable_http/remote_client.rs
@aibrahim-oai aibrahim-oai force-pushed the dev/remote-mcp-http-runner-full-ci branch from 1a1b28d to afcf571 Compare April 19, 2026 18:38
@aibrahim-oai aibrahim-oai force-pushed the dev/remote-mcp-http-client-full-ci branch from d2f4117 to f11defd Compare April 19, 2026 18:38
@aibrahim-oai aibrahim-oai changed the title Add executor-backed RMCP HTTP client [3/4] Add executor-backed RMCP HTTP client Apr 19, 2026
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: f11defd27c

ℹ️ 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/streamable_http/remote_client.rs
@aibrahim-oai aibrahim-oai force-pushed the dev/remote-mcp-http-runner-full-ci branch from afcf571 to 81ff713 Compare April 19, 2026 18:48
@aibrahim-oai aibrahim-oai force-pushed the dev/remote-mcp-http-client-full-ci branch from f11defd to 48f6619 Compare April 19, 2026 18:48
@aibrahim-oai aibrahim-oai force-pushed the dev/remote-mcp-http-runner-full-ci branch from 81ff713 to d6a38e3 Compare April 19, 2026 18:57
@aibrahim-oai aibrahim-oai force-pushed the dev/remote-mcp-http-client-full-ci branch from 48f6619 to c02a707 Compare April 19, 2026 18:57
@aibrahim-oai aibrahim-oai force-pushed the dev/remote-mcp-http-runner-full-ci branch from d6a38e3 to 0a24aa2 Compare April 19, 2026 19:07
@aibrahim-oai aibrahim-oai force-pushed the dev/remote-mcp-http-client-full-ci branch from c02a707 to 4bd6bdf Compare April 19, 2026 19:07
@aibrahim-oai aibrahim-oai force-pushed the dev/remote-mcp-http-runner-full-ci branch from 0a24aa2 to 4690cae Compare April 19, 2026 19:15
@aibrahim-oai aibrahim-oai force-pushed the dev/remote-mcp-http-client-full-ci branch from 4bd6bdf to 7914b4b Compare April 19, 2026 19:15
@aibrahim-oai aibrahim-oai force-pushed the dev/remote-mcp-http-runner-full-ci branch from 4690cae to b85c91f Compare April 19, 2026 19:22
@aibrahim-oai aibrahim-oai force-pushed the dev/remote-mcp-http-client-full-ci branch from 7914b4b to f4d2712 Compare April 19, 2026 19:22
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: f4d2712d0b

ℹ️ 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/streamable_http/remote_client.rs
@aibrahim-oai aibrahim-oai force-pushed the dev/remote-mcp-http-runner-full-ci branch from b85c91f to f14bc16 Compare April 20, 2026 15:45
@aibrahim-oai aibrahim-oai force-pushed the dev/remote-mcp-http-client-full-ci branch from f4d2712 to c84554f Compare April 20, 2026 15: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: c84554f5b8

ℹ️ 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 +1371 to +1372
let metadata_client = build_http_client(&default_headers)?;
let mut oauth_state = OAuthState::new(url.to_string(), Some(metadata_client)).await?;
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 Fallback to token when environment OAuth discovery is unreachable

create_environment_oauth_transport_and_runtime performs OAuth metadata discovery with a local reqwest client (OAuthState::new(...)). For environment transport, the MCP URL can be reachable only from exec-server, so this call fails before any MCP request is proxied. create_pending_transport only falls back on NoAuthorizationSupport, so network-unreachable discovery errors abort startup even with valid stored tokens.

Useful? React with 👍 / 👎.

@aibrahim-oai aibrahim-oai force-pushed the dev/remote-mcp-http-runner-full-ci branch from f14bc16 to dbee178 Compare April 20, 2026 15:52
@aibrahim-oai aibrahim-oai force-pushed the dev/remote-mcp-http-client-full-ci branch from c84554f to cedd12a Compare April 20, 2026 15:52
@aibrahim-oai aibrahim-oai force-pushed the dev/remote-mcp-http-runner-full-ci branch from dbee178 to 5baf804 Compare April 20, 2026 16:02
@aibrahim-oai aibrahim-oai force-pushed the dev/remote-mcp-http-client-full-ci branch from cedd12a to 6c3949a Compare April 20, 2026 16:02
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: cedd12a13f

ℹ️ 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".

/// Starts a local exec-server and connects an initialized `ExecServerClient`.
async fn spawn_exec_server() -> anyhow::Result<ExecServerProcess> {
let codex_home = TempDir::new()?;
let mut child = Command::new(codex_utils_cargo_bin::cargo_bin("codex")?)
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 codex binary before spawning exec-server test

spawn_exec_server hard-fails on cargo_bin("codex")?. In a clean cargo test -p codex-rmcp-client run, that binary is not present (could not locate binary "codex"), so the new integration test fails before exercising RMCP behavior. This makes the test non-hermetic; skip when unavailable or use a harness that guarantees the binary path.

Useful? React with 👍 / 👎.

@aibrahim-oai aibrahim-oai force-pushed the dev/remote-mcp-http-runner-full-ci branch from 5baf804 to 941b42e Compare April 20, 2026 16:11
@aibrahim-oai aibrahim-oai force-pushed the dev/remote-mcp-http-client-full-ci branch from 6c3949a to abc0092 Compare April 20, 2026 16:11
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: b902e49baf

ℹ️ 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".

backend: Arc<dyn StreamableHttpTransportBackend>,
}

#[derive(Clone)]
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.

P0 Badge Remove derive attribute from impl block

Delete #[derive(Clone)] on the impl StreamableHttpTransportClient block. derive can only be applied to structs/enums/unions, so this triggers a compile-time error (E0774) and blocks building codex-rmcp-client.

Useful? React with 👍 / 👎.

map_streamable_http_error(error, StreamableHttpTransportClientError::Remote)
})
}
.boxed()
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.

P0 Badge Import FutureExt before calling boxed on async blocks

This module calls .boxed() on async blocks, but futures::FutureExt is never imported. Without that trait in scope, method resolution fails (no method named boxed), so the new transport backend cannot compile.

Useful? React with 👍 / 👎.

Comment thread codex-rs/rmcp-client/src/rmcp_client.rs Outdated
StreamableHttpClientTransport<AuthClient<StreamableHttpTransportClient>>,
OAuthPersistor,
)> {
let http_client = build_http_client(&default_headers)?;
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.

P0 Badge Define or import build_http_client in OAuth setup

create_oauth_transport_and_runtime calls build_http_client, but this function is no longer defined/imported in rmcp_client.rs after the refactor. That leaves an unresolved symbol at compile time and prevents codex-rmcp-client from building.

Useful? React with 👍 / 👎.

@aibrahim-oai
Copy link
Copy Markdown
Collaborator Author

@codex review

@chatgpt-codex-connector
Copy link
Copy Markdown
Contributor

Codex Review: Didn't find any major issues. What shall we delve into next?

ℹ️ 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 and others added 4 commits April 22, 2026 13:10
Co-authored-by: Codex <noreply@openai.com>
Co-authored-by: Codex <noreply@openai.com>
Co-authored-by: Codex <noreply@openai.com>
Co-authored-by: Codex <noreply@openai.com>
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: 7d40346010

ℹ️ 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".

/*http_headers*/ None,
/*env_http_headers*/ None,
OAuthCredentialsStoreMode::File,
exec_client,
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 Wrap exec client in Arc before calling remote constructor

create_remote_client passes an ExecServerClient directly to RmcpClient::new_remote_streamable_http_client, but that API requires Arc<dyn ExecutorHttpClient>. This yields E0308 during test builds, so the new remote integration tests do not compile (cargo check -p codex-rmcp-client --tests fails).

Useful? React with 👍 / 👎.

aibrahim-oai and others added 4 commits April 22, 2026 14:26
Co-authored-by: Codex <noreply@openai.com>
Co-authored-by: Codex <noreply@openai.com>
Co-authored-by: Codex <noreply@openai.com>
Co-authored-by: Codex <noreply@openai.com>
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: b30bb4c614

ℹ️ 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 on lines 1606 to +1609
http_headers,
env_http_headers,
store_mode,
runtime_environment.environment().get_http_client(),
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 Honor experimental_environment for Streamable HTTP placement

make_rmcp_client now always injects runtime_environment.environment().get_http_client() into new_streamable_http_client, regardless of experimental_environment. If the runtime default environment is remote, servers configured as local (experimental_environment unset/local) are still routed through exec-server HTTP, which can break localhost/private-network MCP endpoints and changes documented placement behavior.

Useful? React with 👍 / 👎.

aibrahim-oai and others added 11 commits April 22, 2026 15:43
Co-authored-by: Codex <noreply@openai.com>
Co-authored-by: Codex <noreply@openai.com>
Co-authored-by: Codex <noreply@openai.com>
Co-authored-by: Codex <noreply@openai.com>
Co-authored-by: Codex <noreply@openai.com>
Co-authored-by: Codex <noreply@openai.com>
Co-authored-by: Codex <noreply@openai.com>
Co-authored-by: Codex <noreply@openai.com>
Co-authored-by: Codex <noreply@openai.com>
Co-authored-by: Codex <noreply@openai.com>
Co-authored-by: Codex <noreply@openai.com>
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

2 participants