Skip to main content
Glama
metabase-mcp

metabase-mcp

by livingroot

Server Configuration

Describes the environment variables required to run the server.

NameRequiredDescriptionDefault
METABASE_URLYesBase URL of your Metabase instance, e.g. http://localhost:3000
METABASE_API_KEYYesAPI key created in Admin → Settings → Authentication → API Keys

Instructions

Guidance the server publishes about itself, which clients place ahead of the tool catalog so the model reads it before choosing anything.

You are working with a Metabase instance via its REST API.

Hard rules

  • NEVER make direct HTTP requests to Metabase. All interactions must go through the MCP tools provided by this server.

  • If a capability is not implemented as an MCP tool, stop and tell the user you cannot do it. Do not attempt workarounds or direct API calls.

Dashboard & card building tips

  • To create a filter with a dropdown list, use a Field Filter parameter on the card (SQL variable type "Field Filter", tag_config with field_id), not a plain Text/Number parameter. Field Filters let Metabase render a native dropdown populated from the field values.

  • values_source_type: card on a dashboard filter only works if the connected card uses a type: dimension (Field Filter) template tag. For plain text/number/date variables, Metabase silently ignores the card source and falls back to a plain text input.

  • A Field Filter is bound to exactly one physical column in one table. You cannot point a single Field Filter at a computed expression or a UNION across tables. For multi-table filtering, use separate Field Filters per table or a Metabase model (dataset) with its own fields — converting a card to a model is not yet supported by this server.

  • dashboards_connect_filter auto-detects whether to use target_type='dimension' or 'variable' by reading the card's template tag. You do not need to pass target_type explicitly unless you want to override this detection.

  • Always link dashboard filter widgets to card parameters after adding them; an unlinked filter has no effect.

  • Use "question" cards (GUI-based) for simple aggregations and "native" cards for complex SQL. Mixing both on one dashboard is fine.

  • After creating or updating a card, always re-fetch its metadata before embedding it in a dashboard to get the correct parameter mappings.

Time grouping & date filters (native SQL)

  • Time grouping ("Group by day/week/month") in SQL: newer Metabase docs describe {{mb.time_grouping("unit", "table.column")}} (the server parses it into a temporal-unit tag), but on this instance (v0.59 + ClickHouse) such cards fail with HTTP 400 — UNVERIFIED, do not rely on it. What runs: a {{unit}} tag with tag_config {type: "temporal-unit", field_id: <date column>} used in SELECT and GROUP BY; on the card page it shows as a text input, so check grouping on the dashboard.

  • Connect it with a dashboard filter of type: "temporal-unit" ("Time grouping" widget); dashboards_connect_filter maps it as dimension automatically. With no value selected Metabase groups by raw (untruncated) timestamps — set a default (e.g. "week") on the filter.

  • For a date range prefer ONE Field Filter (type: dimension, field_id of the date column, widget_type date/all-options) used as WHERE {{date}} over two plain date variables. Field Filters need the table to be synced into Metabase metadata first — a freshly created table has no field_id until Admin → Databases → Sync.

  • Charts over a time grouping: set visualization_settings graph.dimensions [period, series], graph.metrics, and graph.x_axis.scale: "timeseries" so the X axis is temporal, not categorical.

  • Dashboard filter slugs must be unique per dashboard. Names without Latin letters (e.g. Cyrillic) get their slug from parameter_id; pass slug explicitly if you need a specific URL key.

  • This server cannot delete dashboard filters or tabs, and cannot remove stale parameter_mappings from a dashcard. Plan filters before adding them; leftover ones must be removed in the Metabase UI.

ClickHouse SQL gotchas

  • multiIf/if conditions must be UInt8: 0 + (x = 'a') is UInt16 and fails — use 0 OR (x = 'a').

  • multiIf branches must share a type: mixing toStartOfDay (DateTime) and toStartOfMonth (Date) fails — wrap all in toDate(...).

  • Tables on ReplacingMergeTree need FINAL (or argMax) to hide not-yet-merged duplicates.

