跳过安装。2 分钟内即可运行。
在 cloud.anythingmcp.com 开始免费试用,一键添加 Metabase,然后将你的 AI 客户端(Claude、ChatGPT、Copilot 或 Cursor)指向生成的 MCP 端点。无需 Docker,无需 git clone,无需任何工程经验。
AnythingMCP 已收录在 Claude 的连接器目录中:一键添加到 Claude (在新标签页中打开),然后登录并选择 Claude 可以使用哪些 MCP 服务器。
摘要
在任意 AI 智能体中使用自托管或 Metabase Cloud 上的 Metabase:搜索并运行已保存的问题和仪表板卡片,执行 SQL 或 MBQL 查询,读取数据库、表和字段的元数据,浏览集合,并创建或更新问题、仪表板和集合。使用带有某个 Metabase 组权限的 API 密钥。
试试这样问
Metabase 的示例提示
点击任意提示即可复制,然后粘贴到 Claude、ChatGPT、Cursor、Gemini、Copilot 或 OpenClaw 中,在该连接器上运行。
Claude 是 AI,可能会出错。请核对回答。
💡 无需安装? 直接使用 cloud.anythingmcp.com。 登录、点击 Connectors → Metabase、粘贴凭证、生成 MCP API key,即可完成。无 Docker、无
git clone、无本地服务器。
Metabase + Claude
在任意 AI 智能体中使用自托管或 Metabase Cloud 上的 Metabase:搜索并运行已保存的问题和仪表板卡片,执行 SQL 或 MBQL 查询,读取数据库、表和字段的元数据,浏览集合,并创建或更新问题、仪表板和集合。使用带有某个 Metabase 组权限的 API 密钥。
前提条件
完整的设置说明已内置在连接器中 (在 store 中选择连接器时可见)。所需环境变量:
METABASE_URL, METABASE_API_KEY
步骤 1 — 获取凭证
设置大约需要 3 分钟。你需要一个 Metabase 实例(自托管或 Metabase Cloud),以及一位可以创建 API 密钥的管理员。
- 在
METABASE_URL中填写你打开 Metabase 时使用的地址,例如https://metabase.example.com或https://yourcompany.metabaseapp.com,不要带/api,末尾也不要加斜杠。 - 以管理员身份打开 Admin settings、Settings、Authentication、API keys,点击 Create API key,填写名称并选择一个 组。密钥以该组的权限运行:读取时,拥有集合的查看权限和目标数据库的查询权限即可;创建和修改内容需要 curate 权限。仅限管理员的读取操作(如
metabase_list_users)需要 Administrators 组。 - 将密钥(只显示一次)复制到
METABASE_API_KEY。它通过x-api-key请求头发送。 - 安装连接器并运行
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。
此连接器不会永久删除内容,不会修改用户、组或权限,也不会创建或编辑数据库连接。
步骤 2 — 安装 adapter
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
步骤 3 — 在 Claude 中添加连接器
你的服务器 URL: 在 AnythingMCP 中打开 MCP Servers → 此连接器所在的服务器,复制它的 URL(
https://cloud.anythingmcp.com/mcp/…)。本指南中出现YOUR_SERVER_ID的地方都用它替换。
推荐路径:在 claude.ai web 上工作,无需触碰任何配置文件。
- 在 Claude 中打开 Customize → Connectors。
- 点击 +,然后点击 Add custom connector。
- 输入名称(例如
Metabase)和远程 MCP 服务器 URLhttps://cloud.anythingmcp.com/mcp/YOUR_SERVER_ID,然后点击 Add。 - 点击 Connect,登录 AnythingMCP(OAuth)并允许访问。
下面所有工具都会出现在你的聊天中,开始输入提示。
可用工具
| Tool | What it does |
|---|---|
metabase_get_current_user | The account the API key acts as: id, name, e-mail, whether it is an admin, and its group memberships |
metabase_list_users | People in Metabase (admin only): id, name, e-mail, active state, groups, last login |
metabase_list_permission_groups | Permission groups (All Users, Administrators and custom groups) with their member count |
metabase_list_databases | Databases connected to Metabase: id, name, engine (postgres, bigquery-cloud-sdk, snowflake, ...), sync state. include=tables also lists… |
metabase_get_database | One database: name, engine, time zone, sync schedule and, with include=tables, its tables |
metabase_get_database_metadata | Full metadata of a database: every table with its fields (id, name, display name, base and semantic type, foreign key target) |
metabase_list_database_schemas | Schema names of one database (for example public or analytics), for metabase_list_schema_tables |
metabase_list_schema_tables | Tables of one schema of a database: id, name, display name, description, entity type, row count estimate |
metabase_get_table_metadata | A 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_values | Distinct values Metabase has cached for a category field (up to 1000), useful for filter values |
metabase_list_cards | Saved questions, models and metrics: id, name, type (question, model, metric), display, collection, description, the query behind it… |
metabase_get_card | One saved question, model or metric: name, description, collection, display, the query (dataset_query: native SQL or MBQL), parameters and… |
metabase_run_card | Run a saved question (or model) and return its result: data.cols (column names and types), data.rows (rows as arrays), row_count |
metabase_list_dashboards | Dashboards: id, name, description, collection, creator and last edit |
metabase_get_dashboard | One dashboard with its tabs, filters (parameters) and cards (dashcards): each dashcard has its id, card_id, the card, position and… |
metabase_run_dashboard_card | Run one card of a dashboard with the dashboard's filter values and return its result rows (data.cols, data.rows) |
metabase_list_collections | Collections (folders for questions, models and dashboards): id, name, location (path of parent ids), personal owner, archived flag |
metabase_get_collection | One collection: name, description, location, authority level (official), personal owner |
metabase_list_collection_items | What a collection contains: questions (card), models (dataset), metrics, dashboards, sub-collections, with id, name, model, description and… |
metabase_search | Search Metabase content by name and description: questions (card), models (dataset), metrics, dashboards, collections, tables, databases… |
metabase_run_native_query | Run a SQL (native) query on a connected database without saving it, with the permissions of the API key's group |
metabase_run_query | Run any dataset query without saving it: an MBQL query built from table and field ids ({"database": 1, "type": "query", "query"… |
metabase_get_recent_items | Items the API key's account recently viewed (views) or picked in the data picker (selections): questions, dashboards, tables, collections… |
metabase_get_popular_items | The most viewed dashboards, questions and tables of the instance, for "what do people use most" |
metabase_create_card | Save 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_card | Change a saved question: name, description, query, chart type and settings, collection, or archive it (archived true moves it to the trash… |
metabase_create_dashboard | Create an empty dashboard in a collection |
metabase_update_dashboard | Change a dashboard: name, description, collection, filters, tabs, archive state, or its cards. dashcards REPLACES the whole card list: read… |
metabase_create_collection | Create a collection (folder), optionally inside another one |
metabase_update_collection | Rename 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 集合中的一个柱状图问题。”
FAQ
Claude Code 和 Claude Desktop 一样工作吗? 是的,两者都指向 https://cloud.anythingmcp.com/mcp/YOUR_SERVER_ID。
下一步
这份指南对你有帮助吗?