Slack MCP server

Enables AI interaction with Slack workspaces through nine tools for channel management, messaging, user profiles, and reactions using both Bot and User OAuth tokens
Back to servers
Provider
Ubie
Release date
Apr 11, 2025
Language
TypeScript
Stats
18 stars

The Slack MCP (Model Context Protocol) server enables AI assistants to interact with Slack API through a standardized interface. It provides a set of tools that allow access to various Slack functionalities like posting messages, retrieving channel history, and searching messages.

Installation

To install the Slack MCP server, run the following command:

npm install @ubie-oss/slack-mcp-server

Note that this package is hosted in GitHub Registry, so you'll need a Personal Access Token (PAT) to install it.

Configuration

Before using the server, you need to set up the following environment variables:

  • SLACK_BOT_TOKEN: Your Slack Bot User OAuth Token
  • SLACK_USER_TOKEN: Your Slack User OAuth Token (required for certain features like message search)

You can set these variables in a .env file:

SLACK_BOT_TOKEN=xoxb-your-bot-token
SLACK_USER_TOKEN=xoxp-your-user-token

Starting the Server

You can start the MCP server in two ways:

Method 1: Direct execution

npx @ubie-oss/slack-mcp-server

Method 2: Run the installed module

node node_modules/.bin/slack-mcp-server

MCP Configuration

To configure your client to use the Slack MCP server, create an MCP configuration JSON file:

{
  "slack": {
    "command": "npx",
    "args": [
      "-y",
      "@ubie-oss/slack-mcp-server"
    ],
    "env": {
      "NPM_CONFIG_//npm.pkg.github.com/:_authToken": "<your-github-pat>",
      "SLACK_BOT_TOKEN": "<your-bot-token>",
      "SLACK_USER_TOKEN": "<your-user-token>"
    }
  }
}

Available Tools

The Slack MCP server provides the following tools:

  • slack_list_channels: List public channels in the workspace with pagination
  • slack_post_message: Post a new message to a Slack channel
  • slack_reply_to_thread: Reply to a specific message thread in Slack
  • slack_add_reaction: Add a reaction emoji to a message
  • slack_get_channel_history: Get recent messages from a channel
  • slack_get_thread_replies: Get all replies in a message thread
  • slack_get_users: Retrieve basic profile information of all users in the workspace
  • slack_get_user_profile: Get a user's profile information
  • slack_search_messages: Search for messages in the workspace

How It Works

Each tool follows a consistent implementation pattern:

  1. It validates requests using Zod schemas
  2. Calls the appropriate Slack WebAPI endpoint
  3. Parses the response to include only necessary fields
  4. Returns the result as JSON

For example, the slack_list_channels tool validates the incoming request against a schema, calls the Slack API's conversations.list method, and returns a filtered response containing only the essential channel information.

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