Skip to content

Conversation

gpeal
Copy link
Collaborator

@gpeal gpeal commented Sep 25, 2025

The official Rust SDK has come a long way since we first started our mcp client implementation 5 months ago and, today, it is much more complete than our own stdio-only implementation.

This PR introduces a new config flag experimental_use_rmcp_client which will use a new mcp client powered by the sdk instead of our own.

To keep this PR simple, I've only implemented the same stdio MCP functionality that we had but will expand on it with future PRs.

@AdsQnn
Copy link

AdsQnn commented Sep 25, 2025

Either way, the code should roughly look like this:

let npx_path = which("npx")?; // works like the `which` command
let status = Command::new(npx_path)
    .arg("-v")
    .status()
    .await?;

Without which, it won’t work on Windows.

gpeal and others added 7 commits September 25, 2025 16:13
Limit mock SSE response to a single use in tests; add debug eprintlns to rmcp_client tests. Fix order of edition in Cargo.toml and enable tokio io-std feature. Move stdio helper into rmcp_test_server, and comment out ServerInfo name/version fields.
@gpeal gpeal force-pushed the gpeal/rmcp-client-1 branch 8 times, most recently from 569b9bf to 7cdb709 Compare September 26, 2025 07:36
@gpeal gpeal force-pushed the gpeal/rmcp-client-1 branch from 7cdb709 to 35292f8 Compare September 26, 2025 07:37

let expected_env_value = "propagated-env";
let rmcp_test_server_bin = CargoBuild::new()
.package("codex-rmcp-client")
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I had to use escargot instead of the existing cargo crate because this binary is in the rmcp-client crate

Copy link
Collaborator

Choose a reason for hiding this comment

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

Nice, we have some tests in weird places because of this limitation, so it would be nice to clean those up in the near future.


let expected_env_value = "propagated-env";
let rmcp_test_server_bin = CargoBuild::new()
.package("codex-rmcp-client")
Copy link
Collaborator

Choose a reason for hiding this comment

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

Nice, we have some tests in weird places because of this limitation, so it would be nice to clean those up in the near future.

params: Option<ListToolsRequestParams>,
timeout: Option<Duration>,
) -> Result<ListToolsResult> {
let service = self.service().await?;
Copy link
Collaborator

Choose a reason for hiding this comment

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

I would consider producing the initialized client as a separate object so all your methods won't have to go through self.service().await? like this.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

That's what is happening here but the state is a struct with Connecting/Ready so the await is just to lock the state and get the ready state.

.collect()
}

#[cfg(unix)]
Copy link
Collaborator

Choose a reason for hiding this comment

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

I don't believe there's a good reference to cite for these: I believe I came up with these lists via empirical testing of either https://modelcontextprotocol.io/docs/tools/inspector or Claude Desktop. (I made an MCP server that just dumped env.)

@gpeal gpeal merged commit e555a36 into main Sep 26, 2025
19 checks passed
@gpeal gpeal deleted the gpeal/rmcp-client-1 branch September 26, 2025 17:13
@github-actions github-actions bot locked and limited conversation to collaborators Sep 26, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants