Metabase MCP server

Integrates with Metabase to enable querying dashboards, executing SQL, and retrieving structured data for data analysis and insights generation.
Back to servers
Setup instructions
Provider
Lewis Chung
Release date
Mar 03, 2025
Language
TypeScript
Stats
66 stars

This MCP server provides integration with Metabase API, allowing AI assistants to interact with Metabase dashboards, questions, databases, and execute queries. It serves as a bridge between AI systems and your Metabase analytics platform.

Installation

Prerequisites

Before installing, you'll need:

  • Node.js and npm installed
  • Access to a Metabase instance
  • Valid Metabase credentials (API key or username/password)

Installation Steps

Clone the repository and install:

git clone https://github.com/imlewc/metabase-server.git && cd metabase-server && npm i && npm run build && npm link

Alternatively, you can install via Smithery:

npx -y @smithery/cli install @imlewc/metabase-server --client claude

Configuration

The server requires environment variables for authentication with your Metabase instance. You can use either API Key (preferred) or username/password authentication.

API Key Authentication (Preferred)

# Required environment variables
export METABASE_URL=https://your-metabase-instance.com
export METABASE_API_KEY=your_metabase_api_key

Username/Password Authentication (Fallback)

# Required environment variables
export METABASE_URL=https://your-metabase-instance.com
export METABASE_USERNAME=your_username
export METABASE_PASSWORD=your_password

Integration with Claude Desktop

To use with Claude Desktop, add the server configuration to your Claude Desktop config file:

For MacOS: ~/Library/Application Support/Claude/claude_desktop_config.json For Windows: %APPDATA%/Claude/claude_desktop_config.json

{
  "mcpServers": {
    "metabase-server": {
      "command": "metabase-server",
      "env": {
        "METABASE_URL": "https://your-metabase-instance.com",
        "METABASE_API_KEY": "your_metabase_api_key"
        // Or alternatively:
        // "METABASE_USERNAME": "your_username",
        // "METABASE_PASSWORD": "your_password"
      }
    }
  }
}

Features and Usage

Available Resources

The server provides access to Metabase resources via metabase:// URIs:

  • Dashboards
  • Cards/questions
  • Databases

Available Tools

List Dashboards

Returns all dashboards available in your Metabase instance:

// Tool call example
{
  "name": "list_dashboards"
}

List Cards

Returns all questions/cards in your Metabase instance:

// Tool call example
{
  "name": "list_cards"
}

List Databases

Returns all databases connected to your Metabase instance:

// Tool call example
{
  "name": "list_databases"
}

Execute Card

Executes a specific Metabase question/card and returns the results:

// Tool call example
{
  "name": "execute_card",
  "parameters": {
    "card_id": 123
  }
}

Get Dashboard Cards

Returns all cards contained within a specified dashboard:

// Tool call example
{
  "name": "get_dashboard_cards",
  "parameters": {
    "dashboard_id": 456
  }
}

Execute Query

Executes a custom SQL query against a Metabase database:

// Tool call example
{
  "name": "execute_query",
  "parameters": {
    "database_id": 789,
    "query": "SELECT * FROM products LIMIT 10"
  }
}

Debugging

Since MCP servers communicate over stdio, you can use the MCP Inspector for debugging:

npm run inspector

This will provide a URL to access debugging tools in your browser.

How to install this MCP server

For Claude Code

To add this MCP server to Claude Code, run this command in your terminal:

claude mcp add-json "metabase-server" '{"command":"/path/to/metabase-server/build/index.js","env":{"METABASE_URL":"https://your-metabase-instance.com","METABASE_API_KEY":"your_metabase_api_key"}}'

See the official Claude Code MCP documentation for more details.

For Cursor

There are two ways to add an MCP server to Cursor. The most common way is to add the server globally in the ~/.cursor/mcp.json file so that it is available in all of your projects.

If you only need the server in a single project, you can add it to the project instead by creating or adding it to the .cursor/mcp.json file.

Adding an MCP server to Cursor globally

To add a global MCP server go to Cursor Settings > Tools & Integrations and click "New MCP Server".

When you click that button the ~/.cursor/mcp.json file will be opened and you can add your server like this:

{
    "mcpServers": {
        "metabase-server": {
            "command": "/path/to/metabase-server/build/index.js",
            "env": {
                "METABASE_URL": "https://your-metabase-instance.com",
                "METABASE_API_KEY": "your_metabase_api_key"
            }
        }
    }
}

Adding an MCP server to a project

To add an MCP server to a project you can create a new .cursor/mcp.json file or add it to the existing one. This will look exactly the same as the global MCP server example above.

How to use the MCP server

Once the server is installed, you might need to head back to Settings > MCP and click the refresh button.

The Cursor agent will then be able to see the available tools the added MCP server has available and will call them when it needs to.

You can also explicitly ask the agent to use the tool by mentioning the tool name and describing what the function does.

For Claude Desktop

To add this MCP server to Claude Desktop:

1. Find your configuration file:

  • macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
  • Windows: %APPDATA%\Claude\claude_desktop_config.json
  • Linux: ~/.config/Claude/claude_desktop_config.json

2. Add this to your configuration file:

{
    "mcpServers": {
        "metabase-server": {
            "command": "/path/to/metabase-server/build/index.js",
            "env": {
                "METABASE_URL": "https://your-metabase-instance.com",
                "METABASE_API_KEY": "your_metabase_api_key"
            }
        }
    }
}

3. Restart Claude Desktop for the changes to take effect

Want to 10x your AI skills?

Get a free account and learn to code + market your apps using AI (with or without vibes!).

Nah, maybe later