Metabase Integration
STDIOA Model Context Protocol server for Metabase integration.
A Model Context Protocol server for Metabase integration.
A Model Context Protocol server for Metabase integration.
This is a TypeScript-based MCP server that implements integration with Metabase API. It allows AI assistants to interact with Metabase, providing access to:
metabase://
URIslist_dashboards
- List all dashboards in Metabaselist_cards
- List all questions/cards in Metabaselist_databases
- List all databases in Metabaseexecute_card
- Execute a Metabase question/card and get resultsget_dashboard_cards
- Get all cards in a dashboardexecute_query
- Execute a SQL query against a Metabase databaseBefore running the server, you need to set environment variables for authentication. The server supports two methods:
API Key (Preferred):
METABASE_URL
: The URL of your Metabase instance (e.g., https://your-metabase-instance.com
).METABASE_API_KEY
: Your Metabase API key.Username/Password (Fallback):
METABASE_URL
: The URL of your Metabase instance.METABASE_USERNAME
: Your Metabase username.METABASE_PASSWORD
: Your Metabase password.The server will first check for METABASE_API_KEY
. If it's set, API key authentication will be used. If METABASE_API_KEY
is not set, the server will fall back to using METABASE_USERNAME
and METABASE_PASSWORD
. You must provide credentials for at least one of these methods.
Example setup:
Using API Key:
# Required environment variables export METABASE_URL=https://your-metabase-instance.com export METABASE_API_KEY=your_metabase_api_key
Or, using Username/Password:
# Required environment variables export METABASE_URL=https://your-metabase-instance.com export METABASE_USERNAME=your_username export METABASE_PASSWORD=your_password
You can set these environment variables in your shell profile or use a .env
file with a package like dotenv
.
Install dependencies:
npm install
Build the server:
npm run build
For development with auto-rebuild:
npm run watch
To use with Claude Desktop, add the server config:
On MacOS: ~/Library/Application Support/Claude/claude_desktop_config.json
On Windows: %APPDATA%/Claude/claude_desktop_config.json
{ "mcpServers": { "metabase-server": { "command": "/path/to/metabase-server/build/index.js", "env": { "METABASE_URL": "https://your-metabase-instance.com", // Use API Key (preferred) "METABASE_API_KEY": "your_metabase_api_key" // Or Username/Password (if API Key is not set) // "METABASE_USERNAME": "your_username", // "METABASE_PASSWORD": "your_password" } } } }
Note: You can also set these environment variables in your system instead of in the config file if you prefer.
To install metabase-server for Claude Desktop automatically via Smithery:
npx -y @smithery/cli install @imlewc/metabase-server --client claude
Since MCP servers communicate over stdio, debugging can be challenging. We recommend using the MCP Inspector, which is available as a package script:
npm run inspector
The Inspector will provide a URL to access debugging tools in your browser.
After configuring the environment variables as described in the "Configuration" section, you can manually test the server's authentication. The MCP Inspector (npm run inspector
) is a useful tool for sending requests to the server.
METABASE_URL
and METABASE_API_KEY
environment variables with your Metabase instance URL and a valid API key.METABASE_USERNAME
and METABASE_PASSWORD
are unset or leave them, as the API key should take precedence.npm run build && node build/index.js
(or use your chosen method for running the server, like via Claude Desktop config).tools/call
with {"name": "list_dashboards"}
.METABASE_API_KEY
environment variable is unset.METABASE_URL
, METABASE_USERNAME
, and METABASE_PASSWORD
with valid credentials for your Metabase instance.list_dashboards
tool.METABASE_URL
and an invalid METABASE_API_KEY
. Ensure METABASE_USERNAME
and METABASE_PASSWORD
variables are unset.list_dashboards
). The tool call should fail, and the server logs might indicate an authentication error from Metabase (e.g., "Metabase API error: Invalid X-API-Key").METABASE_API_KEY
is unset. Set METABASE_URL
and invalid METABASE_USERNAME
/METABASE_PASSWORD
.METABASE_API_KEY
, METABASE_USERNAME
, and METABASE_PASSWORD
. Set only METABASE_URL
.