Metabase MCP server

Provides a bridge between databases and external tools, enabling metadata retrieval, schema exploration, and secure action execution across Metabase database systems through an encrypted configuration interface.
Back to servers
Provider
Sazbox AI
Release date
Mar 06, 2025
Language
Python
Stats
1 star

This server enables AI assistants to interact with Metabase databases and actions through the Model Control Protocol (MCP). It provides a secure bridge that allows AI models to explore database schemas, retrieve metadata, visualize relationships, and execute queries or Metabase actions.

Installation Options

Using Docker (Recommended)

  1. Clone the repository:

    git clone https://github.com/yourusername/metabase-mcp.git
    cd metabase-mcp
    
  2. Build and run with Docker Compose:

    docker-compose up -d
    
  3. Access the configuration interface at http://localhost:5001

Manual Installation

  1. Clone the repository:

    git clone https://github.com/yourusername/metabase-mcp.git
    cd metabase-mcp
    
  2. Install dependencies:

    pip install -r requirements.txt
    
  3. Run the configuration interface:

    python -m src.server.web_interface
    
  4. Access the configuration interface at http://localhost:5000

Configuration

Initial Setup

  1. Open the web interface in your browser
  2. Enter your Metabase URL (e.g., http://localhost:3000)
  3. Enter your Metabase API key
  4. Click "Save Configuration" and test the connection

Getting a Metabase API Key

  1. Log in to Metabase as an administrator
  2. Navigate to Settings > Admin settings > API Keys
  3. Create a new API key with appropriate permissions
  4. Copy the generated key to use with the MCP server

Using the MCP Server

Starting the Server

After configuration, start the MCP server:

# Using Docker
docker run -p 5001:5000 metabase-mcp

# Manually
python -m src.server.mcp_server

Available Tools

The server provides these tools to AI assistants:

  • list_databases: Shows all databases configured in Metabase
  • get_database_metadata: Retrieves detailed metadata for a specific database
  • db_overview: Provides a high-level overview of all tables in a database
  • table_detail: Shows detailed information about a specific table
  • visualize_database_relationships: Generates a visual representation of database relationships
  • run_database_query: Executes SQL queries against a database
  • list_actions: Shows all actions configured in Metabase
  • get_action_details: Retrieves detailed information about a specific action
  • execute_action: Runs a Metabase action with parameters

Web Interface Testing

The web interface includes a testing area for each tool where you can:

  • View database listings and metadata
  • Explore table structures and relationships
  • Execute test queries
  • View and execute Metabase actions
  • Test all available functionality before connecting an AI assistant

Security Considerations

  • API keys are stored with encryption
  • The web interface never displays API keys in plain text
  • All API requests use HTTPS when configured with a secure Metabase URL
  • For production environments, deploy behind a secure proxy

Troubleshooting

Common Issues

  • Connection Failed: Verify your Metabase URL is correct and accessible
  • Authentication Error: Check if your API key has proper permissions
  • Docker Network Issues: Ensure proper network configuration when using Docker

Checking Logs

View logs for detailed error information:

# Docker logs
docker logs metabase-mcp

# Manual execution logs are printed to the console

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