The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.
Rust agent-orchestrationai-agentsai-assistantdesktopllmlocal-firstmcppersonal-aiprivacyrustsecond-braintauri
chore: files changed crates/openhuman-core/src/mcp/host.rs,crates/openhuman-core/src/mcp/registry/mo
Steven Enamakelca7164a8af4d
diff --git a/crates/openhuman-core/src/mcp/host.rs b/crates/openhuman-core/src/mcp/host.rsindex 2e4363719f..756a4092f0 100644--- a/crates/openhuman-core/src/mcp/host.rs+++ b/crates/openhuman-core/src/mcp/host.rs@@ -94,6 +94,13 @@ pub struct McpHost {audit: AuditStore,}+/// Lets `tinymcp::Supervisor::run_many` reach the registry inside a host.+impl AsRef<McpRegistry> for McpHost {+ fn as_ref(&self) -> &McpRegistry {+ &self.dynamic+ }+}+impl McpHost {/// Builds a host from `config`, without installing it as the process one.///diff --git a/crates/openhuman-core/src/mcp/registry/mod.rs b/crates/openhuman-core/src/mcp/registry/mod.rsindex 4067b3d9e6..27066708d2 100644--- a/crates/openhuman-core/src/mcp/registry/mod.rs+++ b/crates/openhuman-core/src/mcp/registry/mod.rs@@ -409,80 +409,43 @@ pub mod boot {/// Keeping installed servers connected.#[cfg(feature = "mcp")]pub mod supervisor {- use std::collections::HashMap;- use std::path::PathBuf;-use crate::mcp::host;/// Runs the reconnect supervisor until the process ends.///- /// One task for every host the process has opened. The connection map is- /// per-workspace, and a host opened after boot — a workspace switch — is- /// supervised from the tick after it appears, so no workspace's installed- /// servers go unsupervised. Each host's backoff state is held here, keyed- /// by workspace, and the first tick is delayed a whole interval so it does- /// not race the startup connect pass.+ /// One task for every host the process has opened, driven by+ /// `tinymcp::Supervisor::run_many`: the connection map is per-workspace,+ /// and a host opened after boot — a workspace switch — is supervised from+ /// the tick after it appears, with its backoff state kept per workspace.+ /// The first tick is delayed a whole interval so it does not race the+ /// startup connect pass.pub async fn run() {- let config = tinymcp::SupervisorConfig::default();- let mut supervisors: HashMap<PathBuf, tinymcp::Supervisor> = HashMap::new();-- let start = tokio::time::Instant::now() + config.tick_interval;- let mut interval = tokio::time::interval_at(start, config.tick_interval);- // A tick walks every open workspace's installs in sequence and each- // probe can take the whole probe window, so a tick can outlast its- // own interval. The default behaviour would then fire the missed- // ticks back to back, re-probing servers that were just probed.- //- // `Delay` stops that burst but does not on its own leave a gap: it- // schedules the next deadline one interval after the overdue tick- // *returns*, which is when the cycle starts, not when it ends. A- // cycle that consistently outlasts its interval would therefore find- // the next tick already due and run back to back anyway. The- // `interval.reset()` at the end of the loop body is what actually- // paces from when the cycle finished — which is what- // `tinymcp::Supervisor::run` does, and this loop stands in for it.- interval.set_missed_tick_behavior(tokio::time::MissedTickBehavior::Delay);-- tracing::info!(- tick_seconds = config.tick_interval.as_secs(),- probe_seconds = config.probe_timeout.as_secs(),- "[mcp] the reconnect supervisor started"- );-- loop {- interval.tick().await;- let now = std::time::Instant::now();-- // Adopt every host currently open. A host opened since the last- // tick gets a supervisor on this one, built from the identity and- // proxy it was opened with.- for (workspace, service, identity, proxy) in host::all_hosts() {- let supervisor = supervisors- .entry(workspace.clone())- .or_insert_with(|| tinymcp::Supervisor::new(config.clone(), identity, proxy));-- let report = supervisor- .tick(- service.dynamic().store(),- service.dynamic().connections(),- service.dynamic().oauth(),- now,+ tinymcp::Supervisor::run_many(+ tinymcp::SupervisorConfig::default(),+ // Every host currently open. The identity and proxy each was+ // opened with ride along, so a reconnect dials the way the host's+ // own connections do.+ || {+ host::all_hosts()+ .into_iter()+ .map(+ |(workspace, registry, identity, proxy)| tinymcp::SupervisedHost {+ key: workspace,+ registry,+ identity,+ proxy,+ },)- .await;- // What the tick observed becomes this domain's events, so a- // probe outcome reaches the Event Log and a server that stays- // down reaches the user (#5931). The workspace goes with them:- // this loop covers every host the process has opened, and a- // subscriber that persists or announces one must not take a- // switched-away workspace's outage for its own.- super::supervisor_events::publish(&workspace, &report);- }-- // Pace from the end of the cycle, not its start: a cycle slower- // than the interval leaves the next tick already due, and without- // this the supervisor would probe continuously.- interval.reset();- }+ .collect()+ },+ // What the tick observed becomes this domain's events, so a probe+ // outcome reaches the Event Log and a server that stays down+ // reaches the user (#5931). The workspace goes with them: a+ // subscriber that persists or announces one must not take a+ // switched-away workspace's outage for its own.+ |workspace, report| super::supervisor_events::publish(workspace, report),+ )+ .await;}}diff --git a/crates/openhuman-core/src/mcp/server/http.rs b/crates/openhuman-core/src/mcp/server/http.rsindex 1c0d379892..5dc0bb0543 100644--- a/crates/openhuman-core/src/mcp/server/http.rs+++ b/crates/openhuman-core/src/mcp/server/http.rs@@ -1,8 +1,9 @@//! Streamable HTTP + SSE transport for the OpenHuman MCP server.//!//! Reuses [`super::protocol`] for JSON-RPC dispatch. Session lifecycle and header-//! names match [`crate::mcp::http_client::McpHttpClient`] so remote-//! MCP clients can talk to this server without custom glue.+//! names match `tinymcp`'s Streamable HTTP client (the header names are the+//! `tinymcp_bus` constants both sides use) so remote MCP clients can talk to+//! this server without custom glue.use std::collections::HashMap;use std::convert::Infallible;@@ -33,8 +34,9 @@ use uuid::Uuid;use super::protocol;-pub const HEADER_PROTOCOL_VERSION: &str = "MCP-Protocol-Version";-pub const HEADER_SESSION_ID: &str = "Mcp-Session-Id";+/// The Streamable HTTP header names, from the contract the client transport+/// sends, so this server and remote MCP clients spell them alike.+pub use tinymcp_bus::{HEADER_PROTOCOL_VERSION, HEADER_SESSION_ID};#[derive(Debug, Clone)]pub struct HttpServerConfig {diff --git a/crates/openhuman-core/src/mcp/server/protocol.rs b/crates/openhuman-core/src/mcp/server/protocol.rsindex 5ea6c30235..6d3e539339 100644--- a/crates/openhuman-core/src/mcp/server/protocol.rs+++ b/crates/openhuman-core/src/mcp/server/protocol.rs@@ -2,13 +2,10 @@ use serde_json::{json, Map, Value};use super::{resources, session::McpSession, tools};-pub const LATEST_PROTOCOL_VERSION: &str = "2025-11-25";-const SUPPORTED_PROTOCOL_VERSIONS: &[&str] = &[- "2024-11-05",- "2025-03-26",- "2025-06-18",- LATEST_PROTOCOL_VERSION,-];+/// The protocol versions this server negotiates are the contract's, the same+/// ones `tinymcp`'s client transports accept, so the two cannot drift.+pub use tinymcp_bus::LATEST_PROTOCOL_VERSION;+use tinymcp_bus::SUPPORTED_PROTOCOL_VERSIONS;pub async fn handle_json_line(line: &str) -> Option<String> {let mut session = McpSession::default();