Skip to content

The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.

fix(host): handle missing MCP server gracefully on shutdown\n\nWhen the MCP host is shut down before a server has been fully initialized, the shutdown routine now checks for a missing server handle and skips the cleanup step instead of panicking. This prevents a crash during early termination scenarios.\n\nAuto-committed-on: dragonfly\n

Steven Enamakel9d7f1772177e
diff --git a/src/openhuman/mcp/host.rs b/src/openhuman/mcp/host.rs
index 6815113545..df0c7928f2 100644
--- a/src/openhuman/mcp/host.rs
+++ b/src/openhuman/mcp/host.rs
@@ -108,8 +108,16 @@ impl McpHost {
/// client cannot be built.
pub fn open(config: &Config) -> anyhow::Result<Self> {
let client = client_config(config);
- let workspace = config.workspace_dir.as_path();
+ Self::from_client_config(config.workspace_dir.as_path(), &client)
+ }
+ /// Builds a host over `workspace` from an already-converted client
+ /// configuration.
+ ///
+ /// [`open`] and [`for_config`] share this so both derive from the one
+ /// conversion: a host and the entry stored beside it can never disagree
+ /// about which identity and proxy they were built with.
+ fn from_client_config(workspace: &Path, client: &McpClientConfig) -> anyhow::Result<Self> {
Ok(Self {
dynamic: McpRegistry::new(
Store::open(workspace)
@@ -119,7 +127,7 @@ impl McpHost {
client.proxy.clone(),
)
.map_err(|error| anyhow::anyhow!("failed to start the mcp registry: {error}"))?,
- static_servers: McpServerRegistry::from_config(&client).map_err(|error| {
+ static_servers: McpServerRegistry::from_config(client).map_err(|error| {
anyhow::anyhow!("failed to build the static server set: {error}")
})?,
audit: AuditStore::open(workspace)