MCP Server & Client for Metabase - enables AI agents to interact with Metabase via the Model Context Protocol.
- MCP Server - Exposes all Metabase operations as MCP tools
- MCP Client - Python wrapper to connect to MCP servers
- Tool Definitions - 20+ tools for databases, queries, dashboards, cards, collections, users, and search
- Prompt Templates - Pre-defined prompts for KPI analysis, data exploration, query building, and dashboard creation
- CLI - Command-line interface for testing and management
pip install metabase-mcpCreate a .env file:
METABASE_HOST=http://localhost:3000
METABASE_API_KEY=your_api_key
# or
METABASE_USERNAME=user@example.com
METABASE_PASSWORD=password# Check connection status
metabase-mcp status
# Show configuration
metabase-mcp config
# Start MCP server (stdio)
metabase-mcp startfrom metabase_mcp import MCPClient
client = MCPClient(
host="http://localhost:3000",
api_key="your_api_key",
mcp_server_command=["python", "-m", "metabase_mcp.server"]
)
# List available tools
tools = client.list_tools()
# Call a tool
result = client.call_tool("list_databases")
# Close connection
client.close()The server communicates via stdio, making it compatible with any MCP client:
python -m metabase_mcp.server| Category | Tools |
|---|---|
| Databases | list_databases, get_database, get_tables, get_fields |
| Queries | run_sql_query, run_mbql_query, get_query_metadata |
| Dashboards | list_dashboards, get_dashboard, create_dashboard, update_dashboard, delete_dashboard |
| Cards | list_cards, get_card, create_card, search_cards |
| Collections | list_collections, get_collection, create_collection |
| Users | list_users, get_current_user |
| Search | search_items |
kpi_analyzer- Analyze existing KPIs and suggest new onesdata_explorer- Explore database structurequery_builder- Build queries from natural languagedashboard_creator- Create complete dashboards
MIT