Introducing a new way to review your PRs.

Read the announcement

bruin-data / dac

DaC is a dashboard-as-code tool. Build interactive dashboards using YAML and JSX. Built-in semantic layer. Get your agents to build standardized, reviewable dashboards.

View on GitHub

20 documents · Updated Nov 23, 2026

docs / mcp-dashboard-tooling

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 DataClient interface 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

TriggerConsequenceGuard
The host sends a tool result without a valid dashboard IDThe artifact cannot select a dashboard and shows a connection or load errorKeep the initial tool result contract aligned with the MCP host
A tool response has neither structured content nor valid JSON textDashboard definition or widget data cannot be readReturn one supported result form for every preview action
A dashboard revision changes but the cache identity does notWidgets can show data from an older definitionInclude dashboard ID and revision in the dashboard identity and tool requests
One widget definition cannot renderA broken widget is shown as an error instead of taking down the full pageKeep the widget error boundary around each widget
The host does not support full-screen modeThe full-screen control must not offer an action the host cannot performCheck the host’s available display modes before showing the control
The MCP build emits separate assets or misses the HTML entryThe release cannot serve the expected portable dashboard pageKeep the single-file build configuration and release attachment contract aligned
A dashboard link tries to navigate inside the embedded pageThe page can leave the MCP host context or fail to open the targetRoute HTTP links through the host open-link function

Key files

FileWhy to read it
frontend/…/dashboard.tsxDefines the MCP dashboard lifecycle, host boundary, tool actions, refresh behavior, filters, and widget rendering.
frontend/…/dashboard.htmlDefines the self-contained page shell and its content security policy.
frontend/…/dashboard.cssDefines the MCP page layout, host-friendly states, responsive rules, and export-control restrictions.
frontend/…/theme.tsDefines the light and dark MCP theme artifacts and their relationship to the shared Bruin template.
frontend/vite.mcp.config.tsDefines the dedicated single-file build and release output.
frontend/package.jsonShows the MCP build command and the reusable frontend package boundary.
frontend/…/lib.tsShows the shared dashboard components and hooks reused by the MCP artifact.
frontend/…/dataClient.tsDefines the data-client contract that lets MCP replace browser HTTP access.
frontend/…/template.tsDefines the template component and token contract used by the MCP theme.