Skip to content

Route MCP requests across regional deployments and isolate outages - #36

Merged
rmorehig merged 5 commits into
mainfrom
rafa/regional-api-routing
Oct 28, 2026
Merged

rmorehig merged 5 commits into
mainfrom
rafa/regional-api-routing

Conversation

@rmorehig

@rmorehig rmorehig commented Oct 19, 2026 •

Copy link
Copy Markdown
Contributor

User-authenticated MCP requests previously discovered clusters only through the default deployment. Discover clusters across enabled deployments, resolve routing through each cluster’s region ID, and send requests to deployment-specific public API hosts while retaining routing headers. Authoritative regional records take precedence over gateway duplicates in either response order.

Match the UI’s regional-outage handling: each deployment lookup has a five-second deadline; successful deployments return healthy clusters with unavailable_regions containing failed region IDs and names. Authentication failures and total outages remain errors. Requests for clusters absent from a partial catalog, or gateway stubs lacking both a region reference and valid routing metadata, refresh discovery and fail safely if the cluster is still undiscovered, preventing default-gateway fallback and allowing immediate recovery. The list-clusters tool description and README explain partial results.

Supports current 8-character and legacy 32-character deployment IDs. Custom API origins and API-key routing retain their existing behavior. Merged current main to preserve the newer workflow and query-tool fixes; release notes are under Unreleased.

Validation: all 275 tests passed; pnpm lint, pnpm build, and git diff --check passed. Coverage includes direct EU requests, duplicate deployments and gateway records, custom endpoints, API keys, legacy IDs, partial/total outages, DNS failures, timeouts, authorization errors, empty healthy catalogs, recovery, cluster-ID mutations, and gateway stubs during outages in both catalog orders. An in-memory MCP tool check using the compiled server and a simulated stalled regional transport returned partial results after 5.02 seconds using the real deadline, then routed to the recovered region. Final structured autoreview reported no actionable findings.

Related Platform changes: https://github.com/rawtreedb/rawtree-platform/pull/1566, https://github.com/rawtreedb/rawtree-platform/pull/1575, and https://github.com/rawtreedb/rawtree-platform/pull/1637.

Companion CLI change: rawtreedb/rawtree-cli#85.


Note

Medium Risk
Changes core request routing and cluster discovery for OAuth/session users; mis-routing or stale cache could send operations to the wrong deployment, though extensive tests cover outages and recovery.

Overview
User-authenticated clients no longer list clusters only through the default API gateway. listClusters fans out to each enabled regional deployment (deduped by routing headers), merges catalogs with authoritative region_id metadata over gateway duplicates, and attaches unavailable_regions when some deployments fail within a 5s per-target deadline. rt_ API keys keep the single-gateway behavior.

Scoped cluster operations gain deploymentApiUrl, rewriting api.rawtree.com / api.rawtree.dev to deployment-specific public hosts while still sending X-RawTree-Deployment-Id / X-RawTree-Region. Custom API origins are unchanged. ClusterRouting refuses gateway-only stubs during partial discovery, invalidates cache for retry after recovery, and errors safely when a cluster is missing from a partial catalog. Legacy 32-character deployment IDs are accepted alongside 8-character IDs.

Docs and the list-clusters MCP tool description explain partial results and retry expectations.

Reviewed by Cursor Bugbot for commit a2ccc5e. Bugbot is set up for automated code reviews on this repo. Configure here.

@rmorehig rmorehig changed the title Route MCP requests across regional deployments (0.4.2) Route MCP requests across regional deployments and isolate outages Oct 28, 2026

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes using high effort and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 4cc4c01. Configure here.

Comment thread src/client/discovery.ts
@rmorehig
rmorehig merged commit 4805c3e into main Oct 28, 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