Slack Conversations MCP server

Bridges AI with Slack's messaging platform, enabling access to conversation history from channels through secure authentication and flexible transport modes.
Back to servers
Setup instructions
Provider
Dmitrii Korotovskii
Release date
Apr 13, 2025
Language
Go
Stats
287 stars

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.

Getting Started

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.

Installation

Prerequisites

Before installing, you'll need to obtain authentication tokens from Slack. You can use either:

  • A user OAuth token (xoxp-...)
  • OR both browser token (xoxc-...) and browser cookie (xoxd-...)

Installation Steps

  1. Download the server binary or build from source:
go get github.com/korotovsky/slack-mcp-server
  1. Set up the required environment variables:
# 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"
  1. Run the server:
go run mcp/mcp-server.go

Configuration

Environment Variables

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.

Enabling Message Posting

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"

Usage

Available Tools

1. conversations_history

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 pagination
  • limit: Messages to fetch (e.g., "1d", "7d", "50")

2. conversations_replies

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 name
  • thread_ts: Thread timestamp
  • include_activity_messages: Include joins/leaves (default: false)
  • cursor: For pagination
  • limit: Messages to fetch (e.g., "1d", "50")

3. conversations_add_message

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 name
  • thread_ts: Thread timestamp (optional)
  • payload: Message content
  • content_type: "text/markdown" or "text/plain"

4. conversations_search_messages

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 terms
  • filter_in_channel: Restrict to channel
  • filter_in_im_or_mpim: Restrict to DM/group DM
  • filter_users_with: Messages with user
  • filter_users_from: Messages from user
  • filter_date_before, filter_date_after, filter_date_on, filter_date_during: Date filters
  • filter_threads_only: Only thread messages
  • cursor: For pagination
  • limit: Results to return (1-100)

5. channels_list

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 pagination

Debugging

To 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

Cache Considerations

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.

How to install this MCP server

For Claude Code

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.

For Cursor

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.

Adding an MCP server to Cursor globally

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"
            ]
        }
    }
}

Adding an MCP server to a project

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.

How to use the MCP server

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.

For Claude Desktop

To add this MCP server to Claude Desktop:

1. Find your configuration file:

  • macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
  • Windows: %APPDATA%\Claude\claude_desktop_config.json
  • Linux: ~/.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

Want to 10x your AI skills?

Get a free account and learn to code + market your apps using AI (with or without vibes!).

Nah, maybe later