Powerdrill MCP Server

官方

一個MCP伺服器,提供與Powerdrill資料集互動的工具,實現智慧型AI數據分析與洞察。

文件

Powerdrill MCP 伺服器

smithery badge

一個模型上下文協定 (MCP) 伺服器,提供與 Powerdrill 資料集互動的工具,使用 Powerdrill 使用者 ID 和專案 API 金鑰進行驗證。

請前往 https://chat.powerdrill.ai/ 進行個人 AI 資料分析,或與您的團隊一起使用。

如果您擁有團隊的 Powerdrill 使用者 ID 和專案 API 金鑰,您可以透過 Powerdrill 開源的網頁客戶端操作資料:

功能特色

  • 使用使用者 ID 和專案 API 金鑰進行 Powerdrill 驗證
  • 列出您 Powerdrill 帳戶中可用的資料集
  • 取得特定資料集的詳細資訊
  • 使用自然語言問題在資料集上建立並執行作業
  • 與 Claude Desktop 及其他相容 MCP 的客戶端整合

安裝

透過 Smithery 安裝

要透過 Smithery 為 Claude Desktop 自動安裝 powerdrill-mcp:

npx -y @smithery/cli install @powerdrillai/powerdrill-mcp --client claude

從 npm 安裝

# Install globally
npm install -g @powerdrillai/powerdrill-mcp

# Or run directly with npx
npx @powerdrillai/powerdrill-mcp

從原始碼安裝

複製此儲存庫並安裝相依套件:

git clone https://github.com/yourusername/powerdrill-mcp.git
cd powerdrill-mcp
npm install

CLI 使用方式

若為全域安裝:

# Start the MCP server
powerdrill-mcp

若使用 npx:

# Run the latest version
npx -y @powerdrillai/powerdrill-mcp@latest

在執行前,您需要設定包含 Powerdrill 憑證的環境變數:

# Set environment variables
export POWERDRILL_USER_ID="your_user_id"
export POWERDRILL_PROJECT_API_KEY="your_project_api_key"

或建立一個 .env 檔案並填入這些值。

先決條件

要使用此 MCP 伺服器,您需要一個具有有效 API 憑證(使用者 IDAPI 金鑰)的 Powerdrill 帳戶。以下是取得方式:

  1. 如果您還沒有 Powerdrill 團隊帳戶,請先註冊
  2. 前往您的帳戶設定
  3. 尋找 API 區塊,您會在那裡找到:
    • 使用者 ID:您帳戶的唯一識別碼
    • API 金鑰:用於 API 存取的驗證權杖

首先,觀看此影片教學,了解如何建立您的 Powerdrill 團隊:

Create Powerdrill Team Tutorial

然後,按照此影片教學設定您的 API 憑證:

Powerdrill API Setup Tutorial

快速設定

設定伺服器最簡單的方法是使用提供的設定腳本:

# Make the script executable
chmod +x setup.sh

# Run the setup script
./setup.sh

這將會:

  1. 安裝相依套件
  2. 建置 TypeScript 程式碼
  3. 如果 .env 檔案不存在,則建立它
  4. 使用基於 npx 的設定(建議)為 Claude Desktop 和 Cursor 產生設定檔

然後編輯您的 .env 檔案,填入實際憑證:

POWERDRILL_USER_ID=your_actual_user_id
POWERDRILL_PROJECT_API_KEY=your_actual_project_api_key

在使用前,也請更新已產生設定檔中的憑證。

手動安裝

如果您偏好手動設定:

# Install dependencies
npm install

# Build the TypeScript code
npm run build

# Copy the environment example file
cp .env.example .env

# Edit the .env file with your credentials

使用方式

執行伺服器

npm start

與 Claude Desktop 整合

  1. 開啟 Claude Desktop
  2. 前往「設定」>「伺服器設定」
  3. 使用下列其中一種設定新增伺服器:

選項 1:使用 npx(建議)

{
  "powerdrill": {
    "command": "npx",
    "args": [
      "-y",
      "@powerdrillai/powerdrill-mcp@latest"
    ],
    "env": {
      "POWERDRILL_USER_ID": "your_actual_user_id",
      "POWERDRILL_PROJECT_API_KEY": "your_actual_project_api_key"
    }
  }
}

選項 2:使用 node 搭配本機安裝

{
  "powerdrill": {
    "command": "node",
    "args": ["/path/to/powerdrill-mcp/dist/index.js"],
    "env": {
      "POWERDRILL_USER_ID": "your_actual_user_id",
      "POWERDRILL_PROJECT_API_KEY": "your_actual_project_api_key"
    }
  }
}
  1. 儲存設定
  2. 重新啟動 Claude Desktop

與 Cursor 整合

  1. 開啟 Cursor
  2. 前往「設定」>「MCP 工具」
  3. 使用下列其中一種設定新增 MCP 工具:

選項 1:使用 npx(建議)

{
  "powerdrill": {
    "command": "npx",
    "args": [
      "-y",
      "@powerdrillai/powerdrill-mcp@latest"
    ],
    "env": {
      "POWERDRILL_USER_ID": "your_actual_user_id",
      "POWERDRILL_PROJECT_API_KEY": "your_actual_project_api_key"
    }
  }
}

選項 2:使用 node 搭配本機安裝

{
  "powerdrill": {
    "command": "node",
    "args": ["/path/to/powerdrill-mcp/dist/index.js"],
    "env": {
      "POWERDRILL_USER_ID": "your_actual_user_id",
      "POWERDRILL_PROJECT_API_KEY": "your_actual_project_api_key"
    }
  }
}
  1. 儲存設定
  2. 如有需要,重新啟動 Cursor

使用工具

連接後,您可以在與 Claude Desktop、Cursor、Cline、Windsurf 等的對話中使用 Powerdrill 工具:

  • 列出資料集:What datasets are available in my Powerdrill account?Show me all my datasets
  • 建立資料集:Create a new dataset called "Sales Analytics"Make a new dataset named "Customer Data" with description "Customer information for 2024 analysis"
  • 從本機檔案建立資料來源:Upload the file /Users/your_name/Downloads/sales_data.csv to dataset {dataset_id}Add my local file /path/to/customer_data.xlsx to my {dataset_id} dataset
  • 取得資料集概覽:Tell me more about this dataset: {dataset_id}Describe the structure of dataset {dataset_id}
  • 建立作業:Analyze dataset {dataset_id} with this question: "How has the trend changed over time?"Run a query on {dataset_id} asking "What are the top 10 customers by revenue?"
  • 建立工作階段:Create a new session named "Sales Analysis 2024" for my data analysisStart a session called "Customer Segmentation" for analyzing market data
  • 列出資料來源:What data sources are available in dataset {dataset_id}?Show me all files in the {dataset_id} dataset
  • 列出工作階段:Show me all my current analysis sessionsList my recent data analysis sessions

可用工具

mcp_powerdrill_list_datasets

列出您 Powerdrill 帳戶中可用的資料集。

參數:

  • limit(選用):要回傳的資料集數量上限

回應範例:

{
  "datasets": [
    {
      "id": "dataset-dasfadsgadsgas",
      "name": "mydata",
      "description": "my dataset"
    }
  ]
}

mcp_powerdrill_get_dataset_overview

取得特定資料集的詳細概覽資訊。

參數:

  • datasetId(必要):要取得概覽資訊的資料集 ID

回應範例:

{
  "id": "dset-cm5axptyyxxx298",
  "name": "sales_indicators_2024",
  "description": "A dataset comprising 373 travel bookings with 15 attributes...",
  "summary": "This dataset contains 373 travel bookings with 15 attributes...",
  "exploration_questions": [
    "How does the booking price trend over time based on the BookingTimestamp?",
    "How does the average booking price change with respect to the TravelDate?"
  ],
  "keywords": [
    "Travel Bookings",
    "Booking Trends",
    "Travel Agencies"
  ]
}

mcp_powerdrill_create_job

建立一個作業,使用自然語言問題分析資料。

參數:

  • question(必要):用於分析資料的自然語言問題或提示
  • dataset_id(必要):要分析的資料集 ID
  • datasource_ids(選用):資料集內要分析的特定資料來源 ID 陣列
  • session_id(選用):用於將相關作業分組的工作階段 ID
  • stream(選用,預設:false):是否串流傳輸結果
  • output_language(選用,預設:"AUTO"):輸出的語言
  • job_mode(選用,預設:"AUTO"):作業模式

回應範例:

{
  "job_id": "job-cm3ikdeuj02zk01l1yeuirt77",
  "blocks": [
    {
      "type": "CODE",
      "content": "```python\nimport pandas as pd\n\ndef invoke(input_0: pd.DataFrame) -> pd.DataFrame:\n...",
      "stage": "Analyze"
    },
    {
      "type": "TABLE",
      "url": "https://static.powerdrill.ai/tmp_datasource_cache/code_result/...",
      "name": "trend_data.csv",
      "expires_at": "2024-11-21T09:56:34.290544Z"
    },
    {
      "type": "IMAGE",
      "url": "https://static.powerdrill.ai/tmp_datasource_cache/code_result/...",
      "name": "Trend of Deaths from Natural Disasters Over the Century",
      "expires_at": "2024-11-21T09:56:34.290544Z"
    },
    {
      "type": "MESSAGE",
      "content": "Analysis of Trends in the Number of Deaths from Natural Disasters...",
      "stage": "Respond"
    }
  ]
}

