Skip to main content
Glama
sazboxai

Metabase MCP Server

by sazboxai

元数据库 MCP 服务器

模型控制协议 (MCP) 服务器,使 AI 助手能够与 Metabase 数据库和操作进行交互。

![元数据库 MCP 服务器]

概述

Metabase MCP 服务器在 AI 助手和 Metabase 之间架起了一座桥梁,使 AI 模型能够:

  • 列出并探索 Metabase 中配置的数据库

  • 检索有关数据库架构、表和字段的详细元数据

  • 可视化数据库中表之间的关系

  • 列出并执行 Metabase 操作

  • 通过安全 API 对 Metabase 数据执行操作

该服务器实现了[模型控制协议(MCP)]规范,使其与支持MCP工具的AI助手兼容。

Related MCP server: Metabase MCP Plus

特征

  • 数据库探索:列出所有数据库并探索其模式

  • 元数据检索:获取有关表、字段和关系的详细信息

  • 关系可视化:生成数据库关系的可视化表示

  • 操作管理:列出、查看详细信息并执行元数据库操作

  • 安全 API 密钥处理:加密存储 API 密钥并防止泄露

  • Web 界面:通过用户友好的 Web 界面测试和调试功能

  • Docker 支持:使用 Docker 和 Docker Compose 轻松部署

先决条件

  • Metabase 实例(建议使用 v0.46.0 或更高版本)

  • 具有适当权限的 Metabase API 密钥

  • Docker(用于容器化部署)

  • Python 3.10+(用于本地开发)

安装

使用 Docker(推荐)

  1. 克隆此存储库:

    git clone https://github.com/yourusername/metabase-mcp.git
    cd metabase-mcp
  2. 构建并运行 Docker 容器:

    docker-compose up -d
  3. 访问配置界面http://localhost:5001

手动安装

  1. 克隆此存储库:

    git clone https://github.com/yourusername/metabase-mcp.git
    cd metabase-mcp
  2. 安装依赖项:

    pip install -r requirements.txt
  3. 运行配置界面:

    python -m src.server.web_interface
  4. 访问配置界面http://localhost:5000

配置

  1. 在浏览器中打开 Web 界面

  2. 输入您的 Metabase URL(例如, http://localhost:3000

  3. 输入您的 Metabase API 密钥

  4. 点击“保存配置”并测试连接

获取元数据库 API 密钥

  1. 以管理员身份登录到您的 Metabase 实例

  2. 前往“设置”>“管理设置”>“API 密钥”

  3. 创建具有适当权限的新 API 密钥

  4. 复制生成的密钥以在 MCP 服务器中使用

用法

运行 MCP 服务器

配置完成后,即可运行MCP服务器:

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

# Manually
python -m src.server.mcp_server

可用工具

MCP服务器为AI助手提供以下工具:

  1. list_databases :列出 Metabase 中配置的所有数据库

  2. get_database_metadata :获取特定数据库的详细元数据

  3. db_overview :获取数据库中所有表的高级概述

  4. table_detail :获取特定表的详细信息

  5. visualize_database_relationships :生成数据库关系的可视化表示

  6. run_database_query :对数据库执行 SQL 查询

  7. list_actions :列出 Metabase 中配置的所有操作

  8. get_action_details :获取有关特定操作的详细信息

  9. 执行带有参数的 Metabase 操作

通过 Web 界面测试工具

Web 界面为每个工具提供了一个测试区域:

  1. 列出数据库:查看 Metabase 中配置的所有数据库

  2. 获取数据库元数据:查看数据库的详细架构信息

  3. DB 概览:查看数据库中所有表的简明列表

  4. 表详细信息:查看特定表的详细信息

  5. 可视化数据库关系:生成表关系的可视化表示

  6. 运行查询:对数据库执行 SQL 查询

  7. 列出操作:查看 Metabase 中配置的所有操作

  8. 获取操作详细信息:查看有关特定操作的详细信息

  9. 执行操作:测试执行带参数的操作

安全注意事项

  • API 密钥以静态加密方式存储

  • Web 界面从不以纯文本形式显示 API 密钥

  • 当配置了安全的 Metabase URL 时,所有 API 请求都使用 HTTPS

  • 在生产环境中,服务器应该部署在安全代理后面

发展

项目结构

metabase-mcp/
├── src/
│   ├── api/            # Metabase API client
│   ├── config/         # Configuration management
│   ├── server/         # MCP and web servers
│   └── tools/          # Tool implementations
├── templates/          # Web interface templates
├── docker-compose.yml  # Docker Compose configuration
├── Dockerfile          # Docker build configuration
├── requirements.txt    # Python dependencies
└── README.md           # Documentation

添加新工具

要添加新工具:

  1. src/tools/中实现工具功能

  2. src/server/mcp_server.py中注册该工具

  3. templates/config.html中添加测试接口(可选)

  4. src/server/web_interface.py中添加路由(如果添加测试接口)

故障排除

常见问题

  • 连接失败:确保您的 Metabase URL 正确且可访问

  • 身份验证错误:验证您的 API 密钥是否具有必要的权限

  • Docker 网络问题:使用 Docker 时,确保正确的网络配置

日志

检查日志以获取详细的错误信息:

# Docker logs
docker logs metabase-mcp

# Manual execution logs
# Logs are printed to the console

贡献

欢迎贡献代码!欢迎提交 Pull 请求。

F
license - not found
Not graded
quality - not tested
D
maintenance

Maintenance

Maintainers
Response time
Release cycle
Releases (12mo)
Commit activity

Resources

Unclaimed servers have limited discoverability.

Looking for Admin?

If you are the server author, to access and configure the admin panel.

Related MCP Servers

  • A
    license
    Not graded
    quality
    D
    maintenance
    A Model Context Protocol server that provides AI assistants with comprehensive access to SQL databases, enabling schema inspection, query execution, and database operations with enterprise-grade security.
    46
    7
    MIT
  • A
    license
    A
    quality
    C
    maintenance
    An MCP server that enables AI assistants to query databases, execute SQL, and manage Metabase resources like dashboards, cards, and collections through natural language.
    22
    MIT

View all related MCP servers

Related MCP Connectors

  • A comprehensive Model Context Protocol (MCP) server that enables AI assistants to interact with yo…

  • GibsonAI MCP server: manage your databases with natural language

  • Self-hosted MCP gateway: turn any API, database or MCP server into AI connectors — no code.

View all MCP Connectors

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/sazboxai/MCP_MetaBase'

If you have feedback or need assistance with the MCP directory API, please join our Discord server