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 static server tools
Steven Enamakela8aef7721069
diff --git a/crates/openhuman-core/src/agent/session_host/prelude_integrations.rs b/crates/openhuman-core/src/agent/session_host/prelude_integrations.rsindex 2c035d98bb..0571e6ffe1 100644--- a/crates/openhuman-core/src/agent/session_host/prelude_integrations.rs+++ b/crates/openhuman-core/src/agent/session_host/prelude_integrations.rs@@ -168,6 +168,8 @@ impl OpenHumanTurnPrelude {self.refresh_cold_integrations().await;#[cfg(feature = "mcp")]self.refresh_connected_mcp_tools().await;+ #[cfg(feature = "mcp")]+ self.refresh_configured_mcp_tools().await;if !cold {self.refresh_dynamic_announcements().await;}@@ -238,6 +240,32 @@ impl OpenHumanTurnPrelude {.connected_mcp_tools = prepared;}+ /// Refreshes configured static-server declarations from TinyMCP's+ /// persistent owner cache, listing only when a server has no cached+ /// catalog yet.+ #[cfg(feature = "mcp")]+ async fn refresh_configured_mcp_tools(&self) {+ let Some(config) = self.runtime_config.as_deref() else {+ self.mutable+ .lock()+ .unwrap_or_else(std::sync::PoisonError::into_inner)+ .configured_mcp_tools+ .clear();+ return;+ };+ let presentations = match crate::mcp::module_client::McpConfiguredClient::configured_tool_presentations(config).await {+ Ok(presentations) => presentations,+ Err(error) => {+ tracing::debug!(?error, "[mcp] configured tool catalog is unavailable");+ Vec::new()+ }+ };+ self.mutable+ .lock()+ .unwrap_or_else(std::sync::PoisonError::into_inner)+ .configured_mcp_tools = presentations;+ }+/// Construct searchable MCP actions from the workspace's current snapshot./// Called before the tool-surface lock is taken to keep lock order stable.#[cfg(feature = "mcp")]diff --git a/crates/openhuman-core/src/tools/impl/network/mcp.rs b/crates/openhuman-core/src/tools/impl/network/mcp.rsindex 78b7ee0e70..41fc07b6f6 100644--- a/crates/openhuman-core/src/tools/impl/network/mcp.rs+++ b/crates/openhuman-core/src/tools/impl/network/mcp.rs@@ -420,7 +420,7 @@ pub fn mcp_call_tool(config: Arc<Config>, security: Arc<SecurityPolicy>) -> McpCMcpCallTool::new(config, security)}-fn classified_result(+pub(super) fn classified_result(call: tinymcp_bus::ClassifiedStaticToolCall,server: &str,tool: &str,diff --git a/crates/openhuman-core/src/tools/impl/network/mcp_server_tools.rs b/crates/openhuman-core/src/tools/impl/network/mcp_server_tools.rsindex 5d31e5ba78..4e41d9fe03 100644--- a/crates/openhuman-core/src/tools/impl/network/mcp_server_tools.rs+++ b/crates/openhuman-core/src/tools/impl/network/mcp_server_tools.rs@@ -29,6 +29,153 @@ use crate::config::{Config, McpToolExposure};use crate::mcp::config_servers::McpServerRegistry;use crate::security::{SecurityPolicy, ToolOperation};+/// Builds host adapters from TinyMCP-prepared declarations. Catalog retrieval,+/// naming, schema normalization, and execution remain module-owned.+pub fn configured_server_tools_from_presentations(+ config: &Config,+ presentations: Vec<tinymcp_bus::McpToolPresentation>,+ security: &Arc<SecurityPolicy>,+) -> Vec<Box<dyn Tool>> {+ presentations+ .into_iter()+ .filter_map(|presentation| {+ let server = config+ .mcp_client+ .servers+ .iter()+ .find(|server| server.server.name == presentation.server_id)?;+ Some(Box::new(ModuleConfiguredMcpServerTool {+ presentation,+ config: Arc::new(config.clone()),+ server: server.server.clone(),+ security: Arc::clone(security),+ }) as Box<dyn Tool>)+ })+ .collect()+}++struct ModuleConfiguredMcpServerTool {+ presentation: tinymcp_bus::McpToolPresentation,+ config: Arc<Config>,+ server: tinymcp_bus::McpServerConfig,+ security: Arc<SecurityPolicy>,+}++#[async_trait]+impl Tool for ModuleConfiguredMcpServerTool {+ fn name(&self) -> &str {+ &self.presentation.name+ }++ fn description(&self) -> &str {+ &self.presentation.description+ }++ fn parameters_schema(&self) -> Value {+ self.presentation.parameters.clone()+ }++ fn permission_level(&self) -> PermissionLevel {+ PermissionLevel::Execute+ }++ fn external_effect(&self) -> bool {+ true+ }++ fn category(&self) -> ToolCategory {+ ToolCategory::Workflow+ }++ fn exposure(&self) -> ToolExposure {+ if self.presentation.deferred {+ ToolExposure::Deferred+ } else {+ ToolExposure::Direct+ }+ }++ fn family(&self) -> Option<&str> {+ Some(&self.presentation.family)+ }++ async fn execute(&self, args: Value) -> anyhow::Result<ToolResult> {+ self.security+ .enforce_tool_operation(ToolOperation::Act, self.name())+ .map_err(|error| anyhow::anyhow!(error))?;+ let current = crate::config::ops::reload_config_from_paths(+ &self.config.config_path,+ &self.config.workspace_dir,+ )+ .await+ .map_err(|_| anyhow::anyhow!("could not reload MCP configuration"))?;+ let current_server = current+ .mcp_client+ .servers+ .iter()+ .find(|server| server.server.name == self.presentation.server_id)+ .map(|server| &server.server)+ .ok_or_else(|| anyhow::anyhow!("MCP server is no longer configured"))?;+ if current_server != &self.server {+ anyhow::bail!("MCP server configuration changed; rebuild tools before calling");+ }++ let client = crate::mcp::module_client::McpConfiguredClient::for_config(&self.config)+ .map_err(|_| anyhow::anyhow!("TinyMCP module is unavailable"))?;+ let client_config = crate::mcp::host::client_config(&self.config);+ let live: Vec<tinymcp_bus::McpRemoteTool> = client+ .call(+ &client_config,+ tinymcp_bus::names::methods::STATIC_LIST_TOOLS,+ (self.presentation.server_id.as_str(),),+ )+ .await+ .map_err(|_| anyhow::anyhow!("MCP tool is unavailable"))?;+ let live = client+ .scrub_static_tools(&client_config, &self.presentation.server_id, live)+ .await+ .map_err(|_| anyhow::anyhow!("MCP tool metadata is unavailable"))?;+ let safe = crate::mcp::registry::tools_safe_for_agent(+ &self.presentation.server_id,+ live.into_iter()+ .map(|tool| tinymcp_bus::McpTool {+ name: tool.name,+ description: tool.description.or(tool.title),+ input_schema: tool.input_schema,+ })+ .collect(),+ );+ if !safe+ .iter()+ .any(|tool| tool.name == self.presentation.remote_name)+ {+ anyhow::bail!("MCP tool is no longer available or safe");+ }+ let arguments = client+ .normalize_tool_arguments(&client_config, args)+ .await+ .map_err(|_| anyhow::anyhow!("invalid MCP tool arguments"))?;+ let call: tinymcp_bus::ClassifiedStaticToolCall = client+ .call_confidential(+ &client_config,+ tinymcp_bus::names::methods::STATIC_CALL_TOOL_CLASSIFIED,+ (+ self.presentation.server_id.as_str(),+ self.presentation.remote_name.as_str(),+ Value::Object(arguments),+ ),+ )+ .await+ .map_err(|_| anyhow::anyhow!("MCP tool call failed"))?;+ Ok(super::mcp::classified_result(+ call,+ &self.presentation.server_id,+ &self.presentation.remote_name,+ false,+ ))+ }+}+/// One tool per cached tool of every server in `registry`, for `config`.////// `reserved` names are never produced — the generic bridge tools and