Skip to content

anima-research/slack-mcpl

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

slack-mcpl

Standalone Slack MCPL server: connects a Slack workspace (channels, private channels, DMs, group DMs) to an MCPL host as a first-class channel surface. Sibling of discord-mcpl, built on @connectome/mcpl-core.

Works in plain MCP mode too (tools only, no push events or channels).

Features

  • Channels: every conversation the bot can act in is registered as an MCPL channel (slack:<conversationId>); channels/publish replies into the active thread of the conversation automatically.
  • Real-time events via Socket Mode — no public webhook URL needed, so the server can be spawned over stdio like any other MCPL server.
  • Addressing model: mentions (<@bot>) and DMs are always delivered; ambient channel chatter flows only from subscribed conversations (auto-subscribe on first mention, opt out with unsubscribe_channel). Events carry MCPL RFC-001 chat:* tags for host-side wake gating.
  • Threads: incoming thread replies carry threadId; reply_message posts into a message's thread; fetch_thread reads one (Slack's channel-level history API does not include thread replies).
  • Attachments: incoming files are forwarded as refs and fetched on demand via fetch_attachment, which is auth-locked to files.slack.com (the bot token is never sent to any other host) and size-capped at 5MB.
  • Rollback: slack.messaging supports MCPL checkpoints — rolling back deletes the messages the bot sent after the checkpoint (best-effort).

Tools

send_message, reply_message, send_dm, add_reaction, edit_message, delete_message, list_channels, refresh_channels, fetch_history, fetch_thread, find_user, fetch_attachment, subscribe_channel, unsubscribe_channel, list_subscriptions.

Feature sets: slack.messaging (rollback-capable), slack.history, slack.subscriptions.

Setup

1. Create the Slack app

Go to https://api.slack.com/appsCreate New AppFrom a manifest, and paste:

display_information:
  name: Connectome Agent
features:
  bot_user:
    display_name: connectome-agent
    always_online: true
oauth_config:
  scopes:
    bot:
      - channels:history
      - channels:read
      - groups:history
      - groups:read
      - im:history
      - im:read
      - im:write
      - mpim:history
      - mpim:read
      - chat:write
      - users:read
      - reactions:write
      - files:read
settings:
  event_subscriptions:
    bot_events:
      - message.channels
      - message.groups
      - message.im
      - message.mpim
  socket_mode_enabled: true

2. Tokens

  1. Install to Workspace → copy the Bot User OAuth Token (xoxb-...) → SLACK_BOT_TOKEN
  2. Under Basic Information → App-Level Tokens, generate a token with the connections:write scope (xapp-...) → SLACK_APP_TOKEN
  3. Invite the bot to channels you want it to see: /invite @connectome-agent (DMs work without invites — users can message the bot directly)

3. Run

npm install
npm run build

SLACK_BOT_TOKEN=xoxb-... SLACK_APP_TOKEN=xapp-... slack-mcpl --stdio
# or: slack-mcpl --tcp 9040

Environment

Variable Required Description
SLACK_BOT_TOKEN yes Bot token (xoxb-…) for Web API calls
SLACK_APP_TOKEN yes App-level token (xapp-…, connections:write) for Socket Mode
SLACK_DM_USERS no Comma-separated user-ID whitelist for DMs; others' DMs are dropped
SLACK_SUBSCRIPTIONS_FILE no JSON file persisting ambient subscriptions across restarts
SLACK_BACKSCROLL_LIMIT no Messages fetched on first interaction with a conversation (default 50)
SLACK_MCPL_DEBUG_LOG no Absolute path for a diagnostic file log

Tests

npm test

Provenance

The Slack domain logic (Socket Mode event handling, mrkdwn formatting, cursor-drained history pagination, attachment URL allowlisting) was salvaged from zulip-mcp PR #8's multi-platform branch and re-homed here as a standalone MCPL server following discord-mcpl's structure.

About

Standalone Slack MCPL server: Socket Mode events, threads, MCPL channels & chat:* tags

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages