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): expose configured MCP tools in session tool surface
Steven Enamakel00841eca29e2
diff --git a/crates/openhuman-core/src/agent/session_host/prelude_integrations.rs b/crates/openhuman-core/src/agent/session_host/prelude_integrations.rsindex 0571e6ffe1..9502fda218 100644--- a/crates/openhuman-core/src/agent/session_host/prelude_integrations.rs+++ b/crates/openhuman-core/src/agent/session_host/prelude_integrations.rs@@ -301,6 +301,30 @@ impl OpenHumanTurnPrelude {)}+ /// Builds configured static MCP executors from the module-prepared cache.+ #[cfg(feature = "mcp")]+ pub(super) fn collect_configured_mcp_tools(&self) -> Vec<Box<dyn tinytools::Tool>> {+ let Some(config) = self.runtime_config.as_deref() else {+ return Vec::new();+ };+ let presentations = self+ .mutable+ .lock()+ .unwrap_or_else(std::sync::PoisonError::into_inner)+ .configured_mcp_tools+ .clone();+ let security = Arc::new(crate::security::SecurityPolicy::from_config(+ &config.autonomy,+ &config.workspace_dir,+ &config.action_dir,+ ));+ crate::tools::implementations::network::configured_server_tools_from_presentations(+ config,+ presentations,+ &security,+ )+ }+pub(super) async fn refresh_cold_integrations(&self) {let should_fetch = !self.mutablediff --git a/crates/openhuman-core/src/agent/session_host/runtime_session_tool_surface.rs b/crates/openhuman-core/src/agent/session_host/runtime_session_tool_surface.rsindex 7b8efe6cf5..5696016128 100644--- a/crates/openhuman-core/src/agent/session_host/runtime_session_tool_surface.rs+++ b/crates/openhuman-core/src/agent/session_host/runtime_session_tool_surface.rs@@ -15,15 +15,27 @@ impl OpenHumanTurnPrelude {let Some(registry) = AgentDefinitionRegistry::current() else {return Ok(());};- let Some(definition) = self.session_definition(®istry) else {- return Ok(());- };+ let definition = self.session_definition(®istry);let has_recorded_tool_snapshot = self.mutable.lock().unwrap_or_else(std::sync::PoisonError::into_inner).recorded_tool_snapshot_adopted;- if definition.subagents.is_empty() && !has_recorded_tool_snapshot {+ #[cfg(feature = "mcp")]+ let has_configured_mcp_tools = !self+ .mutable+ .lock()+ .unwrap_or_else(std::sync::PoisonError::into_inner)+ .configured_mcp_tools+ .is_empty();+ #[cfg(not(feature = "mcp"))]+ let has_configured_mcp_tools = false;+ if !definition+ .as_ref()+ .is_some_and(|definition| !definition.subagents.is_empty())+ && !has_recorded_tool_snapshot+ && !has_configured_mcp_tools+ {return Ok(());}let (integrations, integrations_are_authoritative, recorded_tool_snapshot_adopted) = {@@ -39,20 +51,29 @@ impl OpenHumanTurnPrelude {};#[cfg(feature = "mcp")]let mcp_tools = self.collect_mcp_search_tools();+ #[cfg(feature = "mcp")]+ let configured_mcp_tools = self.collect_configured_mcp_tools();let mut surface = self.tool_surface.lock().unwrap_or_else(std::sync::PoisonError::into_inner);- let mut collected = collect_orchestrator_tools(&definition, ®istry, &integrations);+ let mut collected = definition+ .as_ref()+ .map(|definition| collect_orchestrator_tools(definition, ®istry, &integrations))+ .unwrap_or_default();#[cfg(feature = "mcp")]collected.extend(mcp_tools);- let rebuilt = self.rebuilt_recorded_tools(- &definition,- &surface.tools,- &collected,- &integrations,- integrations_are_authoritative,- );+ #[cfg(feature = "mcp")]+ collected.extend(configured_mcp_tools);+ let rebuilt = definition.as_ref().map_or_else(Vec::new, |definition| {+ self.rebuilt_recorded_tools(+ definition,+ &surface.tools,+ &collected,+ &integrations,+ integrations_are_authoritative,+ )+ });collected.extend(rebuilt);super::super::managed_tools::reject_synthesized_collisions(&surface.permanent_tool_names,diff --git a/crates/openhuman-core/src/mcp/module_client.rs b/crates/openhuman-core/src/mcp/module_client.rsindex 2de4a8b253..b44ce09bf5 100644--- a/crates/openhuman-core/src/mcp/module_client.rs+++ b/crates/openhuman-core/src/mcp/module_client.rs@@ -441,8 +441,17 @@ impl McpConfiguredClient {(server.name.as_str(),),).await?;- let tools = match cached {- Some(tools) => tools,+ let tools: Vec<McpRemoteTool> = match cached {+ Some(tools) => tools+ .into_iter()+ .map(|tool| McpRemoteTool {+ name: tool.name,+ title: None,+ description: tool.description,+ input_schema: tool.input_schema,+ meta: None,+ })+ .collect(),None => client.call(&client_config,