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.
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:
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
š Usage
With Cursor/Claude Desktop
Once configured in mcp.json, you can ask LLMs questions like:
Direct Server Usage
Run the server directly:
Or run in development mode with auto-reload:
Programmatic Usage
š ļø 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
š§ 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:
ā ļø 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
remote-capable server
The server can be hosted and run remotely because it primarily relies on remote services or has no dependency on the local environment.
Tools
Enables LLMs to interact with Metabase instances through 33 tools for querying cards, dashboards, databases, collections, and executing SQL queries against your Metabase installation.