Slack Notify MCP

Slack Notify MCP

MCP server for posting messages to Slack channels via webhooks or bot API. Supports configurable usernames, emojis, and both webhook and bot token authentication modes.

Category
访问服务器

README

Slack Webhook MCP Server

A Model Context Protocol (MCP) server for posting messages to Slack via webhooks or bot tokens.

Features

  • Two modes of operation: Webhooks or Bot API
  • Post messages to Slack channels
  • Support for channel overrides
  • Configurable bot username and emoji
  • Slack-specific mention support (<!channel>, <!here>, <@USERID>)
  • Comprehensive error handling and validation

Installation

bun install

Setup

Option 1: Webhook Mode (Simple)

  1. Create a Slack App and Webhook:

    • Go to Slack API Apps
    • Create a new app or select an existing one
    • Navigate to "Incoming Webhooks"
    • Enable incoming webhooks
    • Add a new webhook to your workspace
    • Copy the webhook URL (format: https://hooks.slack.com/services/T.../B.../...)
  2. Configure MCP Client:

{
  "mcpServers": {
    "slack-webhook": {
      "command": "bun",
      "args": [
        "run", 
        "src/index.ts",
        "--webhook-url",
        "https://hooks.slack.com/services/YOUR/SLACK/WEBHOOK",
        "--channel",
        "#general"
      ],
      "cwd": "/path/to/slack-webhook-mcp-server"
    }
  }
}

Option 2: Bot Token Mode (Advanced)

  1. Create a Slack App with Bot Token:

    • Go to Slack API Apps
    • Create a new app or select an existing one
    • Go to "OAuth & Permissions"
    • Add bot token scopes: chat:write, chat:write.public
    • Install app to workspace
    • Copy the "Bot User OAuth Token" (starts with xoxb-)
  2. Get Channel IDs:

    • Right-click on channel in Slack → "View channel details" → Copy channel ID
    • Or use Slack API to list channels
  3. Configure MCP Client:

{
  "mcpServers": {
    "slack-bot": {
      "command": "bun",
      "args": [
        "run", 
        "src/index.ts",
        "--bot-token",
        "xoxb-YOUR-BOT-TOKEN",
        "--channel",
                  "CXXXXXXXXXX",
        "--username",
        "MCP Bot"
      ],
      "cwd": "/path/to/slack-webhook-mcp-server"
    }
  }
}

Usage

Command Line Arguments

Webhook Mode:

  • --webhook-url <url> - Slack webhook URL (required)
  • --channel <channel> - Default channel name (optional, e.g., "#general")

Bot Mode:

  • --bot-token <token> - Slack bot token (required, starts with xoxb-)
  • --channel <channel> - Default channel ID (required, e.g., "CXXXXXXXXXX")

Common Options:

  • --username <username> - Default bot username (optional)
  • --icon-emoji <emoji> - Default bot emoji (optional, e.g., ":robot_face:")
  • --help - Show help message

Examples

Webhook Mode:

bun run src/index.ts \
  --webhook-url "https://hooks.slack.com/services/T00000000/B00000000/XXXXXXXXXXXXXXXXXXXXXXXX" \
  --channel "#general" \
  --username "Assistant"

Bot Mode:

bun run src/index.ts \
  --bot-token "xoxb-YOUR-BOT-TOKEN" \
  --channel "CXXXXXXXXXX" \
  --username "Assistant"

Available Tools

post_slack_message

Post a message to your configured Slack integration.

Parameters:

  • message (required): The message content to send (max 4000 characters)
  • channel (optional): Channel to post to (overrides default)
    • Webhook mode: Channel name (e.g., "#random")
    • Bot mode: Channel ID (e.g., "CXXXXXXXXXX")
  • username (optional): Override the default username for this message
  • icon_emoji (optional): Override the default emoji for this message

Example usage in MCP client:

Please post "Hello from MCP!" to the general channel

Mode Comparison

Feature Webhook Mode Bot Mode
Setup Simple Requires OAuth setup
Channel Reference Names (#general) IDs (CXXXXXXXXXX)
Permissions Limited to webhook channel Configurable scopes
Rate Limits Higher Standard API limits
Features Basic messaging Full API access
Authentication URL-based Token-based

Slack-Specific Features

Mentions

  • User mention: <@U1234567890>
  • Channel notification: <!channel>
  • Here notification: <!here>

Channel References

  • Webhook mode: Use #channel-name format
  • Bot mode: Use channel IDs like CXXXXXXXXXX

Development

Scripts

  • bun run start - Start the server
  • bun run dev - Start with file watching
  • bun run build - Build for production

Project Structure

slack-webhook-mcp-server/
├── package.json          # Dependencies and scripts
├── src/
│   └── index.ts         # Main server implementation  
├── types/
│   └── slack.ts         # TypeScript types and schemas
└── README.md            # This file

Error Handling

The server includes comprehensive error handling for:

  • Invalid webhook URLs and bot tokens
  • Network connectivity issues
  • Slack API errors (different handling for webhook vs bot)
  • Message length validation (4000 char limit)
  • Channel ID validation (bot mode)
  • Malformed requests

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

官方
精选