MCP dashboard tooling
MCP dashboard tooling provides a self-contained dashboard view for machine clients such as Claude. It combines the shared DAC dashboard widgets with a host tool interface, so an MCP host can select a dashboard and supply its definition, widget data, and filter options without exposing the normal browser application or a separate page for each dashboard.
MCP dashboard artifact
The MCP dashboard artifact is a single HTML page that runs inside an MCP host. It receives a tool result that identifies a dashboard, then requests the definition and data needed to render that dashboard through the host’s server-tool bridge.
This keeps the machine-client view focused on dashboard work while still using the shared dashboard model. It supports the main dashboard experience:
- dashboard title, description, update time, and draft status
- global and tab-scoped filters
- dashboard tabs and responsive widget rows
- metric, chart, table, text, image, and nested tab widgets through the shared widget layer
- refresh, host link opening, and full-screen display mode when the host allows it
The host remains responsible for the MCP tool call and for opening external links. The page does not load dashboard content from an outside URL, which lets the host control the data boundary.
The diagram shows how a machine client turns a tool result into a rendered dashboard.
sequenceDiagram
participant M as Machine client
participant H as MCP host
participant A as Dashboard artifact
participant T as Dashboard preview tool
M->>H: Request dashboard view
H->>A: Send tool input and host context
A->>T: Request definition
T-->>A: Definition and dashboard metadata
A->>T: Request widget data or filter options
T-->>A: Results for the current filters
A-->>H: Render dashboard view
H-->>M: Display dashboard
Tool-backed dashboard state
The dashboard view treats the MCP host as its data client. A selected dashboard is loaded by the preview tool, and later widget or filter-option requests carry the dashboard ID, state, revision, and current filter values. A revision-aware identity prevents data from an earlier dashboard definition from being reused after an edit.
The view keeps the current dashboard visible during a background refresh. A failed first load shows a clear error, while a broken individual widget is isolated so it does not remove the rest of the dashboard. Draft and published state are passed through the selection so machine clients can ask for the intended version.
References: frontend/…/dashboard.tsx• L32-55 frontend/…/dashboard.tsx• L90-165 frontend/…/dashboard.tsx• L168-206
Host interaction boundary
The host interaction boundary connects page behavior to the MCP environment. The artifact receives tool input and results, observes changes to theme and display mode, requests automatic sizing, and delegates link opening and display-mode changes to the host.
This boundary also defines the security shape of the page. The HTML policy permits only in-page scripts and styles plus data or blob images. Dashboard links do not navigate the embedded page; HTTP links go through the host instead.
References: frontend/…/dashboard.tsx• L32-44 frontend/…/dashboard.tsx• L122-146 frontend/…/dashboard.html• L5-12
Theme artifacts
Theme artifacts give the MCP view a stable visual contract for light and dark host modes. Each artifact combines the shared Bruin component set with a token set for surfaces, text, states, and chart colors.
The MCP theme copy follows the dashboard appearance used by Bruin Desktop. The host context selects the light or dark template, while the shared TemplateProvider makes its tokens and components available to filters, rows, widget frames, and visual widgets. This allows the MCP page to reuse dashboard behavior without creating a second widget system.
References: frontend/…/theme.ts• L1-4 frontend/…/theme.ts• L5-54 frontend/…/TemplateProvider.tsx• L10-57 frontend/…/index.ts• L13-34
Reusable dashboard interface
The reusable dashboard interface is the @bruin-data/dac-ui library exposed by frontend/…/lib.ts. It provides the data-client boundary, theme provider, filter bar, row layout, widget frames, widget renderers, query hooks, filter-option hooks, and shared dashboard types.
The MCP artifact supplies its own data client rather than using browser HTTP routes. That client maps dashboard definition, widget, and filter-option requests to MCP tool actions. The same widget layer then handles layout and rendering, so changes to shared dashboard functionality can serve both the local web app and machine clients.
References: frontend/…/lib.ts• L3-26 frontend/…/dataClient.ts• L5-29 frontend/…/dashboard.tsx• L192-208 frontend/…/DashboardWidget.tsx• L7-67
Dedicated frontend build
The MCP page has a separate Vite build because it is a release artifact for an embedded host, not a route in the local dashboard application. The build:mcp script uses frontend/vite.mcp.config.ts, takes mcp/dashboard.html as its entry point, and writes the result to frontend/dist-mcp as one self-contained HTML file.
The build includes the React and Tailwind plugins plus the single-file plugin. The normal frontend build and the MCP build therefore share source components but produce different delivery forms: the local app serves a web application, while the MCP build produces a portable page that a host can attach to a release and serve through its MCP system.
References: frontend/package.json• L23-30 frontend/vite.mcp.config.ts• L1-15 frontend/tsconfig.app.json• L10-27
Artifact delivery
Artifact delivery starts when a release builds the MCP page and ends when an MCP host serves that page to a machine client. The page carries its styles and code with it, so the host does not need to provide the local DAC application or allow the page to fetch a separate asset bundle.
This delivery mode is separate from local server APIs and live reload. For the local browser workflow, see Local server APIs and live reload. For the normal dashboard page, see Frontend dashboard experience. For the shared widget behavior and export limits, see Frontend widgets and export interactions.
References: frontend/vite.mcp.config.ts• L6-15 frontend/…/dashboard.html• L5-12 frontend/…/dashboard.css• L1-7
Change checklist
When these files or sections are changed, remember to consider these:
- Keep the MCP tool action names and request fields aligned with the host-side preview tool contract.
- Keep dashboard and widget identity stable across definition revisions, widget queries, filter options, and cached results.
- Keep the MCP data-client behavior aligned with the shared
DataClientinterface so reusable widgets continue to work. - Keep light and dark token names aligned with the shared DAC styles and widget states.
- Keep the single-file entry, output path, release artifact name, and host delivery step aligned.
- Preserve the embedded page’s link and content security boundary when adding dashboard features.
Important failure modes
| Trigger | Consequence | Guard |
|---|---|---|
| The host sends a tool result without a valid dashboard ID | The artifact cannot select a dashboard and shows a connection or load error | Keep the initial tool result contract aligned with the MCP host |
| A tool response has neither structured content nor valid JSON text | Dashboard definition or widget data cannot be read | Return one supported result form for every preview action |
| A dashboard revision changes but the cache identity does not | Widgets can show data from an older definition | Include dashboard ID and revision in the dashboard identity and tool requests |
| One widget definition cannot render | A broken widget is shown as an error instead of taking down the full page | Keep the widget error boundary around each widget |
| The host does not support full-screen mode | The full-screen control must not offer an action the host cannot perform | Check the host’s available display modes before showing the control |
| The MCP build emits separate assets or misses the HTML entry | The release cannot serve the expected portable dashboard page | Keep the single-file build configuration and release attachment contract aligned |
| A dashboard link tries to navigate inside the embedded page | The page can leave the MCP host context or fail to open the target | Route HTTP links through the host open-link function |
Key files
| File | Why to read it |
|---|---|
| frontend/…/dashboard.tsx | Defines the MCP dashboard lifecycle, host boundary, tool actions, refresh behavior, filters, and widget rendering. |
| frontend/…/dashboard.html | Defines the self-contained page shell and its content security policy. |
| frontend/…/dashboard.css | Defines the MCP page layout, host-friendly states, responsive rules, and export-control restrictions. |
| frontend/…/theme.ts | Defines the light and dark MCP theme artifacts and their relationship to the shared Bruin template. |
| frontend/vite.mcp.config.ts | Defines the dedicated single-file build and release output. |
| frontend/package.json | Shows the MCP build command and the reusable frontend package boundary. |
| frontend/…/lib.ts | Shows the shared dashboard components and hooks reused by the MCP artifact. |
| frontend/…/dataClient.ts | Defines the data-client contract that lets MCP replace browser HTTP access. |
| frontend/…/template.ts | Defines the template component and token contract used by the MCP theme. |