Skip to main content
Glama

Metabase MCP

Ask DeepWiki npm version License: MIT Node.js TypeScript GitHub stars

Buy Me A Coffee

A high-performance Model Context Protocol server for AI integration with Metabase analytics platforms. Features response optimization, robust error handling, and comprehensive data access tools.

Key Features

  • Response Optimization: Up to 90% token reduction for efficient AI context usage

  • Robust Error Handling: Comprehensive error handling with structured, actionable responses

  • Smart Caching: Multi-layer caching with configurable TTL for improved performance

  • Modern MCP Support: MCP 2026-07-28 discovery and cache hints with legacy client compatibility

  • Unified Commands: list, retrieve, search, execute, and export tools

  • Dual Authentication: API key or email/password authentication

  • Large Data Export: Export up to 1M rows in CSV, JSON, and XLSX formats

  • Read-Only Mode: Enabled by default to restrict execute to SELECT queries only

Related MCP server: FastAPI MCP Server

Installation

Option 1: Claude Desktop

Install directly from the Claude Desktop Directory, or:

  1. Download metabase-mcp.mcpb from Releases

  2. Open the .mcpb file with Claude Desktop to install

  3. Configure your Metabase credentials in Claude Desktop's extension settings

Option 2: Manual Configuration

Add the following to your MCP client configuration:

{
  "mcpServers": {
    "metabase-mcp": {
      "command": "npx",
      "args": ["-y", "@jerichosequitin/metabase-mcp"],
      "env": {
        // Required
        "METABASE_URL": "https://your-metabase-instance.com",

        // Authentication (choose one)
        "METABASE_API_KEY": "your_api_key_here",       // API key (recommended)
        "METABASE_USER_EMAIL": "",                     // OR email/password
        "METABASE_PASSWORD": "",

        // Optional (defaults shown)
        "EXPORT_DIRECTORY": "~/Downloads/Metabase",    // Export location
        "METABASE_PROXY_AUTHORIZATION": "",            // Optional Proxy-Authorization value for IAP, e.g. "Bearer <token>"
        "METABASE_READ_ONLY_MODE": "true",             // Restrict to SELECT queries
        "LOG_LEVEL": "info",                           // debug, info, warn, error, fatal (debug enables pretty JSON)
        "CACHE_TTL_MS": "600000",                      // 10 minutes
        "REQUEST_TIMEOUT_MS": "600000"                 // 10 minutes
      }
    }
  }
}

Option 3: Docker

For containerized deployments without installing Node.js. Add to your MCP client configuration:

{
  "mcpServers": {
    "metabase-mcp": {
      "command": "docker",
      "args": [
        "run", "-i", "--rm", "--init",
        "-e", "METABASE_URL=https://your-metabase-instance.com",
        "-e", "METABASE_API_KEY=your_api_key",
        // Optional: mount volume for exports
        // "-v", "~/Downloads/Metabase:/home/node/exports",
        "ghcr.io/jerichosequitin/metabase-mcp:latest"
      ]
    }
  }
}

Or build locally: docker build -t metabase-mcp . and use metabase-mcp as the image name.

Required flags: -i (interactive, for MCP stdio), --rm (cleanup), --init (signal handling)

Environment variables: Pass via -e flags. See Manual Configuration for all options. Docker defaults: LOG_LEVEL=info, METABASE_READ_ONLY_MODE=true, EXPORT_DIRECTORY=/home/node/exports.

Available Tools

list

Fetch all records for a resource type with optimized responses returning only essential fields.

  • Models: cards, dashboards, tables, databases, collections

  • Pagination: offset/limit parameters for large datasets

retrieve

Get detailed information for specific items by ID with concurrent processing.

  • Models: card, dashboard, table, database, collection, field

  • Batch Support: Up to 50 IDs per request

  • Pagination: table_offset/table_limit for databases with many tables

Search across all Metabase items using the native search API.

  • Filtering: By model type, database ID, or content

  • Options: Search native SQL queries, include dashboard questions

execute

Execute SQL queries or run saved cards with configurable row limits (default: 100, max: 500).

  • SQL Mode: Custom queries with database_id and query

  • Card Mode: Saved cards with card_id and optional card_parameters for filtering

  • Security: Respects Read-Only Mode (blocks INSERT, UPDATE, DELETE, DROP, etc.)

export

Export large datasets up to 1M rows to the configured export directory.

  • Formats: CSV, JSON, XLSX

  • SQL Mode: Export custom query results

  • Card Mode: Export saved card results with optional filtering

  • Note: When using hosted remote deployments (e.g., Glama), exported files are saved inside the container and are inaccessible. Use execute for query results directly, or run locally via npx/Docker for full export functionality.

clear_cache

