metabase-mcp
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@metabase-mcp show me the sales data for last month"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
Metabase MCP Server - Connect AI Assistants to Your Metabase Analytics
A high-performance Model Context Protocol (MCP) server for Metabase, enabling AI assistants like Claude, Cursor, and other MCP clients to interact seamlessly with your Metabase instance. Query databases, execute SQL, manage dashboards, and automate analytics workflows with natural language through AI-powered database operations.
Perfect for: Data analysts, developers, and teams looking to integrate AI assistants with their Metabase business intelligence platform for automated SQL queries, dashboard management, and data exploration.
Key Features
Database Operations
List Databases: Browse all configured Metabase databases
Table Discovery: Explore tables with metadata and descriptions
Field Inspection: Get detailed field/column information with smart pagination
Query & Analytics
SQL Execution: Run native SQL queries with parameter support and templating
MongoDB Support: Execute native MongoDB queries with automatic JSON conversion for aggregation pipelines
Card Management: Execute, create, and manage Metabase questions/cards (SQL and MongoDB)
Collection Organization: Create and manage collections for better organization
Natural Language Queries: Let AI assistants translate questions into SQL or MongoDB queries
Authentication & Security
API Key Support: Secure authentication via Metabase API keys (recommended)
Session-based Auth: Alternative email/password authentication
Environment Variables: Secure credential management via
.envfiles
AI Assistant Integration
Claude Desktop: Native integration with Anthropic's Claude AI
Cursor IDE: Seamless integration for AI-assisted development
Any MCP Client: Compatible with all Model Context Protocol clients
Enhanced Performance & Reliability
Context-aware Logging: Real-time logging with debug, info, warning, and error levels visible to AI clients
Proper Error Handling: FastMCP
ToolErrorexceptions for better error messages and debuggingMiddleware Stack: Built-in error handling and logging middleware for production reliability
Best Practices: Follows latest FastMCP patterns with duplicate prevention and clean configuration
Modern Python: Uses Python 3.12+ type hints (
|syntax) for better type safety
Related MCP server: Metabase MCP Server
Quick Start
Prerequisites
Python 3.12+
Metabase instance with API access
uvxoruvpackage manager
Installation
Option 1: Using uvx (Easiest - No Installation Required)
# Run directly without installing (like npx for Python)
uvx metabase-mcp
# With environment variables
METABASE_URL=https://your-instance.com METABASE_API_KEY=your-key uvx metabase-mcpOption 2: Install from PyPI
# Install globally
uv tool install metabase-mcp
# Or with pip
pip install metabase-mcp
# Then run
metabase-mcpOption 3: Development Setup (From Source)
# Clone the repository
git clone https://github.com/cheukyin175/metabase-mcp.git
cd metabase-mcp
# Install dependencies
uv sync
# Run the server
uv run python server.pyConfiguration
Create a .env file with your Metabase credentials:
cp .env.example .envConfiguration Options
Option 1: API Key Authentication (Recommended)
METABASE_URL=https://your-metabase-instance.com
METABASE_API_KEY=your-api-key-hereOption 2: Email/Password Authentication
METABASE_URL=https://your-metabase-instance.com
METABASE_USER_EMAIL=your-email@example.com
METABASE_PASSWORD=your-passwordOptional: Metabase API HTTP Timeout
METABASE_HTTP_TIMEOUT=30.0 # Default: 30.0 secondsOptional: Custom Host/Port for SSE/HTTP
HOST=localhost # Default: 0.0.0.0
PORT=9000 # Default: 8000Usage
Run the Server
Quick Start (No Setup Required)
# Run directly with uvx
uvx metabase-mcp
# With custom Metabase instance
METABASE_URL=https://your-instance.com METABASE_API_KEY=your-key uvx metabase-mcpFrom Source (Development)
# STDIO transport (default)
uv run python server.py
# SSE transport (uses HOST=0.0.0.0, PORT=8000 by default)
uv run python server.py --sse
# HTTP transport (uses HOST=0.0.0.0, PORT=8000 by default)
uv run python server.py --http
# Custom host and port via environment variables
HOST=localhost PORT=9000 uv run python server.py --sse
HOST=192.168.1.100 PORT=8080 uv run python server.py --httpCursor Integration
You can manually configure Cursor by editing your Cursor settings.
For SSE transport: You must start the server before using Cursor:
uv run python server.py --sseClaude Desktop Integration
Option 1: Using uvx (Recommended)
Add this to ~/Library/Application Support/Claude/claude_desktop_config.json:
{
"mcpServers": {
"metabase-mcp": {
"command": "uvx",
"args": ["metabase-mcp"],
"env": {
"METABASE_URL": "https://your-metabase-instance.com",
"METABASE_API_KEY": "your-api-key-here"
}
}
}
}Option 2: Using Local Installation
If you've cloned the repository:
{
"mcpServers": {
"metabase-mcp": {
"command": "uv",
"args": [
"run",
"--directory",
"/absolute/path/to/metabase-mcp",
"python",
"server.py"
],
"env": {
"METABASE_URL": "https://your-metabase-instance.com",
"METABASE_API_KEY": "your-api-key-here"
}
}
}
}Option 3: Using FastMCP CLI
fastmcp install server.py -n "Metabase MCP"Available Tools
Database Operations
Tool | Description |
| List all configured databases in Metabase |
| Get all tables in a specific database with metadata |
| Retrieve field/column information for a table |
Query Operations
Tool | Description |
| Execute native SQL queries with parameter support |
| Execute native MongoDB queries with automatic JSON conversion for aggregation pipelines |
| Run saved Metabase questions/cards |
Card Management
Tool | Description |
| List all saved questions/cards |
| Create new questions/cards with SQL queries |
| Create new MongoDB questions/cards with native query support |
Collection Management
Tool | Description |
| Browse all collections |
| Create new collections for organization |
Transport Methods
The server supports multiple transport methods:
STDIO (default): For IDE integration (Cursor, Claude Desktop)
SSE: Server-Sent Events for web applications
HTTP: Standard HTTP for API access
uv run python server.py # STDIO (default)
uv run python server.py --sse # SSE (HOST=0.0.0.0, PORT=8000)
uv run python server.py --http # HTTP (HOST=0.0.0.0, PORT=8000)
HOST=localhost PORT=9000 uv run python server.py --sse # Custom host/portDevelopment
Setup Development Environment
# Install with dev dependencies
uv sync --group dev
# Or with pip
pip install -r requirements-dev.txtCode Quality
# Run linting
uv run ruff check .
# Format code
uv run ruff format .
# Type checking
uv run mypy server.pyUsage Examples
Query Examples
# List all databases
databases = await list_databases()
# Execute a SQL query
result = await execute_query(
database_id=1,
query="SELECT * FROM users LIMIT 10"
)
# Create and run a card
card = await create_card(
name="Active Users Report",
database_id=1,
query="SELECT COUNT(*) FROM users WHERE active = true",
collection_id=2
)Project Structure
metabase-mcp/
├── server.py # Main MCP server implementation
├── pyproject.toml # Project configuration and dependencies
└── .env.example # Environment variables templateContributing
Contributions are welcome! Please feel free to submit a Pull Request.
License
MIT License - see LICENSE file for details
Resources
Keywords & Topics
metabase mcp model-context-protocol claude cursor ai-assistant fastmcp sql database analytics business-intelligence bi data-analysis anthropic llm python automation api data-science query-builder natural-language-sql
Star History
If you find this project useful, please consider giving it a star! It helps others discover this tool.
Use Cases
Natural Language Database Queries: Ask Claude to query your Metabase databases using plain English
Automated Report Generation: Use AI to create and manage Metabase cards and collections
Data Exploration: Let AI assistants help you discover insights from your data
SQL Query Assistance: Get help writing and optimizing SQL queries through AI
Dashboard Management: Automate the creation and organization of Metabase dashboards
Data Analysis Workflows: Integrate AI-powered analytics into your development workflow
Available Tools
15 toolsadd_card_to_dashboardA
Add an existing card to a dashboard at a specified position and size.
Args: dashboard_id: The ID of the dashboard to add the card to. card_id: The ID of the card to add. col: Column position on the dashboard grid (default: 0). row: Row position on the dashboard grid (default: 0). size_x: Width of the card in grid units (default: 6). size_y: Height of the card in grid units (default: 4).
Returns: The created dashboard card object.
Inputs: card_id (required), dashboard_id (required), col, row, +2 more. Returns: object
create_cardA
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), query (required), database_id (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), color, parent_id, description. Returns: object
create_mongodb_cardA
Create a new MongoDB question/card in Metabase.
Args: name: Name of the card. database_id: ID of the MongoDB database. collection: MongoDB collection name. query: MongoDB query string (aggregation pipeline or query). description: Optional description. collection_id: Optional collection to place the card in. visualization_settings: Optional visualization configuration.
Returns: The created MongoDB card object.
Inputs: name (required), query (required), collection (required), database_id (required), +3 more. 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_mongodb_queryA
Execute a MongoDB native query against a Metabase database.
Args: database_id: The ID of the MongoDB database to query. collection: The MongoDB collection name. query: The MongoDB query (aggregation pipeline array or query object). native_parameters: Optional parameters for the query.
Returns: Query execution results.
Inputs: query (required), collection (required), database_id (required), native_parameters. Returns: object
execute_queryA
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: query (required), database_id (required), native_parameters. Returns: object
get_dashboard_cardsB
Get the cards and their layout information for a specific dashboard.
Returns each card's id, name, display type, size, and position on the dashboard grid (col, row, size_x, size_y).
Args: dashboard_id: The ID of the dashboard.
Returns: A list of dashboard card objects with layout and card metadata.
Inputs: dashboard_id (required). Returns: result
get_table_fieldsA
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_cardsA
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 dashboards with their metadata including id, name, description, collection_id, and creator info.
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_tablesA
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_card_displayA
Update the display type of a saved question/card in Metabase.
Args: card_id: The ID of the card to update. display: The display type (e.g. "table", "bar", "line", "pie", "scalar", "row", "area", "combo", "pivot", "smartscalar", "funnel", "waterfall", "map"). visualization_settings: Optional visualization settings to apply with the display change.
Returns: The updated card object.
Inputs: card_id (required), display (required), visualization_settings. Returns: object
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 15 tools
Each tool targets a distinct resource and action (e.g., create vs execute vs list for cards, queries, collections), and even similar tools like create_card and create_mongodb_card are clearly differentiated by database type.
All tools follow a consistent verb_noun pattern (e.g., create_card, list_dashboards, execute_query) with underscores, making the API predictable and easy to navigate.
With 15 tools covering card management, collection organization, dashboard operations, database querying, and metadata listing, the count is well-scoped for a Metabase integration without being overwhelming.
The tool set covers core querying and listing but has notable gaps: no create_dashboard, no delete operations for cards/collections/dashboards, and limited card updates (only display type). These missing operations could hinder workflows that require full lifecycle management.
Maintenance
Related MCP Connectors
Work with your database from AI tools: ask, export, approved changes, and scheduled jobs.
Connect AI assistants to Preset to explore data, charts, and dashboards in authorized workspaces.
Query your Logspot analytics, companies, and revenue from any AI assistant, and run your actions.
Query and update Teable records, manage tables, and access the Teable API with AI agents.
Related MCP Servers
- AlicenseNot gradedqualityDmaintenanceEnables AI assistants to interact with Metabase analytics platform, allowing them to query databases, manage dashboards and cards, execute SQL queries, and access analytics data through natural language.167 npmMIT
- AlicenseNot gradedqualityCmaintenanceEnables AI assistants to interact with Metabase analytics platform, allowing them to query databases, manage dashboards, execute SQL queries, and organize collections through natural language.167 npmMIT
- AlicenseNot gradedqualityDmaintenanceEnables AI assistants to interact with Metabase analytics platform, allowing users to query databases, manage dashboards and cards, execute SQL queries, and access analytics data through natural language.167 npm1MIT
- AlicenseNot gradedqualityDmaintenanceEnables AI assistants to interact with Metabase analytics platform, allowing them to query databases, execute SQL, manage dashboards and cards, and access analytics data through natural language.167 npmMIT