This MCP server provides integration with Metabase API, allowing AI assistants to interact with Metabase dashboards, questions, databases, and execute queries. It serves as a bridge between AI systems and your Metabase analytics platform.
Before installing, you'll need:
Clone the repository and install:
git clone https://github.com/imlewc/metabase-server.git && cd metabase-server && npm i && npm run build && npm link
Alternatively, you can install via Smithery:
npx -y @smithery/cli install @imlewc/metabase-server --client claude
The server requires environment variables for authentication with your Metabase instance. You can use either API Key (preferred) or username/password authentication.
# Required environment variables
export METABASE_URL=https://your-metabase-instance.com
export METABASE_API_KEY=your_metabase_api_key
# Required environment variables
export METABASE_URL=https://your-metabase-instance.com
export METABASE_USERNAME=your_username
export METABASE_PASSWORD=your_password
To use with Claude Desktop, add the server configuration to your Claude Desktop config file:
For MacOS: ~/Library/Application Support/Claude/claude_desktop_config.json
For Windows: %APPDATA%/Claude/claude_desktop_config.json
{
"mcpServers": {
"metabase-server": {
"command": "metabase-server",
"env": {
"METABASE_URL": "https://your-metabase-instance.com",
"METABASE_API_KEY": "your_metabase_api_key"
// Or alternatively:
// "METABASE_USERNAME": "your_username",
// "METABASE_PASSWORD": "your_password"
}
}
}
}
The server provides access to Metabase resources via metabase://
URIs:
Returns all dashboards available in your Metabase instance:
// Tool call example
{
"name": "list_dashboards"
}
Returns all questions/cards in your Metabase instance:
// Tool call example
{
"name": "list_cards"
}
Returns all databases connected to your Metabase instance:
// Tool call example
{
"name": "list_databases"
}
Executes a specific Metabase question/card and returns the results:
// Tool call example
{
"name": "execute_card",
"parameters": {
"card_id": 123
}
}
Returns all cards contained within a specified dashboard:
// Tool call example
{
"name": "get_dashboard_cards",
"parameters": {
"dashboard_id": 456
}
}
Executes a custom SQL query against a Metabase database:
// Tool call example
{
"name": "execute_query",
"parameters": {
"database_id": 789,
"query": "SELECT * FROM products LIMIT 10"
}
}
Since MCP servers communicate over stdio, you can use the MCP Inspector for debugging:
npm run inspector
This will provide a URL to access debugging tools in your browser.
To add this MCP server to Claude Code, run this command in your terminal:
claude mcp add-json "metabase-server" '{"command":"/path/to/metabase-server/build/index.js","env":{"METABASE_URL":"https://your-metabase-instance.com","METABASE_API_KEY":"your_metabase_api_key"}}'
See the official Claude Code MCP documentation for more details.
There are two ways to add an MCP server to Cursor. The most common way is to add the server globally in the ~/.cursor/mcp.json
file so that it is available in all of your projects.
If you only need the server in a single project, you can add it to the project instead by creating or adding it to the .cursor/mcp.json
file.
To add a global MCP server go to Cursor Settings > Tools & Integrations and click "New MCP Server".
When you click that button the ~/.cursor/mcp.json
file will be opened and you can add your server like this:
{
"mcpServers": {
"metabase-server": {
"command": "/path/to/metabase-server/build/index.js",
"env": {
"METABASE_URL": "https://your-metabase-instance.com",
"METABASE_API_KEY": "your_metabase_api_key"
}
}
}
}
To add an MCP server to a project you can create a new .cursor/mcp.json
file or add it to the existing one. This will look exactly the same as the global MCP server example above.
Once the server is installed, you might need to head back to Settings > MCP and click the refresh button.
The Cursor agent will then be able to see the available tools the added MCP server has available and will call them when it needs to.
You can also explicitly ask the agent to use the tool by mentioning the tool name and describing what the function does.
To add this MCP server to Claude Desktop:
1. Find your configuration file:
~/Library/Application Support/Claude/claude_desktop_config.json
%APPDATA%\Claude\claude_desktop_config.json
~/.config/Claude/claude_desktop_config.json
2. Add this to your configuration file:
{
"mcpServers": {
"metabase-server": {
"command": "/path/to/metabase-server/build/index.js",
"env": {
"METABASE_URL": "https://your-metabase-instance.com",
"METABASE_API_KEY": "your_metabase_api_key"
}
}
}
}
3. Restart Claude Desktop for the changes to take effect