Trello集成服务

一个提供与Trello看板交互工具的模型上下文协议(MCP)服务器,支持自动处理速率限制、类型安全和错误处理。

  • by hrs-asano
  • JavaScript
  • 本地部署
  • 35 星标
  • 更新于
在 GitHub 查看 hrs-asano/claude-mcp-trello

使用说明

克劳德·MCP·特雷洛

一种模型上下文协议(MCP)服务器,提供与Trello板交互的工具。该服务器能够与Trello的API无缝集成,同时自动处理速率限制、类型安全和错误处理。

特性

  • Trello板完全集成:与卡片、列表和棋盘活动交互
  • 内置速率限制:遵守Trello的API限制(每个API密钥300个请求/10秒,每个令牌100个请求/10 s)
  • 类型安全实施:用TypeScript编写,具有全面的类型定义
  • 输入验证:对所有API输入进行稳健验证
  • 错误处理:优雅的错误处理,信息丰富

可用工具

trello_get_cards_by_list

检索指定列表ID中包含的卡片列表。

{
  name: "trello_get_cards_by_list",
  arguments: {
    listId: string; // Trello list ID
  }
}

trello_get_lists

检索指定板中的所有列表。

{
  name: "trello_get_lists",
  arguments: {
    boardId: string; // The ID of the Trello board to get lists from
  }
}

trello_get_recent_activity

检索指定板的最新活动。这 limit 参数可以指定要检索的数量(默认值:10)。

{
  name: "trello_get_recent_activity",
  arguments: {
    boardId: string; // The ID of the Trello board to get activity from
    limit?: number;  // Optional: number of activities to retrieve
  }
}

trello_add_card

将卡添加到指定列表中。

{
  name: "trello_add_card",
  arguments: {
    listId: string;       // The ID of the list to add to
    name: string;         // The title of the card
    description?: string; // Optional: details of the card
    dueDate?: string;     // Optional: due date (e.g., ISO8601)
    labels?: string[];    // Optional: array of label IDs
  }
}

trello_update_card

更新卡的内容。

{
  name: "trello_update_card",
  arguments: {
    cardId: string;       // The ID of the card to be updated
    name?: string;        // Optional: updated title
    description?: string; // Optional: updated description
    dueDate?: string;     // Optional: updated due date (e.g., ISO8601)
    labels?: string[];    // Optional: updated array of label IDs
  }
}

trello_archive_card

归档(关闭)指定的卡片。

{
  name: "trello_archive_card",
  arguments: {
    cardId: string; // The ID of the card to archive
  }
}

trello_add_list

向指定板添加新列表。

{
  name: "trello_add_list",
  arguments: {
    boardId: string; // The ID of the Trello board to add the list to
    name: string;    // Name of the new list
  }
}

trello_archive_list

归档(关闭)指定的列表。

{
  name: "trello_archive_list",
  arguments: {
    listId: string; // The ID of the list to archive
  }
}

trello_get_my_cards

检索与您的帐户相关的所有卡。

{
  name: "trello_get_my_cards",
  arguments: {}
}

trello_search_all_boards

根据计划/权限,在工作区(组织)中的所有板上执行跨板搜索。

{
  name: "trello_search_all_boards",
  arguments: {
    query: string;   // Search keyword
    limit?: number;  // Optional: max number of results (default: 10)
  }
}

trello_get_card_attachments

从指定的卡中检索所有附件。返回附件元数据,包括名称、文件大小、MIME类型和URL。在下载之前,使用此功能可以发现卡上存在哪些附件。

{
  name: "trello_get_card_attachments",
  arguments: {
    cardId: string;  // The ID of the Trello card to get attachments from
  }
}

返回具有以下属性的附件对象数组:

  • id:附件的唯一标识符
  • name:附件的显示名称
  • url:访问/下载附件的URL
  • bytes:附件的大小(以字节为单位)(外部链接为0)
  • mimeType:MIME类型(例如,“image/png”、“application/pdf”)
  • date:添加附件时的ISO 8601日期字符串
  • isUpload:这是Trello上传(true)还是外部链接(false)
  • fileName:附件的文件名

trello_download_attachment

从Trello卡下载特定附件。对于直接上传到Trello的文件,将内容作为base64编码数据返回。对于外部链接,返回URL。

{
  name: "trello_download_attachment",
  arguments: {
    cardId: string;       // The ID of the Trello card containing the attachment
    attachmentId: string; // The ID of the attachment to download
  }
}

返回一个具有以下属性的对象:

  • attachment:完整的附件元数据
  • content:Base64编码文件内容(用于Trello上传)或 null (用于外部链接)
  • url:附件的直接URL

使用提示:首次使用 trello_get_card_attachments 要列出所有附件并获取其ID,请使用 trello_download_attachment 下载特定文件。

速率限制

服务器实现用于速率限制的令牌桶算法,以符合Trello的API限制:

  • 每个API密钥每10秒300个请求
  • 每个令牌每10秒100个请求

速率限制是自动处理的,如果达到限制,请求将被排队。

错误处理

服务器为各种场景提供详细的错误消息:

  • 输入参数无效
  • 请求频率超限
  • API身份验证错误
  • 网络问题
  • 板/列表/卡ID无效

发展

先决条件

  • Node.js 16或更高版本
  • npm或纱线

设置

  1. 克隆存储库:

    git clone https://github.com/hrs-asano/claude-mcp-trello.git
    cd claude-mcp-trello
    
  2. 安装依赖项:

npm install
  1. 构建项目:
npm run build

运行测试

npm test

与Claude Desktop集成

要将此MCP服务器与Claude Desktop集成,请将以下配置添加到您的 ~/库/应用程序\支持/Claude/Claude_desktop_config文件:

{
  "mcpServers": {
    "trello": {
      "command": "{YOUR_NODE_PATH}", // for example: /opt/homebrew/bin/node
      "args": [
        "{YOUR_PATH}/claude-mcp-trello/build/index.js"
      ],
      "env": {
        "TRELLO_API_KEY": "{YOUR_KEY}",
        "TRELLO_TOKEN": "{YOUR_TOKEN}"
      }
    }
  }
}

确保将{YOUR_NODE_PATH}、{YOUR_PATH},{YOUR_KEY}和{YOUR_TOKEN}替换为适合您环境的值。

注: 板ID作为参数传递给各个工具,而不是全局配置,允许您使用多个板。

贡献

欢迎投稿!请阅读我们的 贡献指南 有关我们的行为准则和提交pull请求流程的详细信息。

许可证

此项目根据MIT许可证获得许可-请参阅 许可证 文件以获取详细信息。

致谢