Skip to content

fsmw/metabase-mcp-python

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

metabase-mcp

MCP Server & Client for Metabase - enables AI agents to interact with Metabase via the Model Context Protocol.

Features

  • 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

Installation

pip install metabase-mcp

Configuration

Create a .env file:

METABASE_HOST=http://localhost:3000
METABASE_API_KEY=your_api_key
# or
METABASE_USERNAME=user@example.com
METABASE_PASSWORD=password

Usage

CLI

# Check connection status
metabase-mcp status

# Show configuration
metabase-mcp config

# Start MCP server (stdio)
metabase-mcp start

Python Client

from 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()

MCP Server

The server communicates via stdio, making it compatible with any MCP client:

python -m metabase_mcp.server

Available Tools

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

Available Prompts

  • kpi_analyzer - Analyze existing KPIs and suggest new ones
  • data_explorer - Explore database structure
  • query_builder - Build queries from natural language
  • dashboard_creator - Create complete dashboards

License

MIT

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages