使用说明
Slack MCP Server
An MCP server that lets you interact with Slack from Claude Code or any MCP client. Each user authenticates with their own Slack account via OAuth — all actions are performed as the authenticated user using user tokens (xoxp).
Features
- Per-user OAuth — authenticate with your own Slack identity
- User tokens (xoxp) — messages appear as sent by you, search works correctly
- Multi-workspace — connect to multiple Slack workspaces
- 11 tools — messaging, channels, search, reactions, workspace management
Prerequisites
- Create a Slack app at https://api.slack.com/apps
- Set redirect URL to
http://localhost:9876/callback - Add User Token Scopes (not bot scopes):
channels:read,groups:read— list channelschannels:history,groups:history— read channel historyim:history,mpim:history— read DM and group DM historychat:write— post messagessearch:read— search messagesreactions:write,reactions:read— reactionsusers:read— user info
- Note your Client ID and Client Secret
Setup
# Clone and install
git clone <repo-url>
cd slack-mcp-server
uv sync
# Configure environment
cp .env.example .env
# Edit .env with your SLACK_CLIENT_ID and SLACK_CLIENT_SECRET
Usage with Claude Code
Option A: OAuth (recommended for teams)
claude mcp add slack \
-e SLACK_CLIENT_ID=your-client-id \
-e SLACK_CLIENT_SECRET=your-client-secret \
-- uv --directory /path/to/slack-mcp-server run slack-mcp-server
Then in Claude Code, ask to "authenticate with Slack" — it will open the browser for OAuth.
Option B: Direct token (personal use)
claude mcp add slack \
-e SLACK_USER_TOKEN=xoxp-your-token \
-- uv --directory /path/to/slack-mcp-server run slack-mcp-server
After setup
Restart Claude Code, then use tools like post_message, search_messages, list_channels, etc.
Tools
| Tool | Description |
|---|---|
slack_authenticate |
Connect your Slack account via OAuth |
slack_list_workspaces |
List connected workspaces |
slack_set_default_workspace |
Set the default workspace |
slack_remove_workspace |
Disconnect a workspace |
post_message |
Post a message to a channel |
reply_to_thread |
Reply in a thread |
list_channels |
List workspace channels |
get_channel_history |
Read channel message history |
search_messages |
Search messages across the workspace |
add_reaction |
Add an emoji reaction |
remove_reaction |
Remove an emoji reaction |
Development
uv run pytest # Run tests
uv run ruff check src/ # Lint
uv run mcp dev src/slack_mcp_server/server.py # MCP Inspector
