连接器指南阅读约 5 分钟30 个 MCP 工具7 种语言

Metabase 接入 MCP:在任意 AI 智能体中使用已保存问题、仪表板、SQL 与 MBQL 查询和集合

在任意 AI 智能体中使用自托管或 Metabase Cloud 上的 Metabase:搜索并运行已保存的问题和仪表板卡片,执行 SQL 或 MBQL 查询,读取数据库、表和字段的元数据,浏览集合,并创建或更新问题、仪表板和集合。使用带有某个 Metabase 组权限的 API 密钥。

HC作者:HelpCode 团队更新于 5 分钟阅读 在 GitHub 开源

无需信用卡 · 7 天试用 · 提供自托管方案

Metabase

Metabase

Metabase BI: search and run saved questions and dashboard cards, run SQL or MBQL queries, read database, table and field metadata, browse collections, and create or update questions, dashboards and collections.

个工具

30

区域

INTL

类别

数据分析

身份验证

API Key

所需环境变量

METABASE_URLMETABASE_API_KEY
在 Cloud 上一键安装

7 天免费试用 · 无需信用卡

  • 7 天免费试用
    无需信用卡
  • 符合 GDPR,SOC 2 就绪
    数据驻留欧盟,审计日志
  • 在 GitHub 开源
    开源 · AGPL-3.0
  • 支持 ChatGPT、Claude、Gemini
    任何兼容 MCP 的客户端

跳过安装。2 分钟内即可运行。

在 cloud.anythingmcp.com 开始免费试用,一键添加 Metabase,然后将你的 AI 客户端(Claude、ChatGPT、Copilot 或 Cursor)指向生成的 MCP 端点。无需 Docker,无需 git clone,无需任何工程经验。

开始免费试用

摘要

在任意 AI 智能体中使用自托管或 Metabase Cloud 上的 Metabase:搜索并运行已保存的问题和仪表板卡片,执行 SQL 或 MBQL 查询,读取数据库、表和字段的元数据,浏览集合,并创建或更新问题、仪表板和集合。使用带有某个 Metabase 组权限的 API 密钥。

试试这样问

Metabase 的示例提示

点击任意提示即可复制,然后粘贴到 Claude、ChatGPT、Cursor、Gemini、Copilot 或 OpenClaw 中,在该连接器上运行。

Metabase · 通过 MCP 实时
分享
Opus 4.7

Claude 是 AI,可能会出错。请核对回答。

💡 无需安装? 直接使用 cloud.anythingmcp.com。 登录、点击 Connectors → Metabase、粘贴凭证、生成 MCP API key,即可完成。无 Docker、无 git clone、无本地服务器。

Metabase

在任意 AI 智能体中使用自托管或 Metabase Cloud 上的 Metabase:搜索并运行已保存的问题和仪表板卡片,执行 SQL 或 MBQL 查询,读取数据库、表和字段的元数据,浏览集合,并创建或更新问题、仪表板和集合。使用带有某个 Metabase 组权限的 API 密钥。

设置

设置大约需要 3 分钟。你需要一个 Metabase 实例(自托管或 Metabase Cloud),以及一位可以创建 API 密钥的管理员。

  1. 在 METABASE_URL 中填写你打开 Metabase 时使用的地址,例如 https://metabase.example.com 或 https://yourcompany.metabaseapp.com,不要带 /api,末尾也不要加斜杠。
  2. 以管理员身份打开 Admin settings、Settings、Authentication、API keys,点击 Create API key,填写名称并选择一个 组。密钥以该组的权限运行:读取时,拥有集合的查看权限和目标数据库的查询权限即可;创建和修改内容需要 curate 权限。仅限管理员的读取操作(如 metabase_list_users)需要 Administrators 组。
  3. 将密钥(只显示一次)复制到 METABASE_API_KEY。它通过 x-api-key 请求头发送。
  4. 安装连接器并运行 metabase_get_current_user:它会显示密钥所代表的账户,并确认地址和密钥可用。

读取内容:通过 metabase_search 搜索内容(问题、模型、指标、仪表板、集合、表、数据库、分段,也可按需搜索原生问题的 SQL 文本或回收站),集合及其内容,已保存的问题、模型和指标及其背后的查询,带有标签页、筛选器和卡片的仪表板,以及最近使用和最受欢迎的项目。连接到 Metabase 的数据库及其 schema、表和字段(不返回连接信息),以及用于筛选器的分类字段缓存值。用户和权限组。

运行内容:metabase_run_card 运行已保存的问题或模型,筛选条件通过 parameters 传入;metabase_run_dashboard_card 按仪表板的筛选值运行仪表板中的一张卡片。metabase_run_native_query 以数据库自身的方言运行 SQL,{{name}} 变量通过 template_tags 和 parameters 传入;metabase_run_query 运行由表 ID 和字段 ID 构成的 MBQL 查询。这些操作都不会保存任何内容。AI 会优先用已保存的问题回答,只有在没有合适问题时才编写临时查询。

写入内容:metabase_create_card 在集合中或直接在仪表板内保存新的问题、模型或指标,metabase_update_card 修改它们,metabase_create_dashboard 创建空仪表板,metabase_update_dashboard 修改名称、筛选器、标签页或卡片。其 dashcards 列表会替换全部卡片,因此 AI 会先读取仪表板,保留现有卡片及其 ID,再用负数 ID 在 24 列网格上添加新卡片。metabase_create_collection 和 metabase_update_collection 用于创建、重命名和移动集合。

安装时关闭的工具:无,所有工具均已开启。连接器没有删除工具:通过更新工具归档问题、仪表板或集合时,它们会被移入回收站,将 archived 设为 false 即可恢复。

数据格式:查询结果以 data.cols(name、display_name,以及 type/Integer、type/DateTime 等 base_type)和 data.rows(按列顺序排列的数组)返回,并附带 row_count。日期为 ISO 8601 格式,使用实例的报表时区。数据库、表、字段、问题和仪表板的 ID 都是整数;顶层集合为 root。卡片的 type 为 question、model 或 metric;在搜索结果和集合内容中,模型显示为 dataset。

分页:metabase_search、metabase_list_collection_items 和 metabase_list_users 接受 limit 和 offset 并返回 total。其他列表一次返回全部内容。对于大型数据库,metabase_get_database_metadata 可能非常大;metabase_list_schema_tables 和 metabase_get_table_metadata 更轻量。

限制:查询工具最多返回 2,000 行,这是 API 对临时结果的上限,因此 AI 会在查询中聚合或筛选,而不是逐页读取原始行。原生查询使用 Metabase 的数据库连接运行:对于绝不能被修改的数据库,请在 Metabase 中配置只读的数据库用户。

常见错误:失败的查询会返回 status: failed,并在 error 中给出数据库的消息,作为调用失败上报。401 表示密钥错误或已被删除。403 表示密钥所属组缺少相应权限(数据访问、curate 或 admin)。404 表示 ID 错误,或地址下没有 /api 路由:请检查 METABASE_URL。

此连接器不会永久删除内容,不会修改用户、组或权限,也不会创建或编辑数据库连接。

前提条件: METABASE_URL, METABASE_API_KEY

本地安装连接器

curl -fsSL https://raw.githubusercontent.com/HelpCode-ai/anythingmcp/main/docker-compose.quickstart.yml -o docker-compose.yml
printf 'JWT_SECRET=%s\nENCRYPTION_KEY=%s\n' "$(openssl rand -hex 32)" "$(openssl rand -hex 32)" > .env
docker compose up -d

打开 http://localhost:3000/connectors/store,选择 Metabase 并填入前提条件中列出的环境变量。

可用工具

ToolWhat it does
metabase_get_current_userThe account the API key acts as: id, name, e-mail, whether it is an admin, and its group memberships
metabase_list_usersPeople in Metabase (admin only): id, name, e-mail, active state, groups, last login
metabase_list_permission_groupsPermission groups (All Users, Administrators and custom groups) with their member count
metabase_list_databasesDatabases connected to Metabase: id, name, engine (postgres, bigquery-cloud-sdk, snowflake, ...), sync state. include=tables also lists…
metabase_get_databaseOne database: name, engine, time zone, sync schedule and, with include=tables, its tables
metabase_get_database_metadataFull metadata of a database: every table with its fields (id, name, display name, base and semantic type, foreign key target)
metabase_list_database_schemasSchema names of one database (for example public or analytics), for metabase_list_schema_tables
metabase_list_schema_tablesTables of one schema of a database: id, name, display name, description, entity type, row count estimate
metabase_get_table_metadataA table with its fields (id, name, display name, base type, semantic type such as type/PK, type/FK, type/Category, foreign key targets)…
metabase_get_field_valuesDistinct values Metabase has cached for a category field (up to 1000), useful for filter values
metabase_list_cardsSaved questions, models and metrics: id, name, type (question, model, metric), display, collection, description, the query behind it…
metabase_get_cardOne saved question, model or metric: name, description, collection, display, the query (dataset_query: native SQL or MBQL), parameters and…
metabase_run_cardRun a saved question (or model) and return its result: data.cols (column names and types), data.rows (rows as arrays), row_count
metabase_list_dashboardsDashboards: id, name, description, collection, creator and last edit
metabase_get_dashboardOne dashboard with its tabs, filters (parameters) and cards (dashcards): each dashcard has its id, card_id, the card, position and…
metabase_run_dashboard_cardRun one card of a dashboard with the dashboard's filter values and return its result rows (data.cols, data.rows)
metabase_list_collectionsCollections (folders for questions, models and dashboards): id, name, location (path of parent ids), personal owner, archived flag
metabase_get_collectionOne collection: name, description, location, authority level (official), personal owner
metabase_list_collection_itemsWhat a collection contains: questions (card), models (dataset), metrics, dashboards, sub-collections, with id, name, model, description and…
metabase_searchSearch Metabase content by name and description: questions (card), models (dataset), metrics, dashboards, collections, tables, databases…
metabase_run_native_queryRun a SQL (native) query on a connected database without saving it, with the permissions of the API key's group
metabase_run_queryRun any dataset query without saving it: an MBQL query built from table and field ids ({"database": 1, "type": "query", "query"…
metabase_get_recent_itemsItems the API key's account recently viewed (views) or picked in the data picker (selections): questions, dashboards, tables, collections…
metabase_get_popular_itemsThe most viewed dashboards, questions and tables of the instance, for "what do people use most"
metabase_create_cardSave a new question, model or metric in a collection. dataset_query is the query (native SQL or MBQL, as in metabase_run_query); display is…
metabase_update_cardChange a saved question: name, description, query, chart type and settings, collection, or archive it (archived true moves it to the trash…
metabase_create_dashboardCreate an empty dashboard in a collection
metabase_update_dashboardChange a dashboard: name, description, collection, filters, tabs, archive state, or its cards. dashcards REPLACES the whole card list: read…
metabase_create_collectionCreate a collection (folder), optionally inside another one
metabase_update_collectionRename a collection, change its description, move it under another parent, or archive it (archived true moves it and its content to the…

示例提示

  • “找到关于月度收入的已保存问题,并按最近 12 个月运行它。”
  • “我们的 Metabase 中哪些仪表板被查看得最多?连同所属集合一起列出来。”
  • “用地区筛选 EMEA 运行 Sales overview 仪表板的卡片,并总结其中的数字。”
  • “写一条针对 orders 表的 SQL 查询,统计今年各国家的订单数,并给我看结果。”
  • “把刚才运行的查询保存为 Marketing 集合中的一个柱状图问题。”

下一步

这份指南对你有帮助吗?

你的 Metabase 智能体只差一次点击。

安装连接器,粘贴密钥,向你的 AI 客户端提问。免费试用 7 天,无需信用卡。

相关指南

连接器

如何通过 MCP 将 Metabase 连接到 ChatGPT

在任意 AI 智能体中使用自托管或 Metabase Cloud 上的 Metabase:搜索并运行已保存的问题和仪表板卡片,执行 SQL 或 MBQL 查询,读取数据库、表和字段的元数据,浏览集合,并创建或更新问题、仪表板和集合。使用带有某个 Metabase 组权限的 API 密钥。

连接器

如何通过 MCP 将 Metabase 连接到 Claude

在任意 AI 智能体中使用自托管或 Metabase Cloud 上的 Metabase:搜索并运行已保存的问题和仪表板卡片,执行 SQL 或 MBQL 查询,读取数据库、表和字段的元数据,浏览集合,并创建或更新问题、仪表板和集合。使用带有某个 Metabase 组权限的 API 密钥。

连接器

如何通过 MCP 将 Metabase 连接到 Cursor

在任意 AI 智能体中使用自托管或 Metabase Cloud 上的 Metabase:搜索并运行已保存的问题和仪表板卡片,执行 SQL 或 MBQL 查询,读取数据库、表和字段的元数据,浏览集合,并创建或更新问题、仪表板和集合。使用带有某个 Metabase 组权限的 API 密钥。

连接器

如何通过 MCP 将 Metabase 连接到 Gemini

在任意 AI 智能体中使用自托管或 Metabase Cloud 上的 Metabase:搜索并运行已保存的问题和仪表板卡片,执行 SQL 或 MBQL 查询,读取数据库、表和字段的元数据,浏览集合,并创建或更新问题、仪表板和集合。使用带有某个 Metabase 组权限的 API 密钥。

连接器

如何通过 MCP 将 Metabase 连接到 Meta Muse

在任意 AI 智能体中使用自托管或 Metabase Cloud 上的 Metabase:搜索并运行已保存的问题和仪表板卡片,执行 SQL 或 MBQL 查询,读取数据库、表和字段的元数据,浏览集合,并创建或更新问题、仪表板和集合。使用带有某个 Metabase 组权限的 API 密钥。

连接器

如何通过 MCP 将 Metabase 连接到 Microsoft Copilot

在任意 AI 智能体中使用自托管或 Metabase Cloud 上的 Metabase:搜索并运行已保存的问题和仪表板卡片,执行 SQL 或 MBQL 查询,读取数据库、表和字段的元数据,浏览集合,并创建或更新问题、仪表板和集合。使用带有某个 Metabase 组权限的 API 密钥。