Skip to main content
Glama
hamas

Spark Assistant for Slack - MCP Server

by hamas

Spark Assistant for Slack - MCP Server

一个用于与 Slack 工作区交互的 Model Context Protocol (MCP) 服务器,专为 Spark Assistant 定制。该服务器提供工具,用于列出频道、发布消息、回复线程、添加表情符号回应、获取频道历史记录、查看用户资料以及测试 Slack API 身份验证。


⚡ 快速开始

  1. 安装依赖并构建:

    npm install
    npm run build
  2. 配置环境变量:.env.example 复制为 .env 并填写你的 Slack 凭据:

    cp .env.example .env
    SLACK_BOT_TOKEN=xoxb-your-slack-bot-token
    SLACK_TEAM_ID=T00000000
  3. 运行服务器:

    # Standard stdio mode (for Claude Desktop / Antigravity / Cursor / Windsurf)
    node dist/index.js
    
    # HTTP mode on port 3000
    node dist/index.js --transport http --port 3000

Related MCP server: Slack MCP Server

🛠️ 可用工具

  1. slack_auth_test

    • 测试机器人令牌身份验证,并获取已连接的工作区和机器人用户详情

    • 返回:工作区名称、团队 ID、机器人用户 ID 以及身份验证 URL

  2. slack_list_channels

    • 列出机器人所属的公共和私有频道,或工作区中预定义的频道

    • 可选输入:limit(默认:100,最大:200)、cursor(分页)

  3. slack_post_message

    • 向 Slack 频道或私信用户发布新消息

    • 必需输入:channel_idtext

  4. slack_reply_to_thread

    • 回复 Slack 中的特定消息线程

    • 必需输入:channel_idthread_tstext

  5. slack_add_reaction

    • 向消息添加表情符号回应

    • 必需输入:channel_idtimestampreaction(不带冒号的表情符号名称)

  6. slack_get_channel_history

    • 获取频道中的最近消息

    • 必需输入:channel_id | 可选:limit(默认:10)

  7. slack_get_thread_replies

    • 获取消息线程中的所有回复

    • 必需输入:channel_idthread_ts

  8. slack_get_users

    • 获取带有基本资料信息的工作区用户列表

    • 可选输入:cursorlimit(默认:100,最大:200)

  9. slack_get_user_profile

    • 获取特定用户的详细资料信息

    • 必需输入:user_id

Slack 机器人设置

要使用此 MCP 服务器,你需要创建一个 Slack 应用并使用必要的权限进行配置:

1. 创建 Slack 应用

  • 访问 Slack 应用页面

  • 点击“创建新应用”

  • 选择“从零开始”

  • 为你的应用命名并选择你的工作区

2. 配置机器人令牌作用域

导航到“OAuth 与权限”并添加以下作用域:

  • channels:history - 查看公共频道中的消息和其他内容

  • channels:read - 查看基本频道信息

  • chat:write - 以应用身份发送消息

  • reactions:write - 向消息添加表情符号回应

  • users:read - 查看用户及其基本信息

  • users.profile:read - 查看用户的详细资料

3. 将应用安装到工作区

  • 点击“安装到工作区”并授权该应用

  • 保存以 xoxb- 开头的“机器人用户 OAuth 令牌”

4. 获取你的团队 ID

按照此指南获取你的团队 ID(以 T 开头)

5. 将机器人添加到频道(可选)

为了让机器人能够访问私有频道或发布消息,你可能需要使用 /invite @your-bot-name 将其邀请到特定频道

功能

  • 多种传输支持:支持 stdio 和 Streamable HTTP 传输

  • 现代 MCP SDK:已更新为使用最新的 MCP SDK(v1.13.2)和现代 API

  • 全面的 Slack 集成:包含完整的 Slack 操作集:

    • 列出频道(支持预定义频道)

    • 发布消息

    • 回复线程

    • 添加回应

    • 获取频道历史记录

    • 获取线程回复

    • 列出用户

    • 获取用户资料

