Repository navigation
Report an unlisted registry server as unknown, and skip too-short searches - #176
Conversation
…rches Two user-input cases against the official MCP registry came back as raw upstream errors (625 Sentry events, 39 users): - a detail lookup for a name the registry does not list gets 404, which surfaced as Error::Http rather than the Error::UnknownServer the module already returns for an empty versions document; - a search of one or two characters was sent as search=, and the registry refuses it with 422 (at least 3 characters after trimming). get_listed now maps a 404 from the versions endpoint to UnknownServer, so the curated fallback and a host's unknown-server handling apply to it. A query shorter than 3 characters after trimming is no longer sent as a search, and the page comes back unfiltered, as for an empty query. The host side (treating UnknownServer as expected user state instead of an unexpected failure) is openhuman's part of tinyhumansai#167. Closes tinyhumansai#167
|
Important
This repository does not receive automatic reviews because it has fewer than 10 stars.
|
Tiny Sweeper reviewReviewed head: Verdict: Ready for maintainer review · Priority: none Diagnostics and supporting detailsFull summaryPull request purpose (title): Report an unlisted registry server as unknown, and skip too-short searches. This pull request turns two user-input cases against the official MCP registry into ordinary, expected outcomes instead of raw upstream errors: a detail lookup for a name the registry does not list (a 404 from `/v0/servers/{name}/versions`) now returns `Error::UnknownServer` rather than `Error::Http`, and a search query shorter than the registry's three-character minimum is no longer sent as a `search` parameter, so the unfiltered page is served instead. Both changes are documented in rustdoc and exercised by new and updated tests around the changed code. The latest-push delta is unavailable; there is no base-to-head comparison, so nothing below is a push delta. No findings were reported by any answered lane. Review snapshot
Completeness: Complete What changedBehaviorally, `McpOfficialRegistry::get` now matches the detail response against `Error::Http { status: 404, .. }` and converts it into `Error::UnknownServer { server }` carrying the qualified name, so an unlisted server is reported the same way as an empty versions document and the curated fallback and host unknown-server handling apply, as described in the `# Errors` rustdoc on `get` (crates/tinymcp/src/registry/sources/official/mod.rs, crates/tinymcp/src/registry/sources/official/mod.rs#impl McpOfficialRegistry {). The local-index lookup test was updated to expect `UnknownServer` for an uncurated name that the registry does not list, where it previously expected `Http { status: 404 }`, while a curated server is still described from its entry (crates/tinymcp/src/registry/sources/official/index_tests.rs#async fn an_uncurated_server_the_registry_does_not_list_is_still_an_error() {). For search, a new `MIN_SEARCH_CHARS` constant documents the registry's three-character (post-trim) floor, and `fetch_page` only attaches the `search` parameter when the trimmed query meets it, otherwise fetching the unfiltered page as for an empty query (crates/tinymcp/src/registry/sources/official/mod.rs). The test harness gained a `searches` field so each request's `search` parameter is recorded for assertions (crates/tinymcp/src/registry/sources/official/mod_tests.rs#struct Seen {, crates/tinymcp/src/registry/sources/official/mod_tests.rs#async fn paged_registry(pages: usize) -> (String, Arc<Seen>) {). Features
Tests
FindingsNo active actionable findings. Before mergeNone. How this fits togetherflowchart LR
n0["McpOfficialRegistry<br/>changed"]:::changed
n1["Seen<br/>changed"]:::changed
n2["...ng_a_slash_is_sent_as_one_escaped_segment<br/>changed"]:::changed
n3["paged_registry<br/>changed"]:::changed
n4["the_first_page_is_fetched_without_a_cursor<br/>changed"]:::changed
n5["auth_at"]:::impacted
n6["store"]:::impacted
n7["cursors"]:::impacted
n8["adapter"]:::impacted
n9["...search_skips_the_network_for_the_cooldown"]:::impacted
n2 -->|calls| n3
n2 -->|tests| n3
n2 -->|calls| n5
n2 -->|tests| n5
n2 -->|calls| n6
n2 -->|tests| n6
n2 -->|calls| n8
n2 -->|tests| n8
n3 -->|uses| n1
n4 -->|calls| n3
n4 -->|tests| n3
n4 -->|calls| n5
n4 -->|tests| n5
n4 -->|calls| n6
n4 -->|tests| n6
n4 -->|calls| n7
n4 -->|tests| n7
n4 -->|calls| n8
n4 -->|tests| n8
n8 -->|uses| n0
n9 -->|calls| n5
n9 -->|tests| n5
n9 -->|calls| n6
n9 -->|tests| n6
classDef changed fill:#0d4429,stroke:#238636,color:#e6edf3
classDef impacted fill:#161b22,stroke:#6e7681,color:#c9d1d9
classDef flagged fill:#5a1e02,stroke:#d93f0b,color:#ffffff
classDef blocking fill:#67060c,stroke:#f85149,color:#ffffff
Agent review detailscritique
security
tests
commits
description
Evidence and run details
|
Summary
Two user-input cases against the official MCP registry came back as raw upstream errors and reached Sentry at error level (TAURI-RUST-116W, 601 events and 39 users; 165B, 24 events):
/v0/servers/{name}/versions. That surfaced asError::Http, not theError::UnknownServerthe module already returns for an empty versions document. It's now mapped toUnknownServer, so the curated fallback and a host's unknown-server handling apply.search=, and the registry refuses it with 422 ("at least 3 characters after trimming"). A query that short is no longer sent as a search, and the page comes back unfiltered, as for an empty query.Related issue
Closes #167. The host side, treating
UnknownServeras expected user state with a friendly message, belongs in OpenHuman (mcp/registry/ops.rs).API or behavior changes
McpOfficialRegistry::getreturnsUnknownServerfor a registry 404, including through the local-index lookup, where it used to surface asHttp { status: 404 }.Validation
On our Linux CI runner, at e4b8cf8:
cargo fmt --all -- --check: clean.cargo clippy --all-targets --all-features -- -D warnings: 0 errors, same as main.cargo build --all-targets --all-features: ok.cargo test -p tinymcp registry::sources::official: 150 passed, 0 failed.cargo test --workspace: no failures unique to this branch. The 5 failures are main's known full-suite timeouts inregistry::bootandtinybus_module::directories.a_name_the_registry_does_not_list_is_an_unknown_serverand the index lookup test fail;Tests
a_name_the_registry_does_not_list_is_an_unknown_serveruses a stub registry answering 404.a_query_shorter_than_the_registry_minimum_is_not_sent_as_a_searchchecks that"a"and" ab "send nosearchwhile"abc"does.an_uncurated_server_the_registry_does_not_list_is_still_an_error(index) used to expect the rawHttp { status: 404 }. It now expectsUnknownServer, which is the change this PR makes; it is still an error, and a curated server is still described from its entry.Documentation
The rustdoc on
getand onMIN_SEARCH_CHARS.Checklist
#[allow(...)],#[ignore], or relaxed lints.envcontents in the diff or the description