Skip to main content
Glama
sdancy10

Slack MCP Server

by sdancy10

Slack MCP Server

MCP server for Slack API integration with HTTP transport.

Authentication Methods

Standard Slack API tokens. Requires a Slack app with appropriate scopes.

export SLACK_TOKEN=xoxb-your-bot-token
# or
export SLACK_TOKEN=xoxp-your-user-token

Uses browser session cookies to impersonate a logged-in user. Useful when:

  • You don't have admin approval for a Slack app

  • You need to act as a specific user

  • You want to access private channels the user is a member of

Extracting Tokens from Chrome

  1. Open Chrome DevTools on your Slack workspace:

    • Navigate to https://your-workspace.slack.com

    • Press F12 or right-click → "Inspect"

    • Go to the Application tab

  2. Get the

    • In DevTools, go to Console tab

    • Paste and run:

      JSON.parse(localStorage.localConfig_v2).teams[Object.keys(JSON.parse(localStorage.localConfig_v2).teams)[0]].token
    • Copy the xoxc-... token

  3. Get the

    • In DevTools, go to ApplicationCookieshttps://your-workspace.slack.com

    • Find the cookie named d

    • Copy the Value (starts with xoxd-...)

    • ⚠️ The value is URL-encoded — keep it as-is

  4. Get workspace details:

    • Team ID: In Console, run:

      JSON.parse(localStorage.localConfig_v2).teams[Object.keys(JSON.parse(localStorage.localConfig_v2).teams)[0]].id
    • User ID: Run:

      JSON.parse(localStorage.localConfig_v2).teams[Object.keys(JSON.parse(localStorage.localConfig_v2).teams)[0]].user_id
    • Domain: Your Slack URL (e.g., your-workspace.slack.com)

  5. Create your env file:

    cp cookie-tokens.env.example /path/to/secrets/cookie-tokens.env
    # Edit the file with your extracted values

A shell script is provided for quick API calls:

# Set up your tokens
source /path/to/secrets/cookie-tokens.env

# Test authentication
./scripts/slack-cookie-client.sh auth

# List channels
./scripts/slack-cookie-client.sh channels 20

# Get channel history
./scripts/slack-cookie-client.sh history C0123ABCDEF 10

# Send a message
./scripts/slack-cookie-client.sh send C0123ABCDEF "Hello from the script!"

# Search messages
./scripts/slack-cookie-client.sh search "keyword"

# List users
./scripts/slack-cookie-client.sh users 50

Token Expiration

Cookie tokens expire when:

  • You log out of Slack in the browser

  • You change your password

  • Slack rotates session tokens (typically every few weeks)

When tokens expire, repeat the extraction process.


Setup (Standard Token)

  1. Get a Slack token (Bot Token xoxb-... or User Token xoxp-...)

  2. Configure environment:

export SLACK_TOKEN=xoxb-your-token
  1. Run:

npm install
npm run start:http

Docker

docker build -t slack-mcp .
docker run -d -p 3929:3929 -e SLACK_TOKEN=xoxb-... slack-mcp

Endpoints

  • GET /health - Health check

  • GET /tools - List available tools

  • POST /call - Call a tool

Available Tools

Tool

Description

slack_list_channels

List channels

slack_get_channel_history

Get channel messages

slack_post_message

Send a message

slack_update_message

Edit a message

slack_delete_message

Delete a message

slack_add_reaction

Add emoji reaction

slack_get_user_info

Get user details

slack_list_users

List workspace users

slack_search_messages

Search messages

Example

# List channels
curl -X POST http://localhost:3929/call \
  -H "Content-Type: application/json" \
  -d '{"name": "slack_list_channels", "arguments": {}}'

# Post message
curl -X POST http://localhost:3929/call \
  -H "Content-Type: application/json" \
  -d '{"name": "slack_post_message", "arguments": {"channel": "C123", "text": "Hello!"}}'

Token Scopes Required

For Bot Token (xoxb-...):

  • channels:read, channels:history

  • chat:write

  • users:read

  • reactions:write

  • search:read (for search)

For User Token (xoxp-...):

  • Same as above, plus any additional scopes for your use case

For Cookie Auth:

  • No scopes needed — inherits all permissions of the logged-in user

-
security - not tested
F
license - not found
-
quality - not tested

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/sdancy10/slack-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server