Slack MCP服务器
一种用于与Slack API交互的模型上下文协议(MCP)服务器实现。此服务器为Slack工作区自动化提供了工具。
特性
- 将短信发布到Slack频道
- 回复帖子
- 添加反应
- 列出频道和用户
- 获取频道历史记录和线程回复
安装
地方发展
- 克隆存储库并安装依赖项:
npm install- 创建一个
.env使用您的Slack凭据创建文件:
SLACK_BOT_TOKEN=your_bot_token
SLACK_TEAM_ID=your_team_id- 构建项目:
npm run build- 运行服务器:
node build/index.js可用工具
用户工具
用户_松弛
- 说明: 获取工作区中所有用户的列表及其基本配置文件信息。
- 输入:
{
"limit": 100,
"cursor": "optional_cursor"
}get_user_profile_on_lack
- 说明: 获取特定用户的详细个人资料信息。
- 输入:
{
"user_id": "your_user_id"
}消息工具
send_message_on_lack
- 说明: 在Slack频道发布新消息。
- 输入:
{
"channel_id": "your_channel_id",
"text": "Hello, world!"
}螺纹工具
reply_to_thread_on_lack
- 说明: 回复Slack中的特定消息线程。
- 输入:
{
"channel_id": "your_channel_id",
"thread_ts": "your_thread_ts",
"text": "This is a reply"
}get_thread_replies_on_lack
- 说明: 在消息线程中获取所有回复。
- 输入:
{
"channel_id": "your_channel_id",
"thread_ts": "your_thread_ts"
}渠道工具
channels_list_on_lack
- 说明: 在工作区中列出带有分页的公共频道。
- 输入:
{
"limit": 100,
"cursor": "optional_cursor"
}get_channel_history_onslack
- 说明: 从频道获取最新消息。
- 输入:
{
"channel_id": "your_channel_id",
"limit": 10
}反应工具
slack_add_action
- 说明: 在消息中添加反应表情符号。
- 输入:
{
"channel_id": "your_channel_id",
"timestamp": "your_message_ts",
"reaction": "your_reaction"
}用法示例
要调用工具,请发送一个JSON请求,如下所示:
{
"method": "tools/call",
"params": {
"name": "send_message_on_slack",
"arguments": {
"channel_id": "your_channel_id",
"text": "Hello from the Slack MCP server!"
}
}
}环境变量
创建一个 .env 文件包含:
SLACK_BOT_TOKEN=your_bot_token
SLACK_TEAM_ID=your_team_id运行服务器
npm install
npm run build
npx @modelcontextprotocol/slack-server或者,对于直接节点执行:
node build/index.js许可证
MIT许可证。看 许可证 了解详情。
