Skip to content

Latest commit

 

History

History
257 lines (217 loc) · 14.3 KB

File metadata and controls

257 lines (217 loc) · 14.3 KB

3. Configuration and Usage

You can configure the MCP server using command line arguments and environment variables.

Using DXT

For Claude Desktop users, you can use the DXT extension to run the MCP server without needing to edit the claude_desktop_config.json file directly. Download the latest version of the DXT Extension from releases page.

  1. Open Claude Desktop and go to the Settings menu.
  2. Click on the Extensions tab.
  3. Drag and drop the downloaded .dxt file to install it and click "Install".
  4. Fill all required configuration fields
    • Authentication method: xoxc/xoxd or xoxp.
    • Value for SLACK_MCP_XOXC_TOKEN and SLACK_MCP_XOXD_TOKEN in case of xoxc/xoxd method, or SLACK_MCP_XOXP_TOKEN in case of xoxp.
    • You may also enable Add Message Tool to allow posting messages to channels.
    • You may also change User-Agent if needed if you have Enterprise Slack.
  5. Enable MCP Server.

Important

You may need to disable bundled node in Claude Desktop and let it use node from host machine to avoid some startup issues in case you encounter them. It is DXT known bug: modelcontextprotocol/mcpb#45 (comment)

Using Cursor Installer

The MCP server can be installed using the Cursor One-Click method.

Below are prepared configurations:

  • npx and xoxc/xoxd method: Install MCP Server
  • npx and xoxp method: Install MCP Server

Important

Remember to replace tokens in the configuration with your own tokens, as they are just examples.

Using npx

If you have npm installed, this is the fastest way to get started with slack-mcp-server on Claude Desktop.

Open your claude_desktop_config.json and add the mcp server to the list of mcpServers:

Warning

If you are using Enterprise Slack, you may set SLACK_MCP_USER_AGENT environment variable to match your browser's User-Agent string from where you extracted xoxc and xoxd and enable SLACK_MCP_CUSTOM_TLS to enable custom TLS-handshakes to start to look like a real browser. This is required for the server to work properly in some environments with higher security policies.

Option 1: Using XOXP Token

{
  "mcpServers": {
    "slack": {
      "command": "npx",
      "args": [
        "-y",
        "slack-mcp-server@latest",
        "--transport",
        "stdio"
      ],
      "env": {
        "SLACK_MCP_XOXP_TOKEN": "xoxp-..."
      }
    }
  }
}

Option 2: Using XOXC/XOXD Tokens

{
  "mcpServers": {
    "slack": {
      "command": "npx",
      "args": [
        "-y",
        "slack-mcp-server@latest",
        "--transport",
        "stdio"
      ],
      "env": {
        "SLACK_MCP_XOXC_TOKEN": "xoxc-...",
        "SLACK_MCP_XOXD_TOKEN": "xoxd-..."
      }
    }
  }
}
Or, stdio transport with docker.

Option 1: Using XOXP Token

{
  "mcpServers": {
    "slack": {
      "command": "docker",
      "args": [
        "run",
        "-i",
        "--rm",
        "-e",
        "SLACK_MCP_XOXP_TOKEN",
        "ghcr.io/korotovsky/slack-mcp-server",
        "mcp-server",
        "--transport",
        "stdio"
      ],
      "env": {
        "SLACK_MCP_XOXP_TOKEN": "xoxp-..."
      }
    }
  }
}

Option 2: Using XOXC/XOXD Tokens

{
  "mcpServers": {
    "slack": {
      "command": "docker",
      "args": [
        "run",
        "-i",
        "--rm",
        "-e",
        "SLACK_MCP_XOXC_TOKEN",
        "-e",
        "SLACK_MCP_XOXD_TOKEN",
        "ghcr.io/korotovsky/slack-mcp-server",
        "mcp-server",
        "--transport",
        "stdio"
      ],
      "env": {
        "SLACK_MCP_XOXC_TOKEN": "xoxc-...",
        "SLACK_MCP_XOXD_TOKEN": "xoxd-..."
      }
    }
  }
}

Please see Docker for more information.

Using npx with sse transport:

In case you would like to run it in sse mode, then you should use mcp-remote wrapper for Claude Desktop and deploy/expose MCP server somewhere e.g. with ngrok or docker-compose.

