MCP 配置指南

如何为 OpenClaw 设置 Slack MCP

让 OpenClaw 读取 Slack 频道、总结讨论,并代表你发送消息。

Overview

The Slack MCP enables:

Prerequisites

Step 1 — Create a Slack App

  1. Go to api.slack.com/apps
  2. Click "Create New App" → "From scratch"
  3. Name it (e.g., "OpenClaw MCP") and select your workspace

Step 2 — Configure Bot Scopes

Go to "OAuth & Permissions" and add these Bot Token Scopes:

Step 3 — Enable Socket Mode

  1. Go to "Socket Mode" in sidebar
  2. Enable Socket Mode
  3. Generate an App-Level Token with connections:write scope
  4. Copy this token (starts with xapp-)

Step 4 — Install App to Workspace

  1. Go to "Install App" in sidebar
  2. Click "Install to Workspace"
  3. Authorize the requested permissions
  4. Copy the Bot User OAuth Token (starts with xoxb-)

Step 5 — Get IDs

Step 6 — Add Config to OpenClaw

Slack CLI Config json
{
  "Slack": {
    "command": "npx",
    "args": ["-y", "@modelcontextprotocol/server-slack"],
    "env": {
      "SLACK_BOT_TOKEN": "xoxb-REPLACE-WITH-YOUR-TOKEN",
      "SLACK_APP_TOKEN": "xapp-REPLACE-WITH-YOUR-TOKEN",
      "SLACK_TEAM_ID": "T0123456789",
      "SLACK_CHANNEL_IDS": "C0123456789,C9876543210",
      "MCP_MODE": "stdio"
    }
  }
}

Important: Store tokens as environment variables, not plaintext in config.

Step 7 — Verify

  1. Run openclaw status — Slack MCP should show as "running"
  2. Test: "What's the latest message in #general?"
  3. Test: "Summarize today's discussion in #engineering"

Common Errors

ErrorCauseFix
not_in_channel Bot not added to channel Invite bot: /invite @OpenClaw
invalid_auth Wrong or expired token Regenerate Bot Token, update config
missing_scope Required scope not added Add scope in OAuth & Permissions, reinstall app
channel_not_found Wrong channel ID Verify channel ID in Slack settings

Security Notes

Example Prompts

相关 MCP