slack-mcp
Enables AI assistants to interact with Slack workspaces, providing tools for reading messages, posting content, managing channels, and more.
README
slack-mcp
A Model Context Protocol (MCP) server that enables AI assistants to interact with Slack workspaces. This server provides a bridge between AI tools and Slack, allowing you to read messages, post content, and manage Slack channels programmatically through MCP-compatible clients.
What is this and why should I use it?
This MCP server transforms your Slack workspace into an AI-accessible environment. It provides 21+ tools for comprehensive Slack interaction:
Message & Thread Operations
- Read channel history with date filtering and thread support
- Post messages and replies to threads
- Search messages across workspace or within specific channels
- Execute Slack commands
Channel Management
- List, join, create, and rename channels
- Look up channel IDs by name
- Invite users to channels
Reactions & Users
- Add and view emoji reactions
- Send direct messages and group DMs
- Manage usergroups (clear members)
Utility
- Check authentication status
- Cache management for performance
Key Benefits
- Seamless Integration: Connect your AI assistant directly to Slack without manual copy-pasting
- Automated Workflows: Build AI-powered Slack bots that can read, analyze, and respond to messages
- Enhanced Productivity: Let AI help manage notifications, summarize conversations, or automate routine Slack tasks
- Real-time Collaboration: Enable AI assistants to participate in team discussions and provide instant insights
Use Cases
- Team Assistant: Have an AI that can read team updates and provide summaries
- Notification Manager: Automatically categorize and respond to incoming messages
- Knowledge Base: AI that can search through channel history and provide context
- Meeting Scheduler: AI that can read meeting requests and help coordinate schedules
Setting Up with Claude Code
This repo ships as a Claude Code plugin with a guided setup skill. Claude will walk you through the entire process — no manual config editing required.
Run the setup script. It handles everything — venv, Playwright, token extraction, wrapper script, and Claude Code registration. The only interaction required is logging in to Slack when the browser opens, and entering an optional channel ID for server logs, if desired.
python3 <(curl -fsSL https://raw.githubusercontent.com/redhat-community-ai-tools/slack-mcp/main/scripts/setup-slack-mcp.py)
Or clone the repo first and run it locally:
git clone https://github.com/redhat-community-ai-tools/slack-mcp
python3 slack-mcp/scripts/setup-slack-mcp.py
Options:
| Flag | Description |
|---|---|
--logs-channel DXXXXXXXXX |
Slack channel ID for server logs (optional; logs go to stderr if omitted) |
--workspace https://myco.slack.com |
Specific Slack workspace to open |
--refresh-tokens |
Re-extract tokens when they expire (skips all other steps) |
--skip-verify |
Skip the post-setup smoke test |
When tokens expire, just run:
python3 slack-mcp/scripts/setup-slack-mcp.py --refresh-tokens
Desktop App Token Refresh (Linux)
If you have the Slack desktop app installed, you can refresh tokens without opening a browser:
slack-mcp/scripts/slack-refresh-tokens --validate
This reads tokens directly from the desktop app's local storage on disk — no DevTools, no Playwright, no manual steps. Requires the Slack app to be signed in.
| Flag | Description |
|---|---|
--validate |
Verify tokens against Slack's API after extraction |
--env |
Print tokens as env vars to stdout (for piping into other tools) |
--output FILE |
Write tokens to a custom path (default: ~/.local/share/slack-mcp/tokens.env) |
Requirements: python3, python3-cryptography, secret-tool (libsecret/gnome-keyring), curl, jq
This is useful for CI hooks or session startup scripts that need to silently refresh tokens before launching the MCP server.
Bot token authentication (recommended)
For better security, use a Slack App bot token (xoxb-) instead of browser session tokens. Bot tokens provide:
- Scoped access — only the OAuth permissions you grant, not full user access
- Distinct identity — actions appear as the bot, not as your user account
- Central management — IT can audit and revoke via the Slack admin panel
- No browser DevTools — tokens are generated once in the Slack App settings
Setup
- Create a Slack App at api.slack.com/apps
- Add OAuth scopes:
channels:read,channels:history,channels:manage,groups:read,groups:history,groups:write,chat:write,reactions:read,reactions:write,search:read,users:read,commands,mpim:write - Install to your workspace and copy the Bot User OAuth Token (
xoxb-...) - Invite the bot to channels it needs access to
Running with a bot token
Set SLACK_BOT_TOKEN instead of SLACK_XOXC_TOKEN/SLACK_XOXD_TOKEN:
{
"mcpServers": {
"slack": {
"command": "podman",
"args": [
"run", "-i", "--rm",
"-e", "SLACK_BOT_TOKEN",
"-e", "LOGS_CHANNEL_ID",
"quay.io/redhat-ai-tools/slack-mcp"
],
"env": {
"SLACK_BOT_TOKEN": "xoxb-...",
"LOGS_CHANNEL_ID": "C7000000"
}
}
}
}
LOGS_CHANNEL_ID is optional. When omitted, tool activity is written to stderr instead of posted to Slack.
If both SLACK_BOT_TOKEN and SLACK_XOXC_TOKEN/SLACK_XOXD_TOKEN are set, the bot token takes precedence.
Read-only mode
For agents or automation that should browse and search Slack without posting, reacting, running commands, or joining channels, enable read-only mode.
- Environment variable: set
SLACK_MCP_READ_ONLYto a truthy value (1,true,yes, oron, case-insensitive). - CLI: pass
--read-onlywhen startingslack_mcp_server.py(equivalent to setting the variable).
In read-only mode, tools that mutate Slack state (post_message, send_dm, post_command, add_reaction, join_channel) raise a clear error. Read tools (history, search, threads, whoami, channel listing, cache refresh helpers, and so on) behave as usual. Tool activity that would normally be mirrored to LOGS_CHANNEL_ID is written to stderr instead.
On startup, the server logs a line to stderr when read-only mode is active.
For Podman or Docker, add -e SLACK_MCP_READ_ONLY=true (and the matching key in env) when you want the container to run read-only.
Running with Podman or Docker
You can run the slack-mcp server in a container using Podman or Docker:
Example configuration for running with Podman:
{
"mcpServers": {
"slack": {
"command": "podman",
"args": [
"run",
"-i",
"--rm",
"-e", "SLACK_XOXC_TOKEN",
"-e", "SLACK_XOXD_TOKEN",
"-e", "MCP_TRANSPORT",
"-e", "LOGS_CHANNEL_ID",
"quay.io/redhat-ai-tools/slack-mcp"
],
"env": {
"SLACK_XOXC_TOKEN": "xoxc-...",
"SLACK_XOXD_TOKEN": "xoxd-...",
"MCP_TRANSPORT": "stdio",
"LOGS_CHANNEL_ID": "C7000000"
}
}
}
}
LOGS_CHANNEL_ID is optional. When omitted, tool activity is written to stderr instead of posted to Slack.
Activity logging
By default, tool activity is written to stderr (visible in your terminal or process logs). To mirror activity to a Slack channel instead, set LOGS_CHANNEL_ID to any channel the bot or session user has access to — a self-DM or a DM with Slackbot works well for personal use.
LOGS_CHANNEL_ID=C7000000
In read-only mode, LOGS_CHANNEL_ID is ignored and all activity is always written to stderr.
Running with non-stdio transport
To run the server with a non-stdio transport (such as SSE), set the MCP_TRANSPORT environment variable to a value other than stdio (e.g., sse).
Example configuration to connect to a non-stdio MCP server:
{
"mcpServers": {
"slack": {
"url": "https://slack-mcp.example.com/sse",
"headers": {
"X-Slack-Web-Token": "xoxc-...",
"X-Slack-Cookie-Token": "xoxd-..."
}
}
}
}
Extract your Slack XOXC and XOXD tokens easily using browser extensions or Selenium automation: https://github.com/maorfr/slack-token-extractor.
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。