console: WIP in-console MCP panels and \ask agent - #38743
Draft
leedqin wants to merge 1 commit into
Draft
Conversation
Work in progress, dev-server only, ungated. Opening for visibility and handoff, not for merge. Adds an in-console AI agent behind `\ask <question>` in the SQL Shell, four MCP-backed diagnostic slash commands (`\health`, `\freshness`, `\sources`, `\products`), and three MCP-backed panels (attention feed and data products on the environment overview, freshness on materialized view detail, impact banner on cluster overview). The browser orchestrates the tool-use loop. Catalog reads go straight from the browser through the user's own authenticated session, so RBAC is preserved without any server-side privilege model; only the model completion is proxied, through a dev-server middleware that injects the Anthropic key. The system prompt directs the model at the built-in ontology relations first so it discovers real table and column names rather than guessing them. `console/doc/ask-agent.md` covers running it locally, where the key lives, what the target environment must provide, and the gaps that block shipping: no feature gating on the panels, no production key-holding endpoint, no streaming, and no tests.
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.
Draft, not for merge. Dev-server only and ungated. Opening this for
visibility and to hand the work off.
What this adds
An in-console AI agent plus the MCP-backed surfaces around it:
\ask <question>in the SQL Shell, which runs a tool-use loop against thesystem catalog and answers in plain English, printing each query it ran.
\health,\freshness,\sources,\products.overview, freshness on materialized view detail, and an impact banner on
cluster overview.
Architecture
The browser orchestrates the tool-use loop. This is the part worth reviewing,
because it is meant to be the production shape and not just a demo shortcut:
authenticated session, hitting
/api/mcp/developerand/api/mcp/agent.RBAC is preserved for free, with no server-side privilege model to build or
to get wrong.
hold an Anthropic key. Today that proxy is a Vite dev-server middleware that
reads
ANTHROPIC_API_KEYserver-side and forwards to the Messages API.first, so it discovers real table and column names instead of guessing
them. This is the piece that keeps generated joins correct, and it leans on
catalog facts that are hard to replicate elsewhere, for instance
mz_materialization_lagalready naming the bottleneck input.Model is
claude-opus-5, pinned in both the agent and the proxy fallback.What blocks merging
environment overview, cluster overview, and MV detail pages. Each needs a
LaunchDarkly flag.
/api/askis registered inconfigureServer,so it exists only under
yarn start. A production build has no/api/askand
\askfails there. Cloud console is on Vercel, so the shape there is aVercel Function; self-managed console is served by environmentd and needs its
own key-holding sidecar.
on "Investigating..." until the full answer lands.
which should read a typed interval instead.
Docs
console/doc/ask-agent.mdcovers running it locally, how the key is handled,what the target environment must provide (the MCP endpoint flags, the ontology
relations, and the CORS-allowed-origin requirement when pointing at a bare
emulator), and the same gap list above.
Tests
None added. See the gap list.