slack-mcp-server

bcharleson/slack-mcp-server

3.2

If you are the rightful owner of slack-mcp-server and would like to certify it and/or have it hosted online, please leave a comment on the right or send an email to dayong@mcphub.com.

A comprehensive Model Context Protocol (MCP) server for Slack API integration, enabling AI assistants to interact with Slack workspaces.

Tools
5
Resources
0
Prompts
0

Slack MCP Server

A comprehensive Model Context Protocol (MCP) server for Slack API integration. This server enables AI assistants like Claude to interact with your Slack workspace, including managing channels, sending messages, searching content, and more.

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

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

1. Clone the Repository

git clone <repository-url>
cd slack-mcp-server

2. Create Virtual Environment

python3.12 -m venv venv
source venv/bin/activate  # On Windows: venv\Scripts\activate

3. Install Dependencies

pip install -e .

Or install from requirements:

pip install -r requirements.txt

Slack App Setup

1. Create a Slack App

  1. Go to Slack API Apps
  2. Click "Create New App" → "From scratch"
  3. 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 info
  • channels:write - Manage public channels
  • channels:history - View messages in public channels
  • groups:read - View private channels
  • groups:write - Manage private channels
  • groups:history - View messages in private channels
Messaging
  • chat:write - Send messages
  • reactions:read - View reactions
  • reactions:write - Add reactions
Direct Messages
  • im:read - View DM info
  • im:write - Start DMs
  • im:history - View DM history
  • mpim:read - View group DM info
  • mpim:write - Start group DMs
  • mpim:history - View group DM history
Users
  • users:read - View users
  • users: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

  1. Click "Install to Workspace"
  2. Authorize the app
  3. Copy the Bot User OAuth Token (starts with xoxb-)
  4. 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-here

You can copy the example file:

cp env.example .env
# Then edit .env with your tokens

Usage

Running the Server

As a Python Module
source venv/bin/activate
python -m slack_mcp_server
Using the Entry Point
source venv/bin/activate
slack-mcp-server

Claude 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-mcp-server/venv/bin/python",
      "args": ["-m", "slack_mcp_server"],
      "cwd": "/path/to/slack-mcp-server",
      "env": {
        "SLACK_BOT_TOKEN": "xoxb-your-bot-token",
        "SLACK_USER_TOKEN": "xoxp-your-user-token"
      }
    }
  }
}

Replace /path/to/slack-mcp-server with the actual path to your installation.

Cursor IDE Configuration

Add to your Cursor MCP settings:

{
  "mcpServers": {
    "slack": {
      "command": "/path/to/slack-mcp-server/venv/bin/python",
      "args": ["-m", "slack_mcp_server"],
      "cwd": "/path/to/slack-mcp-server",
      "env": {
        "SLACK_BOT_TOKEN": "xoxb-your-bot-token",
        "SLACK_USER_TOKEN": "xoxp-your-user-token"
      }
    }
  }
}

Available Tools

Channel Tools

ToolDescription
list_channelsList all accessible channels
get_channel_infoGet details about a specific channel
create_channelCreate a new channel
archive_channelArchive a channel
get_channel_historyFetch message history
join_channelJoin a channel
leave_channelLeave a channel
set_channel_topicSet channel topic

Message Tools

ToolDescription
post_messagePost a message to a channel
reply_to_threadReply in a thread
get_thread_repliesGet all replies in a thread
add_reactionAdd emoji reaction
remove_reactionRemove emoji reaction
get_message_reactionsGet reactions on a message
update_messageUpdate an existing message
delete_messageDelete a message

DM Tools

ToolDescription
send_dmSend a direct message
list_conversationsList DM conversations
get_dm_historyFetch DM history
open_dmOpen a DM conversation

Search Tools (requires User Token)

ToolDescription
search_messagesSearch messages
search_filesSearch files
search_allSearch both messages and files

User Tools

ToolDescription
list_usersList workspace users
get_user_infoGet user details
get_user_presenceCheck if user is online
lookup_user_by_emailFind user by email
get_user_profileGet detailed profile
get_bot_infoGet bot identity
get_team_infoGet workspace info

Testing

Using MCP Inspector

npx @modelcontextprotocol/inspector python -m slack_mcp_server

This opens a web interface to test all available tools interactively.

Manual Testing

  1. Start the server
  2. Use Claude Desktop or another MCP client
  3. 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:

  1. The channel exists
  2. The bot is a member of private channels
  3. The channel ID is correct (use list_channels to 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-mcp-server/
├── src/
│   └── slack_mcp_server/
│       ├── __init__.py
│       ├── __main__.py
│       ├── server.py              # FastMCP server entry point
│       ├── tools/
│       │   ├── __init__.py
│       │   ├── channels.py        # Channel management tools
│       │   ├── messages.py        # Messaging and DM tools
│       │   ├── search.py          # Search functionality
│       │   └── users.py           # User management tools
│       └── utils/
│           ├── __init__.py
│           └── slack_client.py    # Slack API wrapper
├── pyproject.toml
├── requirements.txt
├── env.example
└── README.md

Adding New Tools

  1. Create or edit a file in src/slack_mcp_server/tools/
  2. Define tools using the @mcp.tool() decorator
  3. Register 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.