From b3478e87f190857ff9aa8c0f12b67432e6e9d71b Mon Sep 17 00:00:00 2001 From: Adam Huganir Date: Mon, 1 Dec 2025 09:36:29 -0500 Subject: [PATCH] agent_ui: JSON encode command path along with other elements in MCPcontext modal (#42693) Closes #42692 Release Notes: - Fixed command path not being correctly encoded in context server config modal --- .../configure_context_server_modal.rs | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/crates/agent_ui/src/agent_configuration/configure_context_server_modal.rs b/crates/agent_ui/src/agent_configuration/configure_context_server_modal.rs index 669ca54a6306116d3d57e8b93ff5a726bb24feb8..7f85c9a47ea65a7bd1e14cb6e1733bfd1ddf9513 100644 --- a/crates/agent_ui/src/agent_configuration/configure_context_server_modal.rs +++ b/crates/agent_ui/src/agent_configuration/configure_context_server_modal.rs @@ -1,7 +1,4 @@ -use std::{ - path::PathBuf, - sync::{Arc, Mutex}, -}; +use std::sync::{Arc, Mutex}; use anyhow::{Context as _, Result}; use collections::HashMap; @@ -226,11 +223,12 @@ fn context_server_input(existing: Option<(ContextServerId, ContextServerCommand) Some((id, cmd)) => { let args = serde_json::to_string(&cmd.args).unwrap(); let env = serde_json::to_string(&cmd.env.unwrap_or_default()).unwrap(); - (id.0.to_string(), cmd.path, args, env) + let cmd_path = serde_json::to_string(&cmd.path).unwrap(); + (id.0.to_string(), cmd_path, args, env) } None => ( "some-mcp-server".to_string(), - PathBuf::new(), + "".to_string(), "[]".to_string(), "{}".to_string(), ), @@ -241,14 +239,13 @@ fn context_server_input(existing: Option<(ContextServerId, ContextServerCommand) /// The name of your MCP server "{name}": {{ /// The command which runs the MCP server - "command": "{}", + "command": {command}, /// The arguments to pass to the MCP server "args": {args}, /// The environment variables to set "env": {env} }} -}}"#, - command.display() +}}"# ) }