claude-slack-event-channel-mcp

claude-slack-event-channel-mcp

A one-way MCP channel that forwards Slack events (messages and reactions) into a Claude Code session, enabling Claude to react to Slack activity without leaving the terminal.

Category
访问服务器

README

claude-slack-event-channel-mcp

A one-way (listen-only) Claude Code channel that forwards Slack events into a Claude Code session. It connects to Slack via Socket Mode, filters messages and reactions, and pushes them to Claude as <channel> notifications so Claude can react to things happening in Slack without leaving the terminal.

What is a channel?

A channel is an MCP server that Claude Code spawns as a subprocess and talks to over stdio. Instead of waiting for the user to type, the channel pushes events into the session. One-way channels (like this one) forward alerts, webhooks, or chat messages for Claude to act on; two-way channels also expose a reply tool so Claude can send messages back. This server is one-way: Slack → Claude only.

The channel contract is just three things, all implemented in main.ts:

  1. Declare the capability — the experimental: { 'claude/channel': {} } key in the McpServer constructor is what registers the notification listener and makes this an MCP server a channel.
  2. Emit notifications — for each Slack event, the server calls mcp.server.notification({ method: 'notifications/claude/channel', params: { content, meta } }).
  3. Connect over stdio — mcp.connect(new StdioServerTransport()); Claude Code owns the process.

The instructions string in the constructor is added to Claude's system prompt so Claude knows what these events mean and that the channel is one-way.

How an event reaches Claude

When a Slack event passes the filters, content becomes the body of a <channel> tag and each meta key becomes a tag attribute (the source attribute is filled in automatically from the server's configured name, slack). For example a thread reply arrives in Claude's context as:

<channel source="slack" kind="message" channel="C0123ABC" user="U0456DEF" ts="1718000000.000100" thread_ts="1718000000.000001">
deploy looks stuck, can you check?
</channel>

kind="reaction_added" / kind="reaction_removed" events carry a reaction emoji name and the target ts instead.

Note on meta keys: keys must be identifiers (letters, digits, underscores only). Keys with hyphens or other characters are silently dropped, which is why this server uses thread_ts, not thread-ts.

Delivery is fire-and-forget: notifications are not acknowledged. If the session hasn't loaded this server as a channel, or org policy blocks it, events are dropped silently with no error. Events that arrive while Claude is busy are queued and delivered together on the next turn.

Requirements

  • Bun
  • Claude Code v2.1.80 or later (channels are in research preview). On Team/Enterprise plans an admin must enable channels first.
  • A Slack app with Socket Mode enabled and an App-Level Token (xapp-...) carrying the connections:write scope. Subscribe the app to the events you want forwarded (message.channels, reaction_added, reaction_removed, …) and invite it to the target channels.

Install

bun install

Configure

Copy .env.example to .env and fill in the values (loaded via dotenv):

Variable Required Description
SLACK_APP_TOKEN yes App-Level Token (xapp-...), needs connections:write.
SLACK_WATCH_CHANNELS no Comma-separated channel IDs to forward. Empty = all channels.
SLACK_ALLOWED_SENDERS no Comma-separated user IDs / bot_ids allowed. Empty = allow all.

Security — this is a prompt injection vector. Every forwarded message becomes Claude's input. Anyone who can post in a watched channel can put text in front of Claude. Leaving SLACK_ALLOWED_SENDERS empty is only safe for channels that solely trust an alert bot; always set an allowlist when listening to human messages. The server gates on the sender's identity (user / bot_id), not the channel, so membership in a watched channel alone is not enough.

Register with Claude Code

Claude Code launches the server itself — you do not run it standalone. Add it to your MCP config so Claude Code spawns it as a subprocess. Project-level .mcp.json (relative path):

{
  "mcpServers": {
    "slack": { "command": "bun", "args": ["./main.ts"] }
  }
}

For user-level config in ~/.claude.json, use the absolute path to main.ts so it resolves from any project.

Run during the research preview

Custom channels aren't on the approved allowlist yet, so start Claude Code with the development flag (this bypasses the allowlist for this one entry after a confirmation prompt; org policy still applies):

claude --dangerously-load-development-channels server:slack

The first time, Claude Code asks for consent to use the new server from .mcp.json — select Use this MCP server. A dim notice under the startup banner confirms the channel is registered. Once running, posting in a watched Slack channel pushes the event straight into the session.

If events don't arrive, run /mcp in the session to check the server's status; "Failed to connect" usually means an import/dependency error — check ~/.claude/debug/<session-id>.txt.

Local development

You can run the server directly to verify it connects to Slack (it will throw if SLACK_APP_TOKEN is missing). Note that outside Claude Code there's no channel listener, so notifications go nowhere — this is only useful for checking the Socket Mode connection and your filters.

bun run start   # or: bun run dev  (watch mode)

Scripts

Script Description
bun run start Run the server.
bun run dev Run with file watching.
bun run check Biome lint + format (auto-fix).
bun run lint Biome lint only.
bun run format Biome format (write).
bun run typecheck TypeScript type check.

See also

推荐服务器

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 模型以安全和受控的方式获取实时的网络信息。

官方
精选