Repository navigation
Rank MCP service search over a per-organization index - #198
Merged
Merged
Conversation
Deploying with
|
| Status | Name | Latest Commit | Updated (UTC) |
|---|---|---|---|
| ✅ Deployment successful! View logs |
widefleet-docs | 4b8c414 | Nov 19 2026, 04:48 PM |
tnkuehne
force-pushed
the
feat/mcp-service-search
branch
from
November 19, 2026 16:37
3f1e8e4 to
71cb0f7
Compare
MCP search listed ten route keys at a time across the whole installation and filtered them afterwards, so first pages were often empty and a distinctive word such as "console" needed several calls. It also required the full query to appear as one substring. Search now ranks every permitted entrypoint with BM25 over words from the hostname, entrypoint and service documentation, then pages with limit/offset and returns the next input. Names come before prose in each entry's bounded word list, so long remarks cannot hide method or parameter names. Search reads one per-organization index in R2 instead of every route, publication and documentation object. Publishers refresh a host through the runtime after committing its route and publication: the Cloudflare deployment and removal workflows, and the agent when the runtime release advertises search support and the job has a host. A failed refresh is logged and leaves the committed operation in place. A missing or day-old index is rebuilt by searches, at most 200 routes per search, with progress kept in the index. Until the first rebuild completes, search reports complete: false. Refreshes create a missing index, update a rebuild in progress and always change the object, so a rebuild that read older state cannot overwrite them. The index is derived state; search rechecks returned routes, and describe and call authorize independently.
A daily rebuild serves the previous index, which a lost refresh may have left without a service. Search now reports complete: false until the rebuild has read every route, not only during the first one.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
MCP
searchlisted ten route keys at a time across the whole installation and filtered them afterwards. Pages were often empty because most keys belong to other organizations, so a distinctive word such asconsoleneeded several calls with cursors. The query also had to appear as one contiguous substring, so multi-word queries rarely matched.Search now ranks every permitted entrypoint with BM25 over words from the hostname, entrypoint, method and parameter names, summaries, parameter descriptions and remarks. Names come first in each entry's bounded word list, so long remarks cannot push them out. Identifiers are split (
searchAnalytics→search analytic) and simple plurals are stemmed. The best matches come first. An exact hostname lists that host's entrypoints, and an empty query lists everything. Paging useslimit(default 10, max 50) andoffset, and the response returns{ services, remaining, next, complete };nextis the complete input for the following page. This replaces the KVcursorparameter. The tool description tells clients how to page.Search reads one index object per organization (
service-index/<org>.jsonin the packages bucket) instead of every route, publication and documentation object. A new runtime management endpoint,/.well-known/widefleet/service-index, recomputes one host's entry from the current route and publication and writes it with an ETag condition. Publishers call the endpoint after committing:search: 1and the job has a host. Runtime-only jobs skip the refresh.A failed refresh is logged and leaves the committed operation in place, so it cannot mark a serving deployment as failed or stop a removal.
A missing index, or one older than a day, is rebuilt by searches. Route keys carry no organization, so a rebuild reads every route of the installation; each search advances it by at most 200 routes, six at a time, and keeps its progress in the index. During a rebuild, search uses the last complete index updated with the routes scanned so far. Until the rebuild has read every route, the response reports
complete: falseand the tool description asks clients to search again, because a lost refresh may still hide a service it has not reached.Refreshes and rebuilds cannot overwrite each other. A rebuild writes only if the index is unchanged since it read it. A refresh applies to the index and to a rebuild in progress, creates an expired index when none exists, and always writes. A search that scanned before a concurrent deployment therefore cannot save a result without the new host.
The index is derived state, not authorization. Search rechecks the current route of every returned host, and
describeandcallauthorize independently. A missed refresh can therefore hide a new service or keep stale text until the next rebuild, but cannot expose one whose access was revoked.docs/architecture.mdrecords the publisher contract.Validation:
next.complete: false. The concurrent-publication case fails on both runtimes when a refresh skips a missing index.

Confidence Score: 5/5
The follow-up appears safe to merge; the previous finding is fixed and no new issues were found.Summary
MCP service search now ranks matches from a per-organization index, with publisher refreshes and bounded rebuilds.
Reviews (3) · Last reviewed commit: "Report MCP search as incomplete during e..." · Reviewed by Greptile