Slack MCP Server

$npm install && npm run build
README.md

Integrates AI assistants with Slack workspaces using OAuth 2.0 authenticated user tokens.

Slack MCP Server

A Model Context Protocol (MCP) server for Slack API integration. This server allows AI assistants to interact with Slack workspaces through OAuth 2.0 authenticated user tokens.

Features

  • Channel Operations: List channels, get channel info, get channel members
  • Message Operations: Read messages, send messages, reply to threads, search messages
  • User Operations: List users, get user info, get user profiles
  • File Operations: List files, get file info, upload files
  • Reaction Operations: Add/remove reactions, get message reactions

Prerequisites

  • Node.js 18+
  • A Slack App with OAuth 2.0 configured
  • User token (xoxp-...) with appropriate scopes

Installation

npm install
npm run build

Slack App Setup

1. Create a Slack App

  1. Go to api.slack.com/apps
  2. Click "Create New App" → "From scratch"
  3. Enter app name and select workspace

2. Configure OAuth Scopes

Add these User Token Scopes under "OAuth & Permissions":

channels:read        # List channels
channels:history     # Read channel messages
groups:read          # List private channels
groups:history       # Read private channel messages
im:read              # List direct messages
im:history           # Read direct messages
mpim:read            # List group DMs
mpim:history         # Read group DMs
chat:write           # Send messages
users:read           # List users
users.profile:read   # Read user profiles
files:read           # List files
files:write          # Upload files
reactions:read       # Read reactions
reactions:write      # Add/remove reactions
search:read          # Search messages

3. Configure Redirect URI

Add your platform's callback URL under "OAuth & Permissions" → "Redirect URLs":

https://your-platform.com/oauth/slack/callback

4. Get Client Credentials

Note down your:

  • Client ID
  • Client Secret

Environment Variables

The MCP server reads credentials from environment variables:

# Required
SLACK_ACCESS_TOKEN=xoxp-your-user-token

# Optional
SLACK_TEAM_ID=T0123456789

OAuth 2.0 Flow (Platform Implementation)

Step 1: Redirect User to Slack Authorization

const SLACK_CLIENT_ID = 'your-client-id';
const REDIRECT_URI = 'https://your-platform.com/oauth/slack/callback';
const SCOPES = 'channels:read,channels:history,chat:write,users:read,files:read,files:write,reactions:read,reactions:write,search:read,groups:read,groups:history,im:read,im:history,mpim:read,mpim:history,users.profile:read';

const authUrl = `https://slack.com/oauth/v2/authorize?client_id=${SLACK_CLIENT_ID}&user_scope=${SCOPES}&redirect_uri=${encodeURIComponent(REDIRECT_URI)}&state=${generateRandomState()}`;

// Redirect user to authUrl

Step 2: Handle OAuth Callback

// In your callback handler
app.get('/oauth/slack/callback', async (req, res) => {
  const { code, state } = req.query;

  // Verify state to prevent CSRF
  if (!verifyState(state)) {
    return res.status(400).send('Invalid state');
  }

  // Exchange code for token
  const response = await fetch('https://slack.com/api/oauth.v2.access', {
    method: 'POST',
    headers: {
      'Content-Type': 'application/x-www-form-urlencoded',
    },
    body: new URLSearchParams({
      client_id: SLACK_CLIENT_ID,
      client_secret: SLACK_CLIENT_SECRET,
      code,
      redirect_uri: REDIRECT_URI,
    }),
  });

  const data = await response.json();

  if (data.ok) {
    // Save user token to your database
    const userToken = data.authed_user.access_token; // xoxp-...
    const userId = data.authed_user.id;
    const teamId = data.team.id;

    await db.saveSlackToken(currentUserId, {
      token: userToken,
      slackUserId: userId,
      teamId: teamId,
    });

    res.redirect('/success');
  } else {
    res.status(400).send(`OAuth error: ${data.error}`);
  }
});

Step 3: Start MCP Server with User Token

// When starting the MCP server for a user, inject their token as env var
const userSlackToken = await db.getSlackToken(currentUserId);

const mcpProcess = spawn('node', ['/path/to/slack-mcp/dist/index.js'], {
  env: {
    ...process.env,
    SLACK_ACCESS_TOKEN: userSlackToken,
  },
});

MCP Configuration

Add to your Claude Code configuration (~/.claude/claude_desktop_config.json):

{
  "mcpServers": {
    "slack": {
      "command": "node",
      "args": ["/path/to/slack-mcp/dist/index.js"],
      "env": {
        "SLACK_ACCESS_TOKEN": "xoxp-your-token"
      }
    }
  }
}

Available Tools

Channel Tools

Tool Description
slack_list_channels List all accessible channels
slack_get_channel_info Get channel details
slack_get_channel_members Get channel member list

Message Tools

Tool Description
slack_get_messages Get messages from a channel
slack_get_thread_replies

Tools (5)

slack_list_channelsList all accessible channels
slack_get_channel_infoGet channel details
slack_get_channel_membersGet channel member list
slack_get_messagesGet messages from a channel
slack_get_thread_repliesGet replies to a specific message thread

Environment Variables

SLACK_ACCESS_TOKENrequiredOAuth 2.0 user token (xoxp-...)
SLACK_TEAM_IDSpecific Slack team identifier

Configuration

claude_desktop_config.json
{
  "mcpServers": {
    "slack": {
      "command": "node",
      "args": ["/path/to/slack-mcp/dist/index.js"],
      "env": {
        "SLACK_ACCESS_TOKEN": "xoxp-your-token"
      }
    }
  }
}

Try it

List all the Slack channels I have access to.
Get the last 10 messages from the #general channel.
Find the member list for the channel ID C12345678.
Search my Slack messages for any mention of 'project deadline'.
Upload this text file to the #development channel.

Frequently Asked Questions

What are the key features of Slack MCP Server?

Channel management including listing, info retrieval, and member tracking.. Full message operations: reading, sending, threading, and searching.. File handling capabilities for listing and uploading files.. Reaction management to add, remove, or view message reactions.. Secure OAuth 2.0 authentication using user-specific tokens..

What can I use Slack MCP Server for?

Automating daily standup summaries by reading channel history.. Searching across workspace communications to find specific project details.. Managing Slack reactions and thread replies via natural language.. Uploading generated reports or files directly to specific Slack channels..

How do I install Slack MCP Server?

Install Slack MCP Server by running: npm install && npm run build

What MCP clients work with Slack MCP Server?

Slack MCP Server works with any MCP-compatible client including Claude Desktop, Claude Code, Cursor, and other editors with MCP support.

Use Slack MCP Server with Conare

Manage MCP servers visually, upload persistent context, and never start from zero with Claude Code & Codex.

Try Free