Skip to main content

connect

Function connect 

Source
pub async fn connect(server: &McpServerConfig) -> Result<Connected, String>
Expand description

Spawn one server and discover its tools, or say why not.

Why: the isolation boundary. Every failure mode — an unsupported transport, a command that does not exist, a handshake that times out, a server that will not list its tools — comes back as Err(reason) for the caller to record as a per-server status, so one bad entry costs exactly itself. What: stdio only. env is overlaid on the inherited environment through spawn_with_env; its VALUES are never logged, here or in the returned reason, because they are credentials. Test: super::tests::spawn_tests::a_remote_transport_is_refused_with_a_reason, super::tests::spawn_tests::a_missing_binary_is_refused_with_a_reason, mcp_loader_e2e::spawn_failure_isolates_the_healthy_server.