Slack MCP 服务

一个通过 Slack 用户令牌提供个人 Slack 访问能力的 MCP 服务器,涵盖频道、私信、聊天、搜索、文件、用户和草稿管理等功能。

  • by wise-toddler
  • Python
  • 本地部署
  • 更新于
在 GitHub 查看 wise-toddler/slack-pat-mcp

使用说明

slack-pat-mcp

MCP server for personal Slack access using user tokens (xoxp-). 4 tools covering channels, DMs, chat, search, and user management.

Install

uvx slack-pat-mcp

Claude Code Config

"slack": {
    "command": "uvx",
    "args": ["slack-pat-mcp"],
    "env": {
        "SLACK_USER_TOKEN": "xoxp-...",
        "SLACK_TEAM_ID": "T..."
    }
}

Tools

  • slack_channel — list, list_dms, history, thread, open_dm
  • slack_chat — post, update, delete, react_add, react_remove
  • slack_search — search messages with Slack syntax
  • slack_files — list, info, upload, delete, download (saves a file locally, returns its path; text files also return content). Messages from history/thread include their files and attachments
  • slack_users — list, info, profile, usergroups, set_status
  • slack_drafts — create, list, update, delete; text is Slack mrkdwn (bold/italic/strike/code, lists, quotes, code blocks, links, mentions, emoji), converted to rich_text (needs browser session keys below)

Drafts (optional)

Slack's drafts API rejects xoxp tokens, so drafts use your browser session. In app.slack.com DevTools:

  • SLACK_XOXC_TOKEN — Console: Object.values(JSON.parse(localStorage.localConfig_v2).teams).map(t => [t.name, t.token])
  • SLACK_D_COOKIE — Application → Cookies → https://app.slack.com → d (copy as-is, URL-encoded)

These are unofficial and stop working when you sign out of Slack in that browser.

When set, they are also the fallback for any call where the xoxp token fails with a missing scope (e.g. set_status without users.profile:write) or an auth error (revoked/expired/unset token), so every tool keeps working on the browser session alone.

Required Slack OAuth Scopes (User Token)

channels:read, channels:history, groups:read, groups:history, im:read, im:history, im:write, mpim:read, mpim:history, mpim:write, chat:write, reactions:read, reactions:write, search:read, users:read, users:read.email, users.profile:read, users.profile:write, usergroups:read