mcp_powerdrill_create_session

建立一個新的工作階段,將相關作業分組在一起。

參數:

  • name(必要):工作階段名稱,長度最多 128 個字元
  • output_language(選用,預設:"AUTO"):產生輸出所使用的語言。選項包括:"AUTO"、"EN"、"ES"、"AR"、"PT"、"ID"、"JA"、"RU"、"HI"、"FR"、"DE"、"VI"、"TR"、"PL"、"IT"、"KO"、"ZH-CN"、"ZH-TW"
  • job_mode(選用,預設:"AUTO"):工作階段的作業模式。選項包括:"AUTO"、"DATA_ANALYTICS"
  • max_contextual_job_history(選用,預設:10):保留作為下一個作業上下文的最新作業數量上限 (0-10)
  • agent_id(選用,預設:"DATA_ANALYSIS_AGENT"):代理程式的 ID

回應範例:

{
  "session_id": "session-abcdefghijklmnopqrstuvwxyz"
}

mcp_powerdrill_list_data_sources

列出特定資料集中的資料來源。

參數:

  • datasetId(必要):要列出資料來源的資料集 ID
  • pageNumber(選用,預設:1):開始列出的頁碼
  • pageSize(選用,預設:10):單一頁面上的項目數量
  • status(選用):依狀態篩選資料來源:synching、invalid、synched(多個狀態以逗號分隔)

回應範例:

{
  "count": 3,
  "total": 5,
  "page": 1,
  "page_size": 10,
  "data_sources": [
    {
      "id": "dsource-a1b2c3d4e5f6g7h8i9j0",
      "name": "sales_data.csv",
      "type": "CSV",
      "status": "synched",
      "size": 1048576,
      "dataset_id": "dset-cm5axptyyxxx298"
    },
    {
      "id": "dsource-b2c3d4e5f6g7h8i9j0k1",
      "name": "customer_info.xlsx",
      "type": "EXCEL",
      "status": "synched",
      "size": 2097152,
      "dataset_id": "dset-cm5axptyyxxx298"
    },
    {
      "id": "dsource-c3d4e5f6g7h8i9j0k1l2",
      "name": "market_research.pdf",
      "type": "PDF",
      "status": "synched",
      "size": 3145728,
      "dataset_id": "dset-cm5axptyyxxx298"
    }
  ]
}

mcp_powerdrill_list_sessions

列出您 Powerdrill 帳戶中的工作階段。

參數:

  • pageNumber(選用):開始列出的頁碼(預設:1)
  • pageSize(選用):單一頁面上的項目數量(預設:10)
  • search(選用):依名稱搜尋工作階段

回應範例:

{
  "count": 2,
  "total": 2,
  "sessions": [
    {
      "id": "session-123abc",
      "name": "Product Analysis",
      "job_count": 3,
      "created_at": "2024-03-15T10:30:00Z",
      "updated_at": "2024-03-15T11:45:00Z"
    },
    {
      "id": "session-456def",
      "name": "Financial Forecasting",
      "job_count": 5,
      "created_at": "2024-03-10T14:20:00Z",
      "updated_at": "2024-03-12T09:15:00Z"
    }
  ]
}

mcp_powerdrill_create_dataset

在您的 Powerdrill 帳戶中建立一個新的資料集。

參數:

  • name(必要):資料集名稱,長度最多 128 個字元
  • description(選用):資料集描述,長度最多 128 個字元

回應範例:

{
  "id": "dataset-adsdfasafdsfasdgasd",
  "message": "Dataset created successfully"
}

mcp_powerdrill_create_data_source_from_local_file

透過上傳本機檔案到指定資料集來建立新的資料來源。

參數:

  • dataset_id(必要):要在其中建立資料來源的資料集 ID
  • file_path(必要):要上傳的檔案本機路徑
  • file_name(選用):檔案的自訂名稱,預設為原始檔案名稱
  • chunk_size(選用,預設:5MB):用於分段上傳的每個區塊大小(位元組)

回應範例:

{
  "dataset_id": "dset-cm5axptyyxxx298",
  "data_source": {
    "id": "dsource-a1b2c3d4e5f6g7h8i9j0",
    "name": "sales_data_2024.csv",
    "type": "FILE",
    "status": "synched",
    "size": 2097152
  },
  "file": {
    "name": "sales_data_2024.csv",
    "size": 2097152,
    "object_key": "uploads/user_123/sales_data_2024.csv"
  }
}

疑難排解

如果您遇到問題:

  1. 確保您的環境變數在 .env 中設定正確
  2. 使用 npm start 檢查伺服器是否成功啟動
  3. 驗證您的 Claude Desktop 設定指向正確的檔案路徑
  4. 檢查主控台輸出是否有任何錯誤訊息

授權條款

MIT