{
  "mcpServers": {
    "slack": {
      "command": "npx",
      "args": [
        "-y",
        "mcp-remote",
        "https://x.y.z.q:3001/sse",
        "--header",
        "Authorization: Bearer ${SLACK_MCP_API_KEY}"
      ],
      "env": {
        "SLACK_MCP_API_KEY": "my-$$e-$ecret"
      }
    }
  }
}
Or, sse transport for Windows.
{
  "mcpServers": {
    "slack": {
      "command": "C:\\Progra~1\\nodejs\\npx.cmd",
      "args": [
        "-y",
        "mcp-remote",
        "https://x.y.z.q:3001/sse",
        "--header",
        "Authorization: Bearer ${SLACK_MCP_API_KEY}"
      ],
      "env": {
        "SLACK_MCP_API_KEY": "my-$$e-$ecret"
      }
    }
  }
}

TLS and Exposing to the Internet

There are several reasons why you might need to setup HTTPS for your SSE.

  • mcp-remote is capable to handle only https schemes;
  • it is generally a good practice to use TLS for any service exposed to the internet;

You could use ngrok:

ngrok http 3001

and then use the endpoint https://903d-xxx-xxxx-xxxx-10b4.ngrok-free.app for your mcp-remote argument.

Using Docker

For detailed information about all environment variables, see Environment Variables.

export SLACK_MCP_XOXC_TOKEN=xoxc-...
export SLACK_MCP_XOXD_TOKEN=xoxd-...

docker pull ghcr.io/korotovsky/slack-mcp-server:latest
docker run -i --rm \
  -e SLACK_MCP_XOXC_TOKEN \
  -e SLACK_MCP_XOXD_TOKEN \
  slack-mcp-server mcp-server --transport stdio

Or, the docker-compose way:

wget -O docker-compose.yml https://github.com/korotovsky/slack-mcp-server/releases/latest/download/docker-compose.yml
wget -O .env https://github.com/korotovsky/slack-mcp-server/releases/latest/download/default.env.dist
nano .env # Edit .env file with your tokens from step 1 of the setup guide
docker network create app-tier
docker-compose up -d

Console Arguments

Argument Required ? Description
--transport or -t Yes Select transport for the MCP Server, possible values are: stdio, sse

Environment Variables

Variable Required? Default Description
SLACK_MCP_XOXC_TOKEN Yes* nil Slack browser token (xoxc-...)
SLACK_MCP_XOXD_TOKEN Yes* nil Slack browser cookie d (xoxd-...)
SLACK_MCP_XOXP_TOKEN Yes* nil User OAuth token (xoxp-...) — alternative to xoxc/xoxd
SLACK_MCP_PORT No 13080 Port for the MCP server to listen on
SLACK_MCP_HOST No 127.0.0.1 Host for the MCP server to listen on
SLACK_MCP_API_KEY No nil Bearer token for SSE and HTTP transports
SLACK_MCP_PROXY No nil Proxy URL for outgoing requests
SLACK_MCP_USER_AGENT No nil Custom User-Agent (for Enterprise Slack environments)
SLACK_MCP_CUSTOM_TLS No nil Send custom TLS-handshake to Slack servers based on SLACK_MCP_USER_AGENT or default User-Agent. (for Enterprise Slack environments)
SLACK_MCP_SERVER_CA No nil Path to CA certificate
SLACK_MCP_SERVER_CA_TOOLKIT No nil Inject HTTPToolkit CA certificate to root trust-store for MitM debugging
SLACK_MCP_SERVER_CA_INSECURE No false Trust all insecure requests (NOT RECOMMENDED)
SLACK_MCP_ADD_MESSAGE_TOOL No nil Enable message posting via conversations_add_message by setting it to true for all channels, a comma-separated list of channel IDs to whitelist specific channels, or use ! before a channel ID to allow all except specified ones, while an empty value disables posting by default.
SLACK_MCP_ADD_MESSAGE_MARK No nil When the conversations_add_message tool is enabled, any new message sent will automatically be marked as read.
SLACK_MCP_ADD_MESSAGE_UNFURLING No nil Enable to let Slack unfurl posted links or set comma-separated list of domains e.g. github.com,slack.com to whitelist unfurling only for them. If text contains whitelisted and unknown domain unfurling will be disabled for security reasons.
SLACK_MCP_USERS_CACHE No .users_cache.json Path to the users cache file. Used to cache Slack user information to avoid repeated API calls on startup.
SLACK_MCP_CHANNELS_CACHE No .channels_cache_v2.json Path to the channels cache file. Used to cache Slack channel information to avoid repeated API calls on startup.
SLACK_MCP_LOG_LEVEL No info Log-level for stdout or stderr. Valid values are: debug, info, warn, error, panic and fatal