Slack-MCP

Slack-MCP

A Message Control Protocol server that integrates with Slack to provide channel management, messaging capabilities, and log monitoring across multiple servers, enabling teams to share logs and receive automated alerts in Slack channels.

Category
访问服务器

README

slack-mcp

MCP server for Slack with log monitoring capabilities

🚀 Features

Core Slack Integration

  • Channel Management: Join channels and retrieve message history
  • Messaging: Post messages and threaded replies
  • Commands: Execute Slack slash commands
  • Reactions: Add emoji reactions to messages
  • Authentication: Verify identity and permissions

Log Monitoring & Team Collaboration

  • Server Log Reading: Access logs from any MCP server or application
  • Automated Alerts: Post log analysis to Slack channels
  • Team Debugging: Share logs instantly with team members
  • Multi-Server Monitoring: Monitor logs from multiple services

🏗️ Architecture

┌─────────────────────┐    ┌─────────────────────┐    ┌─────────────────────┐
│    User/Team        │───▶│   Pipeline-Toolkit  │───▶│   Slack-MCP-Logger  │
│  (Natural Language) │    │   (AI Orchestrator) │    │   (Slack Specialist)│
└─────────────────────┘    └─────────────────────┘    └─────────────────────┘
                                      ▲                          │
                                      │                          ▼
                           ┌─────────────────────┐    ┌─────────────────────┐
                           │   Log Files         │    │    Slack API        │
                           │ • pipeline_bot.log  │    │ • Channels          │
                           │ • testing_farm.log  │    │ • Messages          │
                           │ • application.log   │    │ • Reactions         │
                           │ • error.log         │    │ • Commands          │
                           └─────────────────────┘    └─────────────────────┘

Workflow Example

  1. User: "Check recent pipeline logs and alert team if errors found"
  2. Pipeline-Toolkit AI: Understands intent, orchestrates actions
  3. Slack-MCP-Logger:
    • Reads logs via get_server_logs()
    • Posts alerts via post_message()
    • Adds reactions via add_reaction()
  4. Result: Team gets notified in Slack with actionable log data

🛠️ Built-in Tools

1. Channel Management

get_channel_history(channel_id: str) -> list[dict]
join_channel(channel_id: str, skip_log: bool = False) -> bool

2. Messaging

post_message(channel_id: str, message: str, thread_ts: str = "", skip_log: bool = False) -> bool
post_command(channel_id: str, command: str, text: str, skip_log: bool = False) -> bool

3. Reactions & Interactions

add_reaction(channel_id: str, message_ts: str, reaction: str) -> bool

4. Authentication

whoami() -> str

5. 🆕 Log Monitoring

get_server_logs(log_file_path: str, lines: int = 50) -> str

📋 Usage Examples

Log Monitoring & Team Alerts

# Read recent pipeline logs
logs = get_server_logs("logs/pipeline_bot.log", 100)

# Alert team with logs
post_message("C-DEV-TEAM", f"🚨 Pipeline Issues:\n{logs}")

# Mark for urgent attention  
add_reaction("C-DEV-TEAM", message_ts, "rotating_light")

Automated Monitoring Workflow

# Check multiple log sources
pipeline_logs = get_server_logs("logs/pipeline_bot.log", 50)
error_logs = get_server_logs("/var/log/app/error.log", 30)

# Post to different channels based on content
if "ERROR" in pipeline_logs:
    post_message("C-ALERTS", f"⚠️ Pipeline errors:\n{pipeline_logs}")
    
if "CRITICAL" in error_logs:
    post_message("C-INCIDENTS", f"🚨 Critical app errors:\n{error_logs}")

Daily Team Updates

# Morning standup automation
daily_logs = get_server_logs("logs/pipeline_bot.log", 200)
post_message("C-STANDUP", f"☀️ Overnight activity summary:\n{daily_logs}")

🚀 Running with Podman or Docker

You can run the slack-mcp server in a container using Podman or Docker:

Example configuration for running with Podman:

{
  "mcpServers": {
    "slack": {
      "command": "podman",
      "args": [
        "run",
        "-i",
        "--rm",
        "-e", "SLACK_XOXC_TOKEN",
        "-e", "SLACK_XOXD_TOKEN",
        "-e", "MCP_TRANSPORT",
        "-e", "LOGS_CHANNEL_ID",
        "quay.io/redhat-ai-tools/slack-mcp"
      ],
      "env": {
        "SLACK_XOXC_TOKEN": "xoxc-...",
        "SLACK_XOXD_TOKEN": "xoxd-...",
        "MCP_TRANSPORT": "stdio",
        "LOGS_CHANNEL_ID": "C7000000",
      }
    }
  }
}

🌐 Running with non-stdio transport

To run the server with a non-stdio transport (such as SSE), set the MCP_TRANSPORT environment variable to a value other than stdio (e.g., sse).

Example configuration to connect to a non-stdio MCP server:

{
  "mcpServers": {
    "slack": {
      "url": "https://slack-mcp.example.com/sse",
      "headers": {
        "X-Slack-Web-Token": "xoxc-...",
        "X-Slack-Cookie-Token": "xoxd-..."
      }
    }
  }
}

🔐 Authentication

Extract your Slack XOXC and XOXD tokens easily using browser extensions or Selenium automation: https://github.com/maorfr/slack-token-extractor.

🔧 Environment Variables

  • SLACK_XOXC_TOKEN: Slack web token (required)
  • SLACK_XOXD_TOKEN: Slack cookie token (required)
  • MCP_TRANSPORT: Transport mode (stdio or sse, default: stdio)
  • LOGS_CHANNEL_ID: Channel ID for logging MCP operations (required)
  • LOG_BASE_PATH: Optional base path for log file access security

🤝 Integration with Pipeline-Toolkit

This MCP server works seamlessly with Pipeline-Toolkit to provide:

  • Natural Language Processing: Ask questions in plain English
  • Intelligent Tool Selection: AI chooses the right tools automatically
  • Multi-Server Coordination: Monitor logs from multiple MCP servers
  • Team Collaboration: Share insights and alerts through Slack

Example Integration

# In Pipeline-Toolkit
"Check recent logs and update the team if there are any errors"

# Results in:
# 1. get_server_logs("logs/pipeline_bot.log", 100)
# 2. AI analysis of log content
# 3. post_message("C-TEAM", error_summary) if issues found
# 4. add_reaction() for team attention

📊 Use Cases

  • DevOps Monitoring: Automated log analysis and team alerts
  • Incident Response: Quick log sharing and team coordination
  • Daily Standups: Automated activity summaries
  • Build Monitoring: Pipeline status updates and failure alerts
  • Multi-Service Debugging: Centralized log access across services

推荐服务器

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

官方
精选