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
Provider
Lewis Chung
Release date
Mar 03, 2025
Language
TypeScript
Stats
37 stars

This MCP server enables integration with Metabase, allowing AI assistants to access and interact with Metabase dashboards, questions/cards, and databases. It provides structured data access and tools for executing queries against your Metabase instance.

Configuration

Before using the server, you need to set up authentication using environment variables. There are two authentication methods available:

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

The server first checks for METABASE_API_KEY. If present, it uses API key authentication. Otherwise, it falls back to username/password authentication. You must provide credentials for at least one method.

Installation

Installing for Claude Desktop

To use with Claude Desktop, add the server configuration to the appropriate file based on your operating system:

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

Add the following configuration:

{
  "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"
        // Or alternatively:
        // "METABASE_USERNAME": "your_username",
        // "METABASE_PASSWORD": "your_password"
      }
    }
  }
}

You can also set these environment variables in your system instead of in the config file.

Installing via Smithery

For automatic installation with Claude Desktop using Smithery:

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

Usage

The Metabase MCP server provides several tools and resources for interacting with your Metabase instance.

Available Tools

  • list_dashboards: Lists all dashboards in Metabase
  • list_cards: Lists all questions/cards in Metabase
  • list_databases: Lists all databases in Metabase
  • execute_card: Executes a Metabase question/card and returns results
  • get_dashboard_cards: Gets all cards in a dashboard
  • execute_query: Executes a SQL query against a Metabase database

Resource Access

You can access Metabase resources using metabase:// URIs. The server supports:

  • Dashboards
  • Cards/questions
  • Databases

All resources are returned with JSON content type for structured data access.

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, where you can send requests to the server and view responses.

Testing Authentication

Testing API Key Authentication

  1. Set the required environment variables:

    export METABASE_URL=https://your-metabase-instance.com
    export METABASE_API_KEY=your_metabase_api_key
    
  2. Start the server and use an MCP client or the MCP Inspector to call a tool:

    {"name": "list_dashboards"}
    
  3. Verify that the tool call returns the expected data.

Testing Username/Password Authentication

  1. Ensure METABASE_API_KEY is unset, then set:

    export METABASE_URL=https://your-metabase-instance.com
    export METABASE_USERNAME=your_username
    export METABASE_PASSWORD=your_password
    
  2. Start the server and call a tool using an MCP client or the Inspector.

  3. Check that the authentication succeeds and the tool returns data.

How to add this MCP server to 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 > MCP and click "Add new global MCP server".

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

{
    "mcpServers": {
        "cursor-rules-mcp": {
            "command": "npx",
            "args": [
                "-y",
                "cursor-rules-mcp"
            ]
        }
    }
}

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 explictly ask the agent to use the tool by mentioning the tool name and describing what the function does.

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