Repository navigation
feat(gateway): serve pgweb and db-mcp at /svc/ routes - #821
Merged
Merged
Conversation
The gateway serves the env's SQL consoles at /svc/pgweb/ and /svc/db-mcp/ from a new CONSOLE_URLS variable, behind the deployment's control token like its other guarded routes. The deploy records db_web_gateway_url and db_mcp_gateway_url once it has checked the gateway serves both, and keeps db_web_url and db_mcp_url as they are. db-mcp binds every address family on the container path. The CLI prints the gateway URLs, and a website can no longer be named pgweb or db-mcp.
This was referenced Nov 19, 2026
earakely-scale
marked this pull request as ready for review
November 19, 2026 18:55
…etry the console probe - A multi env's computer can't be named pgweb or db-mcp. The gateway serves a computer at /svc/<name>/, so such a computer used to pass the env's name checks and stop the gateway at startup, after every sandbox was made. - Requests to a SQL console are forwarded without a write window. Only the control token reaches a console, so a write through one is no role's, and it no longer runs the changelog queries on the event loop. - The deploy asks each console up to four times: a dropped or refused connection is asked again, as a timeout or a 502-504 already was. - _verify_list_tools uses the MCP SDK's client (30 s, redirects), as it did before it took headers, and the tests check the record names db-mcp at the gateway before using it. - A bad CONSOLE_URLS or WEBSITE_URLS entry names its own variable. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- CONSOLE_SERVICE_NAMES, beside the console service names, is the one set the website and computer name checks refuse. - consoles_environment() writes CONSOLE_URLS for both deploy paths, as computers_environment() and the other gateway variables are written. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…nsole-routes # Conflicts: # src/agent_env/env/env.py # tst/unit/providers/env_providers/env_gateway_provider_test.py
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.
Why
The gateway already fronts each env's MCP servers and state routes at
/svc/<key>/. This PR adds pgweb and db-mcp to that set, so every harness caller reaches the database consoles the same way: one host, one auth scheme, the deployment's control token.What changed
/svc/pgweb/and/svc/db-mcp/from a newCONSOLE_URLSvariable. Both take the control token, like the gateway's other guarded routes.REST_PROXY_URLS, so they never become backing servers in the env card.pgweb:8081anddb-mcp:8000onenv-network. The container path points it at the console sandboxes.--streamable-http-host=with an empty value).db_web_gateway_url({gateway}/svc/pgweb/) anddb_mcp_gateway_url({gateway}/svc/db-mcp/mcp).db_web_urlanddb_mcp_urlstay as they are, so consumers keep working until they move.env deploy,env get-instance,task run,run --keep) prints the gateway URLs.pgwebordb-mcp, since those are now/svckeys.Blast Radius
pgwebordb-mcpwould now clash. The deploy refuses such a website by name.Verification
tst/unit/env/gateway/console_routes_test.pyis new, with 83 cases.tst/unit/env,tst/unit/providersandtst/unit/clipass.ruff check src tstpasses.Dockerfile.db-mcpand this branch's gateway: both consoles answer through the gateway with the token.

Confidence Score: 5/5
The PR appears safe to merge; no new blocking issues were found.Summary
Adds control-token-protected database consoles behind the gateway while keeping their existing direct URLs in deployment records.
No new actionable issues found. Both earlier findings are addressed.
Diagram
%%{init: {'theme': 'neutral'}}%% flowchart LR C[Caller] -->|Control token| G[Gateway] G -->|/svc/pgweb/| P[pgweb] G -->|/svc/db-mcp/mcp| D[db-mcp] P --> DB[(PostgreSQL)] D --> DB G --> R[Deployment record] R --> CLI[CLI displays gateway URLs]Reviews (5) · Last reviewed commit: "Merge remote-tracking branch 'origin/mai..." · Reviewed by Greptile