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
feat(mcp): add stub registry for tool discovery
Steven Enamakelf55e79b70f5c
diff --git a/crates/openhuman-core/src/agent/registry/agents/orchestrator/prompt.rs b/crates/openhuman-core/src/agent/registry/agents/orchestrator/prompt.rsindex bc0bf0f418..785d7651b6 100644--- a/crates/openhuman-core/src/agent/registry/agents/orchestrator/prompt.rs+++ b/crates/openhuman-core/src/agent/registry/agents/orchestrator/prompt.rs@@ -446,7 +446,9 @@ fn render_connected_mcp_servers() -> String {use crate::mcp::registry::connections;let servers = match tokio::runtime::Handle::try_current() {Ok(handle) if handle.runtime_flavor() == tokio::runtime::RuntimeFlavor::MultiThread => {- tokio::task::block_in_place(|| handle.block_on(connections::connected_overview()))+ tokio::task::block_in_place(|| handle.block_on(connections::connected_overview(+ &crate::core::runtime::DispatchCtx::ambient(),+ )))}_ => Vec::new(),};diff --git a/crates/openhuman-core/src/agent/session_host/prelude_integrations.rs b/crates/openhuman-core/src/agent/session_host/prelude_integrations.rsindex 977eff98e2..746d449827 100644--- a/crates/openhuman-core/src/agent/session_host/prelude_integrations.rs+++ b/crates/openhuman-core/src/agent/session_host/prelude_integrations.rs@@ -384,7 +384,7 @@ impl OpenHumanTurnPrelude {connected.len(),self.agent_definition_id);- let mcp_servers = crate::mcp::registry::connections::connected_overview()+ let mcp_servers = crate::mcp::registry::connections::connected_overview(&self.dispatch_ctx()).await.into_iter().map(|server| server.qualified_name)@@ -427,7 +427,7 @@ impl OpenHumanTurnPrelude {mutable.connected_integrations_authoritative = authoritative;}}- let connected_mcp = crate::mcp::registry::connections::connected_overview()+ let connected_mcp = crate::mcp::registry::connections::connected_overview(&self.dispatch_ctx()).await.into_iter().map(|server| server.qualified_name)diff --git a/crates/openhuman-core/src/mcp/host.rs b/crates/openhuman-core/src/mcp/host.rsindex 0a2510f5e7..c6ef62054a 100644--- a/crates/openhuman-core/src/mcp/host.rs+++ b/crates/openhuman-core/src/mcp/host.rs@@ -21,11 +21,9 @@ pub fn set_default_config(config: &Config) {/// The config named by the current scoped dispatch, or the process default/// outside a tenant scope.-pub fn ambient_config() -> Option<Config> {- match crate::core::runtime::current_tenant() {- Ok(tenant) if tenant.is_scoped() => {- crate::core::runtime::CoreContext::with_current_embedder_config(Clone::clone)- }+pub fn ambient_config(ctx: &crate::core::runtime::DispatchCtx) -> Option<Config> {+ match ctx.tenant() {+ Ok(tenant) if tenant.is_scoped() => ctx.embedder_config(),_ => DEFAULT_CONFIG.get().cloned(),}}diff --git a/crates/openhuman-core/src/mcp/registry/mod.rs b/crates/openhuman-core/src/mcp/registry/mod.rsindex a4fd84b54e..8b87611977 100644--- a/crates/openhuman-core/src/mcp/registry/mod.rs+++ b/crates/openhuman-core/src/mcp/registry/mod.rs@@ -92,8 +92,8 @@ pub mod connections {////// Sorted by qualified name, so a prompt built from this does not reshuffle/// between turns and cost its cached prefix.- pub async fn connected_overview() -> Vec<ConnectedServerOverview> {- let Some(config) = host::ambient_config() else {+ pub async fn connected_overview(ctx: &crate::core::runtime::DispatchCtx) -> Vec<ConnectedServerOverview> {+ let Some(config) = host::ambient_config(ctx) else {return Vec::new();};connected_overview_for_config(&config).await@@ -175,8 +175,10 @@ pub mod connections {}/// Every tool on every connected server, paired with its server.- pub async fn all_connected_tools() -> Vec<(String, String, tinymcp_bus::McpTool)> {- connected_overview()+ pub async fn all_connected_tools(+ ctx: &crate::core::runtime::DispatchCtx,+ ) -> Vec<(String, String, tinymcp_bus::McpTool)> {+ connected_overview(ctx).await.into_iter().flat_map(|server| {@@ -192,8 +194,11 @@ pub mod connections {/// The tools one connected server advertises, or `None` when it is not/// connected.- pub async fn tools_for(server_id: &str) -> Option<Vec<tinymcp_bus::McpTool>> {- let config = host::ambient_config()?;+ pub async fn tools_for(+ ctx: &crate::core::runtime::DispatchCtx,+ server_id: &str,+ ) -> Option<Vec<tinymcp_bus::McpTool>> {+ let config = host::ambient_config(ctx)?;server_tools_for_config(&config, server_id).await}@@ -219,8 +224,8 @@ pub mod connections {}/// Whether a server has a live entry.- pub async fn is_connected(server_id: &str) -> bool {- let Some(config) = host::ambient_config() else {+ pub async fn is_connected(ctx: &crate::core::runtime::DispatchCtx, server_id: &str) -> bool {+ let Some(config) = host::ambient_config(ctx) else {return false;};is_connected_for_config(&config, server_id).await@@ -275,8 +280,8 @@ pub mod connections {////// Answers `false` when the service is not up, which is the truth: nothing/// was holding a connection to drop.- pub async fn disconnect(server_id: &str) -> bool {- let Some(config) = host::ambient_config() else {+ pub async fn disconnect(ctx: &crate::core::runtime::DispatchCtx, server_id: &str) -> bool {+ let Some(config) = host::ambient_config(ctx) else {return false;};disconnect_for_config(&config, server_id).awaitdiff --git a/crates/openhuman-core/src/mcp/registry/stub.rs b/crates/openhuman-core/src/mcp/registry/stub.rsindex 381438c12d..3ba87fddc3 100644--- a/crates/openhuman-core/src/mcp/registry/stub.rs+++ b/crates/openhuman-core/src/mcp/registry/stub.rs@@ -116,14 +116,18 @@ pub mod connections {/// Always-on callers already handle this shape with zero `#[cfg]` — the/// orchestrator prompt skips its "## Connected MCP Servers" block on an/// empty slice, and the turn loop seeds an empty announced-server set.- pub async fn connected_overview() -> Vec<ConnectedServerOverview> {+ pub async fn connected_overview(+ _ctx: &crate::core::runtime::DispatchCtx,+ ) -> Vec<ConnectedServerOverview> {Vec::new()}/// Empty: no connected servers means no advertised tools. `tool_registry`/// folds this into its entry map, which simply gains no `mcp-client::*`/// entries.- pub async fn all_connected_tools() -> Vec<(String, String, McpTool)> {+ pub async fn all_connected_tools(+ _ctx: &crate::core::runtime::DispatchCtx,+ ) -> Vec<(String, String, McpTool)> {Vec::new()}diff --git a/crates/openhuman-core/src/tools/registry/ops.rs b/crates/openhuman-core/src/tools/registry/ops.rsindex 907f5ca468..bf2ddc016b 100644--- a/crates/openhuman-core/src/tools/registry/ops.rs+++ b/crates/openhuman-core/src/tools/registry/ops.rs@@ -274,7 +274,12 @@ fn build_registry_entries(config: Option<&Config>) -> Vec<ToolRegistryEntry> {Some(config) => {connections::all_connected_tools_for_config(config).await}- None => connections::all_connected_tools().await,+ None => {+ connections::all_connected_tools(+ &crate::core::runtime::DispatchCtx::ambient(),+ )+ .await+ }}})})