Query & schema exploration

  • Use database_list then database_schema to discover tables before writing queries.

  • Prefer dataset_query for ad-hoc data exploration; save results as cards only when the query will be reused on a dashboard.

  • The {{#card_id-slug}} syntax (referencing another card/model) is supported in SQL. The server builds the correct type: card template tag automatically — do not inline the referenced card's SQL unless you specifically cannot use a card reference.

Error handling

  • If a card update fails with a 400, inspect the "errors" field in the response — it usually names the exact parameter that is malformed.

  • Metabase v0.59 does not support OpenAPI; do not attempt to fetch a schema spec.

Capabilities

Features and capabilities supported by this server

Protocol revision2025-11-25

CapabilityDetails
tools
{
  "listChanged": true
}

Tools

Functions exposed to the LLM to take actions

NameDescription
server_pingA

Ping the MCP server to verify it is running and reachable.

databases_listA

List all databases connected to this Metabase instance. Returns ID, name, engine type, and sync status as a Markdown table.

databases_get_schemaA

Retrieve the full schema tree for a database: all tables with columns, data types, and display labels. A single call returns the complete DB → tables → fields metadata.

tables_listA

List all tables in a database. Returns ID, name, schema name, and estimated row count as a flat Markdown table. Does not include column-level detail.

tables_getA

Retrieve column-level metadata for a specific table: column names, data types, semantic types, display names, and nullable/required flags.

fields_getB

Retrieve metadata and valid values for a specific field (column): data type, display name, semantic type, and enumerated valid values for low-cardinality fields.

queries_execute_sqlA

Execute raw SQL against a database and return results as a Markdown table. Defaults to 50 rows; pass max_rows to adjust. Use queries_export for result sets exceeding 2,000 rows.

cards_executeA

Run a saved Metabase question (card) by ID and return results as a Markdown table. Defaults to 50 rows; pass max_rows to adjust. Only native SQL cards are fully supported.

queries_exportA

Export a full query result set as raw CSV text via /api/dataset/csv. Bypasses the 2,000-row JSON cap that queries_execute_sql hits. Returns the complete result set with no row limit.

cards_listA

List saved questions (cards). Optionally filter by name substring. Returns ID, name, description, database ID, creator, and last-updated date as a Markdown table.

cards_findA

Find saved questions by name and return their SQL. Use this when you know (part of) the card name. Returns ID, name, and SQL for each match — no need to call cards_get separately.

cards_getA

Retrieve the full saved question including its SQL query definition and template-tags configuration (name, type, field_id, widget_type, default, required) as structured JSON. Returns SQL in a fenced code block for native SQL cards.

cards_createA

Create a native SQL saved question in Metabase from a database ID, SQL query, and display name. Returns the new card ID. Field Filter widget_type is auto-detected from the target field's type when omitted and validated against it before saving.

cards_updateA

Update a saved question's name, description, or SQL. Only the provided fields are changed. Requires database_id when updating sql. Pass ref_card_id to copy template-tag types from another card (fixes broken filter types). Field Filter widget_type is auto-detected from the target field's type when omitted and validated against it before saving.

cards_deleteA

Delete a saved question by ID. Permanently removes the card from Metabase.

dashboards_listA

List dashboards. Optionally filter by name substring. Returns ID, name, description, card count, and last-updated date as a Markdown table.

dashboards_getA

Retrieve full dashboard details: name, description, filter parameter definitions, and all placed cards with their positions, sizes, and dashcard IDs.

dashboards_createA

Create a new empty dashboard. Requires a name; description is optional. Returns the new dashboard ID.

dashboards_updateA

Update a dashboard's metadata. Only the provided fields are changed. Preserves parameters, tabs, and all other dashboard fields via read-modify-write.

dashboards_deleteA

Delete a dashboard by ID. Permanently removes the dashboard from Metabase.

dashboards_create_tabA

Create a new tab on a dashboard. Returns the new tab ID — use it in dashboards_add_card's tab_id parameter to place cards on this tab.

dashboards_add_cardA

Add an existing saved question to a dashboard at an optional grid position. Returns the dashcard ID — capture it; it is the placement ID needed for remove/reposition/filter-connect operations (it is NOT the card ID). Pass tab_id to place the card on a specific tab.

dashboards_remove_cardA

Remove a single card from a dashboard using its dashcard placement ID (the ID returned by dashboards_add_card or shown in dashboards_get — NOT the card ID).

dashboards_add_text_cardA

Add a markdown text block or heading to a dashboard. Use 'text' for multi-line markdown content (supports headers, lists, bold, etc.) and 'heading' for a single-line section title. Returns the dashcard ID.

dashboards_update_cardB

Reposition, resize, or move a card between tabs on a dashboard. Identified by its dashcard placement ID. Other cards on the dashboard are preserved.

dashboards_add_filterA

Add a filter parameter to a dashboard. Provide a unique parameter_id string; reuse the same parameter_id in dashboards_connect_filter to wire it to a card. Use values_source_type to control the dropdown source: 'static-list' for a fixed list, 'card' for values from a saved question, 'fields' for values from connected fields (requires a dimension tag_config on the card).

dashboards_connect_filterA

Wire a dashboard filter parameter to a native SQL card's template tag so the filter affects that card's results. The parameter_id must match one added via dashboards_add_filter; tag_name is the {{tag_name}} variable in the card's SQL. For text/date/number tags (type='text'|'date'|'number'), use target_type='variable' (default). For dimension tags created with tag_config field_id, and for 'temporal-unit' (time grouping) tags, use target_type='dimension'.

Prompts

Interactive templates invoked by user choice

NameDescription

No prompts

Resources

Contextual data attached and managed by the client

NameDescription

No resources

TDQS

A3.7/5.0

Scored across 27 tools

Disambiguation4/5

Most tools target a distinct resource+action, and the descriptions explicitly differentiate tricky pairs like dashboards_update (metadata) vs dashboards_update_card (layout) and dashboards_delete vs dashboards_remove_card. The main residual overlap is in read paths: cards_list / cards_find / cards_get / cards_execute all touch saved questions, and tables_list / tables_get / databases_get_schema overlap in metadata scope, though the descriptions do explain the differences.

Naming Consistency5/5

Every tool follows the same plural-resource_verb pattern (dashboards_*, cards_*, databases_*, tables_*, fields_*, queries_*, server_ping), with snake_case throughout. Sub-resource operations like dashboards_add_card and dashboards_connect_filter stay within the same convention, so names are highly predictable.

Tool Count3/5

27 tools is on the heavy side; the 12 dashboard tools in particular are very granular (separate tools for adding text cards, tabs, filters, repositioning). The breadth is partly justified by the genuinely broad domain (dashboards, cards, DB metadata, queries), but some layout operations could be consolidated into fewer parameterized tools.

Completeness3/5

Core lifecycle is covered for dashboards and cards (create/list/get/update/delete/execute), plus solid metadata exploration and SQL execution/export. However, several dead ends exist: tabs can be created but not renamed or deleted, filters can be added and connected but not updated or removed, and collections (where Metabase cards actually live) are entirely absent from the surface.

Maintenance

ActivityMaintained
ResponsivenessNo recent community issues