Slack MCP
Slack MCP 服务器
适用于 Slack 工作区的模型上下文协议 (MCP) 服务器。此集成支持 Stdio 和 SSE 传输、代理设置,并且不需要工作区管理员创建或批准任何权限或机器人😏。
功能演示
工具
conversations_history
通过频道ID获取频道消息
必需输入:
channel_id(字符串):频道 ID,格式为 Cxxxxxxxxxx。cursor(字符串):用于分页的游标。使用响应中最后一行和最后一列的值作为上一个请求返回的 next_cursor 字段。limit(数字,默认值:28):要获取的消息数量限制。
返回:带有时间戳、用户 ID 和文本内容的消息列表
channels_list
获取频道列表
必需输入:
channel_types(数组):可能的频道类型。允许的值:'mpim'、'im'、'public_channel'、'private_channel'。sort(字符串):排序类型。允许的值:'popularity' - 按每个频道的成员/参与者数量排序。
返回:频道列表
Related MCP server: Slack MCP Server
设置指南
1.身份验证设置
在浏览器中打开 Slack 并登录。
查找SLACK_MCP_XOXC_TOKEN
打开浏览器的开发者控制台。
在 Firefox 中,在菜单栏中的
Tools -> Browser Tools -> Web Developer tools下在 Chrome 中,点击 URL 栏右侧的“三个点”按钮,然后选择
More Tools -> Developer Tools切换到控制台选项卡。
输入“允许粘贴”并按 ENTER。
粘贴以下代码片段并按 ENTER 执行:
JSON.parse(localStorage.localConfig_v2).teams[document.location.pathname.match(/^\/client\/([A-Z0-9]+)/)[1]].token
令牌值在执行命令后立即打印(以xoxc-开头),暂时将其保存在某处。
查找SLACK_MCP_XOXD_TOKEN
切换到“应用程序”选项卡,然后在左侧导航窗格中选择“Cookies”。
找到名称为
dCookie。没错,就是字母d。双击此 cookie 的值。
按 Ctrl+C 或 Cmd+C 将其值复制到剪贴板。
保存以供以后使用。
2.安装
选择以下安装方法之一:
3.配置和使用
您可以使用命令行参数和环境变量配置 MCP 服务器。
使用 npx
如果您已安装 npm,这是在 Claude Desktop 上开始使用slack-mcp-server最快方法。
打开claude_desktop_config.json并将 mcp 服务器添加到mcpServers列表中:
{
"mcpServers": {
"slack": {
"command": "npx",
"args": [
"-y",
"slack-mcp-server@latest",
"--transport",
"stdio"
],
"env": {
"SLACK_MCP_XOXC_TOKEN": "xoxc-...",
"SLACK_MCP_XOXD_TOKEN": "xoxd-..."
}
}
}
}{
"mcpServers": {
"slack": {
"command": "docker",
"args": [
"run",
"-i",
"--rm",
"-e",
"SLACK_MCP_XOXC_TOKEN=$SLACK_MCP_XOXC_TOKEN",
"-e",
"SLACK_MCP_XOXD_TOKEN=$SLACK_MCP_XOXD_TOKEN",
"ghcr.io/korotovsky/slack-mcp-server",
"mcp-server",
"--transport",
"stdio"
],
"env": {
"SLACK_MCP_XOXC_TOKEN": "xoxc-...",
"SLACK_MCP_XOXD_TOKEN": "xoxd-..."
}
}
}
}请参阅Docker以了解更多信息。
使用 npx 和sse传输:
如果您想在sse模式下运行它,那么您应该使用 Claude Desktop 的mcp-remote包装器,并在某处部署/公开 MCP 服务器,例如使用ngrok或docker-compose 。
{
"mcpServers": {
"slack": {
"command": "npx",
"args": [
"-y",
"mcp-remote",
"https://x.y.z.q:3001/sse",
"--header",
"Authorization: Bearer ${SLACK_MCP_SSE_API_KEY}"
],
"env": {
"SLACK_MCP_SSE_API_KEY": "my-$$e-$ecret"
}
}
}
}{
"mcpServers": {
"slack": {
"command": "C:\\Progra~1\\nodejs\\npx.cmd",
"args": [
"-y",
"mcp-remote",
"https://x.y.z.q:3001/sse",
"--header",
"Authorization: Bearer ${SLACK_MCP_SSE_API_KEY}"
],
"env": {
"SLACK_MCP_SSE_API_KEY": "my-$$e-$ecret"
}
}
}
}TLS 和暴露到互联网
您可能需要为 SSE 设置 HTTPS 的原因有几个。
mcp-remote只能处理 https 方案;对于任何暴露在互联网上的服务,使用 TLS 通常是一种很好的做法;
您可以使用ngrok :
ngrok http 3001然后使用端点https://903d-xxx-xxxx-xxxx-10b4.ngrok-free.app作为您的mcp-remote参数。
使用 Docker
有关所有环境变量的详细信息,请参阅 环境变量。
export SLACK_MCP_XOXC_TOKEN=xoxc-...
export SLACK_MCP_XOXD_TOKEN=xoxd-...
docker pull ghcr.io/korotovsky/slack-mcp-server:latest
docker run -i --rm \
-e SLACK_MCP_XOXC_TOKEN \
-e SLACK_MCP_XOXD_TOKEN \
slack-mcp-server --transport stdio或者,docker-compose 方式:
wget -O docker-compose.yml https://github.com/korotovsky/slack-mcp-server/releases/latest/download/docker-compose.yml
wget -O .env https://github.com/korotovsky/slack-mcp-server/releases/latest/download/default.env.dist
nano .env # Edit .env file with your tokens from step 1 of the setup guide
docker-compose up -d控制台参数
争论 | 必需的 ? | 描述 |
| 是的 | 选择 MCP 服务器的传输方式,可能的值有: |
环境变量
多变的 | 必需的 ? | 默认 | 描述 |
| 是的 |
| 来自 POST 数据字段集的身份验证数据令牌字段 |
| 是的 |
| 来自 cookie |
| 不 |
| MCP 服务器监听的端口 |
| 不 |
| MCP 服务器监听的主机 |
| 不 |
|
|
| 不 |
| MCP 服务器使用的代理 URL |
| 不 |
| 信任库的 CA 证书路径 |
| 不 |
| 信任所有不安全的请求(不推荐) |
调试工具
# Run the inspector with stdio transport
npx @modelcontextprotocol/inspector go run mcp/mcp-server.go --transport stdio
# View logs
tail -n 20 -f ~/Library/Logs/Claude/mcp*.log安全
切勿共享 API 令牌
确保 .env 文件的安全性和私密性
执照
采用 MIT 许可 - 请参阅LICENSE文件。本产品并非 Slack 官方产品。
Available Tools
2 toolschannels_listC
Get list of channels
Inputs: channel_types (required), sort.
conversations_historyB
Get messages from the channel by channel_id, the last row/column in the response is used as 'cursor' parameter for pagination if not empty
Inputs: channel_id (required), cursor, limit.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 2 tools
The two tools have clearly distinct purposes: channels_list retrieves a list of channels, while conversations_history fetches messages from a specific channel. There is no overlap in functionality, making it easy for an agent to select the correct tool based on the task.
Both tools follow a consistent snake_case naming convention, but the patterns differ slightly: channels_list uses a noun_verb format, while conversations_history uses a noun_noun format. This minor deviation prevents a perfect score, but the naming is still readable and mostly consistent.
With only 2 tools, this server feels too thin for a Slack integration, as it lacks essential operations like sending messages, managing users, or updating channel settings. The scope is severely limited, making it difficult for agents to perform comprehensive Slack-related tasks.
The tool surface is significantly incomplete for a Slack domain. While it covers listing channels and retrieving message history, it misses critical operations such as posting messages, creating channels, or handling reactions, which are core to Slack workflows and will likely cause agent failures.
Maintenance
Related MCP Connectors
Hosted Slack MCP server for Claude, ChatGPT and Cursor, with each action switched per account.
The official MCP Server for the Mux API
One MCP server for all your work accounts: Slack, Teams, Google Chat, Jira, ClickUp, digest, tasks.
An MCP server that let you interact with Cycloid.io Internal Development Portal and Platform
Related MCP Servers
- AlicenseNot gradedqualityDmaintenanceMCP server for posting messages to Slack channels via webhooks or bot API. Supports configurable usernames, emojis, and both webhook and bot token authentication modes.11 npmMIT
- AlicenseNot gradedqualityDmaintenanceA Model Context Protocol (MCP) server for Slack workspace integration. This server allows AI assistants to interact directly with your Slack workspace, providing tools to manage channels, send messages, list users, and upload files.1MIT
- FlicenseNot gradedqualityDmaintenanceAn MCP server that connects to Slack via Socket Mode (WebSocket) and surfaces real-time message notifications through MCP tools. No public URL or ngrok needed.-
- AlicenseNot gradedqualityCmaintenanceA production-ready MCP server for the Slack API that enables searching, listing channels, reading history, inspecting users, fetching threads, and sending messages through controlled Slack tools.MIT