Skip to main content
Glama
Metabase MCP Plus

Metabase MCP Plus

by schachan

Metabase MCP Plus

PyPI version Python 3.12+ License: MIT CI

An enhanced Model Context Protocol (MCP) server for Metabase, enabling AI assistants like Claude, Cursor, and other MCP clients to query databases, execute SQL, manage dashboards, cards, and collections — all through natural language.

Quick Start

Using uvx (No Installation Required)

uvx metabase-mcp-plus

Using pip

pip install metabase-mcp-plus
metabase-mcp-plus

From Source

git clone https://github.com/schachan/metabase-mcp.git
cd metabase-mcp
uv sync
uv run python server.py

Related MCP server: superset-mcp

Configuration

Set environment variables directly or create a .env file:

cp .env.example .env
METABASE_URL=https://your-metabase-instance.com
METABASE_API_KEY=your-api-key-here

Email/Password Authentication

METABASE_URL=https://your-metabase-instance.com
METABASE_USER_EMAIL=your-email@example.com
METABASE_PASSWORD=your-password

Optional: Custom Host/Port (SSE/HTTP transports)

HOST=localhost  # Default: 0.0.0.0
PORT=9000       # Default: 8000

Available Tools (22)

Database Operations (6 tools)

Tool

Description

list_databases

List all configured databases

get_database

Get details of a specific database

list_tables

Get all tables in a database with metadata

get_table_fields

Retrieve field/column information for a table

list_database_schemas

List all schemas in a database

get_schema_tables

Get tables within a specific schema

Query Operations (1 tool)

Tool

Description

execute_query

Execute native SQL queries with parameter support

Card / Question Management (6 tools)

Tool

Description

list_cards

List all saved questions/cards

get_card

Get details of a specific card

execute_card

Run a saved question and return results

create_card

Create a new question with a SQL query

update_card

Update an existing card's name, query, or collection

archive_card

Archive a card

Dashboard Management (5 tools)

Tool

Description

list_dashboards

List all dashboards

get_dashboard

Get full dashboard details including cards

create_dashboard

Create a new dashboard

update_dashboard

Update a dashboard's name, description, or cards

delete_dashboard

Delete a dashboard

Collection Management (3 tools)

Tool

Description

list_collections

Browse all collections

get_collection_items

List items within a collection

create_collection

Create a new collection

Search (1 tool)

Tool

Description

search

Search across cards, dashboards, collections, and tables

Transport Methods

metabase-mcp-plus                # STDIO (default, for IDE integration)
metabase-mcp-plus --sse          # Server-Sent Events
metabase-mcp-plus --http         # Streamable HTTP

Or from source:

uv run python server.py          # STDIO
uv run python server.py --sse    # SSE
uv run python server.py --http   # HTTP

IDE Integration

Claude Desktop

Add to ~/Library/Application Support/Claude/claude_desktop_config.json:

{
    "mcpServers": {
        "metabase": {
            "command": "uvx",
            "args": ["metabase-mcp-plus"],
            "env": {
                "METABASE_URL": "https://your-metabase-instance.com",
                "METABASE_API_KEY": "your-api-key-here"
            }
        }
    }
}

Cursor

Add to your MCP settings (.cursor/mcp.json):

{
    "mcpServers": {
        "metabase": {
            "command": "uvx",
            "args": ["metabase-mcp-plus"],
            "env": {
                "METABASE_URL": "https://your-metabase-instance.com",
                "METABASE_API_KEY": "your-api-key-here"
            }
        }
    }
}

Project Structure

metabase-mcp/
├── server.py              # Entry point — CLI arg parsing and transport selection
├── app.py                 # FastMCP app setup, env loading, client instantiation
├── client.py              # MetabaseClient with auth, retry, and error handling
├── tools/
│   ├── __init__.py        # Registers all tool modules
│   ├── databases.py       # Database, table, schema, and field tools
│   ├── queries.py         # SQL query execution
│   ├── cards.py           # Card CRUD and execution
│   ├── dashboards.py      # Dashboard CRUD
│   ├── collections.py     # Collection browsing and creation
│   └── search.py          # Cross-entity search
├── tests/                 # Comprehensive test suite (95% coverage)
├── .github/workflows/
│   ├── ci.yml             # Lint + test on push/PR
│   └── publish.yml        # Release → PyPI + attach assets
├── RELEASING.md           # How to cut a release (trusted publisher setup)
└── pyproject.toml

Development

# Install with dev dependencies
uv sync --group dev

# Run linting and formatting
uv run ruff check .
uv run ruff format .

# Run tests with coverage
uv run pytest tests/ --cov=. --cov=tools --cov-report=term-missing -v

Architecture Highlights

  • Modular tools — each domain (databases, cards, dashboards, etc.) is a separate module

  • Automatic auth retry — expired session tokens are refreshed transparently on 401

  • Custom exceptions — MetabaseAPIError and MetabaseAuthError for typed error handling

  • Error handler decorator — @tool_error_handler eliminates boilerplate try/except across all 22 tools

  • Middleware stack — built-in error handling and logging middleware via FastMCP

Releases & PyPI

Publishing to PyPI is automated when you publish a GitHub Release (workflow .github/workflows/publish.yml): lint → test → build → attach wheels to the release → upload to PyPI (trusted publisher / OIDC).

See RELEASING.md for one-time PyPI + GitHub environment setup and the exact tag/version rules (v1.2.3 must match version = "1.2.3" in pyproject.toml).

License

MIT License — see LICENSE for details.

Resources

Available Tools

22 tools
archive_cardA

Archive a card/question in Metabase (soft delete).

This sets the card's archived status to true, which hides it from normal views but preserves the data. Safer than permanent deletion.

Args: card_id: The ID of the card to archive.

Returns: The updated card object with archived status.

Inputs: card_id (required). Returns: object

create_cardB

Create a new question/card in Metabase.

Args: name: Name of the card. database_id: ID of the database to query. query: SQL query for the card. description: Optional description. collection_id: Optional collection to place the card in. visualization_settings: Optional visualization configuration.

Returns: The created card object.

Inputs: name (required), database_id (required), query (required), description, +2 more. Returns: object

create_collectionB

Create a new collection in Metabase.

Args: name: Name of the collection. description: Optional description. color: Optional color for the collection. parent_id: Optional parent collection ID.

Returns: The created collection object.

Inputs: name (required), description, color, parent_id. Returns: object

create_dashboardA

Create a new dashboard in Metabase.

Args: name: Name of the dashboard. description: Optional description. collection_id: Optional collection to place the dashboard in. parameters: Optional dashboard filter parameters.

Returns: The created dashboard object.

Inputs: name (required), description, collection_id, parameters. Returns: object

delete_dashboardC

Delete a dashboard from Metabase.

Args: dashboard_id: The ID of the dashboard to delete.

Returns: Confirmation of the deletion.

Inputs: dashboard_id (required). Returns: object

execute_cardB

Execute a saved Metabase question/card and retrieve results.

Args: card_id: The ID of the card to execute. parameters: Optional parameters for the card execution.

Returns: Card execution results.

Inputs: card_id (required), parameters. Returns: object

execute_queryC

Execute a native SQL query against a Metabase database.

Args: database_id: The ID of the database to query. query: The SQL query to execute. native_parameters: Optional parameters for the query.

Returns: Query execution results.

Inputs: database_id (required), query (required), native_parameters. Returns: object

get_cardA

Get detailed information about a specific card/question.

Args: card_id: The ID of the card to retrieve.

Returns: Dictionary with full card metadata including query, visualization settings, and collection info.

Inputs: card_id (required). Returns: object

get_collection_itemsA

List items inside a specific collection.

Args: collection_id: The ID of the collection to browse. models: Optional filter for item types (e.g., ["card", "dashboard", "collection"]).

Returns: Dictionary containing the items in the collection.

Inputs: collection_id (required), models. Returns: object

get_dashboardB

Get detailed information about a specific dashboard.

Args: dashboard_id: The ID of the dashboard.

Returns: Dictionary with full dashboard metadata including cards, parameters, and layout.

Inputs: dashboard_id (required). Returns: object

get_databaseA

Get detailed information about a specific database.

Args: database_id: The ID of the database.

Returns: Dictionary with full database metadata including engine, features, and settings.

Inputs: database_id (required). Returns: object

get_schema_tablesA

List all tables within a specific schema of a database.

Args: database_id: The ID of the database. schema_name: The name of the schema.

Returns: A list of table metadata dictionaries for the given schema.

Inputs: database_id (required), schema_name (required). Returns: result

get_table_fieldsB

Get all fields/columns in a specific table.

Args: table_id: The ID of the table. limit: Maximum number of fields to return (default: 20).

Returns: Dictionary with field metadata, truncated if necessary.

Inputs: table_id (required), limit. Returns: object

list_cardsB

List all saved questions/cards in Metabase.

Returns: Dictionary containing all cards with their metadata.

Inputs: no named parameters. Returns: object

list_collectionsA

List all collections in Metabase.

Returns: Dictionary containing all collections with their metadata.

Inputs: no named parameters. Returns: object

list_dashboardsA

List all dashboards in Metabase.

Returns: A list of dashboard metadata dictionaries.

Inputs: no named parameters. Returns: result

list_databasesA

List all databases configured in Metabase.

Returns: A dictionary containing all available databases with their metadata.

Inputs: no named parameters. Returns: object

list_database_schemasA

List all schemas in a specific database.

Args: database_id: The ID of the database.

Returns: A list of schema names available in the database.

Inputs: database_id (required). Returns: result

list_tablesB

List all tables in a specific database.

Args: database_id: The ID of the database to query.

Returns: Formatted markdown table showing table details.

Inputs: database_id (required). Returns: result

update_cardA

Update an existing card/question in Metabase.

Args: card_id: The ID of the card to update. name: New name for the card. description: New description. query: New SQL query (requires database_id). database_id: Database ID for the query. collection_id: Move card to this collection. visualization_settings: New visualization configuration.

Returns: The updated card object.

Inputs: card_id (required), name, description, query, +3 more. Returns: object

update_dashboardA

Update an existing dashboard in Metabase.

Args: dashboard_id: The ID of the dashboard to update. name: New name for the dashboard. description: New description. collection_id: Move dashboard to this collection. parameters: New dashboard filter parameters.

Returns: The updated dashboard object.

Inputs: dashboard_id (required), name, description, collection_id, +1 more. Returns: object

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    A3.7/5.0

    Scored across 22 tools

    Disambiguation5/5

    Each tool has a clearly distinct purpose. For example, list_cards vs get_card (list vs single), execute_card vs execute_query (saved vs ad-hoc), and get_collection_items vs list_collections (items vs collections themselves) are well-differentiated.

    Naming Consistency5/5

    All tools follow a consistent verb_noun pattern in snake_case (e.g., list_cards, create_card, execute_query). The pattern is predictable and easy for an agent to infer.

    Tool Count5/5

    With 22 tools covering cards, dashboards, collections, databases, schemas, tables, fields, search, and execution, the count is well-scoped for a Metabase management server—not too few nor too many.

    Completeness3/5

    Core entities like cards and dashboards have CRUD (except card hard delete), but collections lack update/delete and get_collection by ID. Database management is read-only. These gaps may require workarounds.

    Maintenance

    ActivityInactive
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers

    • F
      license
      Not graded
      quality
      D
      maintenance
      A Model Control Protocol server that enables AI assistants to interact with Metabase databases, allowing models to explore database schemas, retrieve metadata, visualize relationships, and execute actions.
      7
      -
    • F
      license
      B
      quality
      D
      maintenance
      An MCP server that provides AI assistants with full access to Apache Superset instances, enabling interaction with dashboards, charts, datasets, databases, and SQL execution capabilities.
      34
      -
    • -
      license
      Not graded
      quality
      D
      maintenance
      An MCP server that bridges AI assistants with SQL databases, enabling natural language querying across multiple database types with built-in optimization and security.
      3
      -