Metabase MCP Server
Enables interaction with Metabase instances, providing 33 tools for querying cards (saved questions), dashboards, databases, collections, executing SQL queries, and retrieving metadata about tables, fields, segments, and metrics.
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@Metabase MCP Server show me the revenue dashboard"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
Metabase MCP Server
A Model Context Protocol (MCP) server that enables LLMs to interact with your Metabase instance. This server provides 33 tools for querying cards, dashboards, databases, collections, and executing queries against your Metabase installation.
š Quick Start
Prerequisites
Node.js >= 18.0.0 (required by
@modelcontextprotocol/sdk)npm (comes with Node.js)
Installation
Clone or navigate to the project directory:
cd metabase-mcp-mabInstall dependencies:
npm installVerify Node.js version:
node --version # Should be >= 18.0.0
Configuration
The server requires environment variables to be set. When using with Cursor/Claude Desktop, configure these in your ~/.cursor/mcp.json file:
{
"mcpServers": {
"metabase-local": {
"command": "node",
"args": ["/path/to/metabase-mcp-mab/src/server/index.js"],
"env": {
"METABASE_URL": "https://your-metabase-instance.com",
"METABASE_API_KEY": "your-api-key-here"
}
}
}
}Environment Variables
METABASE_URL(optional): Your Metabase instance URL. Defaults tohttps://data-metabase.swile.coMETABASE_API_KEY(required): Your Metabase API key. Must be provided - no default value for security.
Note: The API key is required and must be provided via environment variables. There is no hardcoded default for security reasons.
Getting Your Metabase API Key
Log into your Metabase instance
Go to Settings ā Account Settings ā API Keys
Create a new API key or use an existing one
Copy the key and add it to your
mcp.jsonconfiguration
Related MCP server: Metabase MCP Server
š Usage
With Cursor/Claude Desktop
Once configured in mcp.json, you can ask LLMs questions like:
"Get the SQL query for card ID 17033"
"List all cards in the database"
"Show me cards related to revenue"
"Execute card 17033 with parameters"
"What databases are available?"Direct Server Usage
Run the server directly:
npm startOr run in development mode with auto-reload:
npm run devProgrammatic Usage
import { createDefaultClient } from './src/client/cards.js';
const client = createDefaultClient();
// Get a specific card
const card = await client.getCard(17033);
console.log(card.sqlQuery);
// List all cards
const cards = await client.listCards('all');
// Search for cards
const revenueCards = await client.searchCards('revenue');
// Execute a query
const results = await client.executeCardQuery(17033, {param: 'value'});š ļø Available Tools
This MCP server provides 27 tools organized into categories:
Card Tools (Questions/Queries)
get_card- Get card details and SQL querylist_cards- List cards with filteringexecute_card_query- Execute saved queriesexecute_query_builder_card- Execute query builder cards with parametersget_generated_sql- Get generated SQL for query builder cardsget_card_with_parameters- Extract card info from dashboard URLs
Dashboard Tools
get_dashboard- Get dashboard detailslist_dashboards- List all dashboards
Database & Table Tools
get_database- Get database informationlist_databases- List all databasesget_database_metadata- Get comprehensive database schemalist_database_tables- List tables in a databaseget_table_metadata- Get detailed table information
Collection Tools
list_collections- List all collections (folders)get_collection_items- Get items in a collection
Query Execution
execute_native_query- Execute custom SQL queries
Field & Column Tools
get_field- Get field/column informationget_field_values- Get distinct values for a field
Segments & Metrics
list_segments- List saved filter segmentslist_metrics- List saved aggregations
Activity & Users
get_activity- Get recent activity feedget_current_user- Get current authenticated userlist_users- List all users (requires admin)
For detailed documentation on all tools, see TOOLS_REFERENCE.md.
š Documentation
USAGE_GUIDE.md - Complete usage guide with examples
TOOLS_REFERENCE.md - Detailed reference for all 27 tools
šļø Project Structure
metabase-mcp-mab/
āāā src/
ā āāā server/
ā ā āāā index.js # Main MCP server implementation
ā āāā client/
ā āāā cards.js # JavaScript client library
āāā testing/
ā āāā test-new-tools.js # Test scripts
āāā package.json # Dependencies and scripts
āāā README.md # This file
āāā USAGE_GUIDE.md # Usage documentation
āāā TOOLS_REFERENCE.md # Tools referenceš§ Development
Scripts
npm start- Run the servernpm run dev- Run the server with auto-reload (watch mode)
Dependencies
@modelcontextprotocol/sdk- MCP SDK frameworkaxios- HTTP client library (though nativefetchis used)dotenv- Environment variable management
Testing
Run test scripts:
node testing/test-new-tools.jsā ļø Important Notes
Risk Levels
š¢ SAFE tools: Read-only operations, no data modification
š” MODERATE RISK tools: Execute queries (read-only but may be slow/resource-intensive)
Performance Considerations
list_cardscan return 15k+ items - results are limited to first 50 in displayget_database_metadatareturns ALL tables and columns - can be very largeexecute_card_queryandexecute_native_querymay take time for complex queriesUse search operations instead of listing everything when possible
Version Compatibility
Some tools may not be available in all Metabase versions (e.g., list_metrics, get_activity). The server gracefully handles missing endpoints.
š Troubleshooting
Server won't start
Check Node.js version:
node --version # Must be >= 18.0.0Verify dependencies are installed:
npm installCheck environment variables:
Ensure
METABASE_API_KEYis set inmcp.jsonVerify
METABASE_URLis correct (if custom)
API authentication errors
Verify your API key is correct and active
Check that the API key has the necessary permissions
Ensure the Metabase URL is accessible from your network
Connection issues
Verify your Metabase instance is running and accessible
Check network connectivity
Ensure firewall rules allow connections
š License
ISC
š¤ Contributing
Contributions welcome! Please ensure:
Node.js >= 18.0.0
All tests pass
Code follows existing patterns
Available Tools
23 toolsexecute_card_queryA
ā¶ļø [MODERATE RISK] Execute a saved card query and return results. Use this to get actual data from a card. May take time for complex queries. Risk: Moderate - executes queries that may be slow or resource-intensive. Does not modify data.
Inputs: cardId (required), parameters.
execute_native_queryA
ā ļø [MODERATE RISK] Execute an ad-hoc native SQL query directly against a database. Use this when you need to run custom SQL that doesn't exist as a saved card. Risk: Moderate - executes arbitrary SQL (read-only with API key, but can be slow or resource-intensive). Always validate SQL before executing.
Inputs: databaseId (required), query (required).
execute_query_builder_cardA
āļø [MODERATE RISK] Execute a query-builder card with specific parameters. Use this to run query builder cards with custom filters and aggregations. Risk: Moderate - executes queries that may be slow or resource-intensive.
Inputs: cardId (required), parameters (required).
get_activityA
š [SAFE] Get recent activity feed showing views, edits, and other actions in Metabase. Use this to see what users are doing or what content is popular. Risk: None - read-only operation.
Inputs: limit.
get_cardA
š [SAFE] Get a Metabase card/question by ID, including its SQL query. Use this when you need to see the SQL behind a specific question or analyze how a card is built. Risk: None - read-only operation.
Inputs: cardId (required).
get_card_with_parametersA
š [SAFE] Get a card with applied parameters from dashboard URL. Use this to extract card ID and parameters from Metabase dashboard URLs with filters. Risk: None - read-only operation.
Inputs: url (required).
get_collection_itemsA
š [SAFE] Get all items (cards, dashboards, models) in a specific collection. Use this to see what content is organized in a folder. Risk: None - read-only operation.
Inputs: collectionId (required), models.
get_current_userA
š¤ [SAFE] Get information about the currently authenticated user (you). Risk: None - read-only operation.
Inputs: no named parameters.
get_dashboardA
š [SAFE] Get a dashboard by ID including all its cards, layout, and parameters. Use this to understand dashboard structure or see all questions in a dashboard at once. Risk: None - read-only operation.
Inputs: dashboardId (required).
get_databaseA
šļø [SAFE] Get database information by ID including engine type and connection details. Use this to understand which database a card connects to. Risk: None - read-only operation.
Inputs: databaseId (required).
get_database_metadataA
š [SAFE] Get complete metadata for a database including ALL tables, columns, and field types. This is comprehensive and may return large amounts of data. Use this when you need to understand the full database schema. Risk: None - read-only, but returns large payloads.
Inputs: databaseId (required).
get_fieldA
š [SAFE] Get detailed information about a specific field/column including its type, description, and metadata. Use this to understand what a column contains. Risk: None - read-only operation.
Inputs: fieldId (required).
get_field_valuesA
š [SAFE] Get distinct values for a field (useful for understanding what values exist in a column). May return many values for high-cardinality fields. Risk: None - read-only, but may return large results.
Inputs: fieldId (required).
get_generated_sqlA
š [MODERATE RISK] Get the generated SQL for a query-builder card with parameters. Use this to see the actual SQL that Metabase generates from query builder parameters. Risk: Moderate - executes queries to generate SQL.
Inputs: cardId (required), parameters (required).
get_table_metadataA
š [SAFE] Get detailed metadata for a specific table including all columns, data types, and foreign key relationships. Use this to understand table structure before writing queries. Risk: None - read-only operation.
Inputs: tableId (required).
list_cardsA
š [SAFE] List Metabase cards/questions with optional filtering. Use this to discover available cards, find cards by type, or see all questions in the system. Can return large results (15k+ cards). Risk: None - read-only, but may be slow with many cards.
Inputs: filter, modelId.
list_collectionsA
š [SAFE] List all collections (folders) in Metabase. Collections organize cards and dashboards. Use this to understand the organizational structure. Risk: None - read-only operation.
Inputs: namespace.
list_dashboardsA
š [SAFE] List all dashboards in Metabase. Use this to discover available dashboards or find dashboards by name. Risk: None - read-only operation.
Inputs: no named parameters.
list_databasesA
šļø [SAFE] List all available databases. Use this to see what data sources are connected to Metabase. Risk: None - read-only operation.
Inputs: no named parameters.
list_database_tablesA
š [SAFE] List all tables in a specific database. Use this to see what tables are available before querying. Risk: None - read-only operation.
Inputs: databaseId (required).
list_metricsA
š [SAFE] List all metrics (saved aggregations) in Metabase. Metrics are reusable calculations like "Total Revenue" or "Average Order Value". Risk: None - read-only operation.
Inputs: no named parameters.
list_segmentsA
šÆ [SAFE] List all segments (saved filters) in Metabase. Segments are reusable filters like "Active Users" or "Premium Customers". Risk: None - read-only operation.
Inputs: no named parameters.
list_usersA
š„ [SAFE - REQUIRES ADMIN] List all Metabase users. Requires admin permissions. Use this to see who has access to Metabase. Risk: None - read-only, but may fail if not admin.
Inputs: no named parameters.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelogā¦
TDQS
Scored across 23 tools
Most tools have distinct purposes, but there is notable overlap among query execution tools (execute_card_query, execute_native_query, execute_query_builder_card) and metadata retrieval tools (get_database_metadata, get_table_metadata, get_field, get_field_values), which could cause confusion. Descriptions help differentiate them, but the boundaries are not entirely clear.
Tool names follow a highly consistent verb_noun pattern throughout, with clear prefixes like 'execute_', 'get_', and 'list_'. There are no deviations in naming conventions, making the set predictable and easy to navigate.
With 23 tools, the count feels heavy for a Metabase interface, as many tools are read-only metadata retrievals that could potentially be consolidated. While it covers many aspects, it borders on being overly granular for the domain.
The tool set provides comprehensive read-only coverage for querying, metadata, and listing resources in Metabase, with no major gaps for data retrieval. However, it lacks write operations (e.g., creating or updating cards, dashboards, or collections), which limits full lifecycle management.
Related MCP Connectors
Enterprise memory, search, and context for frontier AI. 38 tools for business intelligence.
Read and edit GA4, Search Console and Google Tag Manager from any MCP client. 29 tools.
The agent-native cloud: database, functions, AI, storage, computers. 53 tools. OAuth or API key.
Connect your ads, shop, analytics, social, CRM and finance platforms once, then let Claude, ChatGPT, Cursor or any MCP client read, join and explain your numbers. Public statistics from the World Bank, IMF, Eurostat, OECD, WHO and SEC filings come as context, searchable and chartable from the same tools. Read-only by design, every number carries its source.
Related MCP Servers
- FlicenseNot gradedqualityDmaintenanceEnables AI assistants to interact with Metabase analytics platform, allowing them to query databases, manage dashboards and cards, execute SQL queries, and access analytics data through natural language.-
- FlicenseNot gradedqualityDmaintenanceEnables AI assistants to interact with Metabase analytics platform, allowing users to query databases, manage dashboards and cards, execute SQL queries, and access analytics data through natural language.1-
- FlicenseNot gradedqualityDmaintenanceEnables AI assistants to interact with Metabase analytics platform, allowing them to query databases, execute SQL, manage dashboards and cards, and access analytics data through natural language.-
- FlicenseNot gradedqualityNot gradedmaintenanceEnables AI assistants to interact with Metabase by providing access to dashboards, questions, and databases through the Metabase API. It allows users to list resources, execute existing cards, and run custom SQL queries to retrieve data through natural language.15 npm-