Slack MCP Server Policy

Sandbox the Slack MCP server. It needs access to both the Slack API and the web UI.

What it needs

ResourceAccessDetails
FilesystemWrite onlyCache for OAuth tokens, rate-limit state
Networkslack.com + api.slack.comWeb UI + API endpoints
EnvSLACK_BOT_TOKEN, SLACK_TEAM_IDBot authentication

Complete Policy

command: ["node", "@modelcontextprotocol/server-slack"]

filesystem:
  read: []
  write:
    - "./cache"              # OAuth tokens, rate-limit state

network:
  allow:
    - "slack.com"            # Web UI
    - "api.slack.com"        # API

env:
  allow:
    - "SLACK_BOT_TOKEN"
    - "SLACK_TEAM_ID"
    - "HOME"

limits:
  memory_mb: 256
  timeout_s: 300

How to run

# Step 1: Install the server
npm install -g @modelcontextprotocol/server-slack

# Step 2: Set your tokens
export SLACK_BOT_TOKEN="xoxb-xxxxxxxxxxxx"
export SLACK_TEAM_ID="T0123456789"

# Step 3: Run sandboxed
warden run --policy policy-slack.yaml

Tips

  • Grant only cache under write, a write grant also includes read
  • Do not add a separate read: [] if write points to the same path
  • HOME is needed by Node.js libraries
  • SLACK_TEAM_ID looks optional but is required

Troubleshooting

ErrorFix
token not foundExport SLACK_BOT_TOKEN in the shell
Network blockedList both slack.com and api.slack.com
OAuth errorsGrant write access to the cache directory

Resources