Skip to content

feat(atlas-search): MCP endpoint on the search Worker (#8625) - #12785

Merged
dezren39 merged 1 commit into
mainfrom
archer-lane-bt/atlas-mcp
Nov 23, 2026
Merged

dezren39 merged 1 commit into
mainfrom
archer-lane-bt/atlas-mcp

Conversation

@dezren39

@dezren39 dezren39 commented Nov 23, 2026 •

Copy link
Copy Markdown
Member

What

Adds POST /mcp to 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 against home/common).

How

  • src/search.ts (new): the search execution (executeSearch + clampK) extracted from the REST route — one path for both surfaces: same GATE_TOKEN gate, same pinned hosted-per-user context (atlas(worker): state the disclosure context on hosted search requests and key the result cache by it #12622) and personal ceiling, 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: /mcp route (POST-only, 405 + Allow otherwise) behind the existing gate; REST search now calls executeSearch.
  • Not exposed, deliberately: cache purge (a write) and cache inspect (operator/audit).

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.
  • Full worker suite: 31/31 pass; tsc --noEmit clean. Run on the laptop in the branch worktree.
  • Deployment + live verification (new Worker version via 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.

Run Proof on this PR
Open in [code]smith · Need help on this PR? Tag @codesmith-bot with what you need.

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.
@dezren39
dezren39 requested a review from a team as a code owner November 23, 2026 02:47
@dezren39
dezren39 merged commit 9d37641 into main Nov 23, 2026
1 check passed
@dezren39
dezren39 deleted the archer-lane-bt/atlas-mcp branch November 23, 2026 02:47
@coderabbitai

coderabbitai Bot commented Nov 23, 2026

Copy link
Copy Markdown

Warning

Review limit reached

You'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.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 212dbade-2200-4f30-b3f0-ce33c38d471d
Commits

Reviewing files that changed from the base of the PR and between e6a32a5 and 38ca3ab.

Files selected for processing: 6

  • pkgs/atlas-search/worker/README.md
  • pkgs/atlas-search/worker/src/index.ts
  • pkgs/atlas-search/worker/src/mcp.ts
  • pkgs/atlas-search/worker/src/search.ts
  • pkgs/atlas-search/worker/test/mcp.test.ts
  • pkgs/atlas-search/worker/wrangler.toml
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

Share

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant