Skip to content

feat(transport): add which_command for cross-platform executable resolution - #774

Merged
DaleSeo merged 2 commits into
modelcontextprotocol:mainfrom
kakarot-dev:feat/which-command
Apr 7, 2026
Merged

feat(transport): add which_command for cross-platform executable resolution#774
DaleSeo merged 2 commits into
modelcontextprotocol:mainfrom
kakarot-dev:feat/which-command

Conversation

@kakarot-dev

Copy link
Copy Markdown
Contributor

Summary

Adds a which_command() helper function that resolves executable paths via the which crate before constructing a tokio::process::Command. This fixes Windows failures where .cmd shim scripts (e.g. npx.cmd) are not found by Command::new() without a fully-qualified path.

Changes:

  • Added which_command(name) -> io::Result<Command> to child_process.rs
  • Added which v7 as an optional dependency, gated behind transport-child-process feature
  • Re-exported which_command from transport module
  • Added tests for known binary resolution and nonexistent binary error handling

Usage:

use rmcp::transport::{which_command,ConfigureCommandExt};let cmd = which_command("npx")?
.configure(|cmd| {
cmd.arg("-y").arg("@modelcontextprotocol/server-everything");});

Closes#456

…lution
Adds a `which_command()` helper that resolves executable paths via the
`which` crate before constructing a `tokio::process::Command`. This fixes
Windows failures where `.cmd` shim scripts (e.g. `npx.cmd`) are not
found by `Command::new()` without a fully-qualified path.
Closesmodelcontextprotocol#456
@kakarot-dev
kakarot-dev requested a review from a team as a code ownerMarch 25, 2026 15:37
@github-actionsgithub-actionsBot added T-dependencies Dependencies related changes T-config Configuration file changes T-core Core library changes T-transport Transport layer changes labels Mar 25, 2026
Comment threadcrates/rmcp/Cargo.toml
Comment threadcrates/rmcp/src/transport/child_process.rs Outdated
Address review feedback: the `which` dependency is now gated behind a
separate `which-command` feature flag instead of being bundled into
`transport-child-process`. Users on Linux/macOS who don't need
cross-platform executable resolution no longer pull in the extra crate.
Also fixes the doc example import path to use the re-exported
`rmcp::transport::which_command`.
@DaleSeo
DaleSeo merged commit cabf71a into modelcontextprotocol:mainApr 7, 2026
17 checks passed
@github-actionsgithub-actionsBot mentioned this pull request Apr 9, 2026
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

T-configConfiguration file changesT-coreCore library changesT-dependenciesDependencies related changesT-transportTransport layer changes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

The abstract method uses which under the hood.

2 participants

@kakarot-dev@DaleSeo