slack-mcp
# slack-mcp
A lean [MCP](https://modelcontextprotocol.io) server that acts in Slack as **you**, through a user OAuth token (`xoxp-…`). One small Python process covers messaging, threads, search, users, channels, user groups and reactions, plus the APIs most Slack MCP servers skip: scheduled messages, canvases and Slack Lists.
## Tools
| Tool | What it does | Slack methods |
|---|---|---|
| `conversations_history` | Channel or DM messages as CSV; `limit` is a count (`50`) or a window (`1d`, `2w`, `3m`) | `conversations.history` |
| `conversations_replies` | A thread as CSV | `conversations.replies` |
| `conversations_add_message` | Post as you; markdown is rendered by Slack (`markdown_text`), unfurling off | `chat.postMessage` |
| `conversations_preview_message` | Post a `DRAFT` of a text message to your own DM and return a `preview_hash`; `conversations_add_message` with that hash sends only the identical payload, once | `chat.postMessage` |
| `conversations_update_message` | Edit the text of a message you posted (markdown by default) | `chat.update` |
| `conversations_delete_message` | Delete a message you posted | `chat.delete` |
| `conversations_search_messages` | Search with channel, user, date and thread filters, or fetch one message by URL | `search.messages` |
| `users_search` | Find users by ID, handle, name or email, with their DM channel | `users.list`, `users.info` |
| `channels_list` / `channels_me` | All channels, filtered and sorted / channels you are in | `conversations.list`, `users.conversations` |
| `usergroups_list` / `usergroups_me` | User groups / the groups you belong to (read-only) | `usergroups.list` |
| `reactions_add` / `reactions_remove` | Emoji reactions | `reactions.*` |
| `schedule_message`, `list_scheduled_messages`, `delete_scheduled_message` | Scheduled messages; text is markdown by default, like posting | `chat.scheduleMessage`, `chat.scheduledMessages.list`, `chat.deleteScheduledMessage` |
| `canvas_create`, `canvas_edit`, `canvas_find_sections`, `canvas_read`, `canvas_delete` | Canvases from and to markdown | `canvases.*`, `files.info` |
| `list_create`, `list_items`, `list_item_create`, `list_items_update`, `list_item_delete`, `list_delete` | Slack Lists (paid plans); `list_delete` removes the List's file because Slack has no List-delete method | `slackLists.*`, `files.delete` |
Wherever a tool takes a channel, it accepts an ID, `#channel-name`, or `@user` for that user's DM. `conversations_add_message`, `conversations_preview_message` and `schedule_message` also accept `@a,@b` for a group DM with those users (it needs the `mpim:write` scope; Slack returns the existing group DM when one exists). Only those three tools open a DM that does not exist yet; read tools and `conversations_update_message` fail instead. A preview's hash covers the resolved channel, `thread_ts`, `content_type` and the exact text; pending previews are held in memory, so a server restart drops them. A user is matched by ID, handle, then display or real name, and an ambiguous name is refused. Paging cursors carry the original window and page size. Tool names and parameters match [korotovsky/slack-mcp-server](https://github.com/korotovsky/slack-mcp-server) for the overlapping tools, so existing prompts and permission rules keep working.
## Message checks
Before any text is sent, `conversations_add_message`, `conversations_preview_message`, `conversations_update_message` and `schedule_message` check it locally. A text that would render wrongly is refused before any Slack call is made; the refusal lists what is wrong and carries the corrected text to retry with. A message sent as `blocks` is not checked.
| Check | When | Refuses |
|---|---|---|
| Dialect | always | Slack mrkdwn under `text/markdown`: `<url\|label>` links, `•` bullets, and `*single-asterisk*` spans (italic in markdown, bold in mrkdwn) |
| Mentions | always | a bare `@name`, which notifies no one: use `<@U…>`, `<!subteam^S…>`, or backticks |
| `paragraphs` | opt-in | a paragraph or list item over 80 words or 5 sentences |
| `plain-markup` | opt-in | markup in a `text/plain` message, where it shows literally |
Turn the opt-in rules on in the launcher with `SLACK_MCP_STYLE`, a comma-separated list: `export SLACK_MCP_STYLE=paragraphs,plain-markup`. An unknown rule name stops the server at startup.
`slack-mcp-check` runs the same checks offline, with no token and no network call:
```sh
slack-mcp-check [--content-type text/plain] [--style paragraphs,plain-markup] [--json] [FILE]
```
It reads the text from `FILE` or standard input and exits 0 (passes), 1 (refused) or 2 (could not check). With `--json` it prints one object: `{"schema": 1, "ok": false, "content_type": "text/markdown", "style": [], "issues": [{"kind": "dialect", "message": "…"}], "retry": {"content_type": "text/markdown", "text": "…"}}`; `retry` is `null` when there is no corrected text. `--style` defaults to `SLACK_MCP_STYLE`.
## Setup
1. Create a Slack app at <https://api.slack.com/apps> → **From a manifest**:
```json
{
"display_information": { "name": "Slack MCP" },
"oauth_config": {
"scopes": {
"user": [
"channels:history", "channels:read", "groups:history", "groups:read",
"im:history", "im:read", "im:write", "mpim:history", "mpim:read", "mpim:write",
"users:read", "users:read.email", "chat:write", "search:read",
"usergroups:read", "reactions:write",
"canvases:read", "canvases:write", "files:read", "files:write", "lists:read", "lists:write"
]
}
},
"settings": { "org_deploy_enabled": false, "socket_mode_enabled": false, "token_rotation_enabled": false }
}
```
Drop the scopes for tools you will not use; a call that needs a missing scope fails with `missing_scope (token lacks scope: …)`.
2. **Install to Workspace** and copy the **User OAuth Token**.
3. Register a launcher that reads the token from your secret manager at startup, so the token never lands in a config file or on a command line:
```sh
#!/usr/bin/env bash
# slack-mcp-start.sh
SLACK_USER_TOKEN="$(op read 'op://Private/Slack MCP/token')" || exit 1 # or any secret manager
export SLACK_USER_TOKEN
exec uvx --from git+https://github.com/asaphe/slack-mcp@v0.2.0 slack-mcp
```
To install both commands (`slack-mcp` and `slack-mcp-check`) once instead of resolving them at each start, run `uv tool install git+https://github.com/asaphe/slack-mcp@v0.2.0` and end the launcher with `exec slack-mcp`.
```sh
claude mcp add slack --scope user -- /path/to/slack-mcp-start.sh
```
Avoid `claude mcp add … -e SLACK_USER_TOKEN="$(…)"`: the shell expands the secret before Claude Code runs, and it is stored in plain text in `~/.claude.json`.
## Security
- The token is read from `SLACK_USER_TOKEN` only, sent only in the `Authorization` header to `slack.com/api/` and, for `canvas_read`, to `files.slack.com` over HTTPS (any other file URL is refused and redirects are not followed). It is never logged or included in errors.
- Posting tools act as you. Gate them in your MCP client (for Claude Code: `permissions.ask` on `mcp__slack__conversations_add_message`, `schedule_message`, `canvas_create`, `canvas_edit`, `list_create`, `list_item_create`, `list_items_update`, `delete_scheduled_message`, `reactions_*`).
- No telemetry, no disk cache; user and channel directories live in memory for the process lifetime.
- Tools run in worker threads, so a slow Slack call or a rate-limit wait never blocks the MCP connection.
## Development
```sh
uv sync --all-groups
uv run pytest
uv run ruff check . && uv run ruff format --check . && uv run mypy src
```
## License
MIT
TDQS
Scored across 28 tools
Most tools target a clearly distinct resource+action (canvas CRUD, list CRUD, message CRUD, reactions, scheduled messages), and the descriptions add useful clarification. The few soft overlaps are the list_items read vs list_items_update pair, conversations_history vs conversations_replies, and conversations_preview_message vs conversations_add_message, but the preview/post contract is spelled out explicitly enough that an agent can choose correctly.
The dominant pattern is noun_verb (conversations_add_message, canvas_create, usergroups_list), but it breaks down in places: 'list' is a noun namespace in list_create/list_items yet a verb in list_scheduled_messages, and schedule_message/delete_scheduled_message drop the namespace prefix entirely. Mixed noun-first and verb-first conventions plus an ambiguous 'list_' overload make the set readable but not predictable.
28 tools is at the heavy end, though the surface genuinely spans messages, threads, scheduling, canvases, lists, channels, users, usergroups and reactions, so each cluster earns its place. Still, some consolidation (e.g. channels_list/channels_me, usergroups_list/usergroups_me) could trim the count without losing capability.
Messaging, threading, scheduling, reactions, canvases and lists have solid lifecycle coverage, but the surrounding Slack surface has notable holes: no channel create/join/leave/invite or member listing, no user profile lookup beyond search, and no file upload. Agents can work around these via search/history, but common Slack workflows will hit dead ends.