Slack MCP server

Send messages, manage channels, and access workspace history.
Back to servers
Provider
Anthropic
Release date
Nov 19, 2024
Language
TypeScript
Package
Stats
53.2K downloads
40.6K stars

The Slack MCP Server enables Claude to interact with Slack workspaces through the Model Context Protocol, providing tools for posting messages, listing channels, adding reactions, and more.

Setting Up the Slack App

Before using the MCP server, you need to create and configure a Slack app:

  1. Create a Slack App:

    • Visit the Slack Apps page
    • Click "Create New App"
    • Choose "From scratch"
    • Name your app and select your workspace
  2. Configure Bot Token Scopes: Navigate to "OAuth & Permissions" and add these scopes:

    • channels:history - View messages in public channels
    • channels:read - View basic channel information
    • chat:write - Send messages as the app
    • reactions:write - Add emoji reactions to messages
    • users:read - View users and their basic information
    • users.profile:read - View detailed profiles about users
  3. Install App to Workspace:

    • Click "Install to Workspace" and authorize the app
    • Save the "Bot User OAuth Token" that starts with xoxb-
  4. Get your Team ID (starts with a T) by following this guidance

Installation and Configuration

Using with Claude Desktop

Add the following to your claude_desktop_config.json:

Using NPX

{
  "mcpServers": {
    "slack": {
      "command": "npx",
      "args": [
        "-y",
        "@modelcontextprotocol/server-slack"
      ],
      "env": {
        "SLACK_BOT_TOKEN": "xoxb-your-bot-token",
        "SLACK_TEAM_ID": "T01234567",
        "SLACK_CHANNEL_IDS": "C01234567, C76543210"
      }
    }
  }
}

Using Docker

{
  "mcpServers": {
    "slack": {
      "command": "docker",
      "args": [
        "run",
        "-i",
        "--rm",
        "-e",
        "SLACK_BOT_TOKEN",
        "-e",
        "SLACK_TEAM_ID",
        "-e",
        "SLACK_CHANNEL_IDS",
        "mcp/slack"
      ],
      "env": {
        "SLACK_BOT_TOKEN": "xoxb-your-bot-token",
        "SLACK_TEAM_ID": "T01234567",
        "SLACK_CHANNEL_IDS": "C01234567, C76543210"
      }
    }
  }
}

Using with VS Code

For manual installation, add the following JSON block to your User Settings (JSON) file in VS Code. You can do this by pressing Ctrl + Shift + P and typing Preferences: Open Settings (JSON).

Alternatively, you can add it to a file called .vscode/mcp.json in your workspace for sharing configurations.

Using NPX

{
  "mcp": {
    "inputs": [
      {
        "type": "promptString",
        "id": "slack_bot_token",
        "description": "Slack Bot Token (starts with xoxb-)",
        "password": true
      },
      {
        "type": "promptString",
        "id": "slack_team_id",
        "description": "Slack Team ID (starts with T)"
      }
    ],
    "servers": {
      "slack": {
        "command": "npx",
        "args": ["-y", "@modelcontextprotocol/server-slack"],
        "env": {
          "SLACK_BOT_TOKEN": "${input:slack_bot_token}",
          "SLACK_TEAM_ID": "${input:slack_team_id}"
        }
      }
    }
  }
}

Using Docker

{
  "mcp": {
    "inputs": [
      {
        "type": "promptString",
        "id": "slack_bot_token",
        "description": "Slack Bot Token (starts with xoxb-)",
        "password": true
      },
      {
        "type": "promptString",
        "id": "slack_team_id",
        "description": "Slack Team ID (starts with T)"
      }
    ],
    "servers": {
      "slack": {
        "command": "docker",
        "args": ["run", "-i", "--rm", "mcp/slack"],
        "env": {
          "SLACK_BOT_TOKEN": "${input:slack_bot_token}",
          "SLACK_TEAM_ID": "${input:slack_team_id}"
        }
      }
    }
  }
}

Required Environment Variables

  • SLACK_BOT_TOKEN: Required. The Bot User OAuth Token starting with xoxb-
  • SLACK_TEAM_ID: Required. Your Slack workspace ID starting with T
  • SLACK_CHANNEL_IDS: Optional. Comma-separated list of channel IDs to limit channel access (e.g., "C01234567, C76543210"). If not specified, all public channels will be accessible.

Available Tools and Usage

The server provides the following tools for interacting with Slack:

Channel Management

  • slack_list_channels: Lists public or pre-defined channels in the workspace
    • Optional inputs:
      • limit (default: 100, max: 200): Maximum number of channels to return
      • cursor: Pagination cursor for the next page

Messaging

  • slack_post_message: Posts a new message to a Slack channel

    • Required inputs:
      • channel_id: The ID of the channel to post to
      • text: The message text to post
  • slack_reply_to_thread: Replies to a specific message thread

    • Required inputs:
      • channel_id: The channel containing the thread
      • thread_ts: Timestamp of the parent message
      • text: The reply text
  • slack_add_reaction: Adds an emoji reaction to a message

    • Required inputs:
      • channel_id: The channel containing the message
      • timestamp: Message timestamp to react to
      • reaction: Emoji name without colons

Message History

  • slack_get_channel_history: Gets recent messages from a channel

    • Required inputs:
      • channel_id: The channel ID
    • Optional inputs:
      • limit (default: 10): Number of messages to retrieve
  • slack_get_thread_replies: Gets all replies in a message thread

    • Required inputs:
      • channel_id: The channel containing the thread
      • thread_ts: Timestamp of the parent message

User Information

  • slack_get_users: Gets list of workspace users with basic profile information

    • Optional inputs:
      • cursor: Pagination cursor for next page
      • limit (default: 100, max: 200): Maximum users to return
  • slack_get_user_profile: Gets detailed profile information for a specific user

    • Required inputs:
      • user_id: The user's ID

Troubleshooting

If you encounter permission errors, verify that:

  1. All required scopes have been added to your Slack app
  2. The app is properly installed to your workspace
  3. The tokens and workspace ID are correctly copied to your configuration
  4. The app has been added to the channels it needs to access

How to add this MCP server to 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 > MCP and click "Add new global MCP server".

When you click that button the ~/.cursor/mcp.json file will be opened and you can add your server like this:

{
    "mcpServers": {
        "cursor-rules-mcp": {
            "command": "npx",
            "args": [
                "-y",
                "cursor-rules-mcp"
            ]
        }
    }
}

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 explictly ask the agent to use the tool by mentioning the tool name and describing what the function does.

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