Trello集成服务

一个用于Trello集成的模型上下文协议服务器,允许AI助手与Trello看板、列表和卡片进行交互。

  • by xenral
  • TypeScript
  • 本地部署
  • 更新于
在 GitHub 查看 xenral/trello-mcp

使用说明

Trello MCP服务器

A. 模型上下文协议 Trello集成服务器。该软件包允许AI助手与Trello板、列表和卡片进行交互。

特性

  • Trello板完全集成:与卡片、列表和棋盘活动交互
  • 内置速率限制:遵守Trello的API限制(每个API密钥300个请求/10秒,每个令牌100个请求/10 s)
  • 类型安全实施:用TypeScript编写,具有全面的类型定义
  • 输入验证:使用Zod对所有API输入进行稳健验证
  • 错误处理:优雅的错误处理,信息丰富
  • 动态板选择:在不重新启动的情况下在板和工作区之间切换
  • Claude和Cursor集成:已准备好在Cursor IDE中与Claude一起使用

安装

全球安装

npm install -g @xenral/trello-mcp

本地安装

npm install @xenral/trello-mcp

配置

环境变量

服务器可以使用环境变量进行配置 .env 文件:

# Trello API credentials
TRELLO_API_KEY=your-api-key
TRELLO_TOKEN=your-token

# Initial board ID (can be changed later using set_active_board)
TRELLO_BOARD_ID=your-board-id

# Optional: Initial workspace ID (can be changed later using set_active_workspace)
TRELLO_WORKSPACE_ID=your-workspace-id

# Server configuration
PORT=3000
LOG_LEVEL=info # debug, info, warn, error

# Rate limiting configuration (requests per 10 seconds)
API_KEY_RATE_LIMIT=300
TOKEN_RATE_LIMIT=100

