Skip to content

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

test(skills,mcp): prove registry skills and MCP servers install and are usable by the agent

M3gA-Mindf24dac908b39
diff --git a/crates/openhuman-core/Cargo.toml b/crates/openhuman-core/Cargo.toml
index 9207cfed88..dfca9c5c84 100644
--- a/crates/openhuman-core/Cargo.toml
+++ b/crates/openhuman-core/Cargo.toml
@@ -286,6 +286,10 @@ path = "../../tests/personality_e2e.rs"
name = "skill_registry_e2e"
path = "../../tests/skill_registry_e2e.rs"
+[[test]]
+name = "skills_mcp_registry_live"
+path = "../../tests/skills_mcp_registry_live.rs"
+
[[test]]
name = "transcript_search_e2e"
path = "../../tests/transcript_search_e2e.rs"
diff --git a/docs/TEST-COVERAGE-MATRIX.md b/docs/TEST-COVERAGE-MATRIX.md
index 2de51d76de..3c3004abc6 100644
--- a/docs/TEST-COVERAGE-MATRIX.md
+++ b/docs/TEST-COVERAGE-MATRIX.md
@@ -493,12 +493,12 @@ End-to-end coverage of the agent harness via the web-chat RPC surface against an
| 11.1.6 | SearXNG MCP search | RU | `crates/openhuman-core/src/search/tools/searxng.rs`, `crates/openhuman-core/src/mcp/server/tools/`, `crates/openhuman-core/src/tools/schemas.rs` | ✅ | Self-hosted search config, normalized results, MCP argument validation, and mocked HTTP execution |
| 11.1.7 | Bundled prompt resources | RU | `crates/openhuman-core/src/mcp/server/resources.rs`, `crates/openhuman-core/src/mcp/server/protocol.rs` | ✅ | `resources/list` catalog + `resources/read` happy path, -32002 unknown URI, -32602 missing param, catalog-mirrors-BUILTINS parity test |
| 11.1.8 | Resource templates list | RU | `crates/openhuman-core/src/mcp/server/resources.rs`, `crates/openhuman-core/src/mcp/server/protocol.rs` | ✅ | `resources/templates/list` returns `{resourceTemplates: []}` (static catalog), tolerates unknown/cursor params |
-| 11.1.10 | MCP registry install→connect→tool_call | RI | `tests/json_rpc_e2e.rs` (`mcp_clients_install_connect_tool_call_happy_path`), `tests/mcp_registry_e2e.rs`, `crates/openhuman-core/src/mcp/registry/setup_ops.rs`, `app/test/playwright/specs/mcp-tab-flow.spec.ts` (#3039, #4272) | ✅ | HTTP-RPC happy path install→connect→tool_call→update_env against `test-mcp-stub`; transport-aware install (stdio + http_remote) via `build_install_transport`; UI-level Playwright flow drives browse→install→connect→run-tool (#4272) |
+| 11.1.10 | MCP registry install→connect→tool_call | RI | `tests/json_rpc_e2e.rs` (`mcp_clients_install_connect_tool_call_happy_path`), `tests/mcp_registry_e2e.rs`, `tests/agent_harness_e2e.rs` (`agent_calls_a_tool_on_an_mcp_server_installed_from_the_registry`), `tests/skills_mcp_registry_live.rs` (manual, `#[ignore]`), `crates/openhuman-core/src/mcp/registry/setup_ops.rs`, `app/test/playwright/specs/mcp-tab-flow.spec.ts` (#3039, #4272) | ✅ | HTTP-RPC happy path install→connect→tool_call→update_env against `test-mcp-stub`; transport-aware install (stdio + http_remote) via `build_install_transport`; UI-level Playwright flow drives browse→install→connect→run-tool (#4272); official-registry search→install→connect over RPC, then a scripted agent turn calls the server's tool and its answer reaches the model; live official-registry smoke (manual) |
| 11.1.11 | MCP env reconfigure + registry creds | RI/VU | `tests/json_rpc_e2e.rs` (`mcp_clients_registry_settings_roundtrip`), `crates/openhuman-core/src/mcp/registry/ops.rs` (`mcp_clients_registry_settings_get`), `vendor/tinymcp/crates/tinymcp/src/registry/sources/official/` (vendored `tinymcp`), `app/src/components/channels/mcp/InstalledServerDetail.test.tsx` (#3039) | ✅ | `update_env` persist+reconnect; `registry_settings` get/set with secrets write-only (config-first, env-fallback); reconfigure form validation |
| 11.1.12 | MCP UI surface + setup-agent client | VU/RU | `app/src/components/channels/mcp/InstallDialog.test.tsx`, `app/src/components/channels/mcp/McpServersTab.test.tsx`, `app/src/services/api/mcpClientsApi.test.ts`, `crates/openhuman-core/src/mcp/registry/ops.rs`, `crates/openhuman-core/src/mcp/registry/setup_ops_tests.rs`, `vendor/tinymcp/crates/tinymcp/src/registry/{curation,sources}/` (vendored `tinymcp`) (#3039, #4272; `mcpSetupApi.test.ts` was removed in #5095) | ✅ | Skills `?tab=mcp` renders `McpServersTab` (not Coming Soon); auto-connect on install (best-effort); typed `mcpSetupApi` wrapper; curated "perfect server" catalog (declared website + named credential) with official-vendor badge + official-first order; namespace-stripped relevance search + server-side Stdio/Hosted transport filter; clickable Website/Repo links; wired connection health toolbar (Retry all / Disconnect all) (#4272) |
| 11.1.13 | MCP HTTP-remote auth (token / Bearer / OAuth) + redirect resolution | RU/VU | `vendor/tinymcp/crates/tinymcp/src/registry/connections/` (`build_http_auth*`, `resolve_final_url`), `vendor/tinymcp/crates/tinymcp/src/registry/oauth/` (PKCE/token/bundle/callback port) (vendored `tinymcp`), `app/src/components/channels/mcp/ConnectAuthModal.test.tsx` (#3495) | ✅ | Bearer/raw scheme + custom headers; redirect-final-URL resolved before auth; OAuth dynamic client registration + PKCE + refresh; tokens MERGED into stored env; credentials stored encrypted locally, never sent to backend |
| 11.1.14 | MCP "Help & configure" assistant | VU/RU | `app/src/components/channels/mcp/ConfigAssistantPanel.test.tsx`, `app/src/components/channels/mcp/ConfigHelpModal.test.tsx`, `crates/openhuman-core/src/mcp/registry/ops.rs` (`invoke_config_assist_agent`) (#3495) | ✅ | Server-specific prompt offered as a one-click "Get step-by-step setup help" action (on-demand, no longer auto-run on open — #4272), running an agentic turn scoped to web_search_tool/web_fetch/curl only; markdown-rendered reply; per-MCP chat persisted while on the detail page |
-| 11.1.15 | Agent uses connected MCP servers in chat | RU | `crates/openhuman-core/src/agent/registry/agents/loader.rs` (`orchestrator_subagents_include_mcp_agent`, `mcp_agent_drives_connected_servers_without_install_or_shell`, `planner_has_readonly_mcp_discovery_not_execute`), `crates/openhuman-core/src/agent/registry/agents/orchestrator/prompt.rs` (`connected_mcp_block_*`), `crates/openhuman-core/src/agent/harness/session/turn_tests.rs` (`mcp_announcement_fires_once_for_new_server`), `crates/openhuman-core/src/mcp/registry/tools_tests.rs`, `vendor/tinymcp/crates/tinymcp/src/registry/connections/` (vendored `tinymcp`) (#3495) | ✅ | `use_mcp_server` delegate → `mcp_agent` worker (discover→list→call); `mcp_registry_list_tools` read-only discovery; orchestrator `## Connected MCP Servers` prompt block + mid-session connect announcement on the user turn; planner read-only MCP discovery (no `tool_call`) |
+| 11.1.15 | Agent uses connected MCP servers in chat | RU | `crates/openhuman-core/src/agent/registry/agents/loader.rs` (`orchestrator_subagents_include_mcp_agent`, `mcp_agent_drives_connected_servers_without_install_or_shell`, `planner_has_readonly_mcp_discovery_not_execute`), `crates/openhuman-core/src/agent/registry/agents/orchestrator/prompt.rs` (`connected_mcp_block_*`), `crates/openhuman-core/src/agent/harness/session/turn_tests.rs` (`mcp_announcement_fires_once_for_new_server`), `tests/agent_harness_e2e.rs` (`agent_calls_a_tool_on_an_mcp_server_installed_from_the_registry`: orchestrator → `use_skill` → `use_mcp_server` → `mcp_registry_tool_call`), `crates/openhuman-core/src/mcp/registry/tools_tests.rs`, `vendor/tinymcp/crates/tinymcp/src/registry/connections/` (vendored `tinymcp`) (#3495) | ✅ | `use_mcp_server` delegate → `mcp_agent` worker (discover→list→call); `mcp_registry_list_tools` read-only discovery; orchestrator `## Connected MCP Servers` prompt block + mid-session connect announcement on the user turn; planner read-only MCP discovery (no `tool_call`) |
| 11.1.16 | MCP supervisor observability (Event Log + notifications) | RU | `crates/openhuman-core/src/mcp/registry/supervisor_events_tests.rs`, `crates/openhuman-core/src/core/events_tests.rs` (`mcp_supervisor_events_*`, `mcp_lifecycle_events_*`), `crates/openhuman-core/src/desktop/notifications/bus_tests_2_tests.rs` (`mcp_*`, `*_workspace*`, `an_outage_is_filed_under_its_own_workspace_not_the_bridge_s`, `*_announced`), `app/src/components/settings/panels/__tests__/EventLogPanel.test.tsx` (detail line + filter), `vendor/tinymcp/crates/tinymcp/src/registry/supervisor/test.rs` ("The report" section) (#5931) | ✅ | `tinymcp::Supervisor::tick` returns a `TickReport`; the host maps it to `McpServer{ProbeTimedOut,TransportDropped,Reconnected,ReconnectFailed,Parked}` domain events (Event Log, `mcp_client` domain, server name in the agent column, failure reason via `DomainEvent::log_detail`) and the notification bridge notifies only on the first failed reconnect of an episode, on recovery after failures, and on a parked server — filing each under the workspace the event names and announcing it only when that workspace is live, since one process supervises every workspace it has opened and the bridge's own binding may be the stale half after a switch |
<!-- 11.1.9 Vault Markdown Writes — removed: Knowledge Vaults dropped (vault domain + VaultPanel deleted). -->
@@ -574,6 +574,7 @@ End-to-end coverage of the agent harness via the web-chat RPC surface against an
| 13.3.3 | Azure deployment name (off-catalog model id) | VU | `app/src/components/settings/panels/__tests__/azureDeployment.test.ts`, `app/src/components/settings/panels/__tests__/ModelEntryField.test.tsx`, `app/src/components/settings/panels/__tests__/AIPanel.test.tsx` | ✅ | Azure routes by deployment name, not the base model id its `/models` catalog lists (#5213). Covers endpoint-host detection (incl. dot-boundary lookalikes and the excluded Foundry serverless hosts), `/openai/v1` base-URL detection and its inline nudge, the shared entry-mode field used by both pickers (free text, catalog, loading, probe-error branches), no auto-seeding of a catalog id for Azure, the deployment name surviving verbatim into persisted routing, and a provider staying creatable when the live `/models` probe fails |
| 13.3.4 | ChatGPT sign-in in AI settings | VU | `app/src/components/settings/oauth/__tests__/OpenAiOAuthConnect.test.tsx`, `app/src/components/settings/panels/__tests__/AIPanel.test.tsx` | ✅ | Mocked core RPCs cover sign-in, disconnect, provider/routing persistence, failure paths, and delayed initial status. Live desktop OAuth remains a release smoke check. |
| 13.3.5 | OpenRouter sign-in (PKCE) in AI settings | RU+VU | `crates/openhuman-app/src/loopback_oauth_tests.rs`, `app/src/utils/__tests__/openrouterOAuth.test.ts`, `app/src/utils/__tests__/loopbackOauthListener.test.ts`, `app/src/components/settings/panels/__tests__/AIPanel.test.tsx` | ✅ | A pending sign-in stays dismissable (Cancel/Esc/click-outside abort the flow and free the loopback port); Deny, `error=` and missing-code callbacks get a "Sign-in was not completed." page and a dialog error instead of "You're signed in."; cancel clears the listener timeout so a retry is not stopped; the key exchange honours the abort signal (#6263). Live Authorize remains a release smoke check. |
+| 13.3.6 | Skill registry search→install→agent runs the skill | RI | `tests/agent_harness_e2e.rs` (`agent_installs_a_registry_skill_then_runs_it`), `tests/skill_registry_e2e.rs`, `tests/skills_mcp_registry_live.rs` (manual, `#[ignore]`) | ✅ | Agent finds a loopback-catalog skill via `use_skill(skills/setup_skills)`, installs it behind the approval gate, the SKILL.md lands on disk, then `run_skill` → `describe_workflow` returns its body to the model. The live smoke reports, per catalog source, how many listed skills have a download URL and installs one sample each. |
### 13.4 Developer Options
@@ -653,11 +654,11 @@ End-to-end coverage of the agent harness via the web-chat RPC surface against an
| Status | Count |
| ---------------- | ------------------------------------------------ |
-| ✅ Covered | 88 |
+| ✅ Covered | 89 |
| 🟡 Partial | 27 |
| ❌ Missing | 26 |
| 🚫 Manual smoke | 11 |
-| **Total leaves** | **152 explicit + nested = 212 product features** |
+| **Total leaves** | **153 explicit + nested = 213 product features** |
PR-A delta: 13 leaves moved from ❌ → ✅ via 5 WDIO specs + 2 Vitest + 1 Rust integration test.
Section 16 adds 11 leaves (10 ✅, 1 🟡) for the embedded library harness.
diff --git a/tests/agent_harness_e2e.rs b/tests/agent_harness_e2e.rs
index 54ada0987f..4e779b4ae6 100644
--- a/tests/agent_harness_e2e.rs
+++ b/tests/agent_harness_e2e.rs
@@ -3184,6 +3184,446 @@ async fn model_call_ceiling_bounds_a_wedged_call_below_the_turn_deadline_inner()
stack.shutdown();
}
+// ─── Skills + MCP servers: installed from a registry, then used by the agent ─
+//
+// The registry suites (`skill_registry_e2e`, `mcp_registry_e2e`,
+// `raw_coverage/mcp_setup_clients_e2e`) stop at "installed" or "connected".
+// These go one step further: the item comes from a loopback registry through
+// the real install path, then a scripted turn reaches it through the same
+// delegation tools the orchestrator uses in production (`setup_skills`,
+// `run_skill`, `use_mcp_server`).
+//
+// The proof is the tool result the model receives, never the scripted reply:
+// every scripted completion below is canary-free, so a canary inside a tool
+// message can only have come from the installed skill or the running server.
+
+/// A call to a tool that lives in a tool pack, made the way production agents
+/// reach it: through `use_skill`. Packed tools are not on the orchestrator's belt,
+/// so calling one by its bare name only returns `unknown tool`. Ids the call
+/// `call_<tool>` so [`tool_result_text`] finds the result by the inner tool.
+fn packed_tool_call_completion(pack: &str, tool: &str, args: Value) -> Value {
+ json!({ "content": "", "toolCalls": [{
+ "id": format!("call_{tool}"),
+ "name": "use_skill",
+ "arguments": json!({ "skill": pack, "tool": tool, "args": args }).to_string(),
+ }]})
+}
+
+/// The tool message answering the scripted call to `tool_name`.
+///
+/// Calls are id'd `call_<name>` and the result carries that id back, so a
+/// delegate's summary of the same call can never match. Panics on an
+/// `unknown tool` result: that error echoes the call's arguments, so a canary
+/// passed as an argument would otherwise read as a pass.
+fn tool_result_text(requests: &[Value], tool_name: &str) -> Option<String> {
+ let call_id = format!("call_{tool_name}");
+ requests
+ .iter()
+ .filter_map(|request| request.pointer("/body/messages").and_then(Value::as_array))
+ .flatten()
+ .find(|message| {
+ message.get("role").and_then(Value::as_str) == Some("tool")
+ && message.get("tool_call_id").and_then(Value::as_str) == Some(call_id.as_str())
+ })
+ .and_then(|message| message.get("content"))
+ .map(|content| {
+ let text = content
+ .as_str()
+ .map(str::to_string)
+ .unwrap_or_else(|| content.to_string());
+ assert!(
+ !text.trim_start().starts_with("unknown tool"),
+ "`{tool_name}` was not a tool the calling agent could reach: {text}"
+ );
+ text
+ })
+}
+
+const REGISTRY_SKILL_ID: &str = "harness-registry-skill";
+const SKILL_BODY_CANARY: &str = "SKILL_BODY_CANARY_7f3a";
+
+/// A one-entry skill catalog plus the SKILL.md its download URL points at.
+async fn serve_skill_registry_fixture() -> (
+ SocketAddr,
+ tokio::task::JoinHandle<Result<(), std::io::Error>>,
+) {
+ async fn catalog() -> Json<Value> {
+ Json(json!([{
+ "name": REGISTRY_SKILL_ID,
+ "description": "Fixture skill for the registry-to-agent harness test.",
+ "category": "testing",
+ "source": "fixture",
+ "tags": ["harness"],
+ "platforms": ["linux", "macos", "windows"],
+ "envVars": [],
+ "commands": []
+ }]))
+ }
+ async fn skill_md() -> String {
+ format!(
+ "---\nname: {REGISTRY_SKILL_ID}\ndescription: Fixture skill for the registry-to-agent harness test.\nmetadata:\n id: {REGISTRY_SKILL_ID}\n---\n\n# Harness registry skill\n\n## Procedure\nReply with the marker {SKILL_BODY_CANARY}.\n"
+ )
+ }
+ let app = Router::new().route("/skills.json", get(catalog)).route(
+ &format!("/skills/{REGISTRY_SKILL_ID}/SKILL.md"),
+ get(skill_md),
+ );
+ serve_on_ephemeral(app).await
+}
+
+/// A skill found in the registry is installed by the agent (behind the approval
+/// gate), lands on disk, and is then loaded by the skill executor, with its body
+/// reaching the model.
+#[test]
+fn agent_installs_a_registry_skill_then_runs_it() {
+ run_on_agent_stack(
+ "agent_installs_a_registry_skill_then_runs_it",
+ agent_installs_a_registry_skill_then_runs_it_inner,
+ );
+}
+
+async fn agent_installs_a_registry_skill_then_runs_it_inner() {
+ let _lock = env_lock();
+ let _ttl = EnvVarGuard::set("OPENHUMAN_APPROVAL_TTL_SECS", "120");
+ ensure_approval_gate().await;
+ let _approval_bridge = register_approval_bridge();
+
+ let (registry_addr, registry_join) = serve_skill_registry_fixture().await;
+ let registry = format!("http://{registry_addr}");
+ let cache_dir = tempdir().expect("catalog cache tempdir");
+ let _catalog = EnvVarGuard::set(
+ "OPENHUMAN_SKILL_REGISTRY_CATALOG_URL",
+ &format!("{registry}/skills.json"),
+ );
+ let _download = EnvVarGuard::set(
+ "OPENHUMAN_SKILL_REGISTRY_DOWNLOAD_BASE_URL",
+ &format!("{registry}/skills"),
+ );
+ let _local_http = EnvVarGuard::set("OPENHUMAN_SKILL_INSTALL_ALLOW_LOCAL_HTTP", "1");
+ let _cache = EnvVarGuard::set_to_path("OPENHUMAN_SKILL_REGISTRY_CACHE_DIR", cache_dir.path());
+
+ reset_script(vec![
+ // Orchestrator hands the install to `skill_setup` (packed in `skills`).
+ packed_tool_call_completion(
+ "skills",
+ "setup_skills",
+ json!({ "prompt": "Install the harness registry skill", "blocking": true }),
+ ),
+ // skill_setup finds the entry, then installs it (the gate parks here).
+ tool_call_completion(
+ "skill_registry_search",
+ json!({ "query": "harness-registry" }),
+ ),
+ tool_call_completion(
+ "skill_registry_install",
+ json!({ "entry_id": REGISTRY_SKILL_ID }),
+ ),
+ text_completion("Installed the skill."),
+ // Orchestrator hands the run to `skill_executor`, which loads the skill.
+ packed_tool_call_completion(
+ "skills",
+ "run_skill",
+ json!({ "prompt": format!("Run the {REGISTRY_SKILL_ID} skill"), "blocking": true }),
+ ),
+ tool_call_completion(
+ "describe_workflow",
+ json!({ "workflow_id": REGISTRY_SKILL_ID }),
+ ),
+ text_completion("Ran the skill."),
+ text_completion("The skill is installed and ran."),
+ ]);
+ let stack = boot_stack().await;
+
+ let mut events = spawn_sse_collector(format!(
+ "{}/events?client_id=harness-skill-registry",
+ stack.rpc_base
+ ));
+ send_web_chat(
+ &stack.rpc_base,
+ 700,
+ "harness-skill-registry",
+ "thread-skill-registry",
+ "Install a skill from the registry and run it",
+ )
+ .await;
+
+ // Not `wait_for_event`: if the turn ends without asking, the failure has to
+ // show what the agent did instead, which only the captured requests hold.
+ let deadline = tokio::time::Instant::now() + Duration::from_secs(90);
+ let approval = loop {
+ let remaining = deadline.saturating_duration_since(tokio::time::Instant::now());
+ let event = match tokio::time::timeout(remaining, events.recv()).await {
+ Ok(Some(event)) => event,
+ Ok(None) | Err(_) => panic!(
+ "no approval_request for skill_registry_install; requests: {}",
+ serde_json::to_string_pretty(&with_captured(|c| c.clone())).unwrap_or_default()
+ ),
+ };
+ match event.get("event").and_then(Value::as_str) {
+ Some("approval_request") => break event,
+ Some("chat_done") | Some("chat_error") => panic!(
+ "turn ended before skill_registry_install asked for approval: {event}\nrequests: {}",
+ serde_json::to_string_pretty(&with_captured(|c| c.clone())).unwrap_or_default()
+ ),
+ _ => {}
+ }
+ };
+ assert!(
+ approval.to_string().contains("skill_registry_install"),
+ "installing a registry skill must ask for approval; event: {approval}"
+ );
+ let request_id = approval
+ .pointer("/data/request_id")
+ .or_else(|| approval.get("request_id"))
+ .and_then(Value::as_str)
+ .unwrap_or_else(|| panic!("approval_request missing request_id: {approval}"))
+ .to_string();
+ let decide = post_json_rpc(
+ &stack.rpc_base,
+ 701,
+ "openhuman.approval_decide",
+ json!({ "request_id": request_id, "decision": "approve_once" }),
+ )
+ .await;
+ assert_no_jsonrpc_error(&decide, "approval_decide for skill_registry_install");
+
+ let done = wait_for_terminal(&mut events, Duration::from_secs(120)).await;
+ assert_eq!(
+ done.get("event").and_then(Value::as_str),
+ Some("chat_done"),
+ "the install-and-run turn must finish: {done}"
+ );
+
+ let requests = with_captured(|c| c.clone());
+ let dump = || serde_json::to_string_pretty(&requests).unwrap_or_default();
+
+ // Found: the search the agent ran returned the registry entry.
+ let search = tool_result_text(&requests, "skill_registry_search").unwrap_or_else(|| {
+ panic!(
+ "no tool result for skill_registry_search; requests: {}",
+ dump()
+ )
+ });
+ assert!(
+ search.contains(REGISTRY_SKILL_ID),
+ "the agent's registry search did not return the fixture entry: {search}"
+ );
+
+ // Downloaded: the approved install wrote the registry's SKILL.md.
+ let installed = stack
+ ._tmp
+ .path()
+ .join(".openhuman/skills")
+ .join(REGISTRY_SKILL_ID)
+ .join("SKILL.md");
+ let body = std::fs::read_to_string(&installed).unwrap_or_else(|e| {
+ panic!(
+ "installed SKILL.md missing at {installed:?}: {e}; install result: {:?}",
+ tool_result_text(&requests, "skill_registry_install")
+ )
+ });
+ assert!(
+ body.contains(SKILL_BODY_CANARY),
+ "the installed SKILL.md is not the one the registry served: {body}"
+ );
+
+ // Usable: the executor loaded the installed skill and its body reached the model.
+ let described = tool_result_text(&requests, "describe_workflow")
+ .unwrap_or_else(|| panic!("no tool result for describe_workflow; requests: {}", dump()));
+ assert!(
+ described.contains(SKILL_BODY_CANARY),
+ "describe_workflow did not return the installed skill's body, so the agent cannot use it: {described}"
+ );
+
+ registry_join.abort();
+ stack.shutdown();
+}
+
+#[cfg(feature = "mcp")]
+const REGISTRY_MCP_SERVER: &str = "io.github.harness/echo";
+#[cfg(feature = "mcp")]
+const MCP_ECHO_CANARY: &str = "MCP_ECHO_CANARY_91c2";
+
+/// An official-registry record whose npm package launches the hermetic stub.
+///
+/// `runtimeHint` replaces the `npx` launcher (`official/types.rs`
+/// `to_example_config`), and the stub ignores the `-y <identifier>` it is given.
+#[cfg(feature = "mcp")]
+fn registry_mcp_record() -> Value {
+ json!({
+ "name": REGISTRY_MCP_SERVER,
+ "title": "Harness Echo",
+ "description": "Echoes a message back.",
+ "remotes": [],
+ "packages": [{
+ "registryType": "npm",
+ "identifier": "@harness/echo",
+ "runtimeHint": env!("CARGO_BIN_EXE_test-mcp-stub"),
+ "environmentVariables": []
+ }]
+ })
+}
+
+/// The official registry's list and versions endpoints, serving one server.
+#[cfg(feature = "mcp")]
+async fn serve_mcp_registry_fixture() -> (
+ SocketAddr,
+ tokio::task::JoinHandle<Result<(), std::io::Error>>,
+) {
+ async fn list() -> Json<Value> {
+ Json(json!({
+ "servers": [{ "server": registry_mcp_record() }],
+ "metadata": { "nextCursor": "" }
+ }))
+ }
+ async fn versions() -> Json<Value> {
+ Json(json!({ "servers": [{ "server": registry_mcp_record() }] }))
+ }
+ let app = Router::new()
+ .route("/v0/servers", get(list))
+ .route("/v0/servers/{name}/versions", get(versions));
+ serve_on_ephemeral(app).await
+}
+
+/// RPC handlers may wrap a result as `{ result, logs }`.
+#[cfg(feature = "mcp")]
+fn peel_logs_envelope(v: &Value) -> &Value {
+ match v.get("logs") {
+ Some(_) => v.get("result").unwrap_or(v),
+ None => v,
+ }
+}
+
+/// A server found in the MCP registry is installed and connected through the
+/// same RPCs the settings UI uses, then the agent calls its tool through
+/// `use_mcp_server` and the server's answer reaches the model.
+#[cfg(feature = "mcp")]
+#[test]
+fn agent_calls_a_tool_on_an_mcp_server_installed_from_the_registry() {
+ run_on_agent_stack(
+ "agent_calls_a_tool_on_an_mcp_server_installed_from_the_registry",
+ agent_calls_a_tool_on_an_mcp_server_installed_from_the_registry_inner,
+ );
+}
+
+#[cfg(feature = "mcp")]
+async fn agent_calls_a_tool_on_an_mcp_server_installed_from_the_registry_inner() {
+ let _lock = env_lock();
+ let (registry_addr, registry_join) = serve_mcp_registry_fixture().await;
+ let _registry = EnvVarGuard::set(
+ "MCP_OFFICIAL_REGISTRY_BASE",
+ &format!("http://{registry_addr}"),
+ );
+ reset_script(Vec::new());
+ let stack = boot_stack().await;
+
+ // Found.
+ let search = post_json_rpc(
+ &stack.rpc_base,
+ 800,
+ "openhuman.mcp_clients_registry_search",
+ json!({ "query": "echo", "page": 1, "page_size": 10 }),
+ )
+ .await;
+ let search = peel_logs_envelope(assert_no_jsonrpc_error(
+ &search,
+ "mcp_clients_registry_search",
+ ));
+ assert!(
+ search.to_string().contains(REGISTRY_MCP_SERVER),
+ "registry search must list the fixture server: {search}"
+ );
+
+ // Installed and connected.
+ let install = post_json_rpc(
+ &stack.rpc_base,
+ 801,
+ "openhuman.mcp_clients_install",
+ json!({ "qualified_name": REGISTRY_MCP_SERVER, "env": {} }),
+ )
+ .await;
+ let install = peel_logs_envelope(assert_no_jsonrpc_error(&install, "mcp_clients_install"));
+ let server_id = install
+ .pointer("/server/server_id")
+ .and_then(Value::as_str)
+ .unwrap_or_else(|| panic!("install returned no server.server_id: {install}"))
+ .to_string();
+ let connect = post_json_rpc(
+ &stack.rpc_base,
+ 802,
+ "openhuman.mcp_clients_connect",
+ json!({ "server_id": server_id }),
+ )
+ .await;
+ let connect = peel_logs_envelope(assert_no_jsonrpc_error(&connect, "mcp_clients_connect"));
+ assert_eq!(
+ connect.get("status").and_then(Value::as_str),
+ Some("connected"),
+ "the installed server must connect: {connect}"
+ );
+ assert!(
+ connect.to_string().contains("\"echo\""),
+ "the connected server must list its echo tool: {connect}"
+ );
+
+ // Used: orchestrator → use_skill(integrations/use_mcp_server) → mcp_agent,
+ // which owns the pack and calls mcp_registry_tool_call directly.
+ reset_script(vec![
+ packed_tool_call_completion(
+ "integrations",
+ "use_mcp_server",
+ json!({ "prompt": "Call the echo tool on the harness echo server", "blocking": true }),
+ ),
+ tool_call_completion(
+ "mcp_registry_tool_call",
+ json!({
+ "server_id": server_id,
+ "tool_name": "echo",
+ "arguments": { "message": MCP_ECHO_CANARY }
+ }),
+ ),
+ text_completion("Called the tool."),
+ text_completion("The MCP tool answered."),
+ ]);
+ let mut events = spawn_sse_collector(format!(
+ "{}/events?client_id=harness-mcp-registry",
+ stack.rpc_base
+ ));
+ send_web_chat(
+ &stack.rpc_base,
+ 803,
+ "harness-mcp-registry",
+ "thread-mcp-registry",
+ "Use the echo MCP server",
+ )
+ .await;
+ let done = wait_for_terminal(&mut events, Duration::from_secs(120)).await;
+ assert_eq!(
+ done.get("event").and_then(Value::as_str),
+ Some("chat_done"),
+ "the MCP turn must finish: {done}"
+ );
+
+ let requests = with_captured(|c| c.clone());
+ let result = tool_result_text(&requests, "mcp_registry_tool_call").unwrap_or_else(|| {
+ panic!(
+ "no tool result for mcp_registry_tool_call; requests: {}",
+ serde_json::to_string_pretty(&requests).unwrap_or_default()
+ )
+ });
+ assert!(
+ !result.contains("\"is_error\":true"),
+ "the agent's MCP tool call failed: {result}"
+ );
+ assert!(
+ result.contains(MCP_ECHO_CANARY),
+ "the MCP server's answer did not reach the model: {result}"
+ );
+
+ registry_join.abort();
+ stack.shutdown();
+}
+
// ── #5821: the tool-policy boundary is APPENDED, not prepended ──────────────
//
// Lives here rather than in `tests/raw_coverage/`: `raw_coverage_all` declares
diff --git a/tests/skills_mcp_registry_live.rs b/tests/skills_mcp_registry_live.rs
new file mode 100644
index 0000000000..d3a28106dd
--- /dev/null
+++ b/tests/skills_mcp_registry_live.rs
@@ -0,0 +1,376 @@
+//! Live smoke: are the skills and MCP servers the app offers really downloadable?
+//!
+//! The hermetic suites (`skill_registry_e2e`, `mcp_registry_e2e`, and the
+//! registry-to-agent cases in `agent_harness_e2e`) prove the plumbing against
+//! loopback fixtures. They cannot tell whether the *real* catalogs hand out
+//! entries that install and run. These tests hit the real Hermes skill catalog,
+//! the SKILL.md hosts it points at, the official MCP registry and npm.
+//!
+//! Never run in CI (`#[ignore]`: network, third-party uptime, `npx` on PATH).
+//! Run by hand, one test at a time, and read the printed report:
+//!
+//! ```text
+//! RUST_MIN_STACK=67108864 cargo test -p openhuman --test skills_mcp_registry_live \
+//! -- --ignored --nocapture --test-threads=1
+//! ```
+//!
+//! `OPENHUMAN_LIVE_MCP_QUERY` picks the MCP registry search (default `everything`).
+
+use std::collections::BTreeMap;
+use std::net::SocketAddr;
+use std::path::Path;
+use std::sync::{Mutex, OnceLock};
+use std::time::Duration;
+
+use axum::http::header::AUTHORIZATION;
+use serde_json::{json, Value};
+use tempfile::tempdir;
+
+use openhuman_core::core::auth::{init_rpc_token, CORE_TOKEN_ENV_VAR};
+use openhuman_core::core::jsonrpc::build_core_http_router;
+
+const TEST_RPC_TOKEN: &str = "skills-mcp-live-token";
+
+static AUTH_INIT: OnceLock<()> = OnceLock::new();
+static ENV_LOCK: OnceLock<Mutex<()>> = OnceLock::new();
+
+fn env_lock() -> std::sync::MutexGuard<'static, ()> {
+ let mutex = ENV_LOCK.get_or_init(|| Mutex::new(()));
+ mutex
+ .lock()
+ .unwrap_or_else(|poisoned| poisoned.into_inner())
+}
+
+struct EnvVarGuard {
+ key: &'static str,
+ old: Option<String>,
+}
+
+impl EnvVarGuard {
+ fn set(key: &'static str, value: &str) -> Self {
+ let old = std::env::var(key).ok();
+ unsafe { std::env::set_var(key, value) };
+ Self { key, old }
+ }
+}
+
+impl Drop for EnvVarGuard {
+ fn drop(&mut self) {
+ match &self.old {
+ Some(value) => unsafe { std::env::set_var(self.key, value) },
+ None => unsafe { std::env::remove_var(self.key) },
+ }
+ }
+}
+
+/// A core RPC stack over a throwaway `HOME`, with no registry overrides.
+struct LiveStack {
+ rpc_base: String,
+ home: tempfile::TempDir,
+ _guards: Vec<EnvVarGuard>,
+ rpc_join: tokio::task::JoinHandle<Result<(), std::io::Error>>,
+}
+
+impl Drop for LiveStack {
+ fn drop(&mut self) {
+ self.rpc_join.abort();
+ }
+}
+
+async fn live_stack() -> LiveStack {
+ let home = tempdir().expect("tempdir");
+ let guards = vec![
+ EnvVarGuard::set("HOME", &home.path().to_string_lossy()),
+ EnvVarGuard::set(CORE_TOKEN_ENV_VAR, TEST_RPC_TOKEN),
+ EnvVarGuard::set("OPENHUMAN_KEYRING_BACKEND", "file"),
+ ];
+ AUTH_INIT.get_or_init(|| {
+ init_rpc_token(&std::env::temp_dir().join("openhuman-skills-mcp-live-auth"))
+ .expect("init rpc auth token");
+ });
+
+ let config = "api_url = \"http://127.0.0.1:9\"\ndefault_model = \"live-smoke\"\n\n[secrets]\nencrypt = false\n";
+ for dir in [
+ home.path().join(".openhuman"),
+ home.path().join(".openhuman/users/local"),
+ ] {
+ std::fs::create_dir_all(&dir).expect("create config dir");
+ std::fs::write(dir.join("config.toml"), config).expect("write config.toml");
+ }
+
+ let listener = tokio::net::TcpListener::bind("127.0.0.1:0")
+ .await
+ .expect("bind rpc");
+ let addr: SocketAddr = listener.local_addr().expect("rpc addr");
+ let rpc_join =
+ tokio::spawn(async move { axum::serve(listener, build_core_http_router(false)).await });
+ LiveStack {
+ rpc_base: format!("http://{addr}"),
+ home,
+ _guards: guards,
+ rpc_join,
+ }
+}
+
+/// One JSON-RPC call. Returns the `result` (log envelope peeled) or the error text.
+async fn rpc(stack: &LiveStack, method: &str, params: Value) -> Result<Value, String> {
+ let response = reqwest::Client::builder()
+ // `mcp_clients_connect` may be downloading an npm package through npx.
+ .timeout(Duration::from_secs(300))
+ .build()
+ .expect("reqwest client")
+ .post(format!("{}/rpc", stack.rpc_base))
+ .header(AUTHORIZATION, format!("Bearer {TEST_RPC_TOKEN}"))
+ .json(&json!({ "jsonrpc": "2.0", "id": 1, "method": method, "params": params }))
+ .send()
+ .await
+ .map_err(|e| format!("{method}: transport: {e}"))?
+ .json::<Value>()
+ .await
+ .map_err(|e| format!("{method}: body: {e}"))?;
+ if let Some(error) = response.get("error") {
+ return Err(format!("{method}: {error}"));
+ }
+ let result = response.get("result").cloned().unwrap_or(Value::Null);
+ Ok(match result.get("logs") {
+ Some(_) => result.get("result").cloned().unwrap_or(result),
+ None => result,
+ })
+}
+
+fn installed_skill_count(home: &Path) -> usize {
+ std::fs::read_dir(home.join(".openhuman/skills"))
+ .map(|dirs| {
+ dirs.filter_map(Result::ok)
+ .filter(|dir| dir.path().join("SKILL.md").is_file())
+ .count()
+ })
+ .unwrap_or(0)
+}
+
+/// Every source the catalog lists must offer at least one skill that actually
+/// installs, and no source may list skills that can never be installed.
+///
+/// For each source this installs one entry that has a download URL (and an id
+/// unique in the catalog, since install resolves the first entry with that id)
+/// and checks a SKILL.md landed on disk. A source whose entries all lack a
+/// download URL is reported as a failure: the app shows those entries with an
+/// Install button that can only fail.
+#[tokio::test]
+#[ignore = "live: real skill catalog + SKILL.md hosts"]
+async fn live_every_skill_catalog_source_offers_installable_skills() {
+ let _lock = env_lock();
+ let stack = live_stack().await;
+
+ let browse = rpc(
+ &stack,
+ "openhuman.skill_registry_browse",
+ json!({ "force_refresh": true }),
+ )
+ .await
+ .expect("browse the live catalog");
+ let entries = browse
+ .get("entries")
+ .and_then(Value::as_array)
+ .expect("browse returns entries");
+ assert!(!entries.is_empty(), "the live catalog returned no entries");
+
+ let str_of = |entry: &Value, key: &str| {
+ entry
+ .get(key)
+ .and_then(Value::as_str)
+ .unwrap_or("")
+ .to_string()
+ };
+ let mut id_counts: BTreeMap<String, usize> = BTreeMap::new();
+ for entry in entries {
+ *id_counts.entry(str_of(entry, "id")).or_default() += 1;
+ }
+
+ // source -> (listed, downloadable, a downloadable entry with a unique id)
+ let mut by_source: BTreeMap<String, (usize, usize, Option<String>)> = BTreeMap::new();
+ for entry in entries {
+ let slot = by_source.entry(str_of(entry, "source")).or_default();
+ slot.0 += 1;
+ if !str_of(entry, "download_url").trim().is_empty() {
+ slot.1 += 1;
+ let id = str_of(entry, "id");
+ if slot.2.is_none() && id_counts.get(&id) == Some(&1) {
+ slot.2 = Some(id);
+ }
+ }
+ }
+
+ let mut failures = Vec::new();
+ eprintln!("\nsource listed downloadable sample install");
+ for (source, (listed, downloadable, sample)) in &by_source {
+ let outcome = match sample {
+ None if *downloadable == 0 => "NONE DOWNLOADABLE".to_string(),
+ None => "no unique-id sample".to_string(),
+ Some(id) => {
+ let before = installed_skill_count(stack.home.path());
+ match rpc(
+ &stack,
+ "openhuman.skill_registry_install",
+ json!({ "entry_id": id }),
+ )
+ .await
+ {
+ Ok(_) if installed_skill_count(stack.home.path()) > before => {
+ format!("ok ({id})")
+ }
+ Ok(result) => format!("NO SKILL.md WRITTEN ({id}): {result}"),
+ Err(error) => format!("FAILED ({id}): {error}"),
+ }
+ }
+ };
+ eprintln!("{source:<22} {listed:>6} {downloadable:>12} {outcome}");
+ if !outcome.starts_with("ok") {
+ failures.push(format!("{source}: {outcome}"));
+ }
+ if downloadable < listed {
+ failures.push(format!(
+ "{source}: {} of {listed} listed entries have no download URL",
+ listed - downloadable
+ ));
+ }
+ }
+
+ assert!(
+ failures.is_empty(),
+ "skill catalog sources offer entries that cannot be installed:\n {}",
+ failures.join("\n ")
+ );
+}
+
+/// A server found in the official MCP registry installs, connects, lists tools,
+/// and answers a tool call.
+///
+/// Walks the search results for `OPENHUMAN_LIVE_MCP_QUERY` and takes the first
+/// server that connects without credentials, then calls one of its tools that
+/// needs no arguments. Requires `npx` (or `uvx`) on PATH for stdio servers.
+#[cfg(feature = "mcp")]
+#[tokio::test]
+#[ignore = "live: official MCP registry + npm/pypi packages"]
+async fn live_official_mcp_registry_server_installs_connects_and_answers_a_tool_call() {
+ let _lock = env_lock();
+ let stack = live_stack().await;
+ let query = std::env::var("OPENHUMAN_LIVE_MCP_QUERY").unwrap_or_else(|_| "everything".into());
+
+ let search = rpc(
+ &stack,
+ "openhuman.mcp_clients_registry_search",
+ json!({ "query": query, "page": 1, "page_size": 10 }),
+ )
+ .await
+ .expect("search the official MCP registry");
+ let servers = search
+ .get("servers")
+ .and_then(Value::as_array)
+ .cloned()
+ .unwrap_or_default();
+ assert!(
+ !servers.is_empty(),
+ "the official registry returned no servers for {query:?}: {search}"
+ );
+
+ let mut attempts = Vec::new();
+ for server in servers.iter().take(5) {
+ let Some(name) = ["qualified_name", "qualifiedName", "name"]
+ .iter()
+ .find_map(|key| server.get(*key).and_then(Value::as_str))
+ else {
+ attempts.push(format!("unnamed search row: {server}"));
+ continue;
+ };
+
+ let server_id = match rpc(
+ &stack,
+ "openhuman.mcp_clients_install",
+ json!({ "qualified_name": name, "env": {} }),
+ )
+ .await
+ {
+ Ok(installed) => match installed
+ .pointer("/server/server_id")
+ .and_then(Value::as_str)
+ {
+ Some(id) => id.to_string(),
+ None => {
+ attempts.push(format!(
+ "{name}: install returned no server_id: {installed}"
+ ));
+ continue;
+ }
+ },
+ Err(error) => {
+ attempts.push(format!("{name}: install failed: {error}"));
+ continue;
+ }
+ };
+
+ let connected = match rpc(
+ &stack,
+ "openhuman.mcp_clients_connect",
+ json!({ "server_id": server_id }),
+ )
+ .await
+ {
+ Ok(connected) => connected,
+ Err(error) => {
+ attempts.push(format!("{name}: connect failed: {error}"));
+ continue;
+ }
+ };
+ let tools = connected
+ .get("tools")
+ .and_then(Value::as_array)
+ .cloned()
+ .unwrap_or_default();
+ if tools.is_empty() {
+ attempts.push(format!("{name}: connected but listed no tools"));
+ continue;
+ }
+
+ let no_arg_tool = tools.iter().find_map(|tool| {
+ let schema = tool.get("input_schema").or_else(|| tool.get("inputSchema"));
+ let required = schema
+ .and_then(|s| s.get("required"))
+ .and_then(Value::as_array)
+ .is_some_and(|r| !r.is_empty());
+ (!required).then(|| tool.get("name").and_then(Value::as_str))?
+ });
+ let Some(tool_name) = no_arg_tool else {
+ attempts.push(format!(
+ "{name}: {} tools, none callable without arguments",
+ tools.len()
+ ));
+ continue;
+ };
+
+ match rpc(
+ &stack,
+ "openhuman.mcp_clients_tool_call",
+ json!({ "server_id": server_id, "tool_name": tool_name, "arguments": {} }),
+ )
+ .await
+ {
+ Ok(called) if called.get("is_error").and_then(Value::as_bool) == Some(false) => {
+ eprintln!(
+ "\n{name}: installed, connected, {} tools, `{tool_name}` answered",
+ tools.len()
+ );
+ return;
+ }
+ Ok(called) => {
+ attempts.push(format!("{name}: `{tool_name}` returned an error: {called}"))
+ }
+ Err(error) => attempts.push(format!("{name}: `{tool_name}` call failed: {error}")),
+ }
+ }
+
+ panic!(
+ "no server from the official registry search {query:?} installed, connected and answered a tool call:\n {}",
+ attempts.join("\n ")
+ );
+}