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 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.
| Key | Env var | Type | Required | Label |
|---|---|---|---|---|
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.
kosmo integrations:call metabase.metabase_list_dashboards '{}' --json 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.
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 - Parameters
- none
kosmo integrations:call metabase.metabase_list_dashboards '{}' --json 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 - Parameters
- id
kosmo integrations:call metabase.metabase_get_dashboard '{"id":1}' --json 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 - Parameters
- none
kosmo integrations:call metabase.metabase_list_cards '{}' --json 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 - Parameters
- id
kosmo integrations:call metabase.metabase_get_card '{"id":1}' --json 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 - Parameters
- id
kosmo integrations:call metabase.metabase_query_card '{"id":1}' --json 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 - Parameters
- none
kosmo integrations:call metabase.metabase_list_databases '{}' --json 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 - Parameters
- id
kosmo integrations:call metabase.metabase_get_database '{"id":1}' --json 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 - Parameters
- none
kosmo integrations:call metabase.metabase_get_current_user '{}' --json 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
kosmo integrations:schema metabase.metabase_list_dashboards --json | Parameter | Type | Required | Description |
|---|---|---|---|
| No parameters. | |||
metabase.metabase_get_dashboard 1 parameters
kosmo integrations:schema metabase.metabase_get_dashboard --json | Parameter | Type | Required | Description |
|---|---|---|---|
id | integer | yes | The dashboard ID. |
metabase.metabase_list_cards 0 parameters
kosmo integrations:schema metabase.metabase_list_cards --json | Parameter | Type | Required | Description |
|---|---|---|---|
| No parameters. | |||
metabase.metabase_get_card 1 parameters
kosmo integrations:schema metabase.metabase_get_card --json | Parameter | Type | Required | Description |
|---|---|---|---|
id | integer | yes | The card (question) ID. |
metabase.metabase_query_card 1 parameters
kosmo integrations:schema metabase.metabase_query_card --json | Parameter | Type | Required | Description |
|---|---|---|---|
id | integer | yes | The card (question) ID to execute. |
metabase.metabase_list_databases 0 parameters
kosmo integrations:schema metabase.metabase_list_databases --json | Parameter | Type | Required | Description |
|---|---|---|---|
| No parameters. | |||
metabase.metabase_get_database 1 parameters
kosmo integrations:schema metabase.metabase_get_database --json | Parameter | Type | Required | Description |
|---|---|---|---|
id | integer | yes | The database ID. |
metabase.metabase_get_current_user 0 parameters
kosmo integrations:schema metabase.metabase_get_current_user --json | Parameter | Type | Required | Description |
|---|---|---|---|
| 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.