Slack MCP Server
This server provides a comprehensive interface for interacting with the Slack API, enabling AI assistants and agents to manage channels, messages, reactions, direct messages, search, and users within a Slack workspace.
Channel Management: List channels, get details, create/archive channels, join/leave, set topics, and fetch message history.
Messaging: Post messages, reply to threads, get thread replies, update/delete messages, and add/remove/get emoji reactions.
Direct Messages (DMs): Send DMs, list DM/group DM conversations, fetch DM history, and open new DM conversations.
Search (requires User Token): Search messages, files, or both across the workspace with advanced filters (channel, user, date, reactions).
User & Workspace Management: List users, get detailed user info, check presence, look up users by email, get user profiles, and retrieve bot/team information.
Enables comprehensive interaction with Slack workspaces, including channel management (create, archive, join, list), messaging operations (post, reply, update, delete, reactions), direct messaging, searching messages and files, and user management (list users, check presence, lookup by email).
Click on "Install Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@Slack MCP Serverlist all channels in the workspace"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
Slack Agent CLI
A CLI and Model Context Protocol (MCP) server for Slack API integration. Use slack from the terminal for scripting and agent workflows, or slack mcp for AI assistant integration via stdio MCP.
AI agents: See AGENTS.md for install, auth, all commands, MCP tool names, and workflow examples.
Features
Channel Management
List all accessible channels (public/private)
Get channel information and details
Create new channels
Archive channels
Join/leave channels
Set channel topics
Fetch channel message history
Messaging
Post messages to channels
Reply to message threads
Update and delete messages
Add and remove emoji reactions
Get message reactions
Direct Messages (DMs)
Send direct messages to users
List DM and group DM conversations
Fetch DM conversation history
Open new DM conversations
Search (requires User Token)
Search messages across the workspace
Search files
Combined search for messages and files
User Management
List workspace users
Get user profile information
Check user presence/online status
Look up users by email
Get bot and team information
Related MCP server: Slack MCP Server
Prerequisites
Python 3.10 or higher
A Slack workspace with admin access to create apps
Slack Bot Token (xoxb-...) for most operations
Slack User Token (xoxp-...) for search functionality
Installation
npm (recommended)
Requires Node.js 18+ and Python 3.10+.
npm install -g slack-agent-cli
slack --versionMCP via global install:
slack mcpFrom source (Python)
1. Clone the Repository
git clone https://github.com/bcharleson/slack-agent-cli.git
cd slack-agent-cli2. Create Virtual Environment
python3.12 -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate3. Install Dependencies
pip install -e .Or install from requirements:
pip install -r requirements.txtSlack App Setup
1. Create a Slack App
Go to Slack API Apps
Click "Create New App" → "From scratch"
Name your app and select your workspace
2. Configure Bot Token Scopes
Navigate to OAuth & Permissions and add these Bot Token Scopes:
Channels
channels:read- View basic channel infochannels:write- Manage public channelschannels:history- View messages in public channelsgroups:read- View private channelsgroups:write- Manage private channelsgroups:history- View messages in private channels
Messaging
chat:write- Send messagesreactions:read- View reactionsreactions:write- Add reactions
Direct Messages
im:read- View DM infoim:write- Start DMsim:history- View DM historympim:read- View group DM infompim:write- Start group DMsmpim:history- View group DM history
Users
users:read- View usersusers:read.email- View user emails
3. Configure User Token Scopes (for Search)
If you need search functionality, add these User Token Scopes:
search:read- Search messages and files
4. Install the App
Click "Install to Workspace"
Authorize the app
Copy the Bot User OAuth Token (starts with
xoxb-)If using search, also copy the User OAuth Token (starts with
xoxp-)
Configuration
Environment Variables
Create a .env file in the project root:
# Required: Bot Token for most operations
SLACK_BOT_TOKEN=xoxb-your-bot-token-here
# Optional: User Token for search functionality
SLACK_USER_TOKEN=xoxp-your-user-token-hereYou can copy the example file:
cp .env.example .env
# Then edit .env with your tokensUsage
CLI
After installation, the slack command exposes grouped subcommands that mirror the MCP tools:
# Channels
slack channels list
slack channels info C01234567
slack channels history C01234567 --limit 10
# Messages
slack messages post C01234567 "Hello from the CLI"
slack messages reply C01234567 1710000000.000100 "Thread reply"
# DMs
slack dms send U01234567 "Quick note from CLI"
slack dms list
# Search (requires SLACK_USER_TOKEN)
slack search messages "project update in:#general"
# Users / workspace
slack users list
slack users lookup brandon@example.com
slack workspace team
# Output formatting
slack --pretty channels list
slack --output json --quiet channels listGlobal options:
--bot-token/SLACK_BOT_TOKEN--user-token/SLACK_USER_TOKEN--output json|pretty(default:json)--prettyshorthand--quietfor exit-code-only automation
MCP server
Start the stdio MCP server:
slack mcp
# or
slack-agent-cli mcpRunning the Server (development)
source venv/bin/activate
python -m slack_agent_cli.cli mcpClaude Desktop Configuration
Add to your Claude Desktop configuration file:
macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
Windows: %APPDATA%\Claude\claude_desktop_config.json
{
"mcpServers": {
"slack": {
"command": "/path/to/slack-agent-cli/venv/bin/python",
"args": ["-m", "slack_agent_cli"],
"cwd": "/path/to/slack-agent-cli",
"env": {
"SLACK_BOT_TOKEN": "xoxb-your-bot-token",
"SLACK_USER_TOKEN": "xoxp-your-user-token"
}
}
}
}Replace /path/to/slack-agent-cli with the actual path to your installation.
Cursor IDE Configuration
Add to your Cursor MCP settings (~/.cursor/mcp.json):
{
"mcpServers": {
"slack-agent-cli": {
"command": "slack",
"args": ["mcp"],
"env": {
"SLACK_BOT_TOKEN": "xoxb-your-bot-token",
"SLACK_USER_TOKEN": "xoxp-your-user-token"
}
}
}
}Or with a global install:
{
"mcpServers": {
"slack-agent-cli": {
"command": "slack",
"args": ["mcp"],
"env": {
"SLACK_BOT_TOKEN": "xoxb-your-bot-token",
"SLACK_USER_TOKEN": "xoxp-your-user-token"
}
}
}
}Available Tools
Channel Tools
Tool | Description |
| List all accessible channels |
| Get details about a specific channel |
| Create a new channel |
| Archive a channel |
| Fetch message history |
| Join a channel |
| Leave a channel |
| Set channel topic |
Message Tools
Tool | Description |
| Post a message to a channel |
| Reply in a thread |
| Get all replies in a thread |
| Add emoji reaction |
| Remove emoji reaction |
| Get reactions on a message |
| Update an existing message |
| Delete a message |
DM Tools
Tool | Description |
| Send a direct message |
| List DM conversations |
| Fetch DM history |
| Open a DM conversation |
Search Tools (requires User Token)
Tool | Description |
| Search messages |
| Search files |
| Search both messages and files |
User Tools
Tool | Description |
| List workspace users |
| Get user details |
| Check if user is online |
| Find user by email |
| Get detailed profile |
| Get bot identity |
| Get workspace info |
Testing
Using MCP Inspector
npx @modelcontextprotocol/inspector python -m slack_agent_cliThis opens a web interface to test all available tools interactively.
Manual Testing
Start the server
Use Claude Desktop or another MCP client
Try basic commands:
"List all channels in the workspace"
"Get the history of #general channel"
"Send a message to #test-channel saying Hello!"
Troubleshooting
"SLACK_BOT_TOKEN is not set"
Ensure your .env file exists and contains the token, or set it in your MCP client configuration.
"Search requires a User Token"
Search operations require a User Token (SLACK_USER_TOKEN). Add User Token scopes to your Slack app and include the token.
"channel_not_found"
The bot may not have access to the channel. Ensure:
The channel exists
The bot is a member of private channels
The channel ID is correct (use
list_channelsto find IDs)
"missing_scope"
Your Slack app is missing required permissions. Check the OAuth scopes section above and add the missing scopes in your Slack app settings.
Development
Project Structure
slack-agent-cli/
├── src/
│ └── slack_agent_cli/
│ ├── cli/
│ │ └── main.py # Click CLI + `slack mcp`
│ ├── core/
│ │ └── output.py # JSON/pretty output helpers
│ ├── operations/ # Shared handlers for CLI + MCP
│ │ ├── channels.py
│ │ ├── messages.py
│ │ ├── search.py
│ │ └── users.py
│ ├── tools/ # MCP tool registration
│ ├── utils/
│ │ └── slack_client.py
│ └── server.py # FastMCP stdio server
├── pyproject.toml
├── package.json
├── AGENTS.md # AI agent guide (commands, MCP, workflows)
├── requirements.txt
├── .env.example
└── README.mdAdding New Tools
Create or edit a file in
src/slack_agent_cli/tools/Define tools using the
@mcp.tool()decoratorRegister the tools in the server by calling the registration function
License
MIT License
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
Maintenance
Latest Blog Posts
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/bcharleson/slack-agent-cli'
If you have feedback or need assistance with the MCP directory API, please join our Discord server