Skip to content

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

refactor(mcp): take the tool-UI rules from tinymcp-bus, drop the direct tinymcp dep

M3gA-Mindf546f23e09eb
diff --git a/crates/openhuman-app/Cargo.toml b/crates/openhuman-app/Cargo.toml
index 454334bb9d..2cdd36c2c1 100644
--- a/crates/openhuman-app/Cargo.toml
+++ b/crates/openhuman-app/Cargo.toml
@@ -70,7 +70,6 @@ serde_json = "1"
# `openhuman-rpc`'s own: `http-client` (the relay client), `server` (the
# embedded JSON-RPC server and `host::desktop`) and `jev` (the Jev-backed
# `tool_search` ranker the product ships).
-tinymcp = { path = "../../vendor/tinymcp/crates/tinymcp", default-features = false, features = ["ui"] }
openhuman-rpc = { path = "../openhuman-rpc", default-features = false, features = [
"os-keyring",
"http-client",
@@ -94,6 +93,9 @@ openhuman-rpc = { path = "../openhuman-rpc", default-features = false, features
"tinymemes",
"storage-sqlite",
] }
+# The widget scheme reduces CSP origins with `tinymcp_bus::ui`'s pure rules.
+# The contract, not the module crate: hosts reach modules through `*-bus`.
+tinymcp-bus = { path = "../../vendor/tinymcp/crates/tinymcp-bus" }
# Tauri core and plugins. Use upstream Tauri's native WebView runtime (Wry),
# rather than the removed Chromium/CEF fork.
tauri = { version = "2.11", default-features = false, features = [
diff --git a/crates/openhuman-app/src/widget_scheme.rs b/crates/openhuman-app/src/widget_scheme.rs
index 26ddb68c76..fd694f7ec2 100644
--- a/crates/openhuman-app/src/widget_scheme.rs
+++ b/crates/openhuman-app/src/widget_scheme.rs
@@ -33,7 +33,7 @@ fn declared_origins(query: &str) -> (Vec<String>, Vec<String>) {
_ => {}
}
}
- let reduce = |items: Vec<Value>| tinymcp::ui::https_origins(Some(&Value::Array(items)));
+ let reduce = |items: Vec<Value>| tinymcp_bus::ui::https_origins(Some(&Value::Array(items)));
(reduce(connect), reduce(resource))
}
diff --git a/crates/openhuman-core/Cargo.toml b/crates/openhuman-core/Cargo.toml
index d9f5daa961..7d29cd7c43 100644
--- a/crates/openhuman-core/Cargo.toml
+++ b/crates/openhuman-core/Cargo.toml
@@ -222,9 +222,8 @@ tinyconnectors-bus = { path = "../../vendor/tinyconnectors/crates/tinyconnectors
-# tinymcp: pure tool-UI rules only (`tinymcp::ui`). The MCP runtime itself runs
-# as a module behind `tinymcp-bus`.
-tinymcp = { path = "../../vendor/tinymcp/crates/tinymcp", default-features = false, features = ["ui"] }
+# tinymcp's contract, including the pure tool-UI rules (`tinymcp_bus::ui`). The
+# MCP runtime itself runs as a module behind it.
tinymcp-bus = { path = "../../vendor/tinymcp/crates/tinymcp-bus", features = ["schemars"] }
# The transport-free channel vocabulary: inbound envelopes, outbound intents,
# the config schema, controller metadata and relay frames. UNCONDITIONAL — `DomainEvent` embeds
diff --git a/crates/openhuman-core/src/mcp/host.rs b/crates/openhuman-core/src/mcp/host.rs
index 40fe014c64..827dfa9dbd 100644
--- a/crates/openhuman-core/src/mcp/host.rs
+++ b/crates/openhuman-core/src/mcp/host.rs
@@ -117,7 +117,7 @@ pub fn client_config(config: &Config) -> tinymcp_bus::McpClientConfig {
client.client_identity.name = config.mcp_client.client_identity.name.clone();
client.client_identity.title = config.mcp_client.client_identity.title.clone();
client.client_identity.version = config.mcp_client.client_identity.version.clone();
- client.client_identity.capabilities = tinymcp::ui::client_capabilities();
+ client.client_identity.capabilities = tinymcp_bus::ui::client_capabilities();
client.registry_auth = config.mcp_client.registry_auth.clone();
// GitBooks uses dedicated deferred tools and is not part of the configured
diff --git a/crates/openhuman-core/src/mcp/ui/discovery.rs b/crates/openhuman-core/src/mcp/ui/discovery.rs
index ab15a0313c..73c218fadf 100644
--- a/crates/openhuman-core/src/mcp/ui/discovery.rs
+++ b/crates/openhuman-core/src/mcp/ui/discovery.rs
@@ -7,7 +7,7 @@
use serde_json::Value;
fn template_uri(meta: &Value) -> Option<String> {
- tinymcp::ui::template_from_meta(meta).map(|(uri, _)| uri)
+ tinymcp_bus::ui::template_from_meta(meta).map(|(uri, _)| uri)
}
fn meta_keys(meta: &Value) -> Vec<String> {
diff --git a/crates/openhuman-core/src/mcp/ui/mod.rs b/crates/openhuman-core/src/mcp/ui/mod.rs
index d8e23ecef9..f570f0a7ad 100644
--- a/crates/openhuman-core/src/mcp/ui/mod.rs
+++ b/crates/openhuman-core/src/mcp/ui/mod.rs
@@ -1,7 +1,7 @@
//! Tool-provided UI in the chat: MCP Apps widgets, OpenAI Apps SDK widgets,
//! skill views, and the links a tool result offers.
//!
-//! - [`resolve`] applies `tinymcp::ui`'s rules to one call's descriptor
+//! - [`resolve`] applies `tinymcp_bus::ui`'s rules to one call's descriptor
//! `_meta` and result, giving a [`types::McpUiPresentation`], the metadata
//! the chat surface renders, and caches any document the result carried.
//! - [`decorate`] applies that to every MCP tool path.
diff --git a/crates/openhuman-core/src/mcp/ui/ops.rs b/crates/openhuman-core/src/mcp/ui/ops.rs
index 7419790cb2..f66aa5b58f 100644
--- a/crates/openhuman-core/src/mcp/ui/ops.rs
+++ b/crates/openhuman-core/src/mcp/ui/ops.rs
@@ -123,7 +123,7 @@ pub async fn tool_call(
.tool_descriptor(&server_id, &tool_name)
.await
.ok_or_else(|| format!("`{tool_name}` is not offered by this server"))?;
- if !tinymcp::ui::visible_to_app(descriptor.meta.as_ref()) {
+ if !tinymcp_bus::ui::visible_to_app(descriptor.meta.as_ref()) {
tracing::debug!(
server_id,
tool_name,
@@ -131,7 +131,7 @@ pub async fn tool_call(
);
return Err(format!("`{tool_name}` cannot be called from a widget"));
}
- let read_only = tinymcp::ui::is_read_only(descriptor.annotations.as_ref());
+ let read_only = tinymcp_bus::ui::is_read_only(descriptor.annotations.as_ref());
if !read_only && !confirmed {
tracing::debug!(
server_id,
diff --git a/crates/openhuman-core/src/mcp/ui/resolve.rs b/crates/openhuman-core/src/mcp/ui/resolve.rs
index 0b139edc24..727e6511e6 100644
--- a/crates/openhuman-core/src/mcp/ui/resolve.rs
+++ b/crates/openhuman-core/src/mcp/ui/resolve.rs
@@ -1,9 +1,9 @@
//! Turning one tool call into what the chat surface shows for it.
//!
-//! The rules are `tinymcp::ui`'s. This host keeps any widget document the
+//! The rules are `tinymcp_bus::ui`'s. This host keeps any widget document the
//! result carried, so the frame can load it by id.
-pub use tinymcp::ui::{
+pub use tinymcp_bus::ui::{
https_origins, is_ui_uri, resource_from_contents, view_from_envelope, view_from_raw_result,
MAX_STRUCTURED_BYTES, MAX_WIDGET_BYTES as MAX_RESOURCE_BYTES,
};
@@ -15,7 +15,7 @@ use super::types::{McpUiPresentation, UiCallView};
/// nor a link. A document the result embedded is cached for the frame.
#[must_use]
pub fn presentation_from_view(view: &UiCallView) -> Option<McpUiPresentation> {
- let resolved = tinymcp::ui::resolve_presentation(view)?;
+ let resolved = tinymcp_bus::ui::resolve_presentation(view)?;
let mut presentation = resolved.presentation;
if let Some((uri, document)) = resolved.prefetched {
cache::put_read(&view.server_id, &uri, document);
diff --git a/crates/openhuman-core/src/mcp/ui/tools.rs b/crates/openhuman-core/src/mcp/ui/tools.rs
index cc6ce81575..ecac08f51e 100644
--- a/crates/openhuman-core/src/mcp/ui/tools.rs
+++ b/crates/openhuman-core/src/mcp/ui/tools.rs
@@ -15,7 +15,7 @@ use tinytools::{PermissionLevel, Tool, ToolCallOptions, ToolExposure, ToolResult
use super::cache::{self, InlineEntry};
use super::resolve::{MAX_RESOURCE_BYTES, MAX_STRUCTURED_BYTES};
use super::types::{McpUiPresentation, UiCsp, UiFlavor, UiResource, MCP_APP_MIME, MCP_UI_KIND};
-use tinymcp::ui::extract_links;
+use tinymcp_bus::ui::extract_links;
/// The tool's registered name.
pub const SHOW_UI_TOOL: &str = "show_ui";
diff --git a/crates/openhuman-core/src/mcp/ui/types.rs b/crates/openhuman-core/src/mcp/ui/types.rs
index a299728ab3..9c1d5f34f8 100644
--- a/crates/openhuman-core/src/mcp/ui/types.rs
+++ b/crates/openhuman-core/src/mcp/ui/types.rs
@@ -3,11 +3,11 @@
use serde_json::Value;
-pub use tinymcp::ui::{
+pub use tinymcp_bus::ui::{
McpUiPresentation, UiCallView, UiCsp, UiFlavor, UiLink, UiLinkKind, UiResource,
MCP_APPS_EXTENSION, MCP_APP_MIME, MCP_UI_KIND,
};
-pub use tinymcp::MCP_RESULT_KIND;
+pub use tinymcp_bus::MCP_RESULT_KIND;
/// What a widget-initiated tool call needs to know about its target tool.
#[derive(Debug, Clone, Default, PartialEq)]
diff --git a/scripts/ci/module-boundaries.json b/scripts/ci/module-boundaries.json
index cac3a1fd04..4cb2e96e58 100644
--- a/scripts/ci/module-boundaries.json
+++ b/scripts/ci/module-boundaries.json
@@ -114,11 +114,6 @@
},
"pendingContracts": [],
"exceptions": [
- {
- "scope": "hosts",
- "package": "tinymcp",
- "reason": "#7205 tinymcp::ui pure rules; move to tinymcp-bus tracked under #7868"
- },
{
"scope": "tinychannels-bus",
"package": "anyhow",