KosmoKrator

analytics

Metabase CLI for AI Agents

Use the Metabase CLI from KosmoKrator to call Metabase tools headlessly, return JSON, inspect schemas, and automate workflows from coding agents, scripts, and CI.

Metabase CLI Setup

Metabase can be configured headlessly with `kosmokrator integrations:configure metabase`.

Install, configure, and verify
# Install KosmoKrator first if it is not available on PATH.
curl -fsSL https://raw.githubusercontent.com/OpenCompanyApp/kosmokrator/main/install.sh | bash

# Configure and verify this integration.
kosmokrator integrations:configure metabase --set hostname="$METABASE_HOSTNAME" --set username="$METABASE_USERNAME" --set password="$METABASE_PASSWORD" --enable --read allow --write ask --json
kosmokrator integrations:doctor metabase --json
kosmokrator integrations:status --json

Credentials

Authentication type: Username and password basic. Configure credentials once, then reuse the same stored profile from scripts, coding CLIs, Lua, and MCP.

KeyEnv varTypeRequiredLabel
hostname METABASE_HOSTNAME URL url yes Metabase URL
username METABASE_USERNAME Text string yes Username
password METABASE_PASSWORD Secret secret yes Password

Command Patterns

The generic command is stable across every integration. The provider shortcut is shorter for humans.

Generic CLI call
kosmo integrations:call metabase.metabase_list_dashboards '{}' --json
Provider shortcut
kosmo integrations:metabase metabase_list_dashboards '{}' --json

Discovery

These commands return structured output for coding agents that need to inspect capabilities before choosing a function.

Discovery commands
kosmo integrations:docs metabase --json
kosmo integrations:docs metabase.metabase_list_dashboards --json
kosmo integrations:schema metabase.metabase_list_dashboards --json
kosmo integrations:search "Metabase" --json
kosmo integrations:list --json

Automation Contexts

The same configured command surface works in these environments. The command does not change unless the host wrapper, credentials, or permissions change.

CLI Functions

Every function below can be called headlessly. Commands are highlighted, copyable, and scroll horizontally when payloads are long.

metabase.metabase_list_dashboards

List all dashboards available in Metabase. Returns dashboard IDs, names, and basic metadata. Use metabase_get_dashboard to retrieve the full dashboard with cards.

Read read
Parameters
none
Generic call
kosmo integrations:call metabase.metabase_list_dashboards '{}' --json
Shortcut
kosmo integrations:metabase metabase_list_dashboards '{}' --json

metabase.metabase_get_dashboard

Get a single Metabase dashboard by ID, including all cards (questions), layout, and parameters. Use metabase_list_dashboards to find dashboard IDs.

Read read
Parameters
id
Generic call
kosmo integrations:call metabase.metabase_get_dashboard '{"id":1}' --json
Shortcut
kosmo integrations:metabase metabase_get_dashboard '{"id":1}' --json

metabase.metabase_list_cards

List all cards (questions/saved questions) in Metabase. Returns card IDs, names, collection info, and display types. Use metabase_get_card for full definitions or metabase_query_card to run a card.

Read read
Parameters
none
Generic call
kosmo integrations:call metabase.metabase_list_cards '{}' --json
Shortcut
kosmo integrations:metabase metabase_list_cards '{}' --json

metabase.metabase_get_card

Get the full definition of a Metabase card (question) by ID, including the query, display settings, and parameters. Use metabase_list_cards to find card IDs.

Read read
Parameters
id
Generic call
kosmo integrations:call metabase.metabase_get_card '{"id":1}' --json
Shortcut
kosmo integrations:metabase metabase_get_card '{"id":1}' --json

metabase.metabase_query_card

Execute a saved Metabase card (question) and return the query results as rows. Use metabase_list_cards or metabase_get_card to find card IDs. The card must be a question (not a model or metric).

Read read
Parameters
id
Generic call
kosmo integrations:call metabase.metabase_query_card '{"id":1}' --json
Shortcut
kosmo integrations:metabase metabase_query_card '{"id":1}' --json

metabase.metabase_list_databases

List all databases connected to Metabase. Returns database IDs, names, engine types, and metadata. Use metabase_get_database to retrieve tables and fields for a specific database.

Read read
Parameters
none
Generic call
kosmo integrations:call metabase.metabase_list_databases '{}' --json
Shortcut
kosmo integrations:metabase metabase_list_databases '{}' --json

metabase.metabase_get_database

Get detailed metadata for a Metabase database by ID, including its tables, fields, and schema information. Use metabase_list_databases to find database IDs.

Read read
Parameters
id
Generic call
kosmo integrations:call metabase.metabase_get_database '{"id":1}' --json
Shortcut
kosmo integrations:metabase metabase_get_database '{"id":1}' --json

metabase.metabase_get_current_user

Get the currently authenticated Metabase user profile, including name, email, and group memberships. Useful for verifying which account the integration is using.

Read read
Parameters
none
Generic call
kosmo integrations:call metabase.metabase_get_current_user '{}' --json
Shortcut
kosmo integrations:metabase metabase_get_current_user '{}' --json

Function Schemas

Use these parameter tables when building CLI payloads without calling integrations:schema first.

metabase.metabase_list_dashboards 0 parameters
Schema command
kosmo integrations:schema metabase.metabase_list_dashboards --json
ParameterTypeRequiredDescription
No parameters.
metabase.metabase_get_dashboard 1 parameters
Schema command
kosmo integrations:schema metabase.metabase_get_dashboard --json
ParameterTypeRequiredDescription
id integer yes The dashboard ID.
metabase.metabase_list_cards 0 parameters
Schema command
kosmo integrations:schema metabase.metabase_list_cards --json
ParameterTypeRequiredDescription
No parameters.
metabase.metabase_get_card 1 parameters
Schema command
kosmo integrations:schema metabase.metabase_get_card --json
ParameterTypeRequiredDescription
id integer yes The card (question) ID.
metabase.metabase_query_card 1 parameters
Schema command
kosmo integrations:schema metabase.metabase_query_card --json
ParameterTypeRequiredDescription
id integer yes The card (question) ID to execute.
metabase.metabase_list_databases 0 parameters
Schema command
kosmo integrations:schema metabase.metabase_list_databases --json
ParameterTypeRequiredDescription
No parameters.
metabase.metabase_get_database 1 parameters
Schema command
kosmo integrations:schema metabase.metabase_get_database --json
ParameterTypeRequiredDescription
id integer yes The database ID.
metabase.metabase_get_current_user 0 parameters
Schema command
kosmo integrations:schema metabase.metabase_get_current_user --json
ParameterTypeRequiredDescription
No parameters.

Permissions

Headless calls still follow the integration read/write permission policy. Configure read/write defaults with integrations:configure. Add --force only for trusted automation that should bypass that policy.