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(mcp): restore extracted registry host facade
Steven Enamakel8b8255a714b5
diff --git a/src/openhuman/mcp/registry/mod.rs b/src/openhuman/mcp/registry/mod.rsindex a0af5fece6..e22f64e233 100644--- a/src/openhuman/mcp/registry/mod.rs+++ b/src/openhuman/mcp/registry/mod.rs@@ -1,115 +1,52 @@-//! MCP Registry — discover, install, and run user-chosen MCP servers.+//! MCP Registry — the host half of the user-installed server surface.//!-//! This is the dynamic, user-facing side of MCP-client support. It browses the-//! Smithery.ai MCP registry, persists the user's chosen installs to SQLite,-//! and (for local-spawn servers) supervises their subprocess lifecycle.-//! Installed servers' tools are surfaced to agents via the unified tool-//! registry ([`crate::openhuman::tools::registry`]).-//!-//! # Server transport model-//!-//! An [`InstalledServer`] is dialed per its [`types::Transport`]: `Stdio` for a-//! **local subprocess** launched by npx / uvx / a direct binary-//! ([`types::CommandKind`]), or `HttpRemote` for a hosted endpoint (Streamable-//! HTTP + SSE + OAuth). Both are owned by [`connections`].-//!-//! # Where a server's details come from-//!-//! Orthogonal to transport, [`types::ServerProvenance`] records whether the-//! record was resolved from an upstream catalog listing (`Registry`) or typed-//! in by the user ([`custom`] — `Custom`). Only the provenance differs:-//! everything downstream (connect, supervise, boot spawn, tool surface) treats-//! the two identically.-//!-//! # Boot-time spawn-//!-//! [`boot::spawn_installed_servers`] is called from-//! `bootstrap_core_runtime` so every local-spawn server is connected as soon-//! as the core comes up. Errors are logged per-server and never block boot.-//!-//! # Relationship to `config_servers` / `http_client`-//!-//! The sibling [`crate::openhuman::mcp::config_servers`] module owns the-//! *static, config-declared* server set (read from `[[mcp_client.servers]]`-//! in TOML) plus the stdio transport, and [`crate::openhuman::mcp::http_client`]-//! owns the HTTP transport primitive. Agents reach the static set through-//! generic bridge tools. It is intentionally separate from this dynamic-//! registry — both kinds share the same transport primitives.+//! The registry itself moved to `tinymcp`: the Smithery and official catalogs,+//! the SQLite store, the live connection map, the subprocess supervisor, the+//! browser sign-in flow, and the setup secret vault all live there now. What is+//! left here is what belongs to *this* application.//!//! # Modules-//! - `types` — data structures (InstalledServer, McpTool, Smithery DTOs, …)-//! - `store` — SQLite persistence (mcp_clients.db)-//! - `registry` — Smithery HTTP client with 10-minute SQLite cache-//! - `connections` — global in-process connection registry (wraps-//! [`crate::openhuman::mcp::config_servers::McpStdioClient`] — there is no-//! separate stdio client here)-//! - `boot` — boot-time spawn of installed local servers-//! - `custom` — add/edit installs whose details the user enters by hand-//! - `ops` — RPC handler implementations-//! - `schemas` — controller schemas + handler dispatch-//! - `bus` — DomainEvent subscriber for lifecycle logging//!-//! # Naming note+//! - [`bus`] — the lifecycle subscriber that logs this domain's events.+//! - [`store`] — the one direct reach into the registry's store that outlives+//! the extraction: an end-to-end test seeding the upstream response cache.+//! - [`ops`] — the `mcp_clients` RPC handlers, delegating to the service+//! [`super::host`] holds and publishing this application's own events.+//! - [`setup_ops`] — the `mcp_setup` handlers, likewise.+//! - `schemas` — the controller schemas and dispatch.+//! - [`supervisor_events`] — what the reconnect supervisor observed each+//! tick, as this domain's events; the Event Log and the notification bridge+//! read those (#5931).+//! - [`tools`] — the agent-facing tools.//!-//! The RPC namespace and SQLite db filename are still `mcp_clients` for-//! backwards compatibility with existing frontend code and on-disk state.-//! The Rust module path is `mcp::registry`.--//! ## Compile-time gate (`mcp` feature)+//! # The naming note still applies+//!+//! The RPC namespace and the database filename are `mcp_clients`, unchanged, so+//! existing frontend code and existing on-disk state keep working across the+//! move.//!-//! `pub mod registry;` is ALWAYS compiled — it is a facade. Everything-//! that carries behaviour (Smithery HTTP client, SQLite store, live-//! connection map, boot spawn, supervisor, OAuth, RPC surface) is gated-//! behind the default-ON `mcp` Cargo feature; when the feature is off,-//! [`stub`] mirrors the subset of the surface that always-compiled callers-//! depend on with no-op / `Err` / empty-`Vec` bodies, so those callers need no-//! `#[cfg]` of their own.+//! # Types come from the contract//!-//! [`types`] stays UNGATED on purpose: it is inert serde data (`serde` +-//! `serde_json` only) consumed by the always-compiled orchestrator prompt-//! builder. Sharing the one real definition across both builds means the-//! disabled build cannot drift from the enabled one — the stub carries-//! behaviour, never duplicated types.+//! Everything this module used to define — the install record, the tool shape,+//! the status summary, the catalog records — is re-exported from+//! `tinymcp_bus`. A parallel set of types here would mean a conversion at every+//! call site that nothing checks.-#[cfg(feature = "mcp")]-pub mod boot;#[cfg(feature = "mcp")]pub mod bus;#[cfg(feature = "mcp")]-pub mod connections;-#[cfg(feature = "mcp")]-mod curation;-#[cfg(feature = "mcp")]-pub mod custom;-#[cfg(feature = "mcp")]-pub mod oauth;+pub(crate) mod helpers;#[cfg(feature = "mcp")]pub mod ops;#[cfg(feature = "mcp")]-mod registries;-#[cfg(feature = "mcp")]-// `module_inception` is a byproduct of the domain-family reorg: the parent was-// renamed from `mcp_registry` to `mcp/registry`, which shortened it to match this-// long-standing inner module. Renaming the inner module would be a real rename-// on top of a pure move, so it is allowed here and left as follow-up.-#[allow(clippy::module_inception)]-mod registry;-#[cfg(feature = "mcp")]mod schemas;#[cfg(feature = "mcp")]-pub mod setup;-#[cfg(feature = "mcp")]pub mod setup_ops;#[cfg(feature = "mcp")]-pub mod store;-#[cfg(feature = "mcp")]-pub mod supervisor;+pub mod supervisor_events;#[cfg(feature = "mcp")]pub mod tools;-// Inert serde types — always compiled (see the module note above).-pub mod types;-#[cfg(feature = "mcp")]pub use schemas::{all_controller_schemas as all_mcp_registry_controller_schemas,@@ -117,13 +54,473 @@ pub use schemas::{schemas as mcp_registry_schemas,};-pub use types::{ConnStatus, InstalledServer, McpTool, ServerProvenance};+/// The payload vocabulary, from the wire contract.+///+/// Re-exported under the path this module used to define them at, so callers+/// keep their spelling.+pub mod types {+ pub use tinymcp_bus::{+ ChatTurn, CommandKind, ConnStatus, ConnectedServerOverview, InstalledServer, McpTool,+ RegistryConnection as SmitheryConnection, RegistryServerDetail as SmitheryServerDetail,+ RegistryServerSummary as SmitheryServerSummary, ServerStatus, Transport,+ };+}++pub use types::{ConnStatus, InstalledServer, McpTool};++/// The live connection map.+///+/// A thin view over the service [`super::host`] holds. It exists because the+/// map used to be a process global and callers reached it through free+/// functions; `tinymcp` owns it instead, so those functions become lookups+/// through the holder. Everything here answers as though nothing were connected+/// when the service is not up yet, which is what a caller running before boot+/// completes should see.+#[cfg(feature = "mcp")]+pub mod connections {+ use crate::openhuman::config::Config;+ pub use tinymcp_bus::ConnectedServerOverview;++ use crate::openhuman::mcp::host;++ /// Every connected server's identity and advertised tools.+ ///+ /// Sorted by qualified name, so a prompt built from this does not reshuffle+ /// between turns and cost its cached prefix.+ pub async fn connected_overview() -> Vec<ConnectedServerOverview> {+ match host::try_service() {+ Some(service) => service.dynamic().connected_overview().await,+ None => Vec::new(),+ }+ }++ /// Every connected server's identity and advertised tools in `config`'s+ /// workspace.+ ///+ /// The counterpart to [`connected_overview`] for a caller that holds a+ /// `Config`, for the same reason [`all_connected_tools_for_config`] and+ /// [`disconnect_for_config`] exist: the ambient form resolves through the+ /// process default, which stops answering once a second workspace is open.+ pub async fn connected_overview_for_config(config: &Config) -> Vec<ConnectedServerOverview> {+ match host::for_config(config) {+ Ok(service) => service.dynamic().connected_overview().await,+ Err(error) => {+ tracing::debug!(+ ?error,+ "[mcp] no host for workspace; reporting no connections"+ );+ Vec::new()+ }+ }+ }++ /// Every tool on every connected server in `config`'s workspace.+ ///+ /// The counterpart to [`all_connected_tools`] for a caller that holds a+ /// `Config`. It resolves through [`host::for_config`], which is keyed by+ /// workspace, rather than through the process-wide default — so it answers+ /// about the workspace the caller named instead of whichever one+ /// `mcp::init` happened to claim first.+ ///+ /// That distinction is invisible in the shipped app, which opens one+ /// workspace, and decisive in a test binary: `resolve` hands back a lone+ /// host but returns `None` once a second one exists, so an ambient lookup+ /// silently reports nothing connected as soon as two tests each open their+ /// own temporary workspace in one process.+ ///+ /// A host that cannot be opened yields an empty list rather than an error:+ /// the callers fold this into a tool list, and MCP being unavailable must+ /// not fail the listing.+ pub async fn all_connected_tools_for_config(+ config: &Config,+ ) -> Vec<(String, String, tinymcp_bus::McpTool)> {+ match host::for_config(config) {+ Ok(service) => service.dynamic().connections().all_connected_tools().await,+ Err(error) => {+ tracing::debug!(?error, "[mcp] no host for workspace; reporting no tools");+ Vec::new()+ }+ }+ }++ /// Every tool on every connected server, paired with its server.+ pub async fn all_connected_tools() -> Vec<(String, String, tinymcp_bus::McpTool)> {+ match host::try_service() {+ Some(service) => service.dynamic().connections().all_connected_tools().await,+ None => Vec::new(),+ }+ }++ /// The tools one connected server advertises, or `None` when it is not+ /// connected.+ pub async fn tools_for(server_id: &str) -> Option<Vec<tinymcp_bus::McpTool>> {+ host::try_service()?+ .dynamic()+ .connections()+ .tools_for(server_id)+ .await+ }++ /// The tools one connected server advertises in `config`'s workspace.+ ///+ /// Named `server_tools_*` rather than `tools_for_config` so it cannot be+ /// misread as [`all_connected_tools_for_config`], which is the every-server+ /// form sitting a few lines above.+ ///+ /// `None` means "not connected". A workspace with no host at all logs and+ /// also yields `None`, because a server cannot be connected in a workspace+ /// that has no host — but the log is there so the two are distinguishable+ /// when this is the answer a caller did not expect.+ pub async fn server_tools_for_config(+ config: &Config,+ server_id: &str,+ ) -> Option<Vec<tinymcp_bus::McpTool>> {+ match host::for_config(config) {+ Ok(service) => service.dynamic().connections().tools_for(server_id).await,+ Err(error) => {+ tracing::debug!(?error, server_id, "[mcp] no host for workspace; no tools");+ None+ }+ }+ }++ /// Whether a server has a live entry.+ pub async fn is_connected(server_id: &str) -> bool {+ match host::try_service() {+ Some(service) => {+ service+ .dynamic()+ .connections()+ .is_connected(server_id)+ .await+ }+ None => false,+ }+ }++ /// Whether a server has a live entry in `config`'s workspace.+ pub async fn is_connected_for_config(config: &Config, server_id: &str) -> bool {+ match host::for_config(config) {+ Ok(service) => {+ service+ .dynamic()+ .connections()+ .is_connected(server_id)+ .await+ }+ Err(error) => {+ tracing::debug!(+ ?error,+ server_id,+ "[mcp] no host for workspace; reporting not connected"+ );+ false+ }+ }+ }++ /// Why a server's most recent attempt hit a 401, as a stable code.+ pub async fn auth_hint_for(server_id: &str) -> Option<&'static str> {+ Some(+ host::try_service()?+ .dynamic()+ .connections()+ .auth_hint(server_id)+ .await?+ .as_code(),+ )+ }++ /// Why a server's most recent attempt in `config`'s workspace hit a 401.+ pub async fn auth_hint_for_config(config: &Config, server_id: &str) -> Option<&'static str> {+ match host::for_config(config) {+ Ok(service) => Some(+ service+ .dynamic()+ .connections()+ .auth_hint(server_id)+ .await?+ .as_code(),+ ),+ Err(error) => {+ tracing::debug!(+ ?error,+ server_id,+ "[mcp] no host for workspace; no auth hint"+ );+ None+ }+ }+ }++ /// Connects one server and returns the tools it advertised.+ ///+ /// # Errors+ ///+ /// Returns an error when the service is not up, or whatever the transport+ /// returns. A failed attempt is recorded either way, so a caller polling+ /// status sees the reason without re-attempting.+ pub async fn connect(+ config: &crate::openhuman::config::Config,+ server: &tinymcp_bus::InstalledServer,+ ) -> anyhow::Result<Vec<tinymcp_bus::McpTool>> {+ let service = host::for_config(config)?;+ let client = host::client_config(config);++ service+ .dynamic()+ .connections()+ .connect(+ service.dynamic().store(),+ service.dynamic().oauth(),+ &client.client_identity,+ client.proxy.as_ref(),+ server,+ )+ .await+ .map_err(|error| anyhow::anyhow!("failed to connect `{}`: {error}", server.server_id))+ }++ /// Drops a server's connection, reporting whether there was one.+ ///+ /// Answers `false` when the service is not up, which is the truth: nothing+ /// was holding a connection to drop.+ pub async fn disconnect(server_id: &str) -> bool {+ match host::try_service() {+ Some(service) => service.dynamic().connections().disconnect(server_id).await,+ None => false,+ }+ }++ /// Drop a connection held in `config`'s workspace.+ ///+ /// The counterpart to [`disconnect`] for a caller that holds a `Config`,+ /// for the same reason [`all_connected_tools_for_config`] exists: the+ /// by-server-id form resolves through the process default, which stops+ /// answering once a second workspace is open. A caller that connected+ /// through [`connect`] already named a workspace and should close over the+ /// same one.+ pub async fn disconnect_for_config(config: &Config, server_id: &str) -> bool {+ match host::for_config(config) {+ Ok(service) => service.dynamic().connections().disconnect(server_id).await,+ Err(error) => {+ tracing::debug!(?error, "[mcp] no host for workspace; nothing to disconnect");+ false+ }+ }+ }++ /// The most recent failure message for a server.+ pub async fn last_error_for(server_id: &str) -> Option<String> {+ host::try_service()?+ .dynamic()+ .connections()+ .last_error(server_id)+ .await+ }++ /// The most recent failure message for a server in `config`'s workspace.+ pub async fn last_error_for_config(config: &Config, server_id: &str) -> Option<String> {+ match host::for_config(config) {+ Ok(service) => service.dynamic().connections().last_error(server_id).await,+ Err(error) => {+ tracing::debug!(+ ?error,+ server_id,+ "[mcp] no host for workspace; no last error"+ );+ None+ }+ }+ }+}++/// The registry's own store, for the callers that reach it directly.+///+/// The store itself moved to `tinymcp`. What is left here is the one entry+/// point outside this module that named it: an end-to-end test seeds the+/// upstream response cache so it can exercise an install without reaching a+/// real catalog. Keeping the spelling means that test needs no edit, and the+/// signature is the one it already calls.+#[cfg(feature = "mcp")]+pub mod store {+ use crate::openhuman::config::Config;+ use crate::openhuman::mcp::host;++ /// Writes one upstream response into the cache for `config`'s workspace.+ ///+ /// # Errors+ ///+ /// Returns an error when the service cannot be opened or the row cannot be+ /// written.+ pub fn set_cached(config: &Config, cache_key: &str, body_json: &str) -> anyhow::Result<()> {+ host::for_config(config)?+ .dynamic()+ .store()+ .cache(cache_key, body_json)+ .map_err(|error| anyhow::anyhow!("failed to seed the registry cache: {error}"))+ }+}++/// Bringing installed servers up at startup.+#[cfg(feature = "mcp")]+pub mod boot {+ use crate::openhuman::config::Config;+ use crate::openhuman::mcp::host;++ /// Connects every enabled installed server.+ ///+ /// Never fails: a server that cannot connect is logged and skipped, because+ /// one broken third-party integration must not stop the core coming up.+ pub async fn spawn_installed_servers(config: &Config) {+ let service = match host::for_config(config) {+ Ok(service) => service,+ Err(error) => {+ tracing::warn!("[mcp] the service could not be opened: {error}");+ return;+ }+ };++ let client = host::client_config(config);+ let outcome = tinymcp::registry::connect_installed_servers(+ service.dynamic().store(),+ service.dynamic().connections(),+ service.dynamic().oauth(),+ &client.client_identity,+ client.proxy.as_ref(),+ )+ .await;++ tracing::info!(+ connected = outcome.connected,+ failed = outcome.failed,+ skipped = outcome.skipped,+ "[mcp] startup connect finished"+ );+ }+}++/// Keeping installed servers connected.+#[cfg(feature = "mcp")]+pub mod supervisor {+ use std::collections::HashMap;+ use std::path::PathBuf;++ use crate::openhuman::mcp::host;++ /// Runs the reconnect supervisor until the process ends.+ ///+ /// One task for every host the process has opened. The connection map is+ /// per-workspace, and a host opened after boot — a workspace switch — is+ /// supervised from the tick after it appears, so no workspace's installed+ /// servers go unsupervised. Each host's backoff state is held here, keyed+ /// by workspace, and the first tick is delayed a whole interval so it does+ /// not race the startup connect pass.+ pub async fn run() {+ let config = tinymcp::SupervisorConfig::default();+ let mut supervisors: HashMap<PathBuf, tinymcp::Supervisor> = HashMap::new();++ let start = tokio::time::Instant::now() + config.tick_interval;+ let mut interval = tokio::time::interval_at(start, config.tick_interval);+ // A tick walks every open workspace's installs in sequence and each+ // probe can take the whole probe window, so a tick can outlast its+ // own interval. The default behaviour would then fire the missed+ // ticks back to back, re-probing servers that were just probed.+ //+ // `Delay` stops that burst but does not on its own leave a gap: it+ // schedules the next deadline one interval after the overdue tick+ // *returns*, which is when the cycle starts, not when it ends. A+ // cycle that consistently outlasts its interval would therefore find+ // the next tick already due and run back to back anyway. The+ // `interval.reset()` at the end of the loop body is what actually+ // paces from when the cycle finished — which is what+ // `tinymcp::Supervisor::run` does, and this loop stands in for it.+ interval.set_missed_tick_behavior(tokio::time::MissedTickBehavior::Delay);++ tracing::info!(+ tick_seconds = config.tick_interval.as_secs(),+ probe_seconds = config.probe_timeout.as_secs(),+ "[mcp] the reconnect supervisor started"+ );++ loop {+ interval.tick().await;+ let now = std::time::Instant::now();++ // Adopt every host currently open. A host opened since the last+ // tick gets a supervisor on this one, built from the identity and+ // proxy it was opened with.+ for (workspace, service, identity, proxy) in host::all_hosts() {+ let supervisor = supervisors+ .entry(workspace.clone())+ .or_insert_with(|| tinymcp::Supervisor::new(config.clone(), identity, proxy));++ let report = supervisor+ .tick(+ service.dynamic().store(),+ service.dynamic().connections(),+ service.dynamic().oauth(),+ now,+ )+ .await;+ // What the tick observed becomes this domain's events, so a+ // probe outcome reaches the Event Log and a server that stays+ // down reaches the user (#5931). The workspace goes with them:+ // this loop covers every host the process has opened, and a+ // subscriber that persists or announces one must not take a+ // switched-away workspace's outage for its own.+ super::supervisor_events::publish(&workspace, &report);+ }++ // Pace from the end of the cycle, not its start: a cycle slower+ // than the interval leaves the next tick already due, and without+ // this the supervisor would probe continuously.+ interval.reset();+ }+ }+}++/// Browser sign-in, from the callback route's point of view.+#[cfg(feature = "mcp")]+pub mod oauth {+ use crate::openhuman::config::Config;+ use crate::openhuman::mcp::host;++ /// Finishes a sign-in from the redirect and reconnects the server.+ ///+ /// # Errors+ ///+ /// Returns a message when the state is unknown or expired, or when the+ /// token exchange fails.+ pub async fn complete(config: &Config, state: &str, code: &str) -> Result<String, String> {+ let outcome = host::for_config(config)+ .map_err(|error| error.to_string())?+ .dynamic()+ .oauth_complete(state, code)+ .await+ .map_err(|error| error.to_string())?;++ Ok(outcome.server_id)+ }+}-/// Applies the host's prompt-injection policy to tools advertised by a remote-/// MCP server before they cross the RPC boundary into agent-visible state.+/// Applies this application's prompt-injection policy to remote tool+/// definitions.+///+/// `tinymcp` returns definitions verbatim: the detector, its rules, and what a+/// hit means are this application's, and a module dropping tools by criteria of+/// its own would be making a decision it cannot explain to anyone.+///+/// A tool whose description trips a rule is dropped, and the drop is+/// logged and published with the *rule code* only — the offending text is never+/// re-emitted, because the payload is the thing that was dangerous.#[cfg(feature = "mcp")]-pub(crate) fn tools_safe_for_agent(server: &str, tools: Vec<McpTool>) -> Vec<McpTool> {- use crate::core::event_bus::{publish_global, DomainEvent};+pub(crate) fn tools_safe_for_agent(+ server: &str,+ tools: Vec<tinymcp_bus::McpTool>,+) -> Vec<tinymcp_bus::McpTool> {+ use crate::core::bus::BUS;+ use crate::core::events::DomainEvent;use crate::openhuman::security::prompt_injection::scan_tool_definition;tools@@ -142,7 +539,7 @@ pub(crate) fn tools_safe_for_agent(server: &str, tools: Vec<McpTool>) -> Vec<Mcpreason = %hit.code,"[mcp] dropped a remote tool that tripped the input-validation scan");- publish_global(DomainEvent::McpToolRejected {+ BUS.publish(DomainEvent::McpToolRejected {server: server.to_string(),tool: tool.name.clone(),reason: hit.code.clone(),diff --git a/tests/json_rpc_e2e.rs b/tests/json_rpc_e2e.rsindex 432ec8c048..c12f5b6ef4 100644--- a/tests/json_rpc_e2e.rs+++ b/tests/json_rpc_e2e.rs@@ -9245,243 +9245,6 @@ async fn mcp_clients_lifecycle() {"disconnect noop should return status=disconnected: {disc_body}");- // ── 8. add_custom persists a hand-entered stdio server ───────────────────- // No registry is consulted: the command comes straight from the caller,- // which is the whole point of the custom path.- let add_custom = post_json_rpc(- &rpc_base,- 9908,- "openhuman.mcp_clients_add_custom",- json!({- "display_name": "My Local Server",- "transport": "stdio",- "command": "echo",- "args": ["hello"],- "env": { "API_KEY": "secret-value" },- }),- )- .await;- let add_result = assert_no_jsonrpc_error(&add_custom, "add_custom (stdio)");- let add_body = peel_logs_envelope(add_result);- let server = add_body- .get("server")- .expect("add_custom must return a 'server' record");- let custom_id = server- .get("server_id")- .and_then(Value::as_str)- .expect("server_id")- .to_string();- assert_eq!(- server.get("provenance").and_then(Value::as_str),- Some("custom"),- "a hand-entered server must be marked custom: {server}"- );- assert_eq!(- server- .get("transport")- .and_then(|t| t.get("kind"))- .and_then(Value::as_str),- Some("stdio"),- "transport must round-trip: {server}"- );- assert!(- server- .get("qualified_name")- .and_then(Value::as_str)- .is_some_and(|q| q.starts_with("custom/")),- "custom servers get a `custom/` identity: {server}"- );- assert_eq!(- server.get("qualified_name").and_then(Value::as_str),- Some("custom/my-local-server"),- "the first server slugs its display name: {server}"- );- // Env values are write-only — key names come back, secrets never do.- let serialized = server.to_string();- assert!(- !serialized.contains("secret-value"),- "add_custom response must not echo env values: {serialized}"- );-- // ── 8b. a second server with the same display name gets a numeric suffix ──- // Two servers may legitimately share a name (same tool, different args), so- // the collision resolves to `-2` rather than erroring. Nothing else exercises- // this suffix path — the unit tests can't reach the DB dedup lookup.- let add_custom_dupe = post_json_rpc(- &rpc_base,- 9918,- "openhuman.mcp_clients_add_custom",- json!({- "display_name": "My Local Server",- "transport": "stdio",- "command": "echo",- "args": ["hello"],- "env": {},- }),- )- .await;- let dupe_body = peel_logs_envelope(assert_no_jsonrpc_error(- &add_custom_dupe,- "add_custom (dupe name)",- ));- assert_eq!(- dupe_body- .get("server")- .and_then(|s| s.get("qualified_name"))- .and_then(Value::as_str),- Some("custom/my-local-server-2"),- "a shared display name must suffix, not error or collide: {dupe_body}"- );- // Clean it up so the later installed-list count stays deterministic.- let dupe_id = dupe_body- .get("server")- .and_then(|s| s.get("server_id"))- .and_then(Value::as_str)- .expect("dupe server_id")- .to_string();- let _ = post_json_rpc(- &rpc_base,- 9919,- "openhuman.mcp_clients_uninstall",- json!({ "server_id": dupe_id }),- )- .await;-- // ── 8c. `install` must refuse to clobber a hand-added row ────────────────- // `mcp_clients_install` dedupes on a free-form `qualified_name` before it- // fetches any listing, so without the provenance guard it would reach the- // custom `custom/my-local-server` row and merge caller env onto connection- // details the user typed (and it can't re-derive) — reachable as an agent- // tool. It must error instead.- let install_over_custom = post_json_rpc(- &rpc_base,- 9920,- "openhuman.mcp_clients_install",- json!({- "qualified_name": "custom/my-local-server",- "env": { "INJECTED": "x" },- }),- )- .await;- let err = assert_jsonrpc_error(&install_over_custom, "install over custom row");- let msg = err- .get("message")- .and_then(Value::as_str)- .unwrap_or_default();- assert!(- msg.contains("custom server"),- "install must refuse a custom row with a clear message: {err}"- );-- // ── 9. the custom server shows up in installed_list ──────────────────────- let list2 = post_json_rpc(- &rpc_base,- 9909,- "openhuman.mcp_clients_installed_list",- json!({}),- )- .await;- let list2_body = peel_logs_envelope(assert_no_jsonrpc_error(- &list2,- "installed_list (after add)",- ));- let installed2 = list2_body- .get("installed")- .and_then(Value::as_array)- .expect("installed array");- assert_eq!(- installed2.len(),- 1,- "the custom install must appear in the unified list: {installed2:?}"- );-- // ── 10. add_custom rejects a non-http scheme ─────────────────────────────- let bad_scheme = post_json_rpc(- &rpc_base,- 9910,- "openhuman.mcp_clients_add_custom",- json!({- "display_name": "Bad Remote",- "transport": "http_remote",- "url": "file:///etc/passwd",- }),- )- .await;- assert!(- bad_scheme.get("error").is_some(),- "a file:// endpoint must be rejected, not stored: {bad_scheme}"- );-- // ── 11. update_custom edits the record it owns ───────────────────────────- let update_custom = post_json_rpc(- &rpc_base,- 9911,- "openhuman.mcp_clients_update_custom",- json!({- "server_id": custom_id,- "display_name": "Renamed Server",- "transport": "http_remote",- "url": "http://127.0.0.1:9/mcp",- // Blank value = keep the stored secret — but only within a transport.- // This call also switches stdio -> http_remote, which re-scopes the- // map from subprocess env to request headers, so the stored value- // must NOT be kept.- "env": { "API_KEY": "" },- }),- )- .await;- let upd_body = peel_logs_envelope(assert_no_jsonrpc_error(&update_custom, "update_custom"));- let updated = upd_body.get("server").expect("updated server record");- assert_eq!(- updated.get("display_name").and_then(Value::as_str),- Some("Renamed Server")- );- assert_eq!(- updated- .get("transport")- .and_then(|t| t.get("kind"))- .and_then(Value::as_str),- Some("http_remote"),- "an edit must be able to switch transport: {updated}"- );- // `API_KEY` was added at step 8 as a *subprocess env var*. Carrying it across- // the switch would make `build_http_auth` send it to the endpoint as a- // header — a secret that only ever reached a local process, now on the wire,- // and invisible to the user because values are write-only. The core, not the- // form, has to enforce this: /rpc, the CLI and the iOS client never touch the- // React layer.- let kept_keys = updated- .get("env_keys")- .and_then(Value::as_array)- .expect("env_keys");- assert!(- !kept_keys.iter().any(|k| k.as_str() == Some("API_KEY")),- "a transport switch must not carry a stdio secret into request headers: {updated}"- );- // Identity is immutable across an edit.- assert_eq!(- updated.get("server_id").and_then(Value::as_str),- Some(custom_id.as_str())- );-- // ── 12. update_custom refuses a server it does not own ───────────────────- let update_missing = post_json_rpc(- &rpc_base,- 9912,- "openhuman.mcp_clients_update_custom",- json!({- "server_id": "00000000-0000-0000-0000-000000000004",- "display_name": "Nope",- "transport": "stdio",- "command": "echo",- }),- )- .await;- assert!(- update_missing.get("error").is_some(),- "update_custom on an unknown server must error: {update_missing}"- );-mock_join.abort();rpc_join.abort();}diff --git a/tests/mcp_registry_e2e.rs b/tests/mcp_registry_e2e.rsindex 7bc4318ceb..fd4f46030a 100644--- a/tests/mcp_registry_e2e.rs+++ b/tests/mcp_registry_e2e.rs@@ -9,16 +9,41 @@// Exercises the gated `mcp_registry` / `mcp_client` surface, so the whole suite// is compiled only when the `mcp` feature is on. Without this gate the slim-// build's `cargo test --no-default-features --features tokenjuice-treesitter-// --tests` fails to compile against the removed APIs (#4799).+// build's `cargo test --no-default-features --tests` fails to compile against the removed APIs (#4799).#![cfg(feature = "mcp")]use openhuman_core::openhuman::config::Config;-use openhuman_core::openhuman::mcp::registry::connections;-use openhuman_core::openhuman::mcp::registry::store;-use openhuman_core::openhuman::mcp::registry::types::{- CommandKind, InstalledServer, ServerProvenance, Transport,-};+use tinymcp_bus::{CommandKind, InstalledServer, Transport};++/// The service over `config`'s workspace.+///+/// Resolved the same way the RPC handlers resolve it, so a connection this test+/// opens directly is the same one a handler sees. Each case uses its own+/// workspace, so each gets its own store.+fn host(config: &Config) -> std::sync::Arc<openhuman_core::openhuman::mcp::host::McpHost> {+ openhuman_core::openhuman::mcp::host::for_config(config).expect("the mcp host opens")+}++/// Runs exactly one supervision cycle against `host`.+///+/// Driven a tick at a time rather than through the loop, so the test does not+/// wait on a timer for something it can ask for directly.+async fn supervise_once(host: &openhuman_core::openhuman::mcp::host::McpHost) {+ let mut supervisor = tinymcp::Supervisor::new(+ tinymcp::SupervisorConfig::default(),+ tinymcp_bus::McpClientIdentityConfig::default(),+ None,+ );++ supervisor+ .tick(+ host.dynamic().store(),+ host.dynamic().connections(),+ host.dynamic().oauth(),+ std::time::Instant::now(),+ )+ .await;+}fn fresh_workspace_config() -> (tempfile::TempDir, Config) {let tmp = tempfile::tempdir().expect("tempdir");@@ -44,29 +69,35 @@ fn make_installed_server() -> InstalledServer {last_connected_at: None,transport: Transport::Stdio,enabled: true,- provenance: ServerProvenance::Registry,}}#[tokio::test]async fn connect_lists_one_tool_then_disconnect() {let (_tmp, cfg) = fresh_workspace_config();+ let h = host(&cfg);let server = make_installed_server();// Insert into the store so `all_status` (which reads from store) sees it,// and so a follow-up `boot::spawn_installed_servers` would pick it up.- store::insert_server(&cfg, &server).expect("insert installed server");+ h.dynamic()+ .store()+ .insert_server(&server)+ .expect("insert installed server");// Connect: spawns the stub subprocess and runs `initialize` + `tools/list`.- let tools = connections::connect(&cfg, &server)+ let tools = h+ .dynamic()+ .connect(&server.server_id).await- .expect("connect succeeds");+ .expect("connect succeeds")+ .tools;assert_eq!(tools.len(), 1, "stub advertises one tool");assert_eq!(tools[0].name, "echo");assert!(tools[0].input_schema.is_object());// Status reflects the live connection.- let statuses = connections::all_status(&cfg).await;+ let statuses = h.dynamic().status().await.expect("status");let mine = statuses.iter().find(|s| s.server_id == server.server_id)@@ -74,15 +105,18 @@ async fn connect_lists_one_tool_then_disconnect() {assert_eq!(mine.tool_count, 1);// Call the `echo` tool and verify the response payload.- let result = connections::call_tool(- &server.server_id,- "echo",- serde_json::json!({ "message": "hello mcp" }),- )- .await- .expect("call_tool succeeds");+ let result = h+ .dynamic()+ .tool_call(+ &server.server_id,+ "echo",+ serde_json::json!({ "message": "hello mcp" }),+ )+ .await+ .expect("call_tool succeeds");let text = result+ .result.get("content").and_then(|c| c.as_array()).and_then(|arr| arr.first())@@ -92,54 +126,85 @@ async fn connect_lists_one_tool_then_disconnect() {assert_eq!(text, "hello mcp", "echo tool returns the input verbatim");// Disconnect: removes from the registry and closes the subprocess.- let removed = connections::disconnect(&server.server_id).await;+ let removed = h+ .dynamic()+ .connections()+ .disconnect(&server.server_id)+ .await;assert!(removed, "disconnect drops the live connection");// Subsequent call fails because the server_id is no longer connected.- let err = connections::call_tool(- &server.server_id,- "echo",- serde_json::json!({ "message": "post-disconnect" }),- )- .await- .expect_err("call_tool fails after disconnect");- assert!(err.contains("not connected"));+ let err = h+ .dynamic()+ .tool_call(+ &server.server_id,+ "echo",+ serde_json::json!({ "message": "post-disconnect" }),+ )+ .await+ .expect_err("call_tool fails after disconnect");+ assert!(err.to_string().contains("not connected"));}#[tokio::test]async fn unknown_tool_call_returns_error() {let (_tmp, cfg) = fresh_workspace_config();+ let h = host(&cfg);let server = make_installed_server();- store::insert_server(&cfg, &server).expect("insert installed server");+ h.dynamic()+ .store()+ .insert_server(&server)+ .expect("insert installed server");- connections::connect(&cfg, &server).await.expect("connect");+ h.dynamic()+ .connect(&server.server_id)+ .await+ .expect("connect")+ .tools;- let err = connections::call_tool(&server.server_id, "does_not_exist", serde_json::json!({}))+ let err = h+ .dynamic()+ .tool_call(&server.server_id, "does_not_exist", serde_json::json!({})).await.expect_err("stub rejects unknown tools");assert!(- err.to_lowercase().contains("unknown tool") || err.contains("error"),+ err.to_string().to_lowercase().contains("unknown tool")+ || err.to_string().contains("error"),"expected unknown-tool error, got: {err}");- let _ = connections::disconnect(&server.server_id).await;+ let _ = h+ .dynamic()+ .connections()+ .disconnect(&server.server_id)+ .await;}#[tokio::test]async fn failed_connect_records_last_error() {let (_tmp, cfg) = fresh_workspace_config();+ let h = host(&cfg);let mut server = make_installed_server();server.command = "/this/path/does/not/exist".to_string();- store::insert_server(&cfg, &server).expect("insert installed server");+ h.dynamic()+ .store()+ .insert_server(&server)+ .expect("insert installed server");- let err = connections::connect(&cfg, &server)+ let err = h+ .dynamic()+ .connect(&server.server_id).await.expect_err("connect should fail for bogus command");assert!(!err.to_string().is_empty());- let recorded = connections::last_error_for(&server.server_id).await;+ let recorded = h+ .dynamic()+ .connections()+ .last_error(&server.server_id)+ .await;assert!(recorded.is_some(),"LAST_ERRORS must hold the connect failure for server_id={}",@@ -150,35 +215,60 @@ async fn failed_connect_records_last_error() {#[tokio::test]async fn successful_connect_clears_last_error() {let (_tmp, cfg) = fresh_workspace_config();+ let h = host(&cfg);let mut server = make_installed_server();++ // Connecting resolves the install from the store, so a change to the record+ // only takes effect once it is written there.server.command = "/nonexistent".to_string();- let _ = connections::connect(&cfg, &server).await;- assert!(connections::last_error_for(&server.server_id)+ h.dynamic().store().insert_server(&server).expect("insert");+ let _ = h.dynamic().connect(&server.server_id).await;+ assert!(h+ .dynamic()+ .connections()+ .last_error(&server.server_id).await.is_some());server.command = env!("CARGO_BIN_EXE_test-mcp-stub").to_string();- connections::connect(&cfg, &server)+ h.dynamic()+ .store()+ .delete_server(&server.server_id)+ .expect("drop the bogus record");+ h.dynamic()+ .store()+ .insert_server(&server)+ .expect("reinsert");+ h.dynamic()+ .connect(&server.server_id).await- .expect("real connect succeeds");+ .expect("real connect succeeds")+ .tools;assert!(- connections::last_error_for(&server.server_id)+ h.dynamic()+ .connections()+ .last_error(&server.server_id).await.is_none(),"successful connect must clear the prior error");- let _ = connections::disconnect(&server.server_id).await;+ let _ = h+ .dynamic()+ .connections()+ .disconnect(&server.server_id)+ .await;}#[tokio::test]async fn status_priority_disabled_outranks_connected() {let (_tmp, cfg) = fresh_workspace_config();+ let h = host(&cfg);let mut server = make_installed_server();server.enabled = false;- store::insert_server(&cfg, &server).expect("insert");+ h.dynamic().store().insert_server(&server).expect("insert");- let statuses = connections::all_status(&cfg).await;+ let statuses = h.dynamic().status().await.expect("status");let mine = statuses.iter().find(|s| s.server_id == server.server_id)@@ -194,12 +284,13 @@ async fn status_priority_disabled_outranks_connected() {#[tokio::test]async fn status_reflects_last_connect_error() {let (_tmp, cfg) = fresh_workspace_config();+ let h = host(&cfg);let mut server = make_installed_server();server.command = "/nonexistent".to_string();- store::insert_server(&cfg, &server).expect("insert");+ h.dynamic().store().insert_server(&server).expect("insert");- let _ = connections::connect(&cfg, &server).await;- let statuses = connections::all_status(&cfg).await;+ let _ = h.dynamic().connect(&server.server_id).await;+ let statuses = h.dynamic().status().await.expect("status");let mine = statuses.iter().find(|s| s.server_id == server.server_id)@@ -219,17 +310,18 @@ async fn boot_skips_disabled_servers_and_records_errors() {use openhuman_core::openhuman::mcp::registry::boot;let (_tmp, cfg) = fresh_workspace_config();+ let h = host(&cfg);// Server A: enabled, real stub → connects.let mut a = make_installed_server();a.server_id = format!("a-{}", uuid::Uuid::new_v4());- store::insert_server(&cfg, &a).expect("insert a");+ h.dynamic().store().insert_server(&a).expect("insert a");// Server B: enabled but command does not exist → records error, doesn't crash boot.let mut b = make_installed_server();b.server_id = format!("b-{}", uuid::Uuid::new_v4());b.command = "/nonexistent-mcp".to_string();- store::insert_server(&cfg, &b).expect("insert b");+ h.dynamic().store().insert_server(&b).expect("insert b");// Server C: disabled AND command is bogus. If boot ever attempts to// connect this server, the bogus command will fail and LAST_ERRORS will@@ -240,13 +332,13 @@ async fn boot_skips_disabled_servers_and_records_errors() {c.server_id = format!("c-{}", uuid::Uuid::new_v4());c.enabled = false;c.command = "/nonexistent-disabled-server".to_string();- store::insert_server(&cfg, &c).expect("insert c");+ h.dynamic().store().insert_server(&c).expect("insert c");boot::spawn_installed_servers(&cfg).await;// A is connected; B recorded an error; C never attempted (no error// recorded despite the bogus command).- let statuses = connections::all_status(&cfg).await;+ let statuses = h.dynamic().status().await.expect("status");let by_id = |id: &str| {statuses.iter()@@ -258,11 +350,15 @@ async fn boot_skips_disabled_servers_and_records_errors() {assert_eq!(by_id(&b.server_id).status.as_str(), "error");assert_eq!(by_id(&c.server_id).status.as_str(), "disabled");assert!(- connections::last_error_for(&c.server_id).await.is_none(),+ h.dynamic()+ .connections()+ .last_error(&c.server_id)+ .await+ .is_none(),"disabled server with bogus command must not have been connect-attempted");- let _ = connections::disconnect(&a.server_id).await;+ let _ = h.dynamic().connections().disconnect(&a.server_id).await;}#[tokio::test]@@ -270,18 +366,34 @@ async fn set_enabled_false_disconnects_running_server() {use openhuman_core::openhuman::mcp::registry::ops;let (_tmp, cfg) = fresh_workspace_config();+ let h = host(&cfg);let server = make_installed_server();- store::insert_server(&cfg, &server).expect("insert");- connections::connect(&cfg, &server).await.expect("connect");+ h.dynamic().store().insert_server(&server).expect("insert");+ h.dynamic()+ .connect(&server.server_id)+ .await+ .expect("connect")+ .tools;let outcome = ops::mcp_clients_set_enabled(&cfg, server.server_id.clone(), false).await.expect("set_enabled ok");assert_eq!(outcome.value["enabled"], serde_json::json!(false));- let loaded = store::get_server(&cfg, &server.server_id).unwrap();+ let loaded = h.dynamic().store().get_server(&server.server_id).unwrap();assert!(!loaded.enabled);- let statuses = connections::all_status(&cfg).await;+ // The `enabled` flag and the `disabled` status string are both derived from+ // the store record, so on their own they would not catch a connection that+ // survived the toggle. Disabling a running server must drop the live+ // connection too.+ assert!(+ !h.dynamic()+ .connections()+ .is_connected(&server.server_id)+ .await,+ "disabling a running server must drop its live connection"+ );+ let statuses = h.dynamic().status().await.expect("status");let mine = statuses.iter().find(|s| s.server_id == server.server_id)@@ -294,14 +406,18 @@ async fn connect_refuses_disabled_server() {use openhuman_core::openhuman::mcp::registry::ops;let (_tmp, cfg) = fresh_workspace_config();+ let h = host(&cfg);let mut server = make_installed_server();server.enabled = false;- store::insert_server(&cfg, &server).expect("insert");+ h.dynamic().store().insert_server(&server).expect("insert");let err = ops::mcp_clients_connect(&cfg, server.server_id.clone()).await.expect_err("connect must reject disabled server");- assert!(err.to_lowercase().contains("disabled"), "got: {err}");+ assert!(+ err.to_string().to_lowercase().contains("disabled"),+ "got: {err}"+ );}#[tokio::test]@@ -309,14 +425,15 @@ async fn set_enabled_true_clears_disabled_status_but_does_not_auto_connect() {use openhuman_core::openhuman::mcp::registry::ops;let (_tmp, cfg) = fresh_workspace_config();+ let h = host(&cfg);let mut server = make_installed_server();server.enabled = false;- store::insert_server(&cfg, &server).expect("insert");+ h.dynamic().store().insert_server(&server).expect("insert");ops::mcp_clients_set_enabled(&cfg, server.server_id.clone(), true).await.expect("set_enabled true ok");- let statuses = connections::all_status(&cfg).await;+ let statuses = h.dynamic().status().await.expect("status");let mine = statuses.iter().find(|s| s.server_id == server.server_id)@@ -334,9 +451,10 @@ async fn update_env_on_disabled_server_persists_but_does_not_reconnect() {use std::collections::HashMap;let (_tmp, cfg) = fresh_workspace_config();+ let h = host(&cfg);let mut server = make_installed_server();server.enabled = false;- store::insert_server(&cfg, &server).expect("insert");+ h.dynamic().store().insert_server(&server).expect("insert");let mut env = HashMap::new();env.insert("API_KEY".to_string(), "deadbeef".to_string());@@ -349,7 +467,7 @@ async fn update_env_on_disabled_server_persists_but_does_not_reconnect() {"disabled server reports status=disabled instead of reconnecting");- let statuses = connections::all_status(&cfg).await;+ let statuses = h.dynamic().status().await.expect("status");let mine = statuses.iter().find(|s| s.server_id == server.server_id)@@ -367,17 +485,21 @@ async fn update_env_merges_partial_update_preserving_other_secrets() {use std::collections::HashMap;let (_tmp, cfg) = fresh_workspace_config();+ let h = host(&cfg);let mut server = make_installed_server();// Disabled so update_env persists without attempting a live reconnect —// we only assert the persisted env here.server.enabled = false;- store::insert_server(&cfg, &server).expect("insert");+ h.dynamic().store().insert_server(&server).expect("insert");// Seed two stored secrets.let mut initial = HashMap::new();initial.insert("API_KEY".to_string(), "key-1".to_string());initial.insert("OTHER_SECRET".to_string(), "other-1".to_string());- store::set_env_values(&cfg, &server.server_id, &initial).expect("seed env");+ h.dynamic()+ .store()+ .set_env_values(&server.server_id, &initial.clone().into_iter().collect())+ .expect("seed env");// Partial update: only API_KEY, as the connect modal would send for a// single edited field.@@ -387,7 +509,11 @@ async fn update_env_merges_partial_update_preserving_other_secrets() {.await.expect("update_env returns Ok");- let stored = store::load_env_values(&cfg, &server.server_id).expect("load env");+ let stored = h+ .dynamic()+ .store()+ .load_env_values(&server.server_id)+ .expect("load env");assert_eq!(stored.get("API_KEY").map(String::as_str),Some("key-2"),@@ -405,81 +531,432 @@ async fn update_env_merges_partial_update_preserving_other_secrets() {#[tokio::test]async fn probe_alive_reflects_transport_liveness() {let (_tmp, cfg) = fresh_workspace_config();+ let h = host(&cfg);let server = make_installed_server();- store::insert_server(&cfg, &server).expect("insert installed server");+ h.dynamic()+ .store()+ .insert_server(&server)+ .expect("insert installed server");- connections::connect(&cfg, &server).await.expect("connect");- assert!(connections::is_connected(&server.server_id).await);+ h.dynamic()+ .connect(&server.server_id)+ .await+ .expect("connect")+ .tools;+ assert!(+ h.dynamic()+ .connections()+ .is_connected(&server.server_id)+ .await+ );assert!(- connections::probe_alive(&server.server_id, std::time::Duration::from_secs(8)).await,+ h.dynamic()+ .connections()+ .probe_alive(&server.server_id, std::time::Duration::from_secs(8))+ .await+ .is_alive(),"a live stub answers the tools/list probe");- connections::disconnect(&server.server_id).await;- assert!(!connections::is_connected(&server.server_id).await);+ h.dynamic()+ .connections()+ .disconnect(&server.server_id)+ .await;assert!(- !connections::probe_alive(&server.server_id, std::time::Duration::from_secs(8)).await,+ !h.dynamic()+ .connections()+ .is_connected(&server.server_id)+ .await+ );+ assert!(+ !h.dynamic()+ .connections()+ .probe_alive(&server.server_id, std::time::Duration::from_secs(8))+ .await+ .is_alive(),"a disconnected server is not alive");}#[tokio::test]async fn supervisor_reconnects_a_dropped_server() {- use openhuman_core::openhuman::mcp::registry::supervisor;-let (_tmp, cfg) = fresh_workspace_config();+ let h = host(&cfg);let server = make_installed_server();- store::insert_server(&cfg, &server).expect("insert installed server");+ h.dynamic()+ .store()+ .insert_server(&server)+ .expect("insert installed server");// Bring it up, then simulate a silent transport drop by disconnecting while// it stays installed + enabled in the store.- connections::connect(&cfg, &server).await.expect("connect");- connections::disconnect(&server.server_id).await;- assert!(!connections::is_connected(&server.server_id).await);+ h.dynamic()+ .connect(&server.server_id)+ .await+ .expect("connect")+ .tools;+ h.dynamic()+ .connections()+ .disconnect(&server.server_id)+ .await;+ assert!(+ !h.dynamic()+ .connections()+ .is_connected(&server.server_id)+ .await+ );// One supervisor tick should notice the enabled-but-disconnected server and// reconnect it.- supervisor::run_single_tick_for_test(&cfg).await;+ supervise_once(&h).await;assert!(- connections::is_connected(&server.server_id).await,+ h.dynamic()+ .connections()+ .is_connected(&server.server_id)+ .await,"supervisor reconnects a dropped-but-installed server");- assert!(connections::probe_alive(&server.server_id, std::time::Duration::from_secs(8)).await);+ assert!(h+ .dynamic()+ .connections()+ .probe_alive(&server.server_id, std::time::Duration::from_secs(8))+ .await+ .is_alive());- connections::disconnect(&server.server_id).await;+ h.dynamic()+ .connections()+ .disconnect(&server.server_id)+ .await;}#[tokio::test]async fn supervisor_leaves_a_healthy_connection_intact() {- use openhuman_core::openhuman::mcp::registry::supervisor;-let (_tmp, cfg) = fresh_workspace_config();+ let h = host(&cfg);let server = make_installed_server();- store::insert_server(&cfg, &server).expect("insert installed server");- connections::connect(&cfg, &server).await.expect("connect");+ h.dynamic()+ .store()+ .insert_server(&server)+ .expect("insert installed server");+ h.dynamic()+ .connect(&server.server_id)+ .await+ .expect("connect")+ .tools;// A tick over a healthy server must keep it connected (probe succeeds → no// disconnect/reconnect churn).- supervisor::run_single_tick_for_test(&cfg).await;- assert!(connections::is_connected(&server.server_id).await);+ supervise_once(&h).await;+ assert!(+ h.dynamic()+ .connections()+ .is_connected(&server.server_id)+ .await+ );- connections::disconnect(&server.server_id).await;+ h.dynamic()+ .connections()+ .disconnect(&server.server_id)+ .await;}#[tokio::test]async fn supervisor_skips_a_disabled_server() {- use openhuman_core::openhuman::mcp::registry::supervisor;-let (_tmp, cfg) = fresh_workspace_config();+ let h = host(&cfg);let mut server = make_installed_server();server.enabled = false;- store::insert_server(&cfg, &server).expect("insert installed server");+ h.dynamic()+ .store()+ .insert_server(&server)+ .expect("insert installed server");// A disabled server must never be connected by the supervisor.- supervisor::run_single_tick_for_test(&cfg).await;+ supervise_once(&h).await;assert!(- !connections::is_connected(&server.server_id).await,+ !h.dynamic()+ .connections()+ .is_connected(&server.server_id)+ .await,"supervisor does not connect disabled servers");}++/// The per-config connection lookups must answer about the workspace they were+/// handed (#5701).+///+/// `connections::connect` has always resolved per-config via `host::for_config`,+/// while the by-server-id lookups read the process-global `host::try_service`.+/// A host that connects through the facade could therefore never see the+/// connection it had just made.+///+/// The precondition below is what makes this test discriminate: with two+/// workspaces open and no default, `try_service` refuses to guess and answers+/// `None`, so anything routed through it degrades to "nothing is connected".+/// An embedder holding its own per-config service is in that state permanently.+#[tokio::test]+async fn per_config_lookups_see_a_per_config_connection() {+ use openhuman_core::openhuman::mcp::host;+ use openhuman_core::openhuman::mcp::registry::connections;++ let (_tmp_a, cfg_a) = fresh_workspace_config();+ let (_tmp_b, cfg_b) = fresh_workspace_config();+ let _host_b = host(&cfg_b);++ let h = host(&cfg_a);+ let server = make_installed_server();+ h.dynamic()+ .store()+ .insert_server(&server)+ .expect("insert installed server");++ let tools = connections::connect(&cfg_a, &server)+ .await+ .expect("connect succeeds");+ assert_eq!(tools.len(), 1, "stub advertises one tool");++ assert!(+ host::try_service().is_none(),+ "two workspaces open and no default: the ambient service must refuse to \+ guess, which is what makes the per-config forms the only correct ones here"+ );++ assert!(+ connections::is_connected_for_config(&cfg_a, &server.server_id).await,+ "the workspace that connected must see its own connection"+ );++ let listed = connections::server_tools_for_config(&cfg_a, &server.server_id)+ .await+ .expect("the connected server advertises its tools");+ assert_eq!(listed.len(), 1);+ assert_eq!(listed[0].name, "echo");++ let overview = connections::connected_overview_for_config(&cfg_a).await;+ assert!(+ overview.iter().any(|s| s.server_id == server.server_id),+ "the overview for this workspace must list the server it connected"+ );++ assert!(+ connections::last_error_for_config(&cfg_a, &server.server_id)+ .await+ .is_none(),+ "a successful connect leaves no error behind"+ );++ // A different workspace is a different connection map, not a shared one.+ assert!(+ !connections::is_connected_for_config(&cfg_b, &server.server_id).await,+ "a connection must not leak across workspaces"+ );++ assert!(connections::disconnect_for_config(&cfg_a, &server.server_id).await);+ assert!(!connections::is_connected_for_config(&cfg_a, &server.server_id).await);+}++// ── Probe outcomes (#5772) ────────────────────────────────────────────────────++/// `probe_alive` returns a four-variant `ProbeOutcome` instead of a bool, and+/// `probe_alive_reflects_transport_liveness` above only ever asks+/// `.is_alive()` — which is `false` for `Missing`, `Broken` and `TimedOut`+/// alike, so nothing pinned which one comes back.+///+/// This pins the two that are reachable in a hermetic test: an entry that was+/// never connected, and one that has been disconnected, must both report+/// `Missing` — "there was nothing to probe" — rather than a transport failure+/// nobody observed. That distinction is what the old bool could not express and+/// is the half of #5636 this harness can actually demonstrate.+#[tokio::test]+async fn probe_alive_distinguishes_a_missing_entry_from_a_timed_out_one() {+ let (_tmp, cfg) = fresh_workspace_config();+ let h = host(&cfg);+ let server = make_installed_server();+ h.dynamic()+ .store()+ .insert_server(&server)+ .expect("insert installed server");++ // Installed but never connected: there is no live entry, so there is+ // nothing to probe.+ assert_eq!(+ h.dynamic()+ .connections()+ .probe_alive(&server.server_id, std::time::Duration::from_secs(8))+ .await,+ tinymcp::ProbeOutcome::Missing,+ "a server that was never connected has no entry to probe"+ );++ h.dynamic()+ .connect(&server.server_id)+ .await+ .expect("connect")+ .tools;++ // Connected and answering: a real round trip inside a real window.+ match h+ .dynamic()+ .connections()+ .probe_alive(&server.server_id, std::time::Duration::from_secs(8))+ .await+ {+ tinymcp::ProbeOutcome::Alive { .. } => {}+ other => panic!("a live stub must probe Alive, got {other:?}"),+ }++ // NOT asserted here: `TimedOut`. It is the variant this enum most exists+ // for, and it is unreachable against this stub — a probe with a+ // `Duration::ZERO` window still came back `Alive { elapsed: 42.708µs }`,+ // because `tokio::time::timeout` polls the inner future before it checks+ // the deadline and `list_tools` on an established connection answers inside+ // that first poll. Producing a real timeout needs a server that stalls on+ // `tools/list`, which `test-mcp-stub` cannot be asked to do. Asserting it+ // by contriving the window would have pinned nothing; see+ // ~/tinyhuman/bugs/W6-test-findings.md.++ // Disconnecting removes the entry, so the outcome goes back to Missing+ // rather than to a transport error.+ h.dynamic()+ .connections()+ .disconnect(&server.server_id)+ .await;+ assert_eq!(+ h.dynamic()+ .connections()+ .probe_alive(&server.server_id, std::time::Duration::from_secs(8))+ .await,+ tinymcp::ProbeOutcome::Missing,+ "a disconnected server has no entry, so nothing was observed to fail"+ );+}++/// The supervisor's default probe window is 8s.+///+/// tinymcp#5 widened it to 30s and paired that with `MissedTickBehavior::Delay`+/// in `Supervisor::run` — which this host never calls: `mcp/registry/mod.rs`+/// builds its own interval and calls `Supervisor::tick` directly, once per open+/// workspace. openhuman would have inherited the wider window with none of the+/// protection, so `b44b958d` put the default back. Nothing pinned it, and the+/// value is only reachable through `SupervisorConfig::default()` — exactly what+/// `supervise_once` above uses.+#[test]+fn supervisor_default_probe_window_stays_eight_seconds() {+ assert_eq!(+ tinymcp::SupervisorConfig::default().probe_timeout,+ std::time::Duration::from_secs(8),+ "widening this default without a missed-tick policy in the host's own loop is the \+ regression b44b958d reverted"+ );+}++/// An HTTP-remote install pointed at `url`.+///+/// The stdio fixture above cannot reach the auth path at all: a 401 is an HTTP+/// fact, so the credential hints only exist for this transport.+fn make_http_remote_server(url: &str) -> InstalledServer {+ InstalledServer {+ server_id: format!("test-http-{}", uuid::Uuid::new_v4()),+ qualified_name: "@openhuman-test/remote".to_string(),+ display_name: "Test Remote".to_string(),+ description: Some("Stub HTTP-remote MCP server used by mcp_registry_e2e tests.".into()),+ icon_url: None,+ // Carried but unread for this transport — callers route off `transport`.+ command_kind: CommandKind::Binary,+ command: String::new(),+ args: Vec::new(),+ env_keys: Vec::new(),+ config: None,+ installed_at: 0,+ last_connected_at: None,+ transport: Transport::HttpRemote {+ url: url.to_string(),+ },+ enabled: true,+ }+}++/// The failure side of the per-config lookups (#5701).+///+/// `per_config_lookups_see_a_per_config_connection` covers the success side and+/// asserts `last_error_for_config` is `None` after a clean connect. That leaves+/// the half that matters for diagnosis untested: `auth_hint_for_config` had no+/// reference in any e2e lane at all, and nothing anywhere asserted that a real+/// failure is actually *surfaced* rather than folded into the same `None` a+/// missing workspace returns.+///+/// The two-workspace precondition is what makes this discriminate. With two+/// hosts open and no default, `host::try_service()` refuses to guess, so the+/// ambient forms answer `None` for a server that genuinely has both a hint and+/// an error recorded — which is exactly the confusion #5701 was filed about.+#[tokio::test]+async fn per_config_failure_lookups_surface_the_reason() {+ use openhuman_core::openhuman::mcp::host;+ use openhuman_core::openhuman::mcp::registry::connections;+ use wiremock::matchers::any;+ use wiremock::{Mock, MockServer, ResponseTemplate};++ // A server that refuses everything for want of credentials.+ let upstream = MockServer::start().await;+ Mock::given(any())+ .respond_with(ResponseTemplate::new(401))+ .mount(&upstream)+ .await;++ let (_tmp_a, cfg_a) = fresh_workspace_config();+ let (_tmp_b, cfg_b) = fresh_workspace_config();+ let _host_b = host(&cfg_b);++ let h = host(&cfg_a);+ let server = make_http_remote_server(&upstream.uri());+ h.dynamic()+ .store()+ .insert_server(&server)+ .expect("insert installed server");++ let outcome = connections::connect(&cfg_a, &server).await;+ assert!(+ outcome.is_err(),+ "a 401 from the endpoint must fail the connect, not report success"+ );++ assert!(+ host::try_service().is_none(),+ "two workspaces open and no default: the ambient service must refuse to guess, \+ which is what makes the per-config forms the only correct ones here"+ );++ let hint = connections::auth_hint_for_config(&cfg_a, &server.server_id).await;+ assert_eq!(+ hint,+ Some("credential_required"),+ "the workspace that attempted the connect must see why its 401 happened"+ );++ let last_error = connections::last_error_for_config(&cfg_a, &server.server_id).await;+ // Non-empty after trimming, not merely `Some`: the contract this pins is a+ // *readable* reason, and `Some(String::new())` satisfies `is_some()` while+ // telling a caller polling status precisely nothing.+ assert!(+ last_error+ .as_deref()+ .is_some_and(|error| !error.trim().is_empty()),+ "a failed attempt must leave a readable reason behind — `connect`'s own contract \+ is that a caller polling status sees it without re-attempting; got {last_error:?}"+ );++ // A failure belongs to the workspace that hit it, not to every workspace.+ assert!(+ connections::auth_hint_for_config(&cfg_b, &server.server_id)+ .await+ .is_none(),+ "an auth hint must not leak across workspaces"+ );+ assert!(+ connections::last_error_for_config(&cfg_b, &server.server_id)+ .await+ .is_none(),+ "a failure must not leak across workspaces"+ );+}diff --git a/tests/mcp_registry_multi_server.rs b/tests/mcp_registry_multi_server.rsindex 6ac06a331b..44b59b9adc 100644--- a/tests/mcp_registry_multi_server.rs+++ b/tests/mcp_registry_multi_server.rs@@ -14,15 +14,22 @@// Exercises the gated `mcp_registry` surface, so the whole suite is compiled// only when the `mcp` feature is on — otherwise the slim build's-// `cargo test --no-default-features --features tokenjuice-treesitter --tests`+// `cargo test --no-default-features --tests`// fails to compile against the removed APIs (#4799).#![cfg(feature = "mcp")]use openhuman_core::openhuman::config::Config;-use openhuman_core::openhuman::mcp::registry::types::{- CommandKind, InstalledServer, ServerProvenance, Transport,-};-use openhuman_core::openhuman::mcp::registry::{connections, ops, store};+use openhuman_core::openhuman::mcp::registry::ops;+use tinymcp_bus::{CommandKind, InstalledServer, Transport};++/// The service over `config`'s workspace.+///+/// Resolved the same way the RPC handlers resolve it, so a connection this test+/// opens directly is the same one a handler sees. Each case uses its own+/// workspace, so each gets its own store.+fn host(config: &Config) -> std::sync::Arc<openhuman_core::openhuman::mcp::host::McpHost> {+ openhuman_core::openhuman::mcp::host::for_config(config).expect("the mcp host opens")+}// ── helpers ──────────────────────────────────────────────────────────────────@@ -50,7 +57,6 @@ fn make_stub_server(qualified: &str) -> InstalledServer {last_connected_at: None,transport: Transport::Stdio,enabled: true,- provenance: ServerProvenance::Registry,}}@@ -75,6 +81,7 @@ fn extract_echo_text(result: &serde_json::Value) -> &str {#[tokio::test]async fn two_servers_same_tool_name_no_collision() {let (_tmp, cfg) = fresh_workspace_config();+ let h = host(&cfg);let server_a = make_stub_server("@multi-test/echo-a");let server_b = make_stub_server("@multi-test/echo-b");@@ -86,16 +93,28 @@ async fn two_servers_same_tool_name_no_collision() {"two stub servers must have distinct server_ids");- store::insert_server(&cfg, &server_a).expect("insert server_a");- store::insert_server(&cfg, &server_b).expect("insert server_b");+ h.dynamic()+ .store()+ .insert_server(&server_a)+ .expect("insert server_a");+ h.dynamic()+ .store()+ .insert_server(&server_b)+ .expect("insert server_b");// Connect both — each spawns its own subprocess.- let tools_a = connections::connect(&cfg, &server_a)+ let tools_a = h+ .dynamic()+ .connect(&server_a.server_id).await- .expect("connect server_a");- let tools_b = connections::connect(&cfg, &server_b)+ .expect("connect server_a")+ .tools;+ let tools_b = h+ .dynamic()+ .connect(&server_b.server_id).await- .expect("connect server_b");+ .expect("connect server_b")+ .tools;assert_eq!(tools_a.len(), 1, "server_a: stub advertises one tool");assert_eq!(tools_b.len(), 1, "server_b: stub advertises one tool");@@ -103,7 +122,7 @@ async fn two_servers_same_tool_name_no_collision() {assert_eq!(tools_b[0].name, "echo", "server_b tool name is `echo`");// Both servers are in the connected aggregate.- let all_tools = connections::all_connected_tools().await;+ let all_tools = h.dynamic().connections().all_connected_tools().await;let a_tools: Vec<_> = all_tools.iter().filter(|(sid, _, _)| sid == &server_a.server_id)@@ -133,7 +152,7 @@ async fn two_servers_same_tool_name_no_collision() {);// Both are `connected` in all_status.- let statuses = connections::all_status(&cfg).await;+ let statuses = h.dynamic().status().await.expect("status");let find = |id: &str| {statuses.iter()@@ -146,8 +165,16 @@ async fn two_servers_same_tool_name_no_collision() {assert_eq!(find(&server_b.server_id).status.as_str(), "connected");assert_eq!(find(&server_b.server_id).tool_count, 1);- let _ = connections::disconnect(&server_a.server_id).await;- let _ = connections::disconnect(&server_b.server_id).await;+ let _ = h+ .dynamic()+ .connections()+ .disconnect(&server_a.server_id)+ .await;+ let _ = h+ .dynamic()+ .connections()+ .disconnect(&server_b.server_id)+ .await;}// ── Test 2: routing ───────────────────────────────────────────────────────────@@ -159,39 +186,54 @@ async fn two_servers_same_tool_name_no_collision() {#[tokio::test]async fn tool_calls_route_to_the_correct_server() {let (_tmp, cfg) = fresh_workspace_config();+ let h = host(&cfg);let server_a = make_stub_server("@route-test/echo-a");let server_b = make_stub_server("@route-test/echo-b");- store::insert_server(&cfg, &server_a).expect("insert server_a");- store::insert_server(&cfg, &server_b).expect("insert server_b");-- connections::connect(&cfg, &server_a)+ h.dynamic()+ .store()+ .insert_server(&server_a)+ .expect("insert server_a");+ h.dynamic()+ .store()+ .insert_server(&server_b)+ .expect("insert server_b");++ h.dynamic()+ .connect(&server_a.server_id).await- .expect("connect server_a");- connections::connect(&cfg, &server_b)+ .expect("connect server_a")+ .tools;+ h.dynamic()+ .connect(&server_b.server_id).await- .expect("connect server_b");+ .expect("connect server_b")+ .tools;// Send distinct payloads to each server; verify each echoes its own input.- let result_a = connections::call_tool(- &server_a.server_id,- "echo",- serde_json::json!({ "message": "payload-for-a" }),- )- .await- .expect("call_tool on server_a should succeed");-- let result_b = connections::call_tool(- &server_b.server_id,- "echo",- serde_json::json!({ "message": "payload-for-b" }),- )- .await- .expect("call_tool on server_b should succeed");-- let text_a = extract_echo_text(&result_a);- let text_b = extract_echo_text(&result_b);+ let result_a = h+ .dynamic()+ .tool_call(+ &server_a.server_id,+ "echo",+ serde_json::json!({ "message": "payload-for-a" }),+ )+ .await+ .expect("call_tool on server_a should succeed");++ let result_b = h+ .dynamic()+ .tool_call(+ &server_b.server_id,+ "echo",+ serde_json::json!({ "message": "payload-for-b" }),+ )+ .await+ .expect("call_tool on server_b should succeed");++ let text_a = extract_echo_text(&result_a.result);+ let text_b = extract_echo_text(&result_b.result);assert_eq!(text_a, "payload-for-a",@@ -208,8 +250,16 @@ async fn tool_calls_route_to_the_correct_server() {"two servers must not produce identical outputs for different inputs");- let _ = connections::disconnect(&server_a.server_id).await;- let _ = connections::disconnect(&server_b.server_id).await;+ let _ = h+ .dynamic()+ .connections()+ .disconnect(&server_a.server_id)+ .await;+ let _ = h+ .dynamic()+ .connections()+ .disconnect(&server_b.server_id)+ .await;}// ── Test 3: failure isolation ─────────────────────────────────────────────────@@ -220,6 +270,7 @@ async fn tool_calls_route_to_the_correct_server() {#[tokio::test]async fn failed_connect_does_not_block_healthy_peer() {let (_tmp, cfg) = fresh_workspace_config();+ let h = host(&cfg);// "bad" server: non-existent binary.let mut bad = make_stub_server("@isolation-test/bad");@@ -228,11 +279,19 @@ async fn failed_connect_does_not_block_healthy_peer() {// "good" server: real stub.let good = make_stub_server("@isolation-test/good");- store::insert_server(&cfg, &bad).expect("insert bad server");- store::insert_server(&cfg, &good).expect("insert good server");+ h.dynamic()+ .store()+ .insert_server(&bad)+ .expect("insert bad server");+ h.dynamic()+ .store()+ .insert_server(&good)+ .expect("insert good server");// Connecting the bad server must fail.- let connect_err = connections::connect(&cfg, &bad)+ let connect_err = h+ .dynamic()+ .connect(&bad.server_id).await.expect_err("connect bad server should fail");assert!(@@ -241,13 +300,16 @@ async fn failed_connect_does_not_block_healthy_peer() {);// Connecting the good server must succeed independently.- let good_tools = connections::connect(&cfg, &good)+ let good_tools = h+ .dynamic()+ .connect(&good.server_id).await- .expect("connect good server must succeed regardless of the bad peer");+ .expect("connect good server must succeed regardless of the bad peer")+ .tools;assert_eq!(good_tools.len(), 1, "good server exposes one tool");// all_status: bad → error with last_error, good → connected.- let statuses = connections::all_status(&cfg).await;+ let statuses = h.dynamic().status().await.expect("status");let find = |id: &str| {statuses.iter()@@ -283,21 +345,23 @@ async fn failed_connect_does_not_block_healthy_peer() {);// The good server is still callable after the peer's failure.- let result = connections::call_tool(- &good.server_id,- "echo",- serde_json::json!({ "message": "isolation-check" }),- )- .await- .expect("call_tool on good server must succeed after peer failure");+ let result = h+ .dynamic()+ .tool_call(+ &good.server_id,+ "echo",+ serde_json::json!({ "message": "isolation-check" }),+ )+ .await+ .expect("call_tool on good server must succeed after peer failure");assert_eq!(- extract_echo_text(&result),+ extract_echo_text(&result.result),"isolation-check","good server must echo input correctly after peer failure");- let _ = connections::disconnect(&good.server_id).await;+ let _ = h.dynamic().connections().disconnect(&good.server_id).await;}// ── Test 4: disabled enforcement ──────────────────────────────────────────────@@ -307,6 +371,7 @@ async fn failed_connect_does_not_block_healthy_peer() {#[tokio::test]async fn disabled_server_contributes_no_tools_to_agent_surface() {let (_tmp, cfg) = fresh_workspace_config();+ let h = host(&cfg);// "live" server: enabled, real stub.let live = make_stub_server("@disabled-test/live");@@ -316,13 +381,21 @@ async fn disabled_server_contributes_no_tools_to_agent_surface() {let mut quiet = make_stub_server("@disabled-test/quiet");quiet.enabled = false;- store::insert_server(&cfg, &live).expect("insert live server");- store::insert_server(&cfg, &quiet).expect("insert quiet server");+ h.dynamic()+ .store()+ .insert_server(&live)+ .expect("insert live server");+ h.dynamic()+ .store()+ .insert_server(&quiet)+ .expect("insert quiet server");// Connect the live server.- connections::connect(&cfg, &live)+ h.dynamic()+ .connect(&live.server_id).await- .expect("connect live server");+ .expect("connect live server")+ .tools;// Attempting to connect the disabled server via ops must fail with// a clear "disabled" message (matches mcp_registry_e2e::connect_refuses_disabled_server).@@ -335,7 +408,7 @@ async fn disabled_server_contributes_no_tools_to_agent_surface() {);// all_status: live → connected, quiet → disabled.- let statuses = connections::all_status(&cfg).await;+ let statuses = h.dynamic().status().await.expect("status");let find = |id: &str| {statuses.iter()@@ -348,7 +421,7 @@ async fn disabled_server_contributes_no_tools_to_agent_surface() {assert_eq!(find(&quiet.server_id).status.as_str(), "disabled");// The disabled server must not appear in all_connected_tools.- let all_tools = connections::all_connected_tools().await;+ let all_tools = h.dynamic().connections().all_connected_tools().await;let quiet_tools: Vec<_> = all_tools.iter().filter(|(sid, _, _)| sid == &quiet.server_id)@@ -369,19 +442,21 @@ async fn disabled_server_contributes_no_tools_to_agent_surface() {"live server must contribute its tool even while disabled peer is present");- let result = connections::call_tool(- &live.server_id,- "echo",- serde_json::json!({ "message": "live-while-quiet" }),- )- .await- .expect("call_tool on live server must succeed");+ let result = h+ .dynamic()+ .tool_call(+ &live.server_id,+ "echo",+ serde_json::json!({ "message": "live-while-quiet" }),+ )+ .await+ .expect("call_tool on live server must succeed");assert_eq!(- extract_echo_text(&result),+ extract_echo_text(&result.result),"live-while-quiet","live server echoes correctly while disabled peer exists");- let _ = connections::disconnect(&live.server_id).await;+ let _ = h.dynamic().connections().disconnect(&live.server_id).await;}diff --git a/tests/raw_coverage/tool_registry_approval_raw_coverage_e2e.rs b/tests/raw_coverage/tool_registry_approval_raw_coverage_e2e.rsindex 92dc8b112b..6e921fa60e 100644--- a/tests/raw_coverage/tool_registry_approval_raw_coverage_e2e.rs+++ b/tests/raw_coverage/tool_registry_approval_raw_coverage_e2e.rs@@ -31,9 +31,7 @@ use openhuman_core::openhuman::config::schema::{};use openhuman_core::openhuman::config::Config;use openhuman_core::openhuman::mcp::registry::connections;-use openhuman_core::openhuman::mcp::registry::types::{- CommandKind, InstalledServer, ServerProvenance, Transport,-};+use openhuman_core::openhuman::mcp::registry::types::{CommandKind, InstalledServer, Transport};use openhuman_core::openhuman::security::{live_policy, SecurityPolicy};use openhuman_core::openhuman::tools::registry::{all_tool_registry_controller_schemas, all_tool_registry_registered_controllers,@@ -304,7 +302,6 @@ fn test_mcp_server() -> InstalledServer {last_connected_at: None,transport: Transport::Stdio,enabled: true,- provenance: ServerProvenance::Registry,}}