Skip to content

Commit 0aa3c21

Browse files
authored
fix(mcp): shell expansion not being done for stdio command (#2915)
1 parent 864a27b commit 0aa3c21

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

crates/chat-cli/src/mcp_client/client.rs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,10 @@ use crate::cli::chat::tools::custom_tool::{
6060
TransportType,
6161
};
6262
use crate::os::Os;
63-
use crate::util::directories::DirectoryError;
63+
use crate::util::directories::{
64+
DirectoryError,
65+
canonicalizes_path,
66+
};
6467

6568
/// Fetches all pages of specified resources from a server
6669
macro_rules! paginated_fetch {
@@ -504,7 +507,8 @@ impl McpClientService {
504507

505508
match transport_type {
506509
TransportType::Stdio => {
507-
let command = Command::new(command_as_str).configure(|cmd| {
510+
let expanded_cmd = canonicalizes_path(os, command_as_str)?;
511+
let command = Command::new(expanded_cmd).configure(|cmd| {
508512
if let Some(envs) = config_envs {
509513
process_env_vars(envs, &os.env);
510514
cmd.envs(envs);

0 commit comments

Comments
 (0)