Skip to main content
Glama

Slack MCP 服务器

适用于 Slack 工作区的模型上下文协议 (MCP) 服务器。此集成支持 Stdio 和 SSE 传输、代理设置,并且不需要工作区管理员创建或批准任何权限或机器人😏。

功能演示

ezgif-316311ee04f444

工具

  1. conversations_history

  • 通过频道ID获取频道消息

  • 必需输入:

    • channel_id (字符串):频道 ID,格式为 Cxxxxxxxxxx。

    • cursor (字符串):用于分页的游标。使用响应中最后一行和最后一列的值作为上一个请求返回的 next_cursor 字段。

    • limit (数字,默认值:28):要获取的消息数量限制。

  • 返回:带有时间戳、用户 ID 和文本内容的消息列表

  1. channels_list

  • 获取频道列表

  • 必需输入:

    • channel_types (数组):可能的频道类型。允许的值:'mpim'、'im'、'public_channel'、'private_channel'。

    • sort (字符串):排序类型。允许的值:'popularity' - 按每个频道的成员/参与者数量排序。

  • 返回:频道列表

Related MCP server: Slack MCP Server

设置指南

1.身份验证设置

在浏览器中打开 Slack 并登录。

查找SLACK_MCP_XOXC_TOKEN

  • 打开浏览器的开发者控制台。

  • 在 Firefox 中,在菜单栏中的Tools -> Browser Tools -> Web Developer tools下

  • 在 Chrome 中,点击 URL 栏右侧的“三个点”按钮,然后选择More Tools -> Developer Tools

  • 切换到控制台选项卡。

  • 输入“允许粘贴”并按 ENTER。

  • 粘贴以下代码片段并按 ENTER 执行: JSON.parse(localStorage.localConfig_v2).teams[document.location.pathname.match(/^\/client\/([A-Z0-9]+)/)[1]].token

令牌值在执行命令后立即打印(以xoxc-开头),暂时将其保存在某处。

查找SLACK_MCP_XOXD_TOKEN

  • 切换到“应用程序”选项卡,然后在左侧导航窗格中选择“Cookies”。

  • 找到名称为d Cookie。没错,就是字母d 。

  • 双击此 cookie 的值。

  • 按 Ctrl+C 或 Cmd+C 将其值复制到剪贴板。

  • 保存以供以后使用。

2.安装

选择以下安装方法之一:

3.配置和使用

您可以使用命令行参数和环境变量配置 MCP 服务器。

使用 npx

如果您已安装 npm,这是在 Claude Desktop 上开始使用slack-mcp-server最快方法。

打开claude_desktop_config.json并将 mcp 服务器添加到mcpServers列表中:

{
  "mcpServers": {
    "slack": {
      "command": "npx",
      "args": [
        "-y",
        "slack-mcp-server@latest",
        "--transport",
        "stdio"
      ],
      "env": {
        "SLACK_MCP_XOXC_TOKEN": "xoxc-...",
        "SLACK_MCP_XOXD_TOKEN": "xoxd-..."
      }
    }
  }
}
{
  "mcpServers": {
    "slack": {
      "command": "docker",
      "args": [
        "run",
        "-i",
        "--rm",
        "-e",
        "SLACK_MCP_XOXC_TOKEN=$SLACK_MCP_XOXC_TOKEN",
        "-e",
        "SLACK_MCP_XOXD_TOKEN=$SLACK_MCP_XOXD_TOKEN",
        "ghcr.io/korotovsky/slack-mcp-server",
        "mcp-server",
        "--transport",
        "stdio"
      ],
      "env": {
        "SLACK_MCP_XOXC_TOKEN": "xoxc-...",
        "SLACK_MCP_XOXD_TOKEN": "xoxd-..."
      }
    }
  }
}

请参阅Docker以了解更多信息。

使用 npx 和sse传输:

如果您想在sse模式下运行它,那么您应该使用 Claude Desktop 的mcp-remote包装器,并在某处部署/公开 MCP 服务器,例如使用ngrok或docker-compose 。

{
  "mcpServers": {
    "slack": {
      "command": "npx",
      "args": [
        "-y",
        "mcp-remote",
        "https://x.y.z.q:3001/sse",
        "--header",
        "Authorization: Bearer ${SLACK_MCP_SSE_API_KEY}"
      ],
      "env": {
        "SLACK_MCP_SSE_API_KEY": "my-$$e-$ecret"
      }
    }
  }
}
{
  "mcpServers": {
    "slack": {
      "command": "C:\\Progra~1\\nodejs\\npx.cmd",
      "args": [
        "-y",
        "mcp-remote",
        "https://x.y.z.q:3001/sse",
        "--header",
        "Authorization: Bearer ${SLACK_MCP_SSE_API_KEY}"
      ],
      "env": {
        "SLACK_MCP_SSE_API_KEY": "my-$$e-$ecret"
      }
    }
  }
}

