@cognitionai/metabase-mcp-server

中文文档
2.2.0发布于 2026/08/18MITES Module构建来源已验证近 30 天下载 1.4万

A Model Context Protocol server for Metabase integration

原始使用文档
文档目录51 节
  1. 🚀 Quick Start
  2. ✨ Features
  3. 🎯 81+ Tools Available - Complete Metabase API Coverage
  4. 📦 Installation
  5. Method 1: NPX (Recommended)
  6. Method 2: Global Installation
  7. Method 3: Docker
  8. ⚙️ Configuration
  9. Environment Variables
  10. Optional Arguments
  11. 🔌 Integration Examples
  12. Claude Desktop
  13. Windsurf IDE
  14. 🛠️ Available Tools
  15. Core Operations
  16. Card Management
  17. Public Sharing & Embedding
  18. Parameters & Queries
  19. Advanced Features
  20. Core Operations
  21. Query Execution
  22. Card Management
  23. Parameters & Values
  24. Public Sharing
  25. Core Operations
  26. Schema & Metadata
  27. Query Operations
  28. Maintenance
  29. Core Operations
  30. Data Operations
  31. Schema & Relationships
  32. Field Management
  33. Card Integration
  34. Collections
  35. Search & Discovery
  36. Activity & Analytics
  37. Playground Links
  38. 🧪 Development
  39. Setup
  40. Build
  41. Development Mode
  42. Debugging
  43. 🔍 Testing Authentication
  44. API Key Authentication
  45. Username/Password Authentication
  46. 🐛 Troubleshooting
  47. Common Issues
  48. 📄 License
  49. 🤝 Contributing
  50. Development Guidelines
  51. 🆘 Support

Readme: Metabase MCP Server

npm version TypeScript License: MIT Node.js

A comprehensive Model Context Protocol (MCP) server for Metabase integration, providing AI assistants with full access to Metabase's analytics platform.

🚀 Quick Start

# Install and run with npx
export METABASE_URL=https://your-metabase-instance.com
export METABASE_API_KEY=your_metabase_api_key
npx @cognitionai/metabase-mcp-server

✨ Features

🎯 81+ Tools Available - Complete Metabase API Coverage

  • 📊 Dashboard Management (23 tools) - Full CRUD operations, card management, public sharing, embedding
  • 📈 Card/Question Management (21 tools) - Query execution, parameter handling, pivot queries, public links
  • 🗄️ Database Management (13 tools) - Connection management, schema sync, query execution
  • 📋 Table Management (16 tools) - Metadata operations, field management, data operations
  • 🔍 Additional Tools (9 tools) - Collections, search, users, activity tracking, playground links

📦 Installation

💡 Recommended: Node.js 20.19.0+ and npm 8.0.0+ for optimal compatibility

npx @cognitionai/metabase-mcp-server

Method 2: Global Installation

npm install -g @cognitionai/metabase-mcp-server
metabase-mcp-server

Method 3: Docker

docker run -it --rm \
  -e METABASE_URL=https://your-metabase-instance.com \
  -e METABASE_API_KEY=your_metabase_api_key \
  ghcr.io/CognitionAI/metabase-mcp-server

⚙️ Configuration

Environment Variables

API Key Authentication (Preferred):

export METABASE_URL=https://your-metabase-instance.com
export METABASE_API_KEY=your_metabase_api_key

Username/Password Authentication (Fallback):

export METABASE_URL=https://your-metabase-instance.com
export METABASE_USERNAME=your_username
export METABASE_PASSWORD=your_password

Optional Arguments

The server supports command-line arguments to customize tool loading:

  • --essential (default): Load only essential tools
  • --all: Load all 80+ available tools
  • --write: Load only write/modification tools
  • --read: Load only read-only tools
# Using published package (recommended)
# Default behavior (essential tools only)
npx @cognitionai/metabase-mcp-server

# Load all tools
npx @cognitionai/metabase-mcp-server --all

# Load only write tools
npx @cognitionai/metabase-mcp-server --write

# Load only read-only tools
npx @cognitionai/metabase-mcp-server --read

# Using local development build
npm run build
node dist/server.js                    # Default (essential tools)
node dist/server.js --all             # All tools
node dist/server.js --write           # Write tools only
node dist/server.js --read            # Read-only tools only

🔌 Integration Examples

Claude Desktop

Add to your Claude Desktop config (~/Library/Application Support/Claude/claude_desktop_config.json on macOS):

Using published package:

{
  "mcpServers": {
    "metabase": {
      "command": "npx",
      "args": ["@cognitionai/metabase-mcp-server"],
      "env": {
        "METABASE_URL": "https://your-metabase-instance.com",
        "METABASE_API_KEY": "your_metabase_api_key"
      }
    }
  }
}

Using local development build:

{
  "mcpServers": {
    "metabase": {
      "command": "node",
      "args": ["/path/to/metabase-mcp-server/dist/server.js"],
      "env": {
        "METABASE_URL": "https://your-metabase-instance.com",
        "METABASE_API_KEY": "your_metabase_api_key"
      }
    }
  }
}

With custom flags:

{
  "mcpServers": {
    "metabase-all": {
      "command": "npx",
      "args": ["@cognitionai/metabase-mcp-server", "--all"],
      "env": {
        "METABASE_URL": "https://your-metabase-instance.com",
        "METABASE_API_KEY": "your_metabase_api_key"
      }
    }
  }
}

Windsurf IDE

Add to your Windsurf MCP config (~/.windsurf/mcp_config.json):

Using published package:

{
  "mcpServers": {
    "metabase": {
      "command": "npx",
      "args": ["@cognitionai/metabase-mcp-server"],
      "env": {
        "METABASE_URL": "https://your-metabase-instance.com",
        "METABASE_API_KEY": "your_metabase_api_key"
      }
    }
  }
}

Using local development build:

{
  "mcpServers": {
    "metabase": {
      "command": "node",
      "args": ["/path/to/metabase-mcp-server/dist/server.js"],
      "env": {
        "METABASE_URL": "https://your-metabase-instance.com",
        "METABASE_API_KEY": "your_metabase_api_key"
      }
    }
  }
}

With custom flags:

{
  "mcpServers": {
    "metabase-read": {
      "command": "npx",
      "args": ["@cognitionai/metabase-mcp-server", "--read"],
      "env": {
        "METABASE_URL": "https://your-metabase-instance.com",
        "METABASE_API_KEY": "your_metabase_api_key"
      }
    },
    "metabase-write": {
      "command": "npx",
      "args": ["@cognitionai/metabase-mcp-server", "--write"],
      "env": {
        "METABASE_URL": "https://your-metabase-instance.com",
        "METABASE_API_KEY": "your_metabase_api_key"
      }
    }
  }
}

🛠️ Available Tools

📊 Dashboard Management (23 tools)

Core Operations

  • list_dashboards - List all dashboards
  • get_dashboard - Get dashboard by ID
  • create_dashboard - Create new dashboard
  • update_dashboard - Update existing dashboard
  • delete_dashboard - Delete dashboard
  • copy_dashboard - Copy dashboard

Card Management

  • get_dashboard_cards - Get all cards in dashboard
  • add_card_to_dashboard - Add card to dashboard
  • remove_card_from_dashboard - Remove card from dashboard
  • update_dashboard_card - Update card position/settings
  • execute_dashboard_card - Execute specific dashboard card

Public Sharing & Embedding

  • create_public_link - Create public dashboard link
  • delete_public_link - Delete public dashboard link
  • list_public_dashboards - List public dashboards
  • list_embeddable_dashboards - List embeddable dashboards

Parameters & Queries

  • get_dashboard_param_values - Get parameter values
  • search_dashboard_param_values - Search parameter values
  • get_dashboard_param_remapping - Get parameter remapping
  • execute_dashboard_query - Execute dashboard queries

Advanced Features

  • get_dashboard_related - Get related content
  • get_dashboard_query_metadata - Get query metadata
  • update_dashboard_cards - Bulk update cards
  • save_dashboard - Save dashboard changes
  • get_dashboard_items - Get dashboard items
📈 Card/Question Management (21 tools)

Core Operations

  • list_cards - List all cards/questions
  • get_card - Get card by ID
  • create_card - Create new card
  • update_card - Update existing card
  • delete_card - Delete card
  • copy_card - Copy card

Query Execution

  • execute_card - Execute card query
  • execute_card_query_with_format - Execute with specific format
  • execute_pivot_card_query - Execute pivot query
  • get_card_query_metadata - Get query metadata

Card Management

  • move_cards - Move cards between collections
  • move_cards_to_collection - Bulk move to collection
  • get_card_dashboards - Get dashboards containing card
  • get_card_series - Get card series data

Parameters & Values

  • get_card_param_values - Get parameter values
  • search_card_param_values - Search parameter values
  • get_card_param_remapping - Get parameter remapping

Public Sharing

  • create_card_public_link - Create public card link
  • delete_card_public_link - Delete public card link
  • get_public_cards - List public cards
  • get_embeddable_cards - List embeddable cards
🗄️ Database Management (13 tools)

Core Operations

  • list_databases - List all databases
  • get_database - Get database details
  • create_database - Create database connection
  • update_database - Update database settings
  • delete_database - Delete database connection

Schema & Metadata

  • get_database_schema_tables - Get database tables
  • get_database_schemas - Get database schemas
  • get_database_metadata - Get complete metadata
  • sync_database_schema - Sync schema metadata

Query Operations

  • execute_query - Execute SQL queries
  • execute_query_export - Execute and export results

Maintenance

  • get_database_usage_info - Get usage statistics
  • rescan_database_field_values - Rescan field values
📋 Table Management (16 tools)

Core Operations

  • list_tables - List tables with filtering
  • get_table - Get table details
  • update_table - Update table configuration
  • update_tables - Bulk update tables

Data Operations

  • get_table_data - Retrieve table data
  • append_csv_to_table - Append CSV data
  • replace_table_csv - Replace with CSV data

