Skip to content

Resolve MCP deployment headers from cluster metadata - #34

Merged
rmorehig merged 5 commits into
mainfrom
rafa/client-routing-headers
Oct 17, 2026
Merged

rmorehig merged 5 commits into
mainfrom
rafa/client-routing-headers

Conversation

@rmorehig

@rmorehig rmorehig commented Oct 17, 2026 •

Copy link
Copy Markdown
Contributor

Session and OAuth MCP requests now discover the selected cluster through the existing /v1/clusters?organization=<name> endpoint and send both gateway headers automatically. All tool inputs and existing cluster endpoints remain unchanged.

GET /v1/clusters?organization=acme

POST /v1/query?organization=acme&cluster=production
Authorization: Bearer <session-or-OAuth-token>
X-RawTree-Deployment-Id: 12abcdef
X-RawTree-Region: eu-west-1

The headers come from nullable deployment_id and cloud_region cluster metadata. Missing or invalid metadata omits both headers for the default public region fallback. API keys retain embedded routing and skip data-request discovery. Metadata is cached per client for 30 seconds; discovery honors cancellation and cache invalidation after mutations.

Prepares MCP 0.4.0; publication is deferred. The organization-scoped endpoint migration is outside this PR.

Companions: Platform https://github.com/rawtreedb/rawtree-platform/pull/1524 (cluster metadata and hosted MCP pin) and CLI rawtreedb/rawtree-cli#83. The client works against existing responses without routing metadata by omitting the headers.

Validation: 215 tests, TypeScript build and Biome pass. Tests cover actual MCP tool calls, unchanged cluster paths, scope separation, fallback, cancellation and cache races. A live MCP tool call against the rebuilt backend passes with both headers. P3 autoreview and thermonuclear maintainability review are clean.

@rmorehig rmorehig changed the title Scope MCP clusters by organization and send deployment headers Resolve MCP deployment headers from cluster metadata Oct 17, 2026
@rmorehig
rmorehig merged commit 10522e1 into main Oct 17, 2026
2 checks passed
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