Skip to main content

get_mcp_server

Function get_mcp_server 

Source
pub fn get_mcp_server(
    name: &str,
) -> Result<(ServerId, ServerConfig, McpServerEntry)>
Expand description

Retrieves a named server from ~/.claude/mcp.json.

§Arguments

  • name - Server name as defined under mcpServers in mcp.json

§Returns

A tuple of (ServerId, ServerConfig, McpServerEntry):

  • ServerId — typed server identifier
  • ServerConfig — ready-to-use connection config for Introspector
  • McpServerEntry — raw entry for display purposes (command, args, env)

§Errors

Returns an error if the config file is missing, malformed, or the named server is not present.

§Examples

use mcp_execution_cli::commands::common::get_mcp_server;

let (id, _config, entry) = get_mcp_server("github").unwrap();
assert_eq!(id.as_str(), "github");
println!("command: {}", entry.command);