您可以从以下位置获取这些值:

  • API密钥:https://trello.com/app-key
  • 令牌:使用API密钥生成
  • 板ID:在板URL中找到(例如。,https://trello.com/b/BOARD_ID/board-name)
  • 工作区ID:在工作区设置中找到或使用 list_workspaces 工具

用法

启动服务器

# If installed globally
trello-mcp start

# If installed locally
npx trello-mcp start

# Specify a custom port
trello-mcp start --port 8080

# Use a specific .env file
trello-mcp start --env-file /path/to/.env

在Cursor IDE中使用Claude

在游标中设置

  1. 安装Trello MCP服务器:

    npm install -g @xenral/trello-mcp
    
  2. 创建一个 .env 包含Trello凭据的文件(请参阅配置部分)

  3. 通过以下任一方式将Trello MCP添加到光标:

    选项A:全局添加(推荐)

    1. 转到光标设置>MCP
    2. 点击“添加新的全局MCP服务器”
    3. 这将打开 ~/.cursor/mcp.json 文件
    4. 添加Trello MCP配置:
    {
        "mcpServers": {
            "trello-mcp": {
                "command": "npx",
                "args": [
                    "-y",
                    "@xenral/trello-mcp",
                    "start"
                ],
                "env": {
                    "TRELLO_API_KEY": "your-api-key-here",
                    "TRELLO_TOKEN": "your-token-here",
                    "TRELLO_BOARD_ID": "your-board-id-here",
                    "PORT": "3000"
                }
            }
        }
    }
    

    将占位符值替换为实际的Trello API凭据。

    选项B:添加到特定项目

    1. 创建一个 .cursor 项目根目录中的目录
    2. 创建一个 .cursor/mcp.json 与上述配置相同的文件

    选项C:与现有.env文件一起使用

    如果您已经拥有Trello证书 .env 文件,并更喜欢使用它:

    {
        "mcpServers": {
            "trello-mcp": {
                "command": "npx",
                "args": [
                    "-y",
                    "@xenral/trello-mcp",
                    "start",
                    "--env-file",
                    "${workspaceFolder}/.env"
                ]
            }
        }
    }
    
  4. 在光标设置>MCP中,单击刷新按钮以检测新的MCP服务器

  5. 通过在自定义说明中添加以下内容,配置Claude以使用Trello MCP:

    You have access to a Trello integration via MCP.
    When helping me manage tasks, you can create, update, and organize Trello cards.
    

克劳德提示示例

以下是一些如何让Claude与您的Trello板互动的示例:

  • “显示我当前Trello板上的所有列表”
  • 在“待办事项”列表中创建一张名为“实现登录功能”的新卡
  • “将‘修复导航错误’卡移至‘进行中’列表”
  • “显示“代码审查”列表中的所有卡片”
  • “更新“重构器身份验证”卡以在描述中包含API终结点”

光标中的MCP工具参考

Cursor中的Claude可以使用以下Trello MCP工具:

// Get all lists from the active board
mcp_trello-mcp_get_lists({})

// Get all cards in a specific list
mcp_trello-mcp_get_cards_by_list_id({ 
  listId: "LIST_ID" 
})

// Add a new card to a list
mcp_trello-mcp_add_card_to_list({ 
  listId: "LIST_ID",
  name: "Card Title",
  description: "Card description",
  dueDate: "2023-12-31T12:00:00Z" // optional
})

// Update a card's details
mcp_trello-mcp_update_card_details({ 
  cardId: "CARD_ID",
  name: "Updated Title", // optional
  description: "Updated description" // optional
})

// Move a card to a different list
mcp_trello-mcp_move_card({ 
  cardId: "CARD_ID",
  listId: "TARGET_LIST_ID" 
})

// Get recent activity on the board
mcp_trello-mcp_get_recent_activity({
  limit: 10 // optional
})

// Change active board
mcp_trello-mcp_set_active_board({ 
  boardId: "BOARD_ID" 
})

// List available boards
mcp_trello-mcp_list_boards({})

可用工具

get_lists

从当前活动的板中检索所有列表。

{
  "name": "get_lists",
  "arguments": {}
}

get_cards_by_list_id

从特定列表中获取所有卡片。

{
  "name": "get_cards_by_list_id",
  "arguments": {
    "listId": "string"
  }
}

add_card_to_list

将新卡添加到指定列表中。

{
  "name": "add_card_to_list",
  "arguments": {
    "listId": "string",
    "name": "string",
    "description": "string", // optional
    "dueDate": "string", // optional ISO 8601 date
    "labels": ["string"] // optional array of label IDs
  }
}

update_card_details

更新现有卡的详细信息。

{
  "name": "update_card_details",
  "arguments": {
    "cardId": "string",
    "name": "string", // optional
    "description": "string", // optional
    "dueDate": "string", // optional ISO 8601 date
    "labels": ["string"] // optional array of label IDs
  }
}

move_card

将卡片移动到其他列表。

{
  "name": "move_card",
  "arguments": {
    "cardId": "string",
    "listId": "string"
  }
}

get_recent_activity

获取当前活动板上的最近活动。

{
  "name": "get_recent_activity",
  "arguments": {
    "limit": 10 // optional, default is 10
  }
}

set_active_board

为未来的操作设置活动板。

{
  "name": "set_active_board",
  "arguments": {
    "boardId": "string"
  }
}

list_boards

获取所有可用板的列表。

{
  "name": "list_boards",
  "arguments": {}
}

set_active_workspace

为未来的操作设置活动工作区。

{
  "name": "set_active_workspace",
  "arguments": {
    "workspaceId": "string"
  }
}

工作流程示例:Claude和Trello的项目管理

以下是在Cursor中使用Claude和Trello MCP的完整工作流程示例:

  1. 让克劳德总结一下你的Trello董事会,开始新的一天:

    "Show me all lists and cards on my current Trello board"
    
  2. 在克劳德的帮助下计划你的一天:

    "Based on my current cards, what should I prioritize today?"
    
  3. 根据需要创建新任务:

    "Create cards for implementing user authentication in the 'To Do' list with these subtasks: 
    1. Set up JWT middleware
    2. Create login form
    3. Implement password reset flow"
    
  4. 全天更新进度:

    "Move the 'Create login form' card to 'In Progress'"
    
  5. 日终审查:

    "Show me the recent activity on the board and summarize what was accomplished today"
    

发展

先决条件

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

设置

  1. 克隆存储库

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

    npm install
    
  3. 构建项目

    npm run build
    
  4. 以开发模式运行

    npm run dev
    

贡献

欢迎投稿!请随时提交拉取请求。

许可证

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

总结

Trello MCP Server提供了AI助手和Trello板之间的无缝集成,使AI代理能够高效地查看、创建和管理Trello任务。通过实施模型上下文协议(MCP),该服务器允许AI助手:

  1. 浏览公告板、列表和卡片
  2. 创建和更新卡片
  3. 在列表之间移动卡片
  4. 跟踪最近的活动
  5. 在不同的板和工作区之间切换

此实现遵循TypeScript开发的最佳实践,包括全面的错误处理、API调用的速率限制和详细的文档。它被设计为易于扩展,并根据需要提供额外的Trello API功能。