This Slack MCP Server provides a powerful interface for interacting with Slack workspaces through the Model Context Protocol. It supports multiple transport methods, authentication modes, and offers extensive messaging functionality.
The Slack MCP Server lets you interact with Slack workspaces through various tools for fetching, searching, and posting messages. It works in stealth mode (requiring no additional permissions) or OAuth mode, and supports both standard and enterprise Slack environments.
Before installing, you'll need to obtain authentication tokens from Slack. You can use either:
xoxp-...
)xoxc-...
) and browser cookie (xoxd-...
)go get github.com/korotovsky/slack-mcp-server
# Required authentication (Option 1)
export SLACK_MCP_XOXC_TOKEN="xoxc-your-token"
export SLACK_MCP_XOXD_TOKEN="xoxd-your-cookie"
# Required authentication (Option 2)
export SLACK_MCP_XOXP_TOKEN="xoxp-your-token"
# Optional configuration
export SLACK_MCP_PORT="13080"
export SLACK_MCP_HOST="127.0.0.1"
go run mcp/mcp-server.go
Configure the server using these environment variables:
Variable | Required? | Default | Description |
---|---|---|---|
SLACK_MCP_XOXC_TOKEN |
Yes* | nil |
Slack browser token (xoxc-... ) |
SLACK_MCP_XOXD_TOKEN |
Yes* | nil |
Slack browser cookie d (xoxd-... ) |
SLACK_MCP_XOXP_TOKEN |
Yes* | nil |
User OAuth token (xoxp-... ) — alternative to xoxc/xoxd |
SLACK_MCP_PORT |
No | 13080 |
Port for the MCP server to listen on |
SLACK_MCP_HOST |
No | 127.0.0.1 |
Host for the MCP server to listen on |
SLACK_MCP_SSE_API_KEY |
No | nil |
Bearer token for SSE transport |
SLACK_MCP_PROXY |
No | nil |
Proxy URL for outgoing requests |
SLACK_MCP_USER_AGENT |
No | nil |
Custom User-Agent (for Enterprise Slack environments) |
SLACK_MCP_SERVER_CA |
No | nil |
Path to CA certificate |
SLACK_MCP_SERVER_CA_INSECURE |
No | false |
Trust all insecure requests (NOT RECOMMENDED) |
SLACK_MCP_ADD_MESSAGE_TOOL |
No | nil |
Enable message posting (true/false/channel list) |
SLACK_MCP_USERS_CACHE |
No | .users_cache.json |
Path to the users cache file |
SLACK_MCP_CHANNELS_CACHE |
No | .channels_cache_v2.json |
Path to the channels cache file |
*You need either xoxp
OR both xoxc
/xoxd
tokens for authentication.
For security reasons, the conversations_add_message
tool is disabled by default. To enable it:
# Enable for all channels
export SLACK_MCP_ADD_MESSAGE_TOOL="true"
# Enable only for specific channels (comma-separated)
export SLACK_MCP_ADD_MESSAGE_TOOL="C12345678,C87654321"
# Enable for all channels except specific ones
export SLACK_MCP_ADD_MESSAGE_TOOL="!C12345678"
Retrieves messages from channels or DMs:
{
"tool_name": "conversations_history",
"tool_params": {
"channel_id": "#general",
"include_activity_messages": false,
"limit": "1d"
}
}
Parameters:
channel_id
: Channel ID (C...) or name (#general, @username)include_activity_messages
: Include joins/leaves (default: false)cursor
: For paginationlimit
: Messages to fetch (e.g., "1d", "7d", "50")Gets thread messages:
{
"tool_name": "conversations_replies",
"tool_params": {
"channel_id": "#general",
"thread_ts": "1234567890.123456",
"include_activity_messages": false,
"limit": "1d"
}
}
Parameters:
channel_id
: Channel ID or namethread_ts
: Thread timestampinclude_activity_messages
: Include joins/leaves (default: false)cursor
: For paginationlimit
: Messages to fetch (e.g., "1d", "50")Posts messages to channels or threads (when enabled):
{
"tool_name": "conversations_add_message",
"tool_params": {
"channel_id": "#general",
"thread_ts": "1234567890.123456",
"payload": "Hello, world!",
"content_type": "text/markdown"
}
}
Parameters:
channel_id
: Channel ID or namethread_ts
: Thread timestamp (optional)payload
: Message contentcontent_type
: "text/markdown" or "text/plain"Searches messages with filters:
{
"tool_name": "conversations_search_messages",
"tool_params": {
"search_query": "marketing report",
"filter_in_channel": "#general",
"filter_users_from": "@jane",
"filter_date_after": "2023-10-01",
"limit": 20
}
}
Parameters:
search_query
: Search termsfilter_in_channel
: Restrict to channelfilter_in_im_or_mpim
: Restrict to DM/group DMfilter_users_with
: Messages with userfilter_users_from
: Messages from userfilter_date_before
, filter_date_after
, filter_date_on
, filter_date_during
: Date filtersfilter_threads_only
: Only thread messagescursor
: For paginationlimit
: Results to return (1-100)Lists available channels:
{
"tool_name": "channels_list",
"tool_params": {
"channel_types": "public_channel,private_channel,im",
"sort": "popularity",
"limit": 100
}
}
Parameters:
channel_types
: Types to include (comma-separated)sort
: Sorting method (e.g., "popularity")limit
: Results to return (1-999)cursor
: For paginationTo debug the server:
# Run with inspector
npx @modelcontextprotocol/inspector go run mcp/mcp-server.go --transport stdio
# View logs
tail -n 20 -f ~/Library/Logs/Claude/mcp*.log
For full functionality, ensure both users and channels caches are enabled:
Users Cache | Channels Cache | Functionality |
---|---|---|
No | No | Limited - can't reference by @user or #channel |
Yes | No | Limited - can't use #channel references or channels_list |
Yes | Yes | Full functionality |
The cache files are automatically created and updated during usage.
To add this MCP server to Claude Code, run this command in your terminal:
claude mcp add-json "slack-mcp-server" '{"command":"npx","args":["-y","slack-mcp-server"]}'
See the official Claude Code MCP documentation for more details.
There are two ways to add an MCP server to Cursor. The most common way is to add the server globally in the ~/.cursor/mcp.json
file so that it is available in all of your projects.
If you only need the server in a single project, you can add it to the project instead by creating or adding it to the .cursor/mcp.json
file.
To add a global MCP server go to Cursor Settings > Tools & Integrations and click "New MCP Server".
When you click that button the ~/.cursor/mcp.json
file will be opened and you can add your server like this:
{
"mcpServers": {
"slack-mcp-server": {
"command": "npx",
"args": [
"-y",
"slack-mcp-server"
]
}
}
}
To add an MCP server to a project you can create a new .cursor/mcp.json
file or add it to the existing one. This will look exactly the same as the global MCP server example above.
Once the server is installed, you might need to head back to Settings > MCP and click the refresh button.
The Cursor agent will then be able to see the available tools the added MCP server has available and will call them when it needs to.
You can also explicitly ask the agent to use the tool by mentioning the tool name and describing what the function does.
To add this MCP server to Claude Desktop:
1. Find your configuration file:
~/Library/Application Support/Claude/claude_desktop_config.json
%APPDATA%\Claude\claude_desktop_config.json
~/.config/Claude/claude_desktop_config.json
2. Add this to your configuration file:
{
"mcpServers": {
"slack-mcp-server": {
"command": "npx",
"args": [
"-y",
"slack-mcp-server"
]
}
}
}
3. Restart Claude Desktop for the changes to take effect