Skip to content

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

refactor(mcp): register tool UI through mcp helpers to stay within file pins

oxoxDev82cce6b2d87a
diff --git a/crates/openhuman-core/src/core/all.rs b/crates/openhuman-core/src/core/all.rs
index b3231c16b8..a069486014 100644
--- a/crates/openhuman-core/src/core/all.rs
+++ b/crates/openhuman-core/src/core/all.rs
@@ -352,17 +352,10 @@ fn build_registered_controllers() -> Vec<GroupedController> {
DomainGroup::Desktop,
crate::desktop::dashboard::all_dashboard_registered_controllers(),
);
- // MCP client subsystem: Smithery registry browser, local server install/connect, tool dispatch
push(
&mut controllers,
DomainGroup::Mcp,
- crate::mcp::registry::all_mcp_registry_registered_controllers(),
- );
- #[cfg(feature = "mcp")]
- push(
- &mut controllers,
- DomainGroup::Mcp,
- crate::mcp::ui::all_mcp_ui_registered_controllers(),
+ crate::mcp::all_registered_controllers(),
);
// Agent definition and prompt inspection
push(
@@ -821,9 +814,7 @@ pub fn namespace_description(namespace: &str) -> Option<&'static str> {
"mcp_clients" => Some(
"Browse the MCP registries, declare the user's servers in one mcp.json document, manage their connections and credentials, and expose their tools to the agent.",
),
- "mcp_ui" => Some(
- "Serve tool-provided widgets their documents and run the tool calls a widget asks for, under the agent's tool policy.",
- ),
+ "mcp_ui" => Some("Serve MCP tool widgets their documents and run their tool calls."),
"decrypt" => Some("Decrypt secure values managed by secret storage."),
"doctor" => Some("Run diagnostics for workspace and runtime health."),
"hooks" => Some(
diff --git a/crates/openhuman-core/src/mcp/mod.rs b/crates/openhuman-core/src/mcp/mod.rs
index 1180308344..53f79f958b 100644
--- a/crates/openhuman-core/src/mcp/mod.rs
+++ b/crates/openhuman-core/src/mcp/mod.rs
@@ -174,6 +174,16 @@ fn spawn_reconnect_supervisor() {
#[cfg(not(feature = "mcp"))]
pub fn start_boot_jobs(_config: &crate::config::Config) {}
+/// Every `mcp_*` controller this build serves: the client registry and, with
+/// the `mcp` feature, tool UI.
+pub fn all_registered_controllers() -> Vec<crate::core::all::RegisteredController> {
+ #[cfg_attr(not(feature = "mcp"), allow(unused_mut))]
+ let mut controllers = registry::all_mcp_registry_registered_controllers();
+ #[cfg(feature = "mcp")]
+ controllers.extend(ui::all_mcp_ui_registered_controllers());
+ controllers
+}
+
pub mod audit;
// Ungated, like the transport below and for the same reason: `tinymcp` is an
// ordinary dependency, and the startup path calls `host::init` without a `cfg`
diff --git a/crates/openhuman-core/src/tools/ops.rs b/crates/openhuman-core/src/tools/ops.rs
index 7a2eedf5a9..f0c5798a2e 100644
--- a/crates/openhuman-core/src/tools/ops.rs
+++ b/crates/openhuman-core/src/tools/ops.rs
@@ -248,11 +248,6 @@ pub fn all_tools_with_runtime(
tracing::debug!("[tools::ops] memory off; memory tool not registered");
}
- #[cfg(feature = "mcp")]
- tools.push(Box::new(crate::mcp::ui::ShowUiTool::for_config(
- root_config,
- )));
-
// `juice_find` / `juice_extract` / `juice_summarize`: only while a handle can name them.
tools.extend(crate::inference::tokenjuice::repl_tools_for(root_config));
@@ -381,6 +376,7 @@ pub fn all_tools_with_runtime(
// feature; see the static-vs-dynamic note in AGENTS.md.
#[cfg(feature = "mcp")]
{
+ tools.push(crate::mcp::ui::show_ui_tool(root_config));
let mcp_registry = {
// Built from the converted configuration, which is the one place
// the two vocabularies meet. A registry that cannot be built is
@@ -396,11 +392,8 @@ pub fn all_tools_with_runtime(
if !mcp_registry.is_empty() {
tools.push(Box::new(McpListServersTool::new(Arc::clone(&mcp_registry))));
tools.push(Box::new(McpListToolsTool::new(Arc::clone(&mcp_registry))));
- tools.push(Box::new(crate::mcp::ui::UiAwareTool::new(
- Box::new(mcp_call_tool(Arc::clone(&mcp_registry), security.clone())),
- crate::mcp::ui::decorate::MetaLookup::Configured(Arc::clone(&mcp_registry)),
- crate::mcp::ui::decorate::ToolInput::Nested("arguments"),
- )));
+ let call = Box::new(mcp_call_tool(Arc::clone(&mcp_registry), security.clone()));
+ tools.push(crate::mcp::ui::ui_aware_call(call, &mcp_registry));
tracing::debug!(
count = mcp_registry.list().len(),
"[mcp_client] registered generic MCP bridge tools"