Blog/Slack MCP Server: Connect Your AI Agent to Slack

Slack MCP Server: Connect Your AI Agent to Slack

Want Claude Code to read your Slack messages, summarize threads, and even post updates? The Slack MCP server connects your AI agent directly to your Slack workspace, enabling powerful automation wi...

C
CAS Team
December 1, 20248 min read

Slack MCP Server: Connect Your AI Agent to Slack

Want Claude Code to read your Slack messages, summarize threads, and even post updates? The Slack MCP server connects your AI agent directly to your Slack workspace, enabling powerful automation without leaving your terminal.

This tutorial walks you through setting up Slack MCP from scratch—creating the app, configuring permissions, and using it with Claude Code.

By the end of this guide, Claude Code will be able to list channels, read message history, search conversations, and (optionally) post messages to your Slack workspace.

Why Connect Claude Code to Slack?

Integrating Slack with Claude Code unlocks powerful workflows:

  • Summarize long threads — Get the key points from lengthy discussions
  • Search across channels — Find that decision from last month's planning thread
  • Draft responses — Let Claude help craft replies in your voice
  • Automate updates — Post deployment notifications or daily standups
  • Team context — Claude understands your team's conversations

---

Prerequisites

Before starting, you need:

  • Slack workspace where you have permission to install apps
  • Claude Code installed and configured
  • Node.js 18+ installed (for the MCP server)

---

Part 1: Create a Slack App

Navigate to api.slack.com/apps and sign in with your Slack account.

Click Create New App, then select From scratch.

- App Name: Claude Code Bot (or any name you prefer)

- Workspace: Select your target workspace

- Click Create App

---

Part 2: Configure Bot Permissions

Your Slack app needs specific OAuth scopes to interact with your workspace. Let's add the essential ones.

In the sidebar, click OAuth & Permissions.

Scroll to Bot Token Scopes and click Add an OAuth Scope. Add these scopes:

| Scope | Purpose |

|-------|---------|

| channels:history | Read messages in public channels |

| channels:read | List public channels |

| channels:join | Join public channels |

| groups:history | Read messages in private channels (if needed) |

| groups:read | List private channels (if needed) |

| im:history | Read direct messages (if needed) |

| search:read | Search messages and files |

| users:read | View user information |

| chat:write | Post messages (optional, for sending) |

Scroll up and click Install to Workspace. Review the permissions and click Allow.

After installation, you'll see a Bot User OAuth Token starting with xoxb-. Copy this—you'll need it for configuration.

Your bot token grants access to your Slack workspace. Never commit it to version control or share it publicly. Use environment variables.

---

Part 3: Get Your Slack IDs

You need your Team ID and Channel IDs for the MCP configuration.

Find Team ID

  • Open Slack in a browser
  • Look at the URL: https://app.slack.com/client/T0123456789/...
  • The T0123456789 part is your Team ID

Find Channel IDs

  • Right-click on a channel in Slack
  • Select View channel details
  • Scroll down to find the Channel ID (starts with C for public, G for private)

Or use the Slack API to list all channels:

``bash

curl -H "Authorization: Bearer xoxb-your-token" \

https://slack.com/api/conversations.list

`

---

Part 4: Configure Claude Code

Now let's connect the Slack MCP server to Claude Code.

Method 1: CLI Command

The quickest way to add the server:

`bash

claude mcp add-json "slack" '{

"command": "npx",

"args": ["-y", "@modelcontextprotocol/server-slack"],

"env": {

"SLACK_BOT_TOKEN": "xoxb-your-bot-token-here",

"SLACK_TEAM_ID": "T0123456789",

"SLACK_CHANNEL_IDS": "C0123456789,C9876543210"

}

}'

`

Replace the placeholder values with your actual token and IDs.

Method 2: Configuration File

Add to ~/.claude/mcp.json (or .claude/mcp.json in your project):

`json

{

"mcpServers": {

"slack": {

"command": "npx",

"args": ["-y", "@modelcontextprotocol/server-slack"],

"env": {

"SLACK_BOT_TOKEN": "xoxb-your-bot-token-here",

"SLACK_TEAM_ID": "T0123456789",

"SLACK_CHANNEL_IDS": "C0123456789,C9876543210"

}

}

}

}

`

Method 3: Environment Variables

For better security, use environment variables:

`bash

export SLACK_BOT_TOKEN="xoxb-your-bot-token"

export SLACK_TEAM_ID="T0123456789"

export SLACK_CHANNEL_IDS="C0123456789,C9876543210"

`

Then configure without inline values:

`json

{

"mcpServers": {

"slack": {

"command": "npx",

"args": ["-y", "@modelcontextprotocol/server-slack"]

}

}

}

`

---

Part 5: Testing Your Integration

Restart Claude Code and switch to Agent mode. Try these commands:

List Channels

`

What Slack channels do I have access to?

`

Read Recent Messages

`

Show me the last 10 messages from the #engineering channel

`

Summarize a Thread

`

Summarize the discussion in #planning about the Q1 roadmap

`

Search Messages

`

Search Slack for messages about the database migration

`

Claude Code is smart about context. You can ask natural questions like "What did the team decide about authentication yesterday?" and it will search and summarize appropriately.

---

Available Tools

Once connected, the Slack MCP server provides these tools:

| Tool | Description |

|------|-------------|

| list_channels | Get all channels the bot can access |

| get_channel_history | Retrieve messages from a channel |

| get_thread_replies | Get all replies in a thread |

| search_messages | Search across workspace messages |

| get_user_info | Look up user details |

| post_message | Send a message to a channel |

| add_reaction | React to a message with an emoji |

---

Advanced Configuration

Using the Enhanced Slack MCP Server

For more features, consider the community korotovsky/slack-mcp-server:

`json

{

"mcpServers": {

"slack": {

"command": "npx",

"args": ["-y", "@anthropic-labs/slack-mcp-server"],

"env": {

"SLACK_BOT_TOKEN": "xoxb-your-token",

"SLACK_TEAM_ID": "T0123456789",

"SLACK_MCP_ADD_MESSAGE_TOOL": "true"

}

}

}

}

`

Features include:

  • DMs and Group DMs support
  • Smart history fetch (by date or count)
  • Stealth mode without workspace permissions
  • SSE and HTTP transport support

Limiting Message Posting

By default, posting is disabled for safety. To enable:

`json

"env": {

"SLACK_MCP_ADD_MESSAGE_TOOL": "true"

}

`

Once enabled, Claude can post to any channel the bot has access to. Consider limiting SLACK_CHANNEL_IDS to only channels where posting is appropriate.

---

Use Cases

title="Daily Standups"

description="Claude reads yesterday's updates and helps you draft today's standup message."

/>

title="Meeting Prep"

description="Summarize recent discussions in a channel before jumping into a meeting."

/>

title="Incident Response"

description="Quickly search for context about production issues across channels."

/>

title="Onboarding"

description="New team member? Claude can summarize project discussions from the past month."

/>

Example: Deployment Notification

`

Post a message to #deployments that says:

"🚀 v2.3.1 deployed to production

  • Fixed login bug (#1234)
  • Added dark mode toggle
  • Performance improvements"
`

Example: Thread Summary

`

Can you summarize the thread in #architecture about microservices

vs monolith? I need to understand the team's concerns before the

meeting tomorrow.

`

---

Troubleshooting

Server Not Connecting

Symptom: Slack tools don't appear in Claude Code Solutions:
  • Verify your bot token is correct (starts with xoxb-)
  • Check that Node.js is installed
  • Restart Claude Code after configuration changes
  • Run claude mcp list to verify the server is registered

Permission Errors

Symptom: "missing_scope" errors when using tools Solutions:
  • Return to OAuth & Permissions in your Slack app
  • Add the required scope mentioned in the error
  • Reinstall the app to your workspace
  • Copy the new bot token if it changed

Can't Access Channels

Symptom: Claude can't read certain channels Solutions:
  • For public channels: Ensure channels:history scope is added
  • For private channels: Add the bot to the channel manually
  • Check that the channel ID is in your SLACK_CHANNEL_IDS list

Rate Limiting

Symptom: Requests fail with rate limit errors Solution: The Slack API has rate limits. If you're hitting them:
  • Reduce the number of messages requested
  • Add delays between bulk operations
  • Consider caching frequently-accessed data

---

Security Best Practices

Only list specific channel IDs you need. Don't use * or leave it open.

Only request the OAuth scopes you actually need. You can always add more later.

Store tokens in environment variables, not in configuration files that might be committed.

Keep SLACK_MCP_ADD_MESSAGE_TOOL` disabled unless you specifically need to post messages.

Periodically review which channels the bot can access and remove unnecessary ones.

---

Conclusion

The Slack MCP server transforms Claude Code into a powerful Slack assistant. You can search conversations, summarize threads, and even post updates—all from your terminal.

Combined with other MCP servers like GitHub and CAS, you create a unified development environment where Claude understands your code, your tasks, and your team's communication.

With Slack connected, consider adding more MCP servers to complete your workflow:

- CAS for persistent memory and task tracking

- GitHub for repository context

- Supabase for database integration

---

Resources

Share: