Slack MCP Server
Enables AI assistants to interact with Slack workspaces through comprehensive channel management, messaging, direct messages, search functionality, and user management capabilities.
README
Slack MCP Server
A comprehensive Model Context Protocol (MCP) server for Slack API integration. This server enables AI assistants like Claude to interact with your Slack workspace, including managing channels, sending messages, searching content, and more.
Features
Channel Management
- List all accessible channels (public/private)
- Get channel information and details
- Create new channels
- Archive channels
- Join/leave channels
- Set channel topics
- Fetch channel message history
Messaging
- Post messages to channels
- Reply to message threads
- Update and delete messages
- Add and remove emoji reactions
- Get message reactions
Direct Messages (DMs)
- Send direct messages to users
- List DM and group DM conversations
- Fetch DM conversation history
- Open new DM conversations
Search (requires User Token)
- Search messages across the workspace
- Search files
- Combined search for messages and files
User Management
- List workspace users
- Get user profile information
- Check user presence/online status
- Look up users by email
- Get bot and team information
Prerequisites
- Python 3.10 or higher
- A Slack workspace with admin access to create apps
- Slack Bot Token (xoxb-...) for most operations
- Slack User Token (xoxp-...) for search functionality
Installation
1. Clone the Repository
git clone <repository-url>
cd slack-mcp-server
2. Create Virtual Environment
python3.12 -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate
3. Install Dependencies
pip install -e .
Or install from requirements:
pip install -r requirements.txt
Slack App Setup
1. Create a Slack App
- Go to Slack API Apps
- Click "Create New App" → "From scratch"
- Name your app and select your workspace
2. Configure Bot Token Scopes
Navigate to OAuth & Permissions and add these Bot Token Scopes:
Channels
channels:read- View basic channel infochannels:write- Manage public channelschannels:history- View messages in public channelsgroups:read- View private channelsgroups:write- Manage private channelsgroups:history- View messages in private channels
Messaging
chat:write- Send messagesreactions:read- View reactionsreactions:write- Add reactions
Direct Messages
im:read- View DM infoim:write- Start DMsim:history- View DM historympim:read- View group DM infompim:write- Start group DMsmpim:history- View group DM history
Users
users:read- View usersusers:read.email- View user emails
3. Configure User Token Scopes (for Search)
If you need search functionality, add these User Token Scopes:
search:read- Search messages and files
4. Install the App
- Click "Install to Workspace"
- Authorize the app
- Copy the Bot User OAuth Token (starts with
xoxb-) - If using search, also copy the User OAuth Token (starts with
xoxp-)
Configuration
Environment Variables
Create a .env file in the project root:
# Required: Bot Token for most operations
SLACK_BOT_TOKEN=xoxb-your-bot-token-here
# Optional: User Token for search functionality
SLACK_USER_TOKEN=xoxp-your-user-token-here
You can copy the example file:
cp env.example .env
# Then edit .env with your tokens
Usage
Running the Server
As a Python Module
source venv/bin/activate
python -m slack_mcp_server
Using the Entry Point
source venv/bin/activate
slack-mcp-server
Claude Desktop Configuration
Add to your Claude Desktop configuration file:
macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
Windows: %APPDATA%\Claude\claude_desktop_config.json
{
"mcpServers": {
"slack": {
"command": "/path/to/slack-mcp-server/venv/bin/python",
"args": ["-m", "slack_mcp_server"],
"cwd": "/path/to/slack-mcp-server",
"env": {
"SLACK_BOT_TOKEN": "xoxb-your-bot-token",
"SLACK_USER_TOKEN": "xoxp-your-user-token"
}
}
}
}
Replace /path/to/slack-mcp-server with the actual path to your installation.
Cursor IDE Configuration
Add to your Cursor MCP settings:
{
"mcpServers": {
"slack": {
"command": "/path/to/slack-mcp-server/venv/bin/python",
"args": ["-m", "slack_mcp_server"],
"cwd": "/path/to/slack-mcp-server",
"env": {
"SLACK_BOT_TOKEN": "xoxb-your-bot-token",
"SLACK_USER_TOKEN": "xoxp-your-user-token"
}
}
}
}
Available Tools
Channel Tools
| Tool | Description |
|---|---|
list_channels |
List all accessible channels |
get_channel_info |
Get details about a specific channel |
create_channel |
Create a new channel |
archive_channel |
Archive a channel |
get_channel_history |
Fetch message history |
join_channel |
Join a channel |
leave_channel |
Leave a channel |
set_channel_topic |
Set channel topic |
Message Tools
| Tool | Description |
|---|---|
post_message |
Post a message to a channel |
reply_to_thread |
Reply in a thread |
get_thread_replies |
Get all replies in a thread |
add_reaction |
Add emoji reaction |
remove_reaction |
Remove emoji reaction |
get_message_reactions |
Get reactions on a message |
update_message |
Update an existing message |
delete_message |
Delete a message |
DM Tools
| Tool | Description |
|---|---|
send_dm |
Send a direct message |
list_conversations |
List DM conversations |
get_dm_history |
Fetch DM history |
open_dm |
Open a DM conversation |
Search Tools (requires User Token)
| Tool | Description |
|---|---|
search_messages |
Search messages |
search_files |
Search files |
search_all |
Search both messages and files |
User Tools
| Tool | Description |
|---|---|
list_users |
List workspace users |
get_user_info |
Get user details |
get_user_presence |
Check if user is online |
lookup_user_by_email |
Find user by email |
get_user_profile |
Get detailed profile |
get_bot_info |
Get bot identity |
get_team_info |
Get workspace info |
Testing
Using MCP Inspector
npx @modelcontextprotocol/inspector python -m slack_mcp_server
This opens a web interface to test all available tools interactively.
Manual Testing
- Start the server
- Use Claude Desktop or another MCP client
- Try basic commands:
- "List all channels in the workspace"
- "Get the history of #general channel"
- "Send a message to #test-channel saying Hello!"
Troubleshooting
"SLACK_BOT_TOKEN is not set"
Ensure your .env file exists and contains the token, or set it in your MCP client configuration.
"Search requires a User Token"
Search operations require a User Token (SLACK_USER_TOKEN). Add User Token scopes to your Slack app and include the token.
"channel_not_found"
The bot may not have access to the channel. Ensure:
- The channel exists
- The bot is a member of private channels
- The channel ID is correct (use
list_channelsto find IDs)
"missing_scope"
Your Slack app is missing required permissions. Check the OAuth scopes section above and add the missing scopes in your Slack app settings.
Development
Project Structure
slack-mcp-server/
├── src/
│ └── slack_mcp_server/
│ ├── __init__.py
│ ├── __main__.py
│ ├── server.py # FastMCP server entry point
│ ├── tools/
│ │ ├── __init__.py
│ │ ├── channels.py # Channel management tools
│ │ ├── messages.py # Messaging and DM tools
│ │ ├── search.py # Search functionality
│ │ └── users.py # User management tools
│ └── utils/
│ ├── __init__.py
│ └── slack_client.py # Slack API wrapper
├── pyproject.toml
├── requirements.txt
├── env.example
└── README.md
Adding New Tools
- Create or edit a file in
src/slack_mcp_server/tools/ - Define tools using the
@mcp.tool()decorator - Register the tools in the server by calling the registration function
License
MIT License
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
推荐服务器
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 模型以安全和受控的方式获取实时的网络信息。