安装

本地开发

npm install
npm run build

全局安装(NPM)

npm install -g @zencoderai/slack-mcp-server

Docker 安装

# Build the Docker image locally
docker build -t slack-mcp-server .

# Or pull from Docker Hub
docker pull zencoderai/slack-mcp:latest

# Or pull a specific version
docker pull zencoderai/slack-mcp:1.0.0

配置

设置以下环境变量:

export SLACK_BOT_TOKEN="xoxb-your-bot-token"
export SLACK_TEAM_ID="your-team-id"
export SLACK_CHANNEL_IDS="channel1,channel2,channel3"  # Optional: predefined channels
export AUTH_TOKEN="your-auth-token"  # Optional: Bearer token for HTTP authorization (Streamable HTTP transport only)

使用方法

命令行选项

slack-mcp [options]

Options:
  --transport <type>     Transport type: 'stdio' or 'http' (default: stdio)
  --port <number>        Port for HTTP server when using Streamable HTTP transport (default: 3000)
  --token <token>        Bearer token for HTTP authorization (optional, can also use AUTH_TOKEN env var)
  --help, -h             Show this help message

本地使用示例

使用 slack-mcp 命令(全局安装后)

# Use stdio transport (default)
slack-mcp

# Use stdio transport explicitly
slack-mcp --transport stdio

# Use Streamable HTTP transport on default port 3000
slack-mcp --transport http

# Use Streamable HTTP transport on custom port
slack-mcp --transport http --port 8080

# Use Streamable HTTP transport with custom auth token
slack-mcp --transport http --token mytoken

# Use Streamable HTTP transport with auth token from environment variable
AUTH_TOKEN=mytoken slack-mcp --transport http

直接使用 node(用于开发)

# Use stdio transport (default)
node dist/index.js

# Use stdio transport explicitly
node dist/index.js --transport stdio

# Use Streamable HTTP transport on default port 3000
node dist/index.js --transport http

# Use Streamable HTTP transport on custom port
node dist/index.js --transport http --port 8080

# Use Streamable HTTP transport with custom auth token
node dist/index.js --transport http --token mytoken

# Use Streamable HTTP transport with auth token from environment variable
AUTH_TOKEN=mytoken node dist/index.js --transport http

Docker 使用示例

直接使用 Docker

# Run with stdio transport (default)
docker run --rm \
  -e SLACK_BOT_TOKEN="xoxb-your-bot-token" \
  -e SLACK_TEAM_ID="your-team-id" \
  zencoderai/slack-mcp:latest

# Run with HTTP transport on port 3000
docker run --rm -p 3000:3000 \
  -e SLACK_BOT_TOKEN="xoxb-your-bot-token" \
  -e SLACK_TEAM_ID="your-team-id" \
  zencoderai/slack-mcp:latest --transport http

# Run with HTTP transport on custom port
docker run --rm -p 8080:8080 \
  -e SLACK_BOT_TOKEN="xoxb-your-bot-token" \
  -e SLACK_TEAM_ID="your-team-id" \
  zencoderai/slack-mcp:latest --transport http --port 8080

# Run with custom auth token
docker run --rm -p 3000:3000 \
  -e SLACK_BOT_TOKEN="xoxb-your-bot-token" \
  -e SLACK_TEAM_ID="your-team-id" \
  -e AUTH_TOKEN="mytoken" \
  zencoderai/slack-mcp:latest --transport http

使用 Docker Compose

创建 docker-compose.yml 文件:

version: '3.8'

services:
  slack-mcp:
    # Use published image:
    image: zencoderai/slack-mcp:latest
    # Or build locally:
    # build: .
    environment:
      - SLACK_BOT_TOKEN=xoxb-your-bot-token
      - SLACK_TEAM_ID=your-team-id
      - SLACK_CHANNEL_IDS=channel1,channel2,channel3  # Optional
      - AUTH_TOKEN=your-auth-token  # Optional for HTTP transport
    ports:
      - "3000:3000"  # Only needed for HTTP transport
    command: ["--transport", "http"]  # Optional: specify transport type
    restart: unless-stopped

