Skip to content

feat: add slack_add_reaction and slack_remove_reaction tools#47

Open
abid-mahdi wants to merge 2 commits into
slackapi:mainfrom
abid-mahdi:feat/emoji-reactions
Open

feat: add slack_add_reaction and slack_remove_reaction tools#47
abid-mahdi wants to merge 2 commits into
slackapi:mainfrom
abid-mahdi:feat/emoji-reactions

Conversation

@abid-mahdi

Copy link
Copy Markdown

Summary

Closes #31.

The remote MCP server at mcp.slack.com doesn't expose emoji reaction tools. This PR adds a minimal local MCP server (src/reactions.ts) that fills the gap by calling reactions.add and reactions.remove from the Slack Web API directly.

Design decisions

  • @slack/web-api not @slack/bolt — no Socket Mode or event handling needed; only outbound HTTP calls to the Slack API
  • Single file — the two tools have no shared state or helpers, so a single 72-line file is sufficient
  • Parallel to the remote server — runs as a separate slack-reactions entry in .mcp.json alongside the existing slack remote server; users can enable it independently
  • Parameter namingchannel_id, message_ts, emoji_name matches the names proposed in Add emoji reaction support (reactions.add / reactions.remove) #31 and is consistent with the channel_id convention used in the remote server's tools

New tools

Tool Parameters Slack API
slack_add_reaction channel_id, message_ts, emoji_name reactions.add
slack_remove_reaction channel_id, message_ts, emoji_name reactions.remove

emoji_name is without colons — e.g. thumbsup, white_check_mark, eyes.

Required Slack app scope

reactions:write — add to an existing app's bot token scopes, or create a new app.

Files changed

  • src/reactions.ts — standalone MCP server (new)
  • package.json — minimal deps: @modelcontextprotocol/sdk, @slack/web-api, tsx (new)
  • .mcp.jsonslack-reactions server entry
  • README.md — setup instructions
  • CLAUDE.md — tool reference
  • skills/slack-messaging/SKILL.md — updated to reference slack_add_reaction instead of the "can't add reactions" caveat

Relationship to PR #23

PR #23 adds a much larger feature (Socket Mode bridge for real-time Claude ↔ Slack messaging) and includes a react tool as part of that. This PR is intentionally minimal — just the two reaction tools, no event handling, no gating, no Socket Mode required.

Test plan

  • npm install succeeds
  • SLACK_BOT_TOKEN=xoxb-... npx tsx src/reactions.ts starts without errors
  • slack_add_reaction adds a reaction visible in Slack
  • slack_remove_reaction removes it
  • Missing/invalid token exits with a clear error message
  • Calling with an invalid emoji name returns an error response (not a crash)

🤖 Generated with Claude Code

Closes slackapi#31. Adds a lightweight local MCP server (src/reactions.ts) that
wraps reactions.add / reactions.remove from the Slack Web API. The remote
MCP server at mcp.slack.com does not expose reaction tools; this server
runs as a local subprocess alongside the remote one.

Tools: slack_add_reaction, slack_remove_reaction
Params: channel_id, message_ts, emoji_name
Scope required: reactions:write

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@salesforce-cla

salesforce-cla Bot commented Jun 9, 2026

Copy link
Copy Markdown

Thanks for the contribution! Before we can merge this, we need @abid-mahdi to sign the Salesforce Inc. Contributor License Agreement.

Refactors src/reactions.ts to export TOOLS, handleToolCall, and
createServer so they can be unit-tested without starting the server.
Startup code (env validation + server.connect) is guarded behind an
import.meta.url check and only runs when the file is executed directly.

Adds tests/reactions.test.ts: 14 tests covering tool definitions,
slack_add_reaction, slack_remove_reaction, and unknown tool handling.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@abid-mahdi abid-mahdi force-pushed the feat/emoji-reactions branch 2 times, most recently from f26fa6c to 853b4f1 Compare June 9, 2026 11:52
@abid-mahdi

abid-mahdi commented Jun 9, 2026

Copy link
Copy Markdown
Author

Question for maintainers

The Claude Code install section shows this .mcp.json block (unchanged from before this PR):

{
  "mcpServers": {
    "slack": { ... }
  }
}

But this PR adds a slack-reactions entry to the committed .mcp.json, so the file a user actually gets after cloning now contains both servers. The install section no longer reflects what's on disk.

The gap: a user who follows the Claude Code install steps (git cloneclaude --plugin-dir ./) will have the slack-reactions server loaded immediately with an empty SLACK_BOT_TOKEN, causing a startup error from that subprocess before they've read the Emoji Reactions setup section. The fix would be to update the install section's code block to match the full .mcp.json and note the token requirement.

Left this out of the PR since the reactions server is opt-in and you may prefer to keep the install section scoped to the core slack setup — in which case removing slack-reactions from the committed .mcp.json and making it a manual opt-in addition might be the cleaner approach. Happy to go either way.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add emoji reaction support (reactions.add / reactions.remove)

1 participant