Skip to main content
Glama
metabase-mcp-python

metabase-mcp-python

by im-voracity

Language: English | Portugues (BR)

metabase-mcp-python

A Python Model Context Protocol (MCP) server for Metabase, enabling AI assistants to query databases, manage dashboards, and interact with your Metabase instance.

Inspired by CognitionAI/metabase-mcp-server (TypeScript). See CREDITS.md for attribution.

Installation

uv tool install metabase-mcp-python

With pip

pip install metabase-mcp-python

From source

git clone https://github.com/im-voracity/metabase-mcp-python.git
cd metabase-mcp-python
uv sync

Related MCP server: Metabase MCP Plus

Configuration

Set the following environment variables (or use a .env file):

Variable

Required

Description

METABASE_URL

Yes

Your Metabase instance URL (e.g., http://localhost:3000)

METABASE_API_KEY

One of

Metabase API key for authentication

METABASE_USERNAME

One of

Username for session-based authentication

METABASE_PASSWORD

One of

Password for session-based authentication

You must provide either METABASE_API_KEY or both METABASE_USERNAME and METABASE_PASSWORD.

Usage

Claude Desktop

Add to your claude_desktop_config.json:

{
  "mcpServers": {
    "metabase": {
      "command": "uv",
      "args": ["tool", "run", "metabase-mcp-python"],
      "env": {
        "METABASE_URL": "http://localhost:3000",
        "METABASE_API_KEY": "your-api-key"
      }
    }
  }
}

With session authentication:

{
  "mcpServers": {
    "metabase": {
      "command": "uv",
      "args": ["tool", "run", "metabase-mcp-python"],
      "env": {
        "METABASE_URL": "http://localhost:3000",
        "METABASE_USERNAME": "user@example.com",
        "METABASE_PASSWORD": "your-password"
      }
    }
  }
}

Claude CLI

{
  "mcpServers": {
    "metabase": {
      "command": "uv",
      "args": ["tool", "run", "metabase-mcp-python", "--write"],
      "env": {
        "METABASE_URL": "http://localhost:3000",
        "METABASE_API_KEY": "your-api-key"
      }
    }
  }
}

Running from source

{
  "mcpServers": {
    "metabase": {
      "command": "uv",
      "args": ["run", "--directory", "/path/to/metabase-mcp-python", "metabase-mcp"],
      "env": {
        "METABASE_URL": "http://localhost:3000",
        "METABASE_API_KEY": "your-api-key"
      }
    }
  }
}

Tool Filtering Modes

The server supports three modes to control which tools are exposed to the AI assistant:

Mode

Flag

Tools

Description

Essential

--essential (default)

~19

Core read operations for querying and exploring

Write

--write

~59

Essential + create, update, and delete operations

All

--all

~87

Every available tool including advanced operations

Examples:

metabase-mcp                # Essential mode (default)
metabase-mcp --write        # Essential + write tools
metabase-mcp --all          # All tools

The essential mode is the default to keep the tool list manageable and reduce the risk of unintended modifications. Use --write or --all when you need to create or modify Metabase resources.

Available Tools

Tools are organized into five categories:

  • Database (13 tools) -- List, inspect, create, and manage database connections; execute SQL queries

  • Table (17 tools) -- Browse tables, inspect schemas, manage field metadata, import/export CSV

  • Card (21 tools) -- CRUD for saved questions, execute queries, manage public links, move cards

  • Dashboard (27 tools) -- CRUD for dashboards, manage cards/layout, filters audit, public links

  • Additional (9 tools) -- Collections, search, users, playground links

See docs/tools-reference.md for the complete tool listing.

Development

Setup

git clone https://github.com/im-voracity/metabase-mcp-python.git
cd metabase-mcp-python
uv sync --group dev

Testing

uv run pytest
uv run pytest -m "not integration"    # Skip integration tests

Linting and type checking

uv run ruff check src tests
uv run ruff format --check src tests
uv run mypy src

Architecture

See docs/architecture.md for a detailed overview of the codebase structure, request flow, and authentication system.

License

MIT

Available Tools

19 tools
create_dashboardA

Create a new Metabase dashboard - use this to build new analytical views, organize related cards, or establish monitoring interfaces

Inputs: name (required), parameters, description, collection_id, +1 more. Returns: result

execute_cardA
Read-only

Run a Metabase card query and return the actual data results - use this to get current data from existing cards, refresh analytical insights, or programmatically access query results for further processing

Inputs: card_id (required), dashboard_id, ignore_cache, collection_preview. Returns: result

execute_queryA
Read-only

Execute a native SQL query against a Metabase database - use this for custom data analysis, complex queries, or extracting specific data not available through existing cards

Inputs: query (required), database_id (required), parameters. Returns: result

get_cardA
Read-only

Get complete metadata and configuration for a specific Metabase card including query definition, visualization settings, collection location, and permissions - use this when you need to examine or understand how a particular card is built

Inputs: card_id (required). Returns: result

get_card_dashboardsA
Read-only

Find all dashboards that include a specific Metabase card - use this to understand where a card is being used, track dependencies before making changes, or find related analytical content

Inputs: card_id (required). Returns: result

get_collection_itemsA
Read-only

Retrieve all items (cards, dashboards) within a Metabase collection - use this to explore collection contents, organize analytical assets, or understand content structure

Inputs: collection_id (required). Returns: result

get_dashboardA
Read-only

Retrieve detailed information about a specific Metabase dashboard including cards, layout, and settings - use this to examine dashboard structure or get configuration details

Inputs: dashboard_id (required). Returns: result

get_dashboard_cardsA
Read-only

Retrieve all cards within a specific Metabase dashboard - use this to analyze dashboard content, understand data sources, or examine card configurations

Inputs: dashboard_id (required). Returns: result

get_databaseA
Read-only

Retrieve detailed information about a specific Metabase database including connection details and schema - use this to examine database properties or troubleshoot connections

Inputs: database_id (required). Returns: result

get_field_idA
Read-only

Look up a field's ID and metadata by table and column name - essential for building parameter mappings. Returns field_id, base_type, and other metadata needed for filter connections.

Inputs: table_id (required), column_name (required). Returns: result

get_tableA
Read-only

Retrieve comprehensive table information including schema, fields, and metadata - use this to understand structure, explore fields, or get configuration details.

Inputs: table_id (required), include_hidden_fields, include_sensitive_fields, include_editable_data_model. Returns: result

get_table_dataA
Read-only

Retrieve sample data from table for preview and analysis - use this to examine content, verify quality, or understand data patterns.

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

list_cardsA
Read-only

Retrieve all Metabase cards with optional filtering by source type (e.g., 'models') or model relationships - use this to discover available cards, find specific cards by type, or get an overview of all analytical content

Inputs: f, model_id. Returns: result

list_collectionsA
Read-only

Retrieve all Metabase collections for organizing analytical content - use this to understand content structure, find collections, or explore organizational hierarchy

Inputs: archived. Returns: result

list_dashboardsA
Read-only

Retrieve all Metabase dashboards - use this to discover available dashboards, get an overview of analytical content, or find specific dashboards

Inputs: no named parameters. Returns: result

list_databasesA
Read-only

Retrieve all database connections in Metabase - use this to discover available data sources, check connection status, or get an overview of connected databases

Inputs: no named parameters. Returns: result

list_tablesA
Read-only

Retrieve all Metabase tables with optional ID filtering - use this to discover available tables, explore database schema, or get metadata about specific tables.

Inputs: ids. Returns: result

search_contentA
Read-only

Search across all Metabase content including cards, dashboards, collections, and models - use this to find specific content, discover assets, or explore analytical resources

Inputs: q (required), type, limit, models, +2 more. Returns: result

Tool Schema Changelog

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

Loading tool schema changelog…

    TDQS

    A4.1/5.0

    Scored across 19 tools

    Disambiguation5/5

    Each tool has a clearly distinct purpose: database vs table vs card vs dashboard vs collection operations are well-separated. Even similar tools like get_table and get_table_data are distinct (metadata vs sample data).

    Naming Consistency5/5

    All tool names follow a consistent verb_noun pattern using snake_case, with clear verbs like get, list, execute, create, and search. No mixed conventions or ambiguous verbs.

    Tool Count4/5

    19 tools is on the higher end of appropriate for a Metabase server, covering databases, tables, cards, dashboards, collections, and querying. Slightly heavy but each tool provides distinct functionality.

    Completeness3/5

    The set covers reading and querying well, but lacks create/update/delete operations for cards and collections. Only dashboard creation exists, leaving obvious lifecycle gaps for analytical content.

    Maintenance

    ActivityInactive
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers