Metabase MCP (headless)

io.github.Serdnaley由 GitHub 帳號 Serdnaley 發布v0.5.0更新於 Nov 3, 2026

無頭 Metabase MCP:API 金鑰認證,無需 OAuth。178 個工具、工具集、stdio 或 HTTP,支援所有層級。

AI 翻譯由 AI 模型根據下方的原文描述翻譯,可能有誤。

原文描述

Headless Metabase MCP: API-key auth, no OAuth. 178 tools, toolsets, stdio or HTTP, all tiers.

概覽

Metabase MCP (headless) 的本機 MCP 服務;無需登入;STDIO。

暫無 AI 概覽:以下資訊來自註冊中心條目和服務本身。

安裝

在 SourceWeft 中

  1. 開啟 儀表板中的 Metabase MCP (headless),將其新增到工作區。
  2. 為需要使用其工具的對話啟用該服務。

Desktop only,透過 STDIO。 STDIO 服務會啟動本機處理程序,因此需要 SourceWeft 桌面主機。

其他 MCP 客戶端

參照 儲存庫 中的啟動說明。

README

@serdnaley/metabase-mcp

[npm version] [License: MIT] [Tests] [Metabase] [MCP] [Glama score]

The headless MCP server for Metabase. Plug Metabase into any AI agent, app, CI job or server with a plain API key: no OAuth flow, no browser, no admin switch to flip.

  • Headless auth. A Metabase API key (or email/password) is all it needs. That works where an interactive OAuth login can't: servers, CI, containers, your own app or agent. Metabase's built-in MCP is documented as OAuth-only and needs an admin to enable it on 0.60+.
  • Runs locally or as a service. stdio for desktop clients, or Streamable HTTP with a bearer token for shared and server deployments. Metabase credentials stay on the server.
  • Full coverage. 187 tools for querying and for running Metabase: dashboards, questions, collections, users, groups, permissions, databases, settings, alerts, transforms, exports and more.
  • Only the tools you need. Toolsets and per-tool enable/disable keep the model's context small. Every tool carries read-only/destructive hints, so clients can auto-approve reads.
  • Any Metabase. Works with Metabase OSS (free) and paid editions, tested against 0.59 and 0.64. Paid-only features (caching, model persistence, moderation) work when your instance has them; CI covers the free edition.

How it compares with Metabase's built-in MCP and other Metabase MCP servers: docs/comparison.md. Full tool catalog: serdnaley.github.io/metabase-mcp.

Features

  • 187 MCP tools across 34 toolsets: search, databases, tables, collections, cards, dashboards, actions, dataset, users, groups, permissions, segments, revisions, settings, alerts, subscriptions, glossary, documents, timelines, bookmarks, moderation, snippets, x-rays, cache, persistence, uploads, metrics, measures, transforms, exports, API keys, embedding, tasks & logs, explorations
  • Toolsets: load only what you need (METABASE_TOOLSETS=query), add or drop single tools with globs
  • Tool annotations: readOnlyHint / destructiveHint / idempotentHint on every tool
  • stdio or HTTP: Streamable HTTP with bearer auth for shared deployments
  • Read-only mode: hide every write tool with one env var
  • Large-result safety: compact query results, row and response-size caps, paging
  • Resources & prompts: browse databases, cards, dashboards and collections; ready-made workflows
  • Admin automation: users, groups, permissions, settings, database connections, transforms
  • Type-safe: HTTP client generated from Metabase's OpenAPI spec
  • Zero config: runs via npx, no installation needed

Installation

Claude Desktop (one-click bundle)

Download metabase-mcp-X.Y.Z.mcpb from the latest release and open it: Claude Desktop shows a form for the Metabase URL and API key. No Node.js setup or JSON editing.

Claude Desktop (JSON config)

Edit ~/Library/Application Support/Claude/claude_desktop_config.json (macOS) or %APPDATA%\Claude\claude_desktop_config.json (Windows):

json
{  "mcpServers": {    "metabase": {      "command": "npx",      "args": ["-y", "@serdnaley/metabase-mcp"],      "env": {        "METABASE_URL": "https://your-metabase.example.com",        "METABASE_API_KEY": "mb_xxx"      }    }  }}

Restart Claude Desktop after saving.

Claude Code (CLI)
bash
claude mcp add metabase \  --env METABASE_URL=https://your-metabase.example.com \  --env METABASE_API_KEY=mb_xxx \  -- npx -y @serdnaley/metabase-mcp

Or add to .claude/mcp.json:

json
{  "mcpServers": {    "metabase": {      "type": "stdio",      "command": "npx",      "args": ["-y", "@serdnaley/metabase-mcp"],      "env": {        "METABASE_URL": "https://your-metabase.example.com",        "METABASE_API_KEY": "mb_xxx"      }    }  }}
Cursor

Add to ~/.cursor/mcp.json (global) or .cursor/mcp.json (project):

json
{  "mcpServers": {    "metabase": {      "command": "npx",      "args": ["-y", "@serdnaley/metabase-mcp"],      "env": {        "METABASE_URL": "https://your-metabase.example.com",        "METABASE_API_KEY": "mb_xxx"      }    }  }}

Restart Cursor after saving.

Windsurf

Add to ~/.codeium/windsurf/mcp_config.json:

json
{  "mcpServers": {    "metabase": {      "command": "npx",      "args": ["-y", "@serdnaley/metabase-mcp"],      "env": {        "METABASE_URL": "https://your-metabase.example.com",        "METABASE_API_KEY": "mb_xxx"      }    }  }}
Cline (VS Code)

Add to your Cline MCP settings (accessible via the MCP Servers icon):

json
{  "mcpServers": {    "metabase": {      "command": "npx",      "args": ["-y", "@serdnaley/metabase-mcp"],      "env": {        "METABASE_URL": "https://your-metabase.example.com",        "METABASE_API_KEY": "mb_xxx"      }    }  }}
Continue (VS Code)

Add to .continue/config.yaml:

yaml
mcpServers:  - name: metabase    command: npx    args:      - "-y"      - "@serdnaley/metabase-mcp"    env:      METABASE_URL: "https://your-metabase.example.com"      METABASE_API_KEY: "mb_xxx"
Zed

Add to your Zed settings.json:

json
{  "context_servers": {    "metabase": {      "command": "npx",      "args": ["-y", "@serdnaley/metabase-mcp"],      "env": {        "METABASE_URL": "https://your-metabase.example.com",        "METABASE_API_KEY": "mb_xxx"      }    }  }}
Remote / HTTP (any client that speaks Streamable HTTP)

Run the server once in HTTP mode (see HTTP mode), then point clients at it. Claude Code:

bash
claude mcp add --transport http metabase https://mcp.example.com/mcp \  --header "Authorization: Bearer $MCP_HTTP_TOKEN"

Generic JSON config (Cursor, VS Code and others):

json
{  "mcpServers": {    "metabase": {      "url": "https://mcp.example.com/mcp",      "headers": { "Authorization": "Bearer <MCP_HTTP_TOKEN>" }    }  }}

Configuration

VariableRequiredDescription
METABASE_URLYesBase URL of your Metabase instance
METABASE_API_KEYNo*API key for authentication
METABASE_EMAILNo*Email for session-based auth
METABASE_PASSWORDNo*Password for session-based auth
METABASE_READ_ONLY_MODENoSet to true to disable write tools
METABASE_CUSTOM_HEADERSNoExtra HTTP headers sent on every request, including the session login (see below)
METABASE_TOOLSETSNoComma list of toolsets or presets to load (default: all). See Toolsets
METABASE_TOOLS_ENABLENoExtra tools to load on top of the toolsets (names or globs, e.g. get_card,export_*)
METABASE_TOOLS_DISABLENoTools never to load (names or globs); always wins over enable
METABASE_MAX_ROWSNoRow cap for query tools (default 500); see Large results
METABASE_MAX_RESPONSE_CHARSNoSize cap for any tool response (default 100000)
MCP_TRANSPORTNostdio (default) or http. --http on the command line does the same
MCP_HTTP_HOST / MCP_HTTP_PORTNoHTTP bind address, default 127.0.0.1:3333 (PORT also works)
MCP_HTTP_TOKENHTTP modeBearer token clients must send (min. 16 chars)
MCP_HTTP_ALLOW_NO_AUTHNotrue runs HTTP without a token, only on a loopback host

*Either METABASE_API_KEY or both METABASE_EMAIL + METABASE_PASSWORD must be provided. API key is recommended.

Custom headers

Use METABASE_CUSTOM_HEADERS when Metabase sits behind a proxy that needs its own headers, such as Cloudflare Access service tokens. Give it a JSON object:

bash
METABASE_CUSTOM_HEADERS='{"CF-Access-Client-Id": "xxx.access", "CF-Access-Client-Secret": "yyy"}'

or Name: value pairs separated by newlines or ;:

bash
METABASE_CUSTOM_HEADERS='CF-Access-Client-Id: xxx.access; CF-Access-Client-Secret: yyy'

The auth headers (X-API-Key, X-Metabase-Session) always win over a custom header with the same name. A malformed value stops the server at startup.

Toolsets

Each tool domain is a toolset (dashboards, users, transforms, ...; the full list is in Tools). Presets bundle them:

PresetFor
alleverything (default)
queryexploring and querying data: search, databases, tables, dataset, cards, metrics, measures, segments, exports, activity, x-rays, explorations
contentbuilding and organising content: collections, cards, dashboards, documents, snippets, timelines, alerts, ...
adminrunning the instance: users, permissions, settings, databases, tables, cache, uploads, transforms, actions, ...
bash
METABASE_TOOLSETS=query,dashboards      # analyst assistantMETABASE_TOOLS_ENABLE=create_card       # plus one write toolMETABASE_TOOLS_DISABLE='delete_*'       # never delete anything

Precedence, strongest first: read-only mode > METABASE_TOOLS_DISABLE > METABASE_TOOLS_ENABLE > METABASE_TOOLSETS. An unknown toolset stops the server at startup; an enable/disable pattern that matches nothing logs a warning. The startup log (stderr) shows how many tools are enabled.

Large results

Query tools (execute_query, execute_card_query, run_metric) return a compact view: columns (name, type) and rows, without Metabase's column internals, results_metadata and insights. Pass verbose: true for the raw response. Results are capped at METABASE_MAX_ROWS rows (per call: max_rows, never above the cap) and paged with offset; a note says how to get the rest. Every tool response is compact JSON capped at METABASE_MAX_RESPONSE_CHARS. For a 10 / 100 / 500-row SELECT * FROM ORDERS this is 94% / 76% / 60% smaller than the raw pretty-printed response. For full result sets use the export tools with output_path.

Resources and prompts

Besides tools the server offers MCP resources for browsing (compact JSON): metabase://databases, metabase://database/{id}/schema, metabase://card/{id}, metabase://dashboard/{id}, metabase://collection/{id} (root for the root collection), and prompts for common workflows: explore-database, build-dashboard, explain-card, audit-permissions. Both follow the tool selection: a resource needs its toolset, a prompt needs every tool it uses (so build-dashboard disappears in read-only mode).

HTTP mode (shared / server deployments)

bash
METABASE_URL=https://metabase.example.com \METABASE_API_KEY=mb_xxx \MCP_TRANSPORT=http MCP_HTTP_HOST=0.0.0.0 MCP_HTTP_PORT=3333 \MCP_HTTP_TOKEN="$(openssl rand -hex 32)" \npx -y @serdnaley/metabase-mcp

Clients connect to http://<host>:3333/mcp with Authorization: Bearer <MCP_HTTP_TOKEN>. GET /health answers without auth and reveals nothing. The endpoint is stateless (no sessions), so it scales horizontally. Put it behind TLS (a reverse proxy) when it leaves localhost. Everyone with the token acts as the Metabase API key's user, so give each audience its own key, token and toolsets.

Or as a container (ghcr.io/serdnaley/metabase-mcp, amd64 + arm64, HTTP mode by default):

bash
docker run -p 3333:3333 \  -e METABASE_URL=https://metabase.example.com -e METABASE_API_KEY=mb_xxx \  -e MCP_HTTP_TOKEN="$(openssl rand -hex 32)" \  ghcr.io/serdnaley/metabase-mcp

Getting a Metabase API Key

  1. Go to your Metabase instance
  2. Click the gear icon > Admin settings > Authentication > API Keys
  3. Click "Create API Key"
  4. Give it a name and select the appropriate group (e.g., Administrators)
  5. Copy the key — it starts with mb_

Examples

"Create a dashboard showing order trends"

The AI assistant will:

  1. Use search and get_database_metadata to discover your data
  2. Use create_card to create questions (e.g., orders by month, revenue by product)
  3. Use create_dashboard to create the dashboard
  4. Use update_dashboard_cards to arrange the cards with a layout

"Move all Q4 reports to the Archive collection"

The AI assistant will:

  1. Use search to find Q4 report cards
  2. Use create_collection to create an Archive collection if needed
  3. Use update_card on each card to move it to the new collection

"What tables do we have in the analytics database?"

The AI assistant will:

  1. Use list_databases to find the database
  2. Use get_database_metadata to list all tables, fields, and relationships

Tools

Full catalog with parameters: see the tool catalog site (generated from the code).

Read tools (83, always available)

ToolsetTools
Search (search)search
Databases (databases)list_databases, get_database, get_database_metadata, list_database_schemas, get_database_schema
Tables & Fields (tables)get_table, get_table_query_metadata, get_field, get_field_values
Collections (collections)get_collection_tree, list_collections, get_collection, list_collection_items
Cards (cards)list_cards, get_card, execute_card_query
Dashboards (dashboards)list_dashboards, get_dashboard
Actions (actions)list_actions, get_action
Dataset (ad-hoc queries) (dataset)execute_query
Users & Groups (users)list_users, get_user, get_current_user, list_groups, get_group
Permissions (permissions)get_permissions_graph, get_collection_permissions
Segments (segments)list_segments, get_segment
Revisions (revisions)list_revisions
Settings (settings)list_settings, get_setting
Alerts & Subscriptions (notifications)list_alerts, get_alert, list_dashboard_subscriptions, list_notifications
X-Rays (xrays)generate_xray
Activity & Tasks (activity)get_activity, get_recent_items, get_popular_items
Snippets (snippets)list_snippets, get_snippet
Glossary (glossary)list_glossary_terms, get_glossary_term
Documents (documents)list_documents, get_document
Timelines (timelines)list_timelines, get_timeline
Bookmarks (bookmarks)list_bookmarks
EID Translation (eid-translation)translate_entity_ids
Metrics (metrics)list_metrics, get_metric, run_metric, list_metric_dimensions, get_metric_dimension_values
Measures (measures)list_measures, get_measure
Transforms (transforms)list_transforms, get_transform, list_transform_runs, get_transform_run, list_transform_jobs, list_transform_tags
Exports (exports)export_card_query, export_query, export_dashboard_pdf
API Keys (api-keys)list_api_keys
Embedding (embedding)get_embedding_status, create_embed_url
Tasks & Logs (diagnostics)list_tasks, get_task, list_task_types, list_task_runs, get_scheduler_info, get_server_logs, list_log_presets, get_premium_token_status
Explorations (explorations)list_exploration_dimensions, list_my_explorations, get_exploration, get_exploration_query_result

Write tools (104, hidden in read-only mode)

ToolsetTools
Databases (databases)create_database, update_database, delete_database, validate_database, sync_database_schema
Tables & Fields (tables)update_table, update_field, rescan_field_values, discard_field_values, reorder_fields
Collections (collections)create_collection, update_collection
Cards (cards)create_card, update_card, delete_card, copy_card, create_card_public_link, delete_card_public_link
Dashboards (dashboards)create_dashboard, update_dashboard, delete_dashboard, copy_dashboard, update_dashboard_cards, create_dashboard_public_link, delete_dashboard_public_link
Actions (actions)create_action, update_action, delete_action, execute_action, create_action_public_link, delete_action_public_link
Users & Groups (users)create_user, update_user, deactivate_user, reactivate_user, create_group, update_group, delete_group, add_group_member, remove_group_member
Permissions (permissions)update_permissions_graph, update_collection_permissions
Segments (segments)create_segment, update_segment, delete_segment
Revisions (revisions)revert_revision
Settings (settings)update_setting
Alerts & Subscriptions (notifications)send_notification, create_alert, update_alert, delete_alert, create_dashboard_subscription, update_dashboard_subscription, delete_dashboard_subscription
Cache (cache)invalidate_cache, update_cache_config
Model Persistence (persistence)persist_model, unpersist_model, refresh_persisted_model
Uploads (upload)upload_csv
Snippets (snippets)create_snippet, update_snippet, delete_snippet
Glossary (glossary)create_glossary_term, update_glossary_term, delete_glossary_term
Documents (documents)create_document, update_document, delete_document
Timelines (timelines)create_timeline, update_timeline, delete_timeline, create_timeline_event, update_timeline_event, delete_timeline_event
Bookmarks (bookmarks)create_bookmark, delete_bookmark
Moderation (moderation)create_moderation_review
Metrics (metrics)create_metric, update_metric
Measures (measures)create_measure, update_measure
Transforms (transforms)create_transform, update_transform, delete_transform, run_transform, cancel_transform_run, create_transform_job, run_transform_job, delete_transform_job, create_transform_tag
API Keys (api-keys)create_api_key, update_api_key, regenerate_api_key, delete_api_key
Embedding (embedding)set_static_embedding, set_resource_embedding
Tasks & Logs (diagnostics)set_log_levels, reset_log_levels
Explorations (explorations)create_exploration, update_exploration, delete_exploration, restart_exploration_thread, cancel_exploration_thread

Presets for METABASE_TOOLSETS: all (everything); query (search, databases, tables, dataset, cards, metrics, measures, segments, exports, activity, xrays, explorations); content (search, collections, cards, dashboards, documents, snippets, timelines, bookmarks, glossary, revisions, moderation, notifications, exports); admin (users, permissions, settings, databases, tables, cache, persistence, upload, transforms, actions, activity, eid-translation, api-keys, embedding, diagnostics).

Security

execute_query is available even in read-only mode. It can execute arbitrary SQL against any database the configured Metabase account has access to. Metabase enforces its own permission model, but this tool does not add additional restrictions.

To prevent write operations, ensure the Metabase API key or account has read-only database permissions within Metabase itself.

Exports can write local files. export_card_query, export_query and export_dashboard_pdf stay available in read-only mode (they only read from Metabase) and, when given output_path, write to that absolute path on the machine running the MCP server. They never overwrite an existing file unless overwrite: true is passed. Metabase applies the same access check to an export as to running the query; its separate "Download results" permission exists only on Pro/Enterprise.

Read-only mode is not a security boundary. METABASE_READ_ONLY_MODE only hides write tools. What a key can really do is set in Metabase: an API key gets the permissions of its group plus All Users. For a read-only assistant, put the key in a group with View-only collection access and "Create queries" set to query builder only (or no), and restrict All Users to no more than that. See docs/read-only-and-permissions.md for the probe results and a setup checklist.

HTTP mode requires a bearer token. MCP_TRANSPORT=http refuses to start without MCP_HTTP_TOKEN (compared in constant time), unless MCP_HTTP_ALLOW_NO_AUTH=true on a loopback host, where Host-header checks block DNS rebinding. The token grants everything the configured Metabase key can do, so treat it like that key and serve the endpoint over TLS outside localhost.

Raw SQL is one-click. Read tools are marked readOnlyHint: true, including execute_query and export_query, so clients can auto-approve them. ⚠️ Their SQL is sent as-is: this server does not block INSERT/UPDATE/DELETE/DDL, and both tool descriptions say so. Use a Metabase API key whose group cannot run native queries (or a database user with read-only grants) if SQL must not write — see docs/read-only-and-permissions.md.

Action types are restricted. The create_action tool only allows query and implicit action types. HTTP actions (which could make arbitrary outbound requests) are blocked.

Development

bash
bun installbun run dev                    # Start the MCP serverbun run build                  # Build for npmbun run generate-types         # Regenerate types from Metabase OpenAPI spec

Testing

Tests run against a real Metabase instance via Docker:

bash
docker compose up -d             # Start Metabase (pinned version, see docker-compose.yml)./tests/ci/wait-for-metabase.sh  # Wait for ready (~15s)bun test                         # 276 testsdocker compose down              # Stop Metabase

Verified against Metabase v0.65.2.6 (the CI pin; also v0.65.2.2–.5, v0.64.3.4–.6) and v0.59.6. To try another release: MB_IMAGE=metabase/metabase:latest docker compose up -d. CI also runs the suite weekly on metabase:latest as a non-blocking job, so upstream API drift shows up before the pin is bumped.

Actions, transforms and CSV uploads run against the Postgres "Test Warehouse" from docker-compose.yml. Features that need a paid plan or a missing service (moderation, cache invalidation, model persistence, or the warehouse itself) are skipped explicitly with a SKIP … (environment) log line; any other API error fails the test.

How It Works

AI Client (Claude, Cursor, etc.)  ↓ MCP protocol (stdio)MCP Tool (zod schema + handler)  ↓Service function (business logic)  ↓openapi-fetch (type-safe HTTP client)  ↓Metabase REST API

The server generates TypeScript types from Metabase's OpenAPI spec and uses openapi-fetch for type-safe API calls.

License

MIT

來源:README.md,提交 c4f2319

工具

0
SourceWeft 曾在隔離沙箱中以無憑證方式啟動該軟體包一次,以列出其工具,但未能完成:伺服器未能啟動。

版本歷史

2
  1. v0.5.0最新Nov 3, 2026
  2. v0.4.0Oct 26, 2026

評分

已滿足適用檢查項的 50%

該評分衡量此收錄條目的完整程度,依據註冊中心條目、端點與公開來源計算得出。它不是對伺服器本身的評價,也不表示伺服器安全或目前可用:可連通性是帶日期的檢查結果,評分也不包含安裝量或使用者評價。

  • 近 30 天內可連通25 分

    請保持端點能夠回應 MCP 握手;SourceWeft 每 30 天探測一次。

  • 已宣告認證方式10 分

    請在註冊中心條目中宣告憑證請求標頭,或保持端點能夠回應探測,以便判定其認證方式。

  • 已列出工具15 分

    請讓伺服器在無憑證時回應 tools/list,或發布可在沙箱中無憑證啟動的軟體包。

  • 描述必需15 分
  • 圖示10 分
  • 文件15 分
  • 授權條款10 分