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
fix(network): validate MCP server and tool availability before execution
Steven Enamakel8334957ebc8b
diff --git a/crates/openhuman-core/src/tools/impl/browser/browser.rs b/crates/openhuman-core/src/tools/impl/browser/browser.rsindex 287d12cece..790f6686e8 100644--- a/crates/openhuman-core/src/tools/impl/browser/browser.rs+++ b/crates/openhuman-core/src/tools/impl/browser/browser.rs@@ -1,7 +1,6 @@//! Agent-facing browser backed by the TinyComputer module's browser and task members.#[path = "browser_session_pool.rs"]mod session_pool;-use crate::modules::browser::BrowserClient;use crate::security::approval::{ApprovalGate, GateOutcome};use crate::security::SecurityPolicy;@@ -28,7 +27,6 @@ use tinycomputer_bus::browser::{};use tinytools::{Tool, ToolCallOptions, ToolResult, ToolRunContext};use tokio::sync::Mutex;-/// A task paused before an irreversible action, waiting for host approval.struct Pending {task: TaskId,@@ -36,13 +34,11 @@ struct Pending {target: String,token: String,}-impl Pending {fn matches(&self, args: &Value) -> bool {args["token"].as_str() == Some(self.token.as_str())}}-fn needs_host_confirmation(action: &Action) -> bool {matches!(action,@@ -55,7 +51,6 @@ fn needs_host_confirmation(action: &Action) -> bool {| Action::Check { .. })}-fn approval_target(action: &Action) -> (Option<&str>, String) {let target = match action {Action::Click { target, .. }@@ -97,7 +92,6 @@ fn approval_target(action: &Action) -> (Option<&str>, String) {None => (None, String::new()),}}-async fn approve_browser_action(client: &BrowserClient,session: &SessionId,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 4cbd1398f4..d2fe923bb4 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@@ -75,7 +75,7 @@ pub fn configured_server_tools(.map(|tool| {Box::new(ConfiguredMcpServerTool::new(tool,- registry,+ Arc::clone(registry),Arc::clone(security),)) as Box<dyn Tool>})@@ -140,6 +140,7 @@ fn warm_in_background(/// A configured server's tool under this application's call policy.pub struct ConfiguredMcpServerTool {inner: McpServerTool,+ registry: Arc<McpServerRegistry>,security: Arc<SecurityPolicy>,scrubber: SecretScrubber,}@@ -147,12 +148,13 @@ pub struct ConfiguredMcpServerTool {impl ConfiguredMcpServerTool {fn new(inner: McpServerTool,- registry: &McpServerRegistry,+ registry: Arc<McpServerRegistry>,security: Arc<SecurityPolicy>,) -> Self {- let scrubber = SecretScrubber::for_server(registry, inner.server_id());+ let scrubber = SecretScrubber::for_server(®istry, inner.server_id());Self {inner,+ registry,security,scrubber,}@@ -197,6 +199,16 @@ impl Tool for ConfiguredMcpServerTool {self.security.enforce_tool_operation(ToolOperation::Act, self.name()).map_err(|err| anyhow::anyhow!(err))?;+ let server = self.inner.server_id();+ let tool = self.inner.remote_name();+ if !self.registry.list().iter().any(|definition| definition.name == server) {+ anyhow::bail!("MCP server is no longer configured: {server}");+ }+ let live = self.registry.list_tools(server).await?;+ let safe = crate::mcp::registry::tools_safe_for_agent(server, live);+ if !safe.iter().any(|candidate| candidate.name == tool) {+ anyhow::bail!("MCP tool is no longer available or safe: {server}/{tool}");+ }let result = self.inner.execute(args).await?;Ok(self.scrubber.scrub_result(result))}