metabase-agent-mcp-server
v0.2.0
Published
MCP server for the Metabase Agent API — discover tables, metrics, and execute queries against Metabase's semantic layer
Maintainers
Readme
Metabase Agent MCP Server
An MCP (Model Context Protocol) server that exposes Metabase's Agent API as tools for AI assistants like Claude, LibreChat, or any MCP-compatible client.
The Agent API is a versioned REST API for building headless, agentic BI applications on top of Metabase's semantic layer. This MCP server wraps the Agent API v1 endpoints so that LLMs can discover tables and metrics, inspect fields, and run queries — all scoped to the permissions of the configured API key.
Prerequisites
- Metabase v0.59+ with a Pro/Enterprise license (the Agent API is a paid feature)
- A Metabase API key created in Admin > Settings > Authentication > API Keys
- Node.js 20+ (for local usage) or Docker
Configuration
The server reads two required environment variables:
| Variable | Description |
| ------------------ | ------------------------------------------------- |
| METABASE_URL | Base URL of your Metabase instance (e.g. https://metabase.example.com) |
| METABASE_API_KEY | API key for authenticating with Metabase |
Why API key instead of JWT?
The Metabase Agent API docs recommend JWT for per-user auth scoping. However, MCP clients like Claude Desktop and LibreChat pass static environment variables to servers — they don't support dynamic JWT generation. A Metabase API key provides a simple, static credential that works with any MCP client. The API key's permissions are determined by the Metabase user it was created for.
Usage
With Claude Desktop
Add to ~/Library/Application Support/Claude/claude_desktop_config.json:
{
"mcpServers": {
"metabase": {
"command": "node",
"args": ["/path/to/metabase-agent-mcp-server/dist/index.js"],
"env": {
"METABASE_URL": "https://metabase.example.com",
"METABASE_API_KEY": "mb_your_api_key_here"
}
}
}
}With LibreChat
Configure in your LibreChat MCP settings:
mcpServers:
metabase:
command: node
args:
- /path/to/metabase-agent-mcp-server/dist/index.js
env:
METABASE_URL: https://metabase.example.com
METABASE_API_KEY: mb_your_api_key_hereWith Docker
docker build -t metabase-agent-mcp .
docker run -i --rm \
-e METABASE_URL=https://metabase.example.com \
-e METABASE_API_KEY=mb_your_api_key_here \
metabase-agent-mcpAvailable Tools
| Tool | Description |
| ------------------ | --------------------------------------------------------------------------- |
| search | Search for tables and metrics (term-based and/or semantic) |
| get_table | Get details for a table: fields, related tables, metrics, measures, segments |
| get_metric | Get details for a metric: queryable dimensions, segments |
| get_field_values | Get statistics and sample values for a table or metric field |
| run_query | Construct and execute a query in one step |
Typical workflow
- Search for relevant tables or metrics using
search - Inspect a table (
get_table) or metric (get_metric) to see its fields and schema - Explore field values with
get_field_valuesif you need to discover valid filter values - Query using
run_queryto get results
Development
npm install
npm run build
npm startRun tests:
npm testLicense
MIT
