@@ -30,14 +30,12 @@ pub struct McpServer {
3030 pub transport : String ,
3131 #[ serde( skip_serializing_if = "Option::is_none" ) ]
3232 pub connection : Option < String > ,
33- #[ serde( skip_serializing_if = "Option::is_none" , rename = "command" ) ]
33+ #[ serde( skip_serializing_if = "Option::is_none" ) ]
3434 pub command_string : Option < String > ,
35- #[ serde( skip_serializing_if = "Option::is_none" , rename = "command" , default ) ]
36- pub command_array : Option < Vec < String > > ,
3735 #[ serde( skip_serializing_if = "Option::is_none" ) ]
38- pub enabled : Option < bool > ,
39- #[ serde( skip_serializing_if = "Option::is_none" , default ) ]
4036 pub args : Option < Vec < String > > ,
37+ #[ serde( skip_serializing_if = "Option::is_none" ) ]
38+ pub enabled : Option < bool > ,
4139 #[ serde( skip_serializing_if = "Option::is_none" , default ) ]
4240 pub env : Option < HashMap < String , String > > ,
4341 #[ serde( skip_serializing_if = "Option::is_none" , default ) ]
@@ -65,7 +63,8 @@ pub struct ClaudeServer {
6563// Claude-compatible format with servers as a map
6664#[ derive( Debug , Serialize , Deserialize ) ]
6765pub struct ClaudeServersConfig {
68- pub mcpServers : HashMap < String , ClaudeServer > ,
66+ #[ serde( rename = "mcpServers" ) ]
67+ pub mcp_servers : HashMap < String , ClaudeServer > ,
6968}
7069
7170// Get path to MCP servers configuration file
@@ -111,22 +110,21 @@ fn read_mcp_config() -> Result<McpServers> {
111110 let claude_format_result: Result < ClaudeServersConfig , _ > =
112111 serde_json:: from_str ( & content) ;
113112
114- if let Ok ( claude_format) = claude_format_result {
113+ if let Ok ( mut claude_format) = claude_format_result {
115114 tracing:: debug!( "Successfully parsed mcp_servers.json as Claude format" ) ;
116115 // Convert to our internal format
117116 let mut servers = Vec :: new ( ) ;
118117
119- for ( name, server) in claude_format. mcpServers {
118+ for ( name, server) in claude_format. mcp_servers . drain ( ) {
120119 servers. push ( McpServer {
121120 name,
122121 transport : "stdio" . to_string ( ) , // Claude format assumes stdio
123122 connection : None ,
124123 command_string : Some ( server. command ) ,
125- command_array : None ,
126- enabled : server. enabled . or ( Some ( true ) ) , // Default to enabled if not specified
127124 args : Some ( server. args ) ,
128125 env : Some ( server. env ) ,
129126 auto_execute : Some ( Vec :: new ( ) ) , // Claude format doesn't specify auto_execute
127+ enabled : server. enabled ,
130128 } ) ;
131129 }
132130
@@ -187,7 +185,7 @@ fn write_mcp_config(servers: &McpServers) -> Result<()> {
187185 . clone ( )
188186 . or_else ( || {
189187 server
190- . command_array
188+ . args
191189 . as_ref ( )
192190 . and_then ( |cmd| cmd. first ( ) . cloned ( ) )
193191 } )
@@ -196,7 +194,7 @@ fn write_mcp_config(servers: &McpServers) -> Result<()> {
196194 let args = server. args . clone ( ) . unwrap_or_else ( || {
197195 // If we have a command array with more than one element, use all but the first as args
198196 server
199- . command_array
197+ . args
200198 . as_ref ( )
201199 . map ( |cmd| {
202200 if cmd. len ( ) > 1 {
@@ -222,7 +220,7 @@ fn write_mcp_config(servers: &McpServers) -> Result<()> {
222220 }
223221
224222 let claude_config = ClaudeServersConfig {
225- mcpServers : claude_servers,
223+ mcp_servers : claude_servers,
226224 } ;
227225
228226 // Serialize in the Claude-compatible format
@@ -306,10 +304,9 @@ pub async fn enable_server(name: &str) -> Result<()> {
306304 name : name. to_string ( ) ,
307305 transport : "stdio" . to_string ( ) ,
308306 command_string : Some ( command_str. clone ( ) ) ,
309- command_array : None ,
307+ args : Some ( Vec :: new ( ) ) ,
310308 connection : None ,
311309 enabled : Some ( true ) ,
312- args : Some ( Vec :: new ( ) ) ,
313310 env : Some ( HashMap :: new ( ) ) ,
314311 auto_execute : Some ( vec ! [ ] ) ,
315312 } ) ;
@@ -349,10 +346,9 @@ pub async fn disable_server(name: &str) -> Result<()> {
349346 name : name. to_string ( ) ,
350347 transport : "stdio" . to_string ( ) ,
351348 command_string : Some ( command_str. clone ( ) ) ,
352- command_array : None ,
349+ args : Some ( Vec :: new ( ) ) ,
353350 connection : None ,
354351 enabled : Some ( false ) ,
355- args : Some ( Vec :: new ( ) ) ,
356352 env : Some ( HashMap :: new ( ) ) ,
357353 auto_execute : Some ( vec ! [ ] ) ,
358354 } ) ;
@@ -493,7 +489,6 @@ pub async fn install_server(path: &str, custom_name: Option<String>) -> Result<S
493489 command_string : Some ( command) ,
494490 connection : None ,
495491 enabled : Some ( true ) ,
496- command_array : None ,
497492 args : Some ( args) ,
498493 env : Some ( HashMap :: new ( ) ) ,
499494 auto_execute : Some ( Vec :: new ( ) ) ,
0 commit comments