返回 MCP 目录
public公开dns本地运行

mcp-server-motherduck

一个集成MotherDuck和本地DuckDB的MCP服务器,为Claude提供SQL分析能力

article

README

🚀 母亲鸭MCP服务器中文文档

本项目提供了母亲鸭MCP服务器的安装、配置、使用等相关说明,帮助用户快速搭建并使用该服务器。

🚀 快速开始

安装与配置

使用Claude Desktop

  1. 若尚未安装Claude Desktop,可从claude.ai/download下载并安装。
  2. 打开Claude Desktop的配置文件:
    • 首次使用时,可在Claude Desktop应用程序中操作:选择“设置”,进入“开发者”选项卡,点击“编辑配置”按钮。
    • claude_desktop_config.json文件中添加如下配置:
{
  "mcpServers": {
    "mcp-server-motherduck": {
      "command": "uvx",
      "args": [
        "mcp-server-motherduck",
        "--db-path",
        "md:",
        "--motherduck-token",
        "<YOUR_MOTHERDUCK_TOKEN_HERE>"
      ]
    }
  }
}

⚠️ 重要提示

  • 请将<YOUR_MOTHERDUCK_TOKEN_HERE>替换为您的实际MotherDuck令牌。
  • 可根据需要设置--home-dir参数(例如:--home-dir /Users/your_username)。

使用VS Code

您可以在.vscode/mcp.json文件中添加以下配置,也可将此内容直接复制到工作区的mcp.json文件中:

{
  "inputs": [
    {
      "type": "promptString",
      "id": "motherduck_token",
      "description": "MotherDuck令牌",
      "password": true
    }
  ],
  "servers": {
    "motherduck": {
      "command": "uvx",
      "args": [
        "mcp-server-motherduck",
        "--db-path",
        "md:",
        "--motherduck-token",
        "${input:motherduck_token}"
      ]
    }
  }
}

💻 使用示例

示例查询

配置完成后,您可以让Claude执行以下操作:

  • “创建新的数据库和表在MotherDuck中”
  • “从本地CSV文件查询数据”
  • “将本地DuckDB数据库中的数据与MotherDuck中的表格连接”
  • “分析存储在Amazon S3中的数据”

测试方法

默认MotherDuck数据库

要连接到默认的MotherDuck数据库,需要使用--motherduck-token参数指定令牌:

uvx mcp-server-motherduck --db-path md: --motherduck-token <your_motherduck_token>

指定MotherDuck数据库

uvx mcp-server-motherduck --db-path md:your_database_name --motherduck-token <your_motherduck_token>

本地DuckDB数据库

uvx mcp-server-motherduck --db-path /path/to/your/local.db

内存数据库

uvx mcp-server-motherduck --db-path :memory:

💡 使用建议

如果未指定数据库路径但设置了motherduck_token环境变量,服务器将自动连接到默认的MotherDuck数据库(md:)。

🔧 技术细节

运行在SSE模式

要以SSE模式运行服务器,请使用supergateway工具:

npx -y supergateway --stdio "uvx mcp-server-motherduck --db-path md: --motherduck-token <your_motherduck_token>"

故障排除

注意事项:

  1. 确保已正确安装所有依赖项。
  2. 检查命令语法是否正确。
  3. 如遇到spawn uvx ENOENT错误,请确认uvx工具已正确安装并位于系统路径中。

📄 许可证

本项目遵循MIT许可证。更多信息请参考MIT License

help

运行方式说明

cloud

托管运行

托管运行通常表示这个 MCP Server 由服务方环境承载,用户一般按页面提供的连接方式或授权流程接入,不需要在本地长期启动一个 MCP 进程

  1. 打开服务方连接页
  2. 完成授权或复制端点
  3. 在 MCP 客户端中连接
terminal

本地运行 / 其它方式

本地运行通常需要用户在自己的电脑或服务器上安装依赖,把 server_config 复制到 MCP 客户端,并按 env_schema 补齐环境变量、密钥或其它配置

  1. 复制 server_config
  2. 安装所需依赖
  3. 补齐环境变量后重启客户端