v0.8.1 — connect-with-timeout for MCP
v0.8.1 — connect-with-timeout for MCP
Single-fix patch. The connect_timeout introduced in 0.8.0 only bounded discovery; transport setup and the MCP initialize handshake could still hang indefinitely. This release moves the timeout to wrap the full connect-and-discover path.
What's Changed
connect_timeout now wraps transport setup + handshake
McpServerOptions::discovery_timeout is renamed to connect_timeout and the manager-side helper switches from discover_with_options to connect_and_discover, applying the timeout around McpConnection::connect_with_auth plus the initial discovery. Refresh discovery is bounded by the same duration. Servers behind a slow handshake (HTTP transports waiting on TLS or auth, stdio servers slow to spawn) now fail fast.
use std::time::Duration;
use agentkit_mcp::{McpServerManager, McpServerOptions};
let mut manager = McpServerManager::new();
manager.register_with_options(
remote_mcp_config,
McpServerOptions::new().with_timeout(Duration::from_secs(5)),
);
// connect_with_auth + initialize + tools/list + resources/list + prompts/list
// must all complete within 5s, or `McpError::Timeout { operation: "connect", .. }`.
let outcomes = manager.connect_all_settled().await;Migration notes
McpServerOptions::discovery_timeout→connect_timeout. The setterwith_timeout(d)is unchanged.McpError::Timeout { operation, .. }previously reportedoperation: "discovery"; it now reports"connect"for the unified path.
Commits
- feat(mcp): wrap connect_with_auth with timeout (64f5e0b)
Full Changelog: v0.8.0...v0.8.1