-
Notifications
You must be signed in to change notification settings - Fork 5.3k
[MCP] Introduce an experimental official rust sdk based mcp client #4252
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Either way, the code should roughly look like this:
Without which, it won’t work on Windows. |
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.
569b9bf
to
7cdb709
Compare
7cdb709
to
35292f8
Compare
|
||
let expected_env_value = "propagated-env"; | ||
let rmcp_test_server_bin = CargoBuild::new() | ||
.package("codex-rmcp-client") |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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") |
There was a problem hiding this comment.
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?; |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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)] |
There was a problem hiding this comment.
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
.)
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.