Metabase MCP Server
A Model Control Protocol (MCP) server that enables AI assistants to interact with Metabase databases and actions.
![Metabase MCP Server]
Overview
The Metabase MCP Server provides a bridge between AI assistants and Metabase, allowing AI models to:
- List and explore databases configured in Metabase
- Retrieve detailed metadata about database schemas, tables, and fields
- Visualize relationships between tables in a database
- List and execute Metabase actions
- Perform operations on Metabase data through a secure API
This server implements the [Model Control Protocol (MCP)] specification, making it compatible with AI assistants that support MCP tools.
Features
- Database Exploration: List all databases and explore their schemas
- Metadata Retrieval: Get detailed information about tables, fields, and relationships
- Relationship Visualization: Generate visual representations of database relationships
- Action Management: List, view details, and execute Metabase actions
- Secure API Key Handling: Store API keys encrypted and prevent exposure
- Web Interface: Test and debug functionality through a user-friendly web interface
- Docker Support: Easy deployment with Docker and Docker Compose
Prerequisites
- Metabase instance (v0.46.0 or higher recommended)
- Metabase API key with appropriate permissions
- Docker (for containerized deployment)
- Python 3.10+ (for local development)
Installation
Using Docker (Recommended)
-
Clone this repository:
git clone https://github.com/yourusername/metabase-mcp.git cd metabase-mcp
-
Build and run the Docker container:
docker-compose up -d
-
Access the configuration interface at http://localhost:5001
Manual Installation
-
Clone this repository:
git clone https://github.com/yourusername/metabase-mcp.git cd metabase-mcp
-
Install dependencies:
pip install -r requirements.txt
-
Run the configuration interface:
python -m src.server.web_interface
-
Access the configuration interface at http://localhost:5000
Configuration
- Open the web interface in your browser
- Enter your Metabase URL (e.g., http://localhost:3000)
- Enter your Metabase API key
- Click "Save Configuration" and test the connection
Obtaining a Metabase API Key
- Log in to your Metabase instance as an administrator
- Go to Settings > Admin settings > API Keys
- Create a new API key with appropriate permissions
- Copy the generated key for use in the MCP server
Usage
Running the MCP Server
After configuration, you can run the MCP server:
# Using Docker
docker run -p 5001:5000 metabase-mcp
# Manually
python -m src.server.mcp_server
Available Tools
The MCP server provides the following tools to AI assistants:
- list_databases: List all databases configured in Metabase
- get_database_metadata: Get detailed metadata for a specific database
- db_overview: Get a high-level overview of all tables in a database
- table_detail: Get detailed information about a specific table
- visualize_database_relationships: Generate a visual representation of database relationships
- run_database_query: Execute a SQL query against a database
- list_actions: List all actions configured in Metabase
- get_action_details: Get detailed information about a specific action
- execute_action: Execute a Metabase action with parameters
Testing Tools via Web Interface
The web interface provides a testing area for each tool:
- List Databases: View all databases configured in Metabase
- Get Database Metadata: View detailed schema information for a database
- DB Overview: View a concise list of all tables in a database
- Table Detail: View detailed information about a specific table
- Visualize Database Relationships: Generate a visual representation of table relationships
- Run Query: Execute SQL queries against databases
- List Actions: View all actions configured in Metabase
- Get Action Details: View detailed information about a specific action
- Execute Action: Test executing an action with parameters
Security Considerations
- API keys are stored encrypted at rest
- The web interface never displays API keys in plain text
- All API requests use HTTPS when configured with a secure Metabase URL
- The server should be deployed behind a secure proxy in production environments
Development
Project Structure
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
Adding New Tools
To add a new tool:
- Implement the tool function in
src/tools/ - Register the tool in
src/server/mcp_server.py - Add a testing interface in
templates/config.html(optional) - Add a route in
src/server/web_interface.py(if adding a testing interface)
Troubleshooting
Common Issues
- Connection Failed: Ensure your Metabase URL is correct and accessible
- Authentication Error: Verify your API key has the necessary permissions
- Docker Network Issues: When using Docker, ensure proper network configuration
Logs
Check the logs for detailed error information:
# Docker logs
docker logs metabase-mcp
# Manual execution logs
# Logs are printed to the console
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
Metadata
Release files for iflow-mcp_sazboxai_metabase-mcp 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| iflow_mcp_sazboxai_metabase_mcp-0.1.0.tar.gz | 14.3 kB | Without provenance | Details for iflow_mcp_sazboxai_metabase_mcp-0.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| iflow_mcp_sazboxai_metabase_mcp-0.1.0-py3-none-any.whl | Python 3 | none | any | Details for iflow_mcp_sazboxai_metabase_mcp-0.1.0-py3-none-any.whl |
Total release size: 31.0 kB
Release files / iflow_mcp_sazboxai_metabase_mcp-0.1.0.tar.gz
| Download URL | iflow_mcp_sazboxai_metabase_mcp-0.1.0.tar.gz |
|---|---|
| Size | 14.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
082af989c571dec30586ae9943f49b2de4fc1ba9e19832ba04920da21bd83f60
|
|
BLAKE2b-256 checksum How to use checksums |
34e3887226959042af443b0db7a24562d6f71b79f88c21a8e16acf1dbf4360aa
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.9.27 {"installer":{"name":"uv","version":"0.9.27","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Debian GNU/Linux","version":"13","id":"trixie","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|
Release files / iflow_mcp_sazboxai_metabase_mcp-0.1.0-py3-none-any.whl
| Download URL | iflow_mcp_sazboxai_metabase_mcp-0.1.0-py3-none-any.whl |
|---|---|
| Size | 16.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
039643ac80259f2a38e2966a60498adbe71a15b87c926ffb3a84d4d27d3ab57e
|
|
BLAKE2b-256 checksum How to use checksums |
1273cf90d73a3a9edef4a529eddc97b20be0bb9b5f8e570011c0c38b6e28cc42
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.9.27 {"installer":{"name":"uv","version":"0.9.27","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Debian GNU/Linux","version":"13","id":"trixie","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|
Security for iflow-mcp_sazboxai_metabase-mcp 0.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.