Repository navigation
feat(atlas-search): MCP endpoint on the search Worker (#8625) - #12785
Merged
Merged
Conversation
Add a stateless MCP (Model Context Protocol) Streamable HTTP endpoint, POST /mcp, to the atlas-search Worker, exposing one tool — search — for mcpx and other MCP clients. The search execution moves to src/search.ts (executeSearch + clampK) so the REST route and the MCP endpoint share exactly one path: same GATE_TOKEN gate (checked in index.ts), same pinned hosted-per-user disclosure context (#12622) and personal ceiling, same per-query Durable Object cache. An MCP search and a REST search for the same query share one cache entry; the new tests pin that, plus the context stated to the service on an MCP-originated call. Deliberately not exposed: cache purge (a write) and cache inspect (operator/audit). Per-agent identity stamping, per-agent ceilings/corpus scoping, and the query audit log remain #8625's later slices — callers here share the one hosted identity the REST surface already serves. Tests: test/mcp.test.ts, 7 cases (gate + POST-only, version negotiation, ping/notifications/unknown methods, tools/list shape, tools/call over the shared path, argument validation, batch). Full worker suite 31/31, typecheck clean.
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 29 minutes. View limit details
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. |
This was referenced Nov 23, 2026
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.
What
Adds
POST /mcpto the atlas-search Worker (#8625, hosted-transport slice): a stateless MCP Streamable HTTP endpoint exposing one tool,search, for mcpx and other MCP clients. Drew's order 2026-11-22: Atlas MCP as a versioned Cloudflare deployment, wired into the laptop's mcpx as a remote server (the mcpx wiring lands in a companion PR againsthome/common).How
src/search.ts(new): the search execution (executeSearch+clampK) extracted from the REST route — one path for both surfaces: sameGATE_TOKENgate, same pinnedhosted-per-usercontext (atlas(worker): state the disclosure context on hosted search requests and key the result cache by it #12622) andpersonalceiling, same per-query Durable Object cache.src/mcp.ts(new): the JSON-RPC layer —initialize(version negotiation),ping,tools/list,tools/call, batch support, notifications → 202. Stateless: no session id.src/index.ts:/mcproute (POST-only, 405 +Allowotherwise) behind the existing gate; REST search now callsexecuteSearch.Scope honesty
Callers of this endpoint share the one hosted identity the REST surface already serves. #8625's per-agent identity stamping, per-agent ceilings/corpus scoping, and query audit log remain open as later slices — recorded on #8625.
Verification
test/mcp.test.ts: 7 new tests — gate + POST-only, version negotiation, ping/notifications/unknown method, tools/list shape, tools/call over the shared path (asserts the service body states the pinned context, and that a REST repeat of the MCP query is a cache hit on the same entry), argument validation, batch.tsc --noEmitclean. Run on the laptop in the branch worktree.cf workers versions create+deployments create, MCP round-trip, mcpx end-to-end) recorded on atlas memory slice 3: MCP query surface over the unified Atlas index (mcpx namespace) (#8567) #8625.Open in [code]smith · Need help on this PR? Tag
@codesmith-botwith what you need.