Clear internal cache with granular control.

  • Targets: Individual model caches, list caches, or bulk operations (all, all-lists, all-individual)

For Developers

Prerequisites

  • Node.js 20.0.0 or higher

  • Active Metabase instance

Setup

git clone https://github.com/jerichosequitin/metabase-mcp.git
cd metabase-mcp
npm install
npm run build

Then configure your MCP client to use the local build:

{
  "mcpServers": {
    "metabase-mcp": {
      "command": "node",
      "args": ["/path/to/metabase-mcp/build/src/index.js"],
      "env": { /* see Manual Configuration for options */ }
    }
  }
}

Debugging

Use the MCP Inspector for development:

npm run inspector

Testing

npm test                 # Run tests
npm run test:coverage    # Coverage report

Building MCPB Package

npm run mcpb:build

Creates metabase-mcp-{version}.mcpb ready for GitHub Releases.

Security

Read-Only Mode is enabled by default (METABASE_READ_ONLY_MODE=true), restricting the execute tool to SELECT queries only. Write operations (INSERT, UPDATE, DELETE, DROP, etc.) are blocked. Set to false to allow write operations.

Authentication: API key authentication is recommended over email/password for production use.

Proxy Authentication: Set METABASE_PROXY_AUTHORIZATION when Metabase is behind a proxy that requires a Proxy-Authorization header, such as Google IAP. The value is passed through exactly as provided, for example Bearer <token>.

License

This project is licensed under the MIT License.

Available Tools

5 tools
clear_cacheA
Idempotent

Clear the internal cache for stored data. Useful for debugging or when you know the data has changed. Supports granular cache clearing for both individual items and list caches.

Inputs: cache_type.

executeA
Destructive

Unified command to execute SQL queries or run saved cards against Metabase databases. Use Card mode when existing cards have the needed filters. Use SQL mode for custom queries or when cards lack required filters. Returns up to 500 rows per request - for larger datasets, use the export tool instead. SECURITY WARNING: SQL mode can execute ANY valid SQL including destructive operations (DELETE, UPDATE, DROP, TRUNCATE, ALTER). Use with caution and ensure appropriate database permissions are configured in Metabase. Note: When Read-Only Mode is enabled, write operations will be rejected with an error.

Inputs: query, card_id, row_limit, database_id, +2 more.

listA
Read-onlyIdempotent

Fetch all records for a single Metabase resource type with highly optimized responses for overview purposes. Retrieves complete lists of cards, dashboards, tables, databases, or collections. Returns only essential identifier fields for efficient browsing and includes intelligent caching for performance. Supports pagination for large datasets exceeding token limits.

Inputs: model (required), limit, offset.

retrieveA
Read-onlyIdempotent

Fetch additional details for supported models (Cards, Dashboards, Tables, Databases, Collections, Fields). Supports multiple IDs (max 50 per request) with intelligent concurrent processing and optimized caching. Includes table pagination for large databases exceeding token limits.

Inputs: ids (required), model (required), table_limit, table_offset.

Tool Schema Changelog

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

Loading tool schema changelog…

    TDQS

    A4.3/5.0

    Scored across 5 tools

    Disambiguation5/5

    Each tool targets a clearly distinct operation: cache clearing, searching, listing, detail retrieval, and query execution. While search and list both return content, search is for discovery across item types and list is for complete overviews of a single resource type, so there is no real ambiguity.

    Naming Consistency4/5

    Most tool names are single-word lowercase verbs (search, retrieve, list, execute), which is consistent and predictable. clear_cache deviates slightly by using snake_case and a compound verb-noun structure, but the pattern is still readable and does not cause confusion.

    Tool Count5/5

    Five tools is a well-scoped count for a Metabase-focused server. Each tool covers a necessary aspect of the read/query workflow without redundant utilities or overwhelming breadth.

    Completeness3/5

    The core discovery and querying workflows are covered well, but the execute tool explicitly directs users to an 'export tool' for larger datasets that is not present in this server. There are also no create/update/delete operations, though that may be intentional for a read-oriented server; the missing export tool is a notable gap.

    Maintenance

    ActivityNo data
    ResponsivenessOutdated data

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      Not graded
      quality
      D
      maintenance
      A high-performance Model Context Protocol (MCP) server designed for large language models, enabling real-time communication between AI models and applications with support for session management and intelligent tool registration.
      2
      MIT
    • A
      license
      A
      quality
      D
      maintenance
      A Model Context Protocol server that enables natural language interaction with Snowflake databases through AI guidance, supporting core database operations, warehouse management, and AI-powered data analysis features.
      13
      3
      MIT
    • F
      license
      Not graded
      quality
      D
      maintenance
      A Python-based Model Context Protocol server that integrates local AI models for managing data with features like CRUD operations, similarity search, and text analysis.
      -