Skip to main content
Version: Next

How to Run Slack MCP Server

This guide explains how to run and configure the Slack MCP Server after installation.

Configurationโ€‹

Before running the server, you need to set up your Slack API token. You have several options:

  1. Create a .env file in your project directory:

    SLACK_API_TOKEN=your_slack_api_token
  2. Specify the path to your .env file when starting the server:

    slack-mcp-server --env /path/to/.env

Using Command-line Argumentsโ€‹

You can provide your API token directly as a command-line argument:

slack-mcp-server --token your_slack_api_token

Running the Serverโ€‹

Alternative Deployment Options

This section covers running the server with Python. For containerized deployments, see ๐Ÿณ Docker Usage section below, which provides multiple server modes and production-ready configurations.

Basic Usageโ€‹

Start the server with default settings using Python:

slack-mcp-server

This will start the server with HTTP streaming transport on port 8000.

Specifying Transport Typeโ€‹

You can choose between HTTP streaming and Server-Sent Events (SSE) transport:

For HTTP streaming (default)

slack-mcp-server --transport streamable-http

For SSE

slack-mcp-server --transport sse

Custom Portโ€‹

Run the server on a specific port:

slack-mcp-server --port 8080

Full Exampleโ€‹

slack-mcp-server --env /path/to/.env --transport sse --port 8080

๐Ÿณ Docker Usageโ€‹

The Slack MCP Server provides a Docker image for easy deployment and containerized environments. The Docker container supports multiple server modes controlled by environment variables.

Quick Start with Dockerโ€‹

Pull and run the Docker image:

# Pull the latest image
docker pull chisanan232/slack-mcp-server:latest

# Run with minimal configuration (defaults to MCP server)
docker run -d -p 8000:8000 \
-e SLACK_BOT_TOKEN=xoxb-your-bot-token-here \
chisanan232/slack-mcp-server

Docker Server Modesโ€‹

The Docker container uses the SERVICE_TYPE environment variable to determine which server to run:

SERVICE_TYPEDescriptionEntry Point
mcp (default)MCP server onlyslack-mcp-server
webhookWebhook server onlyslack-events-server
integratedCombined MCP + webhook via MCP entryslack-mcp-server --integrated
integrated-webhookCombined MCP + webhook via webhook entryslack-events-server --integrated

Environment Variables by Modeโ€‹

๐ŸŽฏ Main Control Variableโ€‹

Environment VariableDescriptionDefault
SERVICE_TYPEServer mode: mcp, webhook, integrated, integrated-webhookmcp

๐Ÿค– MCP Server Variables (SERVICE_TYPE=mcp or integrated)โ€‹

Core Configuration:

Environment VariableDescriptionDefault
SLACK_BOT_TOKENSlack bot token (required) - format: xoxb-...-
MCP_TRANSPORTTransport mode: stdio, sse, streamable-httpstdio
MCP_HOSTHost for HTTP transports-
MCP_PORTPort for HTTP transports-
MCP_MOUNT_PATHMount path for HTTP transports-
MCP_LOG_LEVELLogging level (case-insensitive): debug, info, warning, error, criticalinfo
MCP_LOG_FILEPath to log file (enables file logging with auto-rotation)-
MCP_LOG_DIRDirectory for log fileslogs
MCP_LOG_FORMATCustom log format string-
MCP_ENV_FILEPath to custom .env file-
MCP_NO_ENV_FILEDisable .env file loading (set to true)-
MCP_INTEGRATEDEnable integrated mode (set to true)-
MCP_RETRYNumber of retry attempts for network operations-

๐Ÿช Webhook Server Variables (SERVICE_TYPE=webhook or integrated-webhook)โ€‹

Core Configuration:

Environment VariableDescriptionDefault
SLACK_BOT_TOKENSlack bot token (required) - format: xoxb-...-
SLACK_WEBHOOK_HOSTHost to listen on-
SLACK_WEBHOOK_PORTPort to listen on-
SLACK_WEBHOOK_LOG_LEVELLogging level (case-insensitive): debug, info, warning, error, criticalinfo
SLACK_WEBHOOK_LOG_FILEPath to log file (enables file logging with auto-rotation)-
SLACK_WEBHOOK_LOG_DIRDirectory for log fileslogs
SLACK_WEBHOOK_LOG_FORMATCustom log format string-
SLACK_WEBHOOK_ENV_FILEPath to custom .env file-
SLACK_WEBHOOK_NO_ENV_FILEDisable .env file loading (set to true)-
SLACK_WEBHOOK_INTEGRATEDEnable integrated mode (set to true)-
SLACK_WEBHOOK_MCP_TRANSPORTMCP transport for integrated mode-
SLACK_WEBHOOK_MCP_MOUNT_PATHMCP mount path for integrated mode-
SLACK_WEBHOOK_RETRYNumber of retry attempts-

