How to Connect Slack to AI Agents with the Slack MCP Server
Integrate Slack with your AI agent using MCP. Read messages, post updates, manage channels, and automate Slack workflows seamlessly.
Generate & Test Slack MCP Server Config
One-click export with environment variables & path locators for Claude Desktop, Cursor, Windsurf, and OpenAI Codex CLI.
Connect Slack to AI Agents with MCP
The Slack MCP server enables AI agents to interact directly with your Slack workspace. By acting as an automated participant, your agent can read channel histories, post structured updates, manage conversations, and even react to messages with emojis.
Prerequisites
- βΈSlack workspace Administrator or App Manager access.
- βΈA Slack Bot Token (
xoxb-...). - βΈNode.js 18+ installed on your host machine.
Creating a Slack Bot Token
- βΈVisit api.slack.com/apps.
- βΈClick Create New App β From scratch.
- βΈUnder OAuth & Permissions, add these Bot Token Scopes:
- βΈ
channels:historyβ Read public channel messages - βΈ
channels:readβ List available channels - βΈ
chat:writeβ Post messages as the bot - βΈ
users:readβ View user profiles - βΈ
reactions:writeβ Add emoji reactions
- βΈ
- βΈClick Install to Workspace.
- βΈCopy the generated Bot User OAuth Token.
Configuration Setup
Add the integration to your MCP client config file:
{
"mcpServers": {
"slack": {
"command": "npx",
"args": ["-y", "@modelcontextprotocol/server-slack"],
"env": {
"SLACK_BOT_TOKEN": "xoxb-your-token-here",
"SLACK_TEAM_ID": "T0123456789"
}
}
}
}Available Tools
- βΈ
list_channelsβ Browse workspace channels. - βΈ
post_messageβ Send messages to channels or individuals. - βΈ
reply_to_threadβ Reply inside existing message threads. - βΈ
add_reactionβ React to messages with emojis. - βΈ
get_channel_historyβ Read recent messages from a channel. - βΈ
get_thread_repliesβ Read deep thread conversations. - βΈ
search_messagesβ Full-text search across the workspace.
Example Workflows
- βΈDaily Standup Summary: "Summarize today's messages in the
#engineeringchannel and highlight any action items or blockers." - βΈCross-Channel Analysis: "Search for all mentions of 'deployment' across all channels in the last week and create a summary."
- βΈAutomated Responses: "Post a message to
#generalsummarizing the key architectural decisions we just made in this chat."
Best Practices & Troubleshooting
- βΈPrinciple of Least Privilege: Only grant the OAuth scopes your specific use case requires. Do not grant
groups:history(private channels) unless absolutely necessary. - βΈBot Not In Channel Error: A Slack bot cannot read or post to a channel until it is explicitly invited. Type
/invite @YourBotNameinside the Slack channel you want it to access. - βΈUse Threads: Instruct your agent to use the
reply_to_threadtool rather thanpost_messagewhen responding to existing conversations to avoid flooding the channel feed.
Using with OpenAI Codex
You can use this MCP server with the OpenAI Codex CLI by adding it to your configuration:
codex mcp add --name slack --command "npx -y @modelcontextprotocol/server-slack" --env SLACK_BOT_TOKEN=xoxb-your-tokenFor a full list of recommended servers, see Best MCP Servers for OpenAI Codex.
Build your full agent toolstack in the Visual Generator
Combine How to Connect Slack to AI Agents with the Slack with databases, search APIs, and memory graphs in a single configuration file.
Related Guides
Email Automation Workflows: Orchestrating Gmail and Resend Safely with MCP
Create secure email flows. Whitelist recipient domains, compose email templates, and trigger Gmail drafts programmatically with MCP.
CommunicationMulti-Client Agent Orchestration: Implementing SSE-based Remote Connections
Transition your local stdio servers to network-connected remote servers using bi-directional Server-Sent Events (SSE). Support multi-client scaling.