Schema & Relationships

  • get_table_query_metadata - Get query metadata
  • get_table_fks - Get foreign key relationships
  • get_table_related - Get related tables
  • sync_table_schema - Sync table schema

Field Management

  • reorder_table_fields - Reorder field display
  • rescan_table_field_values - Rescan field values
  • discard_table_field_values - Discard cached values

Card Integration

  • get_card_table_fks - Get card table foreign keys
  • get_card_table_query_metadata - Get card table metadata
🔍 Additional Tools (9 tools)

Collections

  • list_collections - List all collections
  • create_collection - Create new collection
  • update_collection - Update collection
  • delete_collection - Delete collection
  • get_collection_items - Get collection items

Search & Discovery

  • search_content - Search across all content

Activity & Analytics

  • get_recent_views - Get recent activity
  • get_popular_items - Get popular content
  • get_metabase_playground_link - Generate interactive playground links

🧪 Development

Setup

git clone https://github.com/CognitionAI/metabase-mcp-server.git
cd metabase-mcp-server
npm install

Build

npm run build

Development Mode

npm run watch

Debugging

Use the MCP Inspector for debugging:

npm run inspector

🔍 Testing Authentication

API Key Authentication

  1. Set METABASE_URL and METABASE_API_KEY
  2. Start server and verify "Using Metabase API Key" in logs
  3. Test with list_dashboards tool

Username/Password Authentication

  1. Unset METABASE_API_KEY
  2. Set METABASE_URL, METABASE_USERNAME, METABASE_PASSWORD
  3. Start server and verify "Using username/password" in logs
  4. Test with list_dashboards tool

🐛 Troubleshooting

Common Issues

Authentication Errors:

  • Verify your Metabase URL is accessible
  • Check API key validity in Metabase admin settings
  • Ensure username/password credentials are correct

Connection Issues:

  • Confirm Metabase instance is running
  • Check network connectivity
  • Verify SSL certificates if using HTTPS

Tool Execution Errors:

  • Check Metabase permissions for your user/API key
  • Verify the requested resource exists
  • Review server logs for detailed error messages

📄 License

This project is licensed under the MIT License - see the LICENSE file for details.

🤝 Contributing

Contributions are welcome! Please visit our GitHub repository to:

  • 🐛 Report bugs
  • 💡 Request features
  • 🔧 Submit pull requests
  • 📖 Improve documentation

Development Guidelines

  1. Fork the repository
  2. Create a feature branch
  3. Make your changes with tests
  4. Ensure all tests pass
  5. Submit a pull request

🆘 Support


Built with ❤️ for the world

版本与发布记录

@cognitionai/metabase-mcp-server 共发布 7 个版本,首次发布于 2025/08/27;过去 12 个月发布了 2 个版本。最新版本附带 npm provenance 构建来源证明,可追溯到公开的 CI 构建记录。

版本发布日期距今
2.2.0latest2026/08/182 个月前
1.0.142025/11/2611 个月前
1.0.132025/09/161.1 年前
1.0.122025/09/041.2 年前
1.0.112025/08/291.2 年前
1.0.102025/08/281.2 年前

关于 @cognitionai/metabase-mcp-server 的常见问题

@cognitionai/metabase-mcp-server 是什么?

A Model Context Protocol server for Metabase integration

如何安装 @cognitionai/metabase-mcp-server?

在项目目录运行 npm install @cognitionai/metabase-mcp-server,或使用 pnpm add / yarn add / bun add。它还提供命令行工具 metabase-mcp-server,可以用 npx metabase-mcp-server 直接运行。

@cognitionai/metabase-mcp-server 支持 TypeScript 吗?

该包的 package.json 没有声明类型入口。需要类型提示时,可以在 npm 上查找社区维护的 @types/cognitionai__metabase-mcp-server 是否存在。

@cognitionai/metabase-mcp-server 支持 ESM 还是 CommonJS?

以 ES Module 形式发布,推荐使用 import 引入。在 CommonJS 项目中,Node.js 20.19+ / 22.12+ 可以直接 require() 不含顶层 await 的 ES Module,更早的版本需要改用动态 import()。

@cognitionai/metabase-mcp-server 需要什么版本的 Node.js?

package.json 的 engines 字段要求 Node.js >=20.19.0。版本不符时 npm 默认只给出警告,开启 engine-strict 后会拒绝安装。

@cognitionai/metabase-mcp-server 可以商用吗?

@cognitionai/metabase-mcp-server 使用 MIT 许可。宽松许可:允许商业使用、修改和再分发,通常只需在分发时保留原版权与许可声明。以上为概括,不构成法律意见,请以许可原文为准。

@cognitionai/metabase-mcp-server 的下载量有多少?

根据 npm 官方下载统计,@cognitionai/metabase-mcp-server 在 2026/10/11 – 2026/11/09 这 30 天内被下载 13,593 次,日均约 453 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@cognitionai/metabase-mcp-server 还在维护吗?

最新版本 2.2.0 发布于 2026/08/18(2 个月前);至今共发布 7 个版本,其中过去 12 个月发布了 2 个;首次发布于 2025/08/27。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。