Docker Examples by Modeโ€‹

๐Ÿค– MCP Server Modeโ€‹

# MCP server with stdio transport (no HTTP port needed)
docker run -d \
-e SERVICE_TYPE=mcp \
-e SLACK_BOT_TOKEN=xoxb-your-token \
chisanan232/slack-mcp-server

๐Ÿช Webhook Server Modeโ€‹

# Standalone webhook server
docker run -d -p 3000:3000 \
-e SERVICE_TYPE=webhook \
-e SLACK_WEBHOOK_HOST=0.0.0.0 \
-e SLACK_WEBHOOK_PORT=3000 \
-e SLACK_BOT_TOKEN=xoxb-your-token \
chisanan232/slack-mcp-server

๐Ÿ”— Integrated Server Modeโ€‹

# Integrated server via MCP entry point
docker run -d -p 8000:8000 \
-e SERVICE_TYPE=integrated \
-e MCP_TRANSPORT=sse \
-e MCP_HOST=0.0.0.0 \
-e MCP_PORT=8000 \
-e SLACK_BOT_TOKEN=xoxb-your-token \
chisanan232/slack-mcp-server

๐Ÿ“‹ Logging Configurationโ€‹

The server provides comprehensive logging features for both production and development:

Logging Featuresโ€‹

  • โœ… Case-Insensitive Log Levels: Use debug, DEBUG, or Debug - all work!
  • โœ… File Logging: Automatic log rotation at 10MB with 5 backup files
  • โœ… Custom Formats: Customize log output format for your needs
  • โœ… Directory Management: Organize logs in custom directories

Log Levelsโ€‹

LevelDescriptionUse Case
DEBUGDetailed diagnostic information (verbose)Development and troubleshooting
INFOGeneral informational messages (default)Production monitoring
WARNINGWarning messages for potential issuesProduction monitoring
ERRORError messages for serious problemsProduction error tracking
CRITICALCritical error messages for fatal issuesProduction critical alerts

Complete Logging Exampleโ€‹

# MCP Server with all logging options
docker run -d -p 8000:8000 \
-e SERVICE_TYPE=mcp \
-e MCP_TRANSPORT=sse \
-e MCP_HOST=0.0.0.0 \
-e MCP_PORT=8000 \
-e MCP_LOG_LEVEL=debug \
-e MCP_LOG_FILE=/app/logs/mcp-server.log \
-e MCP_LOG_DIR=/app/logs \
-e MCP_LOG_FORMAT="%(asctime)s [%(levelname)s] %(name)s: %(message)s" \
-e SLACK_BOT_TOKEN=xoxb-your-token \
-v $(pwd)/logs:/app/logs \
chisanan232/slack-mcp-server

Log Rotation Behaviorโ€‹

  • Automatically rotates when log file reaches 10MB
  • Keeps 5 backup files (e.g., mcp.log.1, mcp.log.2, ..., mcp.log.5)
  • Oldest backup is deleted on next rotation
  • Uses UTF-8 encoding by default

Using Environment Files with Dockerโ€‹

Create a .env file for your configuration:

# Required Slack tokens
SLACK_BOT_TOKEN=xoxb-your-slack-bot-token-here
SLACK_SIGNING_SECRET=your-slack-signing-secret

# Optional Slack configuration
SLACK_BOT_ID=your-slack-bot-id
SLACK_USER_TOKEN=xoxp-your-user-token
SLACK_TEST_CHANNEL=#your-test-channel
SLACK_TEST_CHANNEL_ID=C1234567890

# Message queue backend (memory, redis, kafka)
QUEUE_BACKEND=memory
REDIS_URL=redis://localhost:6379/0
KAFKA_BOOTSTRAP=broker:9092

Mount the .env file when running the container:

docker run -d -p 8000:8000 \
-v $(pwd)/.env:/app/.env \
-e SERVICE_TYPE=mcp \
-e MCP_TRANSPORT=sse \
-e MCP_HOST=0.0.0.0 \
-e MCP_PORT=8000 \
chisanan232/slack-mcp-server

Docker Compose Exampleโ€‹

Create a docker-compose.yml file:

version: '3.8'

services:
slack-mcp-server:
image: chisanan232/slack-mcp-server:latest
ports:
- "8000:8000"
environment:
- SERVICE_TYPE=integrated
- MCP_TRANSPORT=sse
- MCP_HOST=0.0.0.0
- MCP_PORT=8000
- MCP_LOG_LEVEL=info
- MCP_LOG_FILE=/app/logs/mcp.log
- SLACK_BOT_TOKEN=${SLACK_BOT_TOKEN}
volumes:
- ./logs:/app/logs
env_file:
- .env
restart: unless-stopped
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:8000/health"]
interval: 30s
timeout: 10s
retries: 3

# Example with Redis backend
slack-mcp-redis:
image: chisanan232/slack-mcp-server:latest
ports:
- "8001:8000"
environment:
- SERVICE_TYPE=integrated
- MCP_TRANSPORT=sse
- MCP_HOST=0.0.0.0
- MCP_PORT=8000
- SLACK_BOT_TOKEN=${SLACK_BOT_TOKEN}
- QUEUE_BACKEND=redis
- REDIS_URL=redis://redis:6379/0
depends_on:
- redis
restart: unless-stopped

redis:
image: redis:7-alpine
ports:
- "6379:6379"
restart: unless-stopped

Run with Docker Compose:

# Start services
docker-compose up -d

# View logs
docker-compose logs -f slack-mcp-server

# Stop services
docker-compose down

Production Deployment Tipsโ€‹

๐Ÿ”’ Security Best Practicesโ€‹

  1. Use Docker Secrets for sensitive data:

    # Create secret
    echo "xoxb-your-token" | docker secret create slack_bot_token -

    # Use in container
    docker service create \
    --name slack-mcp \
    --secret slack_bot_token \
    -e SLACK_BOT_TOKEN_FILE=/run/secrets/slack_bot_token \
    chisanan232/slack-mcp-server
  2. Use multi-stage builds for smaller images:

    FROM chisanan232/slack-mcp-server:latest
    # Add your custom configuration
  3. Run as non-root user:

    docker run --user 1000:1000 \
    -e SLACK_BOT_TOKEN=xoxb-your-token \
    chisanan232/slack-mcp-server

๐Ÿ“Š Monitoring and Loggingโ€‹

  1. Health Check Configuration:

    docker run -d \
    --health-cmd="curl -f http://localhost:8000/health || exit 1" \
    --health-interval=30s \
    --health-timeout=10s \
    --health-retries=3 \
    chisanan232/slack-mcp-server
  2. Application Log Management:

    # Enable file logging with rotation
    docker run -d -p 8000:8000 \
    -e MCP_LOG_LEVEL=info \
    -e MCP_LOG_FILE=/app/logs/mcp.log \
    -e MCP_LOG_DIR=/app/logs \
    -v $(pwd)/logs:/app/logs \
    chisanan232/slack-mcp-server
  3. Docker Log Driver Configuration:

    # Configure Docker's log driver for container logs
    docker run -d \
    --log-driver=json-file \
    --log-opt max-size=10m \
    --log-opt max-file=3 \
    -e MCP_LOG_LEVEL=warning \
    chisanan232/slack-mcp-server

๐Ÿš€ Scaling and Load Balancingโ€‹

For high-availability deployments:

# docker-compose.yml for load balancing
version: '3.8'
services:
nginx:
image: nginx:alpine
ports:
- "80:80"
volumes:
- ./nginx.conf:/etc/nginx/nginx.conf
depends_on:
- slack-mcp-1
- slack-mcp-2

slack-mcp-1:
image: chisanan232/slack-mcp-server:latest
environment:
- SERVICE_TYPE=integrated
- MCP_TRANSPORT=sse
- MCP_HOST=0.0.0.0
- MCP_PORT=8000

slack-mcp-2:
image: chisanan232/slack-mcp-server:latest
environment:
- SERVICE_TYPE=integrated
- MCP_TRANSPORT=sse
- MCP_HOST=0.0.0.0
- MCP_PORT=8000

Verifying Server Operationโ€‹

Once the server is running, you can verify it's working by accessing:

curl http://localhost:8000/health

You should receive a JSON response confirming the server is operational.