然后运行:

# Start the service
docker compose up -d

# View logs
docker compose logs -f slack-mcp

# Stop the service
docker compose down

传输类型

Stdio 传输

  • 用例:命令行工具和直接集成

  • 通信方式:标准输入/输出流

  • 默认:是

Streamable HTTP 传输

  • 用例:远程服务器和基于 Web 的集成

  • 通信方式:HTTP POST 请求以及可选的 Server-Sent Events 流

  • 功能

    • 会话管理

    • 双向通信

    • 可恢复连接

    • RESTful API 端点

    • Bearer 令牌身份验证

身份验证(仅限 Streamable HTTP 传输)

使用 Streamable HTTP 传输时,服务器支持 Bearer 令牌身份验证:

  1. 命令行:使用 --token <token> 指定自定义令牌

  2. 环境变量:设置 AUTH_TOKEN=<token> 作为备用

  3. 自动生成:如果两者均未提供,则生成随机令牌

命令行选项优先于环境变量。请使用 Authorization: Bearer <token> 请求头在 HTTP 请求中包含该令牌。

故障排除

如果遇到权限错误,请确认:

  1. 所有必需的作用域都已添加到你的 Slack 应用中

  2. 应用已正确安装到你的工作区

  3. 令牌和工作区 ID 已正确复制到你的配置中

  4. 应用已添加到它需要访问的频道中

开发

构建

npm run build

监听模式

npm run watch

API 端点(Streamable HTTP 传输)

使用 Streamable HTTP 传输时,服务器会暴露以下端点:

  • POST /mcp - 客户端到服务器的通信

  • GET /mcp - 服务器到客户端的通知(Server-Sent Events 流)

  • DELETE /mcp - 会话终止

与上一版本相比的更改

  • 更新 MCP SDK:从 v1.0.1 升级到 v1.13.2

  • 现代 API:从底层 Server 类迁移到高层 McpServer 类

  • Zod 验证:使用 Zod 添加了合适的模式验证

  • 传输灵活性:增加了对 Streamable HTTP 传输的支持

  • 命令行界面:增加了用于选择传输方式的 CLI 参数

  • 会话管理:为 HTTP 传输实现了合适的会话处理

  • 更好的错误处理:改进了错误处理和日志记录

F
license - not found
Not graded
quality - not tested
C
maintenance

Maintenance

Maintainers
Response time
Release cycle
Releases (12mo)
Commit activity

Resources

Unclaimed servers have limited discoverability.

Looking for Admin?

If you are the server author, to access and configure the admin panel.

Related MCP Servers

  • A
    license
    A
    quality
    D
    maintenance
    Interact with Slack Workspaces over the Slack API. Supports stdio and Streamable HTTP transport. Extended from Anthropic's archived server
    8
    771
    75
    MIT
  • A
    license
    A
    quality
    B
    maintenance
    Enables AI assistants to interact with Slack workspaces through comprehensive channel management, messaging, direct messages, search functionality, and user management capabilities.
    30
    7
    2
    MIT
  • F
    license
    Not graded
    quality
    D
    maintenance
    Enables AI assistants to interact with Slack workspaces through natural language, supporting channel management, message operations, user profiles, reactions, and threaded conversations.

View all related MCP servers

Related MCP Connectors

  • Operate Linux, macOS and Windows from your LLM. Every action runs through an auditable allowlist.

  • Voice and chat for AI agents — Discord, Teams, Meet, Slack, Zoom, Telegram, WhatsApp, NC Talk, SIP

  • Catch up on Slack without reading it. Unreads, threads, search. Browser-session or hosted OAuth.

View all MCP Connectors

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/hamas/Spark-Assistant-for-Slack---MCP'

If you have feedback or need assistance with the MCP directory API, please join our Discord server