Skip to content

The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.

chore: files changed crates/openhuman-core/src/mcp/host.rs,crates/openhuman-core/src/mcp/mod.rs,crat

Steven Enamakel00d620651734
diff --git a/crates/openhuman-core/src/mcp/host.rs b/crates/openhuman-core/src/mcp/host.rs
index f7840b4ace..b4185767cd 100644
--- a/crates/openhuman-core/src/mcp/host.rs
+++ b/crates/openhuman-core/src/mcp/host.rs
@@ -127,6 +127,11 @@ pub fn client_config(config: &Config) -> tinymcp_bus::McpClientConfig {
client.client_identity.version = config.mcp_client.client_identity.version.clone();
client.client_identity.capabilities = tinymcp_bus::ui::client_capabilities();
client.registry_auth = config.mcp_client.registry_auth.clone();
+ // Registry-installed and `mcp.json` stdio servers are third-party code and
+ // are never `operator_trusted`: tinymcp refuses to start them unless the
+ // host supplies the jail. The toolchain grants TinyBox resolves are added
+ // when the config is opened (`module_port`), since they need an async call.
+ client.stdio_sandbox = super::host_sandbox::stdio_sandbox(config);
// GitBooks uses dedicated deferred tools and is not part of the configured
// server set, so first-turn tool assembly never dials it for a catalog.
diff --git a/crates/openhuman-core/src/mcp/mod.rs b/crates/openhuman-core/src/mcp/mod.rs
index 41717eedd5..d91144fadf 100644
--- a/crates/openhuman-core/src/mcp/mod.rs
+++ b/crates/openhuman-core/src/mcp/mod.rs
@@ -208,6 +208,7 @@ pub mod audit;
// ordinary dependency, and the startup path calls `host::init` without a `cfg`
// of its own. Gating this would break the build with the domain turned off.
pub mod host;
+pub(crate) mod host_sandbox;
pub mod registry;
pub mod server;
#[cfg(feature = "mcp")]
diff --git a/crates/openhuman-core/src/mcp/module_client/lifecycle.rs b/crates/openhuman-core/src/mcp/module_client/lifecycle.rs
index 9234dd0ffe..a8c7ffa0e0 100644
--- a/crates/openhuman-core/src/mcp/module_client/lifecycle.rs
+++ b/crates/openhuman-core/src/mcp/module_client/lifecycle.rs
@@ -112,7 +112,10 @@ impl McpConfiguredClient {
.to_owned();
Ok(Self::with_port(
data_dir,
- Box::new(TinyMcpPort::new(crate::modules::client(config.clone()))),
+ Box::new(
+ TinyMcpPort::new(crate::modules::client(config.clone()))
+ .with_host_config(config.clone()),
+ ),
))
}
diff --git a/crates/openhuman-core/src/mcp/module_port.rs b/crates/openhuman-core/src/mcp/module_port.rs
index da229ccde3..98295ab854 100644
--- a/crates/openhuman-core/src/mcp/module_port.rs
+++ b/crates/openhuman-core/src/mcp/module_port.rs
@@ -5,6 +5,15 @@ use tinybus::module::ModuleObjectClient;
pub(super) struct TinyMcpPort {
root: ModuleClient,
+ /// The host config the stdio sandbox's toolchain grants resolve against.
+ host_config: Option<crate::config::Config>,
+ /// Resolves the stdio sandbox's toolchain grants against `config` when the
+ /// configured client is opened.
+ pub(super) fn with_host_config(mut self, config: crate::config::Config) -> Self {
+ self.host_config = Some(config);
+ self
+ }
+
#[cfg(feature = "modules")]
pinned: tokio::sync::OnceCell<ModuleObjectClient>,
}
@@ -13,6 +22,7 @@ impl TinyMcpPort {
pub(super) fn new(root: ModuleClient) -> Self {
Self {
root,
+ host_config: None,
#[cfg(feature = "modules")]
pinned: tokio::sync::OnceCell::new(),
}
@@ -64,11 +74,15 @@ impl McpModulePort for TinyMcpPort {
data_dir: &str,
config: &McpClientConfig,
) -> Result<OpenConfiguredResponse, ModuleCallError> {
+ let mut client = config.clone();
+ if let (Some(host), Some(sandbox)) = (&self.host_config, client.stdio_sandbox.as_mut()) {
+ crate::mcp::host_sandbox::with_toolchain_grants(host, sandbox).await;
+ }
self.root_call(
names::methods::OPEN_CONFIGURED,
(OpenConfiguredRequest {
data_dir: data_dir.to_owned(),
- client: config.clone(),
+ client,
},),
true,
)