Skip to Content

Guides

Set up an embed with an AI agent

Ask an AI agent to embed a dashboard in your app and match your brand, with a tenancy check before any guest token.

Do this with your agent

embed-dashboard

Help me with this Databrain task: Set up an embed with an AI agent. Check the current dashboard, host app and guest token scope where relevant. Show the planned changes and how to verify them. Ask before applying changes.

An AI agent with the Databrain MCP server can embed a dashboard in your app, wire the guest token route and match your brand. It asks you to resolve any metrics the check finds without tenant scope. It asks for permission before it changes live data.

Before you start

  • Your AI app is connected to a Databrain MCP server that lists check_embed_tenancy. Connect AI apps to Databrain shows how.
  • The agent can read and edit your app’s code, for example Claude Code or Cursor in your repository.
  • You know how a signed-in user of your app maps to your data: a client ID, an app filter value, or data shared by everyone.

Steps

  1. Ask the agent, in your own words:

    Embed the Sales overview dashboard in our app and match our brand.
  2. Answer its question about tenancy: how a signed-in user maps to a client, and where your server looks that up. The agent never guesses the mapping from example data.

  3. The agent finds the embed. Give it explicit permission before it calls create_embed or makes another live change. If the tool requires a confirmation value, give it APPLY_TO_PRODUCTION once you agree to that change. If your AI app shows an approval button for a Migration assistant change, review the preview before you choose Approve. In apps that ask in chat, approve the exact preview there.

  4. The agent runs check_embed_tenancy with the token shape it plans to send. An unavailable result pauses route setup and token minting.

    The agent shares every warning from the check. A complete result can include warnings. The agent names each affected metric, gives its reason and shares any dashboard warnings. If an incomplete result leaves out names or reasons, the agent says what is missing. The affected scope stays unverified, including metrics the check lists with a scope.

    The agent asks you to verify the affected metrics or dashboard with an authorized viewer. You can continue setup while those checks are pending. A complete result with no metrics leaves row verification pending.

    If the check finds metrics without tenant scope, it stops and names each one. For each metric, choose one:

    • add the client filter to the metric,
    • scope the table to the tenant,
    • or confirm that this data is shared on purpose.

    The agent never confirms for you. It checks again after each change.

  5. After you review the scope and resolve any unscoped metrics, confirm how your server can issue the guest token. The v2 data-app mint requires a client ID. For an app-filter-only setup, use an authorized issuer you already have. If no compatible issuer is available, pause here. When one is available, the route uses your signed-in user’s server-side mapping to send the reviewed scope and bind the short-lived token to the intended embed. Your API key stays on the server. Keep the data app and embed in your server’s configuration. Your token route looks up the client ID from the signed-in user’s membership.

  6. With that token, your app renders <dbn-dashboard>. The agent applies your brand color, font and corner radius. If you have two tenants you are authorized to use for testing, the agent checks the embed in a browser for both and reports the result.

The agent reports the embed ID, the check result and what it verified. It lists any items that stay unverified and gives the reason for each. If setup paused, it reports the missing scope or issuer.

What the agent uses

StepTools
Find the dashboard and data appwhoami, list_data_apps, list_dashboards, list_datamarts
Find or create the embedlist_embeds, create_embed
Check tenancycheck_embed_tenancy
Write the integrationgenerate_embed_code, then your app’s own code
Check the resultdashboard_snapshot, a browser

For styling, the agent follows the same order as you would: theme fields first, then parts, then hide and text overrides. It never writes CSS on internal class names.

If something goes wrong

  • The agent warns that part of the embed is unverified. Read the reasons it gives. You can continue setup while an authorized viewer checks the affected data.
  • The agent asks you for a client ID it could look up. It never invents one. Tell it where your server finds the signed-in user’s client ID.

Next, match your brand by hand, or see every MCP tool.