Repository navigation
feat(frontend): proxy /mcp to the datahub-ai-service - #21350
Conversation
PR SummaryOverview Docker and dev stacks gain Reviewed by Cursor Bugbot for commit 66f9777. Bugbot is set up for automated code reviews on this repo. Configure here. |
Bundle ReportBundle size has no change ✅ |
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
|
🤖 Meticulous is testing this change with Agent swarm instead of replaying recorded sessions. View Agent swarm. Last updated for commit |
Initial JS bundle size ➡️
|
CI's package check compares find_packages with find_namespace_packages, and the gql directory had no __init__.py. Make it a package and declare its .gql files as its own package data. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Installing metadata-ingestion and the two packages from source resolves their build requirements from the configured index. In CI that index needs the netrc secret, which only the lock install step mounted. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
FastMCP 4.2.5 serves subscriptions/listen, and on the 2026-07-28 protocol the SDK advertises listChanged whenever that handler is registered, overriding the notification options. Drop the handler: the server never sends change notifications, and an in-process bus can't reach clients on another replica. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
master now adds its own placeholder right after __SYSTEM_CLIENT_SECRET__. Keeping ours one line further down lets both changes merge without a conflict. The replacements are independent, so their order doesn't matter. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Smart test selectionpytest smoke testsMode: shadow. The selection below is computed but not applied; this PR still runs the default matrix (
Medium confidence: a wrong tag means tests are skipped, so check the tags above against what this PR touches. Selected scopes (21 files or classes, 151 tests)
Add the commit |
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using high effort and found 1 potential issue.
There are 3 total unresolved issues (including 2 from previous reviews).
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 66f9777. Configure here.
| DATAHUB_GMS_BASE_PATH: ${DATAHUB_GMS_BASE_PATH:-/} | ||
| LOG_AGGREGATOR_ENDPOINT: ${LOG_AGGREGATOR_ENDPOINT:-} | ||
| # /mcp is proxied to datahub-ai-service (docker-compose.ai.yml). | ||
| DATAHUB_AI_SERVICE_URL: ${DATAHUB_AI_SERVICE_URL:-http://datahub-ai-service:9005} |
There was a problem hiding this comment.
Frontend /mcp points at missing service
High Severity
The frontend always sets DATAHUB_AI_SERVICE_URL to http://datahub-ai-service:9005, including on the quickstart and debug-min profiles where datahub-ai-service is not started. A configured URL makes /mcp proxy instead of 404, so those installs wait on connect then return 503. The generated CLI compose also freezes that URL as a literal, so it cannot be cleared or overridden.
Additional Locations (2)
Reviewed by Cursor Bugbot for commit 66f9777. Configure here.


Stack. This is one PR in a series that adds a built-in MCP server to DataHub Core. It is based on
na--mcp-server-flag(the previous PR in the stack); review only its own commit. This PR changes GMS, the frontend, Docker or CI, not only the new Python packages. Everything user-facing is behind a GMS feature flag,MCP_SERVER_ENABLED, off by default (added in #21349).Stack so far:
What this does
Serve MCP at /mcp, the same URL shape as DataHub Cloud, by proxying
GET/POST/DELETE /mcp and /mcp/* from the frontend to datahub-ai-service
(DATAHUB_AI_SERVICE_URL; /mcp is 404 while it is unset).
the caller's Authorization header, which is forwarded unchanged. The
session cookie and X-DataHub-Actor are never forwarded, so a logged-in
browser tab can't call /mcp with its cookie. OPTIONS answers 405 with no
CORS headers, so cross-site browser calls fail their preflight. A token
in the URL (?token=) is refused with 400.
Accept, Origin, User-Agent, Last-Event-ID and every Mcp-* header (the
stateless protocol routes on Mcp-Method / Mcp-Name / Mcp-Param-*).
X-Forwarded-Host is overwritten with the Host the client used, and
X-Forwarded-Proto set, for datahub-ai-service's DNS-rebinding check.
(frontend.aiProxy.streamIdleTimeoutSeconds, 600), so slow calls hold no
blocking-I/O thread; gzip is bypassed so SSE isn't buffered. Response
headers wait up to frontend.aiProxy.timeoutSeconds (600).
tied to readiness, held until the response finishes streaming and
released exactly once, including when the client goes away.
Tests run against a local HTTP server: header forwarding and stripping,
404/400/405/503, a first SSE event delivered while the next is held back,
the permit held for the whole stream, and released on client disconnect.
Live through a local OSS frontend: legacy and modern clients, Claude Code
with no token (GMS auth off), and 403 for a rebinding request.
Testing
8 controller tests vs a local HTTP server (streaming, permit release on disconnect). Live through the OSS frontend: legacy + modern clients, Claude Code with no token, rebinding 403.
Checklist
🤖 Generated with Claude Code