mcp-slack

mcp-slack

MCP server that reads Slack through your own browser session, authenticating as you rather than a bot. Provides tools to search messages, retrieve channel/DM/thread history, resolve users, and post messages (write disabled by default).

Category
访问服务器

README

mcp-slack

An MCP server for reading Slack through your own browser session, for workspaces where installing a Slack app isn't an option. Ten tools: six primitives, three multi-call operations, one write that is off by default.

It authenticates as you, not as a bot. Everything you can see, it can read; anything it posts is indistinguishable from a message you typed. Browser-session auth is not an officially supported Slack integration path, so check your workspace's policies first.

The tools take explicit ranges and neutral defaults — no assumed reporting cadence, channel naming scheme, or truncation limit — so workflows can be built on top rather than baked in.

Install

Copy the d cookie from your browser (developer tools → Application → Cookies → https://app.slack.com) into ~/.slack-tokens.yml:

slack:
  - name: myworkspace.slack.com
    token: xoxd-your-cookie-value-here
    xoxc: null # auto-populated on first run

The short-lived xoxc API token is derived automatically and written back, so later runs skip that step. Both values are session credentials — chmod 600 the file, and expect to recopy the cookie whenever your browser session ends.

Then install the server and register it:

uv tool install --editable .
{
  "mcpServers": {
    "slack": {
      "command": "/Users/you/.local/bin/mcp-slack",
      "args": [],
      "lifecycle": "lazy"
    }
  }
}

To skip installing, point at the repo-root shim instead — it carries a PEP 723 header, so uv resolves dependencies on the fly: "command": "uv", "args": ["run", "/path/to/mcp-slack/server.py"].

Tools

Tool Purpose
slack_search Native Slack search syntax (from:@user, in:#channel, after:, has:link)
slack_channel_history Messages from one channel over a time window
slack_thread Every reply in a thread
slack_dm_history DM history with one person
slack_user Resolve a username or user ID to a profile
slack_list_channels Channel discovery by glob and member count (expensive)

Three tools stitch many calls into one result. They exist because their deduplication isn't reproducible from outside: a message found by search, by channel history, and by thread expansion is the same message, and only the server sees all three passes.

Tool Purpose
slack_user_activity Everything one person said or received in a range, with optional surrounding context and thread expansion, grouped by channel
slack_channels_history History for many channels at once, by list or glob, with replies nested under their parents
slack_profiles Batch profiles with custom fields resolved to labels

Time ranges accept YYYY-MM-DD, an epoch, or a relative offset like -7d.

slack_post_message posts as you, and refuses unless SLACK_MCP_ALLOW_WRITE=1 is set in the server's environment:

"env": { "SLACK_MCP_ALLOW_WRITE": "1" }

Behavior worth knowing

  • A channel with no messages can't be resolved by name. Names resolve via search.messages, because conversations.list is throttled to the point of uselessness on Enterprise Grid — measured at 11m48s of consecutive 429 backoffs without reaching the target channel. Pass a channel ID (C…) for empty or archived channels, and prefer a channel name over slack_list_channels, which still enumerates and may return rate_limited.

  • Glob discovery only sees channels you've joined. It uses users.conversations for the same throttling reason.

  • Failures come back as data, not exceptions: {"error": "not_found", ...}. Codes are not_found, rate_limited, auth_failed, and write_disabled. An expired cookie shows up as auth_failed.

  • Rate-limit waits are bounded. A cumulative sleep budget (45s, reset each tool call) means a call returns rate_limited rather than hanging. Library callers who don't mind waiting can raise it: SlackClient(ws, wait_budget=600).

  • Messages are projected, not passed through. Raw Slack records run to several KB each; tools return ts, time, user, user_name, text, and permalink, plus thread fields when meaningful. Mentions and links are rewritten to readable text, and permalinks are built locally, so citing a message costs no extra call.

  • Lookups are cached, message content is not. One JSON file per workspace, with a timestamp per entry:

    Cached TTL
    DM channel ID never assigned once per pair of users
    user name → ID 30d only a handle change invalidates it
    user ID → name 7d display names change occasionally
    channel name → ID 7d renames are rare but real
    team profile schema 30d effectively static
    channel member counts 24h drifts slowly, only gates a filter
    failed lookups 1h stops a typo being re-searched in a loop

    A negative is only recorded after a search completes and matches nothing, so a rate limit or transport error is never cached as "does not exist".

Library use

The multi-call operations are plain functions in slack_mcp/aggregate.py (user_activity, channels_history, profiles) taking an explicit SlackClient. Import them directly rather than speaking MCP to a subprocess.

License

MIT

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选