slack-mpm
MCP server for Slack workspace integration, exposing 40+ Slack operations as tools for Claude Desktop and providing a clean async Python API.
README
slack-mpm
A Python MCP (Model Context Protocol) server and API library for Slack workspace integration. Exposes 40+ Slack operations as MCP tools for use with Claude Desktop, and provides a clean async Python API for building Slack integrations.
What It Is
- Python API library:
from slack_mpm.api import messages; await messages.send_message(...) - MCP server: wraps the API for Claude Desktop via
slack-mpm mcp - Agent scripts: standalone automation scripts in
agents/
Prerequisites
- Python 3.10+ and uv
- A Slack App with a bot token
Creating a Slack App
- Go to https://api.slack.com/apps and click "Create New App"
- Choose "From scratch", give it a name and select your workspace
- Go to "OAuth & Permissions" and add these Bot Token Scopes:
channels:read,channels:write,channels:managechat:write,chat:write.publicusers:readfiles:read,files:writereactions:writepins:writebookmarks:read,bookmarks:writeemoji:readgroups:read,groups:writeim:read,im:writempim:read,mpim:write
- Install the app to your workspace
- Copy the "Bot User OAuth Token" (starts with
xoxb-)
For search_messages and reminders, also create a User Token with search:read, reminders:read, reminders:write.
Quick Start
git clone <repo>
cd slack-mpm
cp .env.local.example .env.local
# Edit .env.local and add your SLACK_BOT_TOKEN=xoxb-...
uv sync
uv run slack-mpm setup # Verify your token works
uv run slack-mpm doctor # Health check
Claude Desktop Configuration
Add to ~/Library/Application Support/Claude/claude_desktop_config.json (macOS):
{
"mcpServers": {
"slack": {
"command": "uv",
"args": ["run", "--directory", "/absolute/path/to/slack-mpm", "slack-mpm", "mcp"]
}
}
}
Restart Claude Desktop. You should see the Slack tools available.
Available Tools
Channel Tools (8)
| Tool | Description |
|---|---|
list_channels |
List all channels (public + private) |
get_channel_info |
Get details about a channel |
create_channel |
Create a new channel |
archive_channel |
Archive a channel |
invite_to_channel |
Invite users to a channel |
kick_from_channel |
Remove a user from a channel |
join_channel |
Join a channel |
set_channel_topic |
Set channel topic |
Message Tools (13)
| Tool | Description |
|---|---|
send_message |
Send a message (supports blocks + threading) |
send_ephemeral |
Send a message visible only to one user |
update_message |
Edit an existing message |
delete_message |
Delete a message |
get_permalink |
Get a permanent link to a message |
search_messages |
Search messages (requires user token) |
list_history |
Fetch channel message history |
add_reaction |
Add emoji reaction |
remove_reaction |
Remove emoji reaction |
pin_message |
Pin a message |
unpin_message |
Unpin a message |
reply_in_thread |
Reply in a thread |
get_thread_replies |
Fetch all thread replies |
User Tools (5)
| Tool | Description |
|---|---|
list_users |
List all workspace users |
get_user_info |
Get user details |
get_user_by_email |
Look up a user by email |
open_dm |
Open a DM channel with user(s) |
list_user_channels |
List channels a user belongs to |
File Tools (5)
| Tool | Description |
|---|---|
upload_file |
Upload a file to channel(s) |
list_files |
List workspace files |
get_file_info |
Get file details |
delete_file |
Delete a file |
share_file |
Share an existing file to channels |
Workspace Tools (4)
| Tool | Description |
|---|---|
get_workspace_info |
Get workspace/team info |
list_emojis |
List custom emoji |
get_bot_info |
Get bot details |
auth_test |
Validate token |
Reminder Tools (4)
| Tool | Description |
|---|---|
add_reminder |
Create a reminder |
list_reminders |
List reminders |
complete_reminder |
Mark reminder complete |
delete_reminder |
Delete a reminder |
Bookmark Tools (3)
| Tool | Description |
|---|---|
list_bookmarks |
List channel bookmarks |
add_bookmark |
Add a bookmark to a channel |
remove_bookmark |
Remove a bookmark |
Scheduled Message Tools (3)
| Tool | Description |
|---|---|
schedule_message |
Schedule a future message |
list_scheduled_messages |
List pending scheduled messages |
delete_scheduled_message |
Cancel a scheduled message |
Using the Python API Directly
import asyncio
from slack_mpm.api import messages, channels, users
from slack_mpm.auth.token_manager import TokenManager
async def main():
token = TokenManager().get_token()
# Send a message
await messages.send_message(token, "#general", "Hello from Python!")
# List channels
data = await channels.list_channels(token)
for ch in data["channels"]:
print(ch["name"])
# Get user info
user = await users.get_user_by_email(token, "person@example.com")
print(user["user"]["real_name"])
asyncio.run(main())
Agent Scripts
Standalone automation scripts in the agents/ directory.
slack_listener.py — Real-time channel monitor
Polls a channel and prints new messages as they arrive.
uv run agents/slack_listener.py --channel C1234567890
uv run agents/slack_listener.py --channel C1234567890 --interval 10
uv run agents/slack_listener.py --channel C1234567890 --no-history
slack_notifier.py — Send notifications
Sends messages or file uploads to Slack channels from the command line or stdin.
uv run agents/slack_notifier.py --channel C1234567890 --message "Deploy complete"
echo "alert!" | uv run agents/slack_notifier.py --channel C1234567890
cat report.txt | uv run agents/slack_notifier.py --channel C1234567890 --as-file --filename report.txt
slack_responder.py — Auto-responder bot
Monitors for @mentions or DMs and auto-replies with a configured message.
uv run agents/slack_responder.py --response "Thanks, I'll get back to you!"
uv run agents/slack_responder.py --channel C1234567890 --response "Got it!" --interval 60
uv run agents/slack_responder.py --response "Out of office" --dry-run
slack_digest.py — Activity digest
Generates a summary of recent channel activity: message counts, active users, top threads.
uv run agents/slack_digest.py --channel C1234567890
uv run agents/slack_digest.py --channel C1234567890 --hours 168 # 1 week
uv run agents/slack_digest.py --channel C1234567890 --hours 24 --top-users 10
slack_archiver.py — Channel history export
Exports complete channel message history to JSON or Markdown files with thread support.
uv run agents/slack_archiver.py --channel C1234567890 --output ./archive/
uv run agents/slack_archiver.py --channel C1234567890 --output ./archive/ --format markdown
uv run agents/slack_archiver.py --channel C1234567890 --output ./archive/ --days 30
Development
# Install dev dependencies
uv sync
# Run tests
uv run pytest
uv run pytest --cov=src --cov-report=html
# Type checking
uv run mypy --strict src/
# Linting
uv run ruff check src/ agents/
uv run ruff format src/ agents/
Project Structure
src/slack_mpm/
├── api/
│ ├── _client.py # Shared httpx client + SlackAPIError
│ ├── channels.py # Channel operations
│ ├── messages.py # Message operations
│ ├── users.py # User operations
│ ├── files.py # File operations
│ ├── workspace.py # Workspace operations
│ ├── reminders.py # Reminder operations
│ ├── bookmarks.py # Bookmark operations
│ └── scheduled.py # Scheduled message operations
├── auth/
│ ├── models.py # SlackToken, TokenStatus, WorkspaceInfo
│ └── token_manager.py # TokenManager (loads from .env.local)
├── cli/
│ └── main.py # CLI: setup, doctor, mcp commands
└── server/
└── slack_mpm_server.py # SlackMCPServer (MCP adapter)
agents/
├── slack_listener.py # Channel message poller
├── slack_notifier.py # Send notifications
├── slack_responder.py # Auto-responder bot
├── slack_digest.py # Activity digest
└── slack_archiver.py # History export
推荐服务器
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 模型以安全和受控的方式获取实时的网络信息。