光标松弛聊天
直接从Cursor在Slack上与您的团队聊天。在开发过程中出现问题时,向团队成员和渠道发送消息。
特性
| 工具 | 说明 |
|---|---|
slack_list_all_channels | 列出所有频道(公共+私人) |
slack_find_channel | 按名称搜索频道 |
slack_post_message | 向频道或DM发布新消息 |
slack_delete_message | 删除邮件 |
slack_update_message | 编辑现有邮件 |
slack_get_channel_history_extended | 阅读频道消息(股份有限公司私人) |
slack_get_thread_replies_extended | 检查线程回复 |
slack_get_file | 从消息中获取文件元数据和可选的图像内容(base64) |
为什么存在: Cursor内置的Slack MCP仅列出公共频道,功能有限。此MCP添加了专用信道支持和消息管理。
______________________________________________________________________
设置概述
| 步骤 | 谁 | 什么 |
|---|---|---|
| 1 | 团队管理员(一次) | 创建Slack应用程序+获取Bot令牌 |
| 2 | 每个开发人员 | 安装MCP+配置令牌 |
______________________________________________________________________
第1部分:Slack应用程序设置(团队管理员)
选项A:从清单创建应用程序(推荐)
- 首选https://api.slack.com/apps
- 点击 创建新应用程序 → 从应用程序清单
- 选择您的工作区
- 粘贴此清单(YAML选项卡):
display_information:
name: Cursor Chat
description: Chat with Slack from Cursor IDE
background_color: "#1a1a2e"
features:
bot_user:
display_name: Cursor
always_online: true
oauth_config:
scopes:
bot:
- chat:write
- channels:read
- channels:history
- groups:read
- groups:history
- users:read
- files:read
- reactions:write
- im:read
- im:history
settings:
org_deploy_enabled: false
socket_mode_enabled: false
token_rotation_enabled: false- 点击 创建
- 首选 安装应用程序 → 安装到工作区
- 复制 Bot用户OAuth令牌 (开始于
xoxb-)
选项B:手动创建应用程序
- 首选https://api.slack.com/apps → 创建新应用程序 → 从头开始
- 将其命名为“光标聊天”并选择您的工作区
- 首选 OAuth和权限 → 添加这些 Bot令牌范围:
| 范围 | 目的 |
|---|---|
chat:write | 发布、编辑、删除消息 |
channels:read | 列出公共频道 |
channels:history | 阅读公共频道消息 |
groups:read | 列出私人频道 |
groups:history | 阅读私人频道消息 |
users:read | 在用户中查找@提及 |
files:read | 读取文件元数据和内容(例如消息中的图像) |
reactions:write | 添加表情符号反应 |
im:read | 列出DM对话 |
im:history | 阅读DM |
- 点击 安装到工作区
- 复制 Bot用户OAuth令牌 (开始于
xoxb-)
邀请Bot加入私人频道
机器人只能看到它被邀请的私人频道:
- 在Slack中打开私人频道
- 单击频道名称→ 集成 → 添加应用程序
- 添加“光标聊天”
______________________________________________________________________
第2部分:开发人员设置(每个人)
快速安装
curl -sL https://raw.githubusercontent.com/CanonSystems/cursor-slack-chat/main/setup.sh | bash手动安装
git clone https://github.com/CanonSystems/cursor-slack-chat.git ~/.cursor/mcp-servers/cursor-slack-chat
cd ~/.cursor/mcp-servers/cursor-slack-chat
npm install配置光标
增添 ~/.cursor/mcp.json (如果不存在则创建):
{
"mcpServers": {
"cursor-slack-chat": {
"command": "node",
"args": ["~/.cursor/mcp-servers/cursor-slack-chat/index.js"],
"env": {
"SLACK_BOT_TOKEN": "xoxb-your-bot-token-here"
}
}
}
}重要提示: 替换 ~ 使用您的实际主目录路径:
- macOS:
/Users/YOURNAME/.cursor/mcp-servers/cursor-slack-chat/index.js - Linux:
/home/YOURNAME/.cursor/mcp-servers/cursor-slack-chat/index.js - 窗户:
C:\\Users\\YOURNAME\\.cursor\\mcp-servers\\cursor-slack-chat\\index.js
重新启动游标
退出并重新打开Cursor以加载新的MCP服务器。
______________________________________________________________________
第3部分:与您的团队共享Bot令牌
这 SLACK_BOT_TOKEN 是敏感的。 永远不要将其提交给回购。
推荐:Slack工作区文件
将令牌存储在Slack本身的文件中:
- 创建一个名为的文本文件
cursor-setup.txt与:
Cursor Slack Chat - Bot Token
Token: xoxb-your-actual-token-here
Setup:
1. Run: curl -sL https://raw.githubusercontent.com/CanonSystems/cursor-slack-chat/main/setup.sh | bash
2. Add the token above to ~/.cursor/mcp.json
3. Restart Cursor- 将其上传到专用通道(如#engineering或#dev-setup)
- 固定文件,以便团队成员可以轻松找到它
然后,团队成员可以在需要时直接在Slack中访问令牌。
替代方法
- 密码管理器 (1Password、LastPass)-存储在共享团队保险库中
- 私人维基 -受限制访问的冲突/概念文档
- 直接分享 -团队带领DM向新成员发放代币
______________________________________________________________________
应用信息
创建Slack应用程序后,您可以在以下位置找到这些IDhttps://api.slack.com/apps:
| 字段 | 查找位置 | 示例 |
|---|---|---|
| 应用程序ID | 基本信息→ 应用程序凭据 | A0ACR01CGK0 |
| 机器人用户ID | OAuth和权限(在令牌响应中) | U0ACLKBU7FD |
| 机器人令牌 | OAuth和权限→ Bot用户OAuth令牌 | xoxb-xxx-xxx-xxx |
______________________________________________________________________
使用示例
配置后,让Cursor执行以下操作:
List all Slack channels including private onesFind the #showtrail channelSend a message to Mani in #showtrail asking about the deploymentCheck if anyone replied to my last message in #showtrailDelete the message with timestamp 1770156144.483089 from channel C06QAJ35QPL______________________________________________________________________
故障排除
“找不到私人频道”
- 确保
groups:read范围已添加 - 添加作用域后重新安装应用程序
- 邀请机器人加入私人频道
“缺少作用域”错误
- 检查错误中缺少哪个范围
- 将其添加到OAuth和权限中
- 将应用程序重新安装到工作区
工具未出现在光标中
- 检查
~/.cursor/mcp.json语法(有效的JSON?) - 验证路径
index.js是正确的 - 完全重新启动游标(而不仅仅是重新加载)
______________________________________________________________________
发展
# Install dependencies
npm install
# Test locally
SLACK_BOT_TOKEN=xoxb-xxx node index.js______________________________________________________________________
许可证
麻省理工学院