TLS 和暴露到互联网

您可能需要为 SSE 设置 HTTPS 的原因有几个。

  • mcp-remote只能处理 https 方案;

  • 对于任何暴露在互联网上的服务,使用 TLS 通常是一种很好的做法;

您可以使用ngrok :

ngrok http 3001

然后使用端点https://903d-xxx-xxxx-xxxx-10b4.ngrok-free.app作为您的mcp-remote参数。

使用 Docker

有关所有环境变量的详细信息,请参阅 环境变量。

export SLACK_MCP_XOXC_TOKEN=xoxc-...
export SLACK_MCP_XOXD_TOKEN=xoxd-...

docker pull ghcr.io/korotovsky/slack-mcp-server:latest
docker run -i --rm \
  -e SLACK_MCP_XOXC_TOKEN \
  -e SLACK_MCP_XOXD_TOKEN \
  slack-mcp-server --transport stdio

或者,docker-compose 方式:

wget -O docker-compose.yml https://github.com/korotovsky/slack-mcp-server/releases/latest/download/docker-compose.yml
wget -O .env https://github.com/korotovsky/slack-mcp-server/releases/latest/download/default.env.dist
nano .env # Edit .env file with your tokens from step 1 of the setup guide
docker-compose up -d

控制台参数

争论

必需的 ?

描述

--transport或-t

是的

选择 MCP 服务器的传输方式,可能的值有: stdio , sse

环境变量

多变的

必需的 ?

默认

描述

SLACK_MCP_XOXC_TOKEN

是的

nil

来自 POST 数据字段集的身份验证数据令牌字段token ( xoxc-... )

SLACK_MCP_XOXD_TOKEN

是的

nil

来自 cookie d身份验证数据令牌( xoxd-... )

SLACK_MCP_SERVER_PORT

不

3001

MCP 服务器监听的端口

SLACK_MCP_SERVER_HOST

不

127.0.0.1

MCP 服务器监听的主机

SLACK_MCP_SSE_API_KEY

不

nil

transport为sse时的授权承载令牌

SLACK_MCP_PROXY

不

nil

MCP 服务器使用的代理 URL

SLACK_MCP_SERVER_CA

不

nil

信任库的 CA 证书路径

SLACK_MCP_SERVER_CA_INSECURE

不

false

信任所有不安全的请求(不推荐)

调试工具

# Run the inspector with stdio transport
npx @modelcontextprotocol/inspector go run mcp/mcp-server.go --transport stdio

# View logs
tail -n 20 -f ~/Library/Logs/Claude/mcp*.log

安全

  • 切勿共享 API 令牌

  • 确保 .env 文件的安全性和私密性

执照

采用 MIT 许可 - 请参阅LICENSE文件。本产品并非 Slack 官方产品。

Available Tools

2 tools
channels_listC

Get list of channels

Inputs: channel_types (required), sort.

conversations_historyB

Get messages from the channel by channel_id, the last row/column in the response is used as 'cursor' parameter for pagination if not empty

Inputs: channel_id (required), cursor, limit.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    B3/5.0

    Scored across 2 tools

    Disambiguation5/5

    The two tools have clearly distinct purposes: channels_list retrieves a list of channels, while conversations_history fetches messages from a specific channel. There is no overlap in functionality, making it easy for an agent to select the correct tool based on the task.

    Naming Consistency4/5

    Both tools follow a consistent snake_case naming convention, but the patterns differ slightly: channels_list uses a noun_verb format, while conversations_history uses a noun_noun format. This minor deviation prevents a perfect score, but the naming is still readable and mostly consistent.

    Tool Count2/5

    With only 2 tools, this server feels too thin for a Slack integration, as it lacks essential operations like sending messages, managing users, or updating channel settings. The scope is severely limited, making it difficult for agents to perform comprehensive Slack-related tasks.

    Completeness2/5

    The tool surface is significantly incomplete for a Slack domain. While it covers listing channels and retrieving message history, it misses critical operations such as posting messages, creating channels, or handling reactions, which are core to Slack workflows and will likely cause agent failures.

    Maintenance

    ActivityInactive
    ResponsivenessMostly unanswered

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      Not graded
      quality
      D
      maintenance
      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.
      11 npm
      MIT
    • A
      license
      Not graded
      quality
      D
      maintenance
      A Model Context Protocol (MCP) server for Slack workspace integration. This server allows AI assistants to interact directly with your Slack workspace, providing tools to manage channels, send messages, list users, and upload files.
      1
      MIT
    • A
      license
      Not graded
      quality
      C
      maintenance
      A production-ready MCP server for the Slack API that enables searching, listing channels, reading history, inspecting users, fetching threads, and sending messages through controlled Slack tools.
      MIT