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:
Using a .env File (Recommended)โ
-
Create a
.envfile in your project directory:SLACK_API_TOKEN=your_slack_api_token -
Specify the path to your
.envfile when starting the server:- pip
- poetry
- uv
slack-mcp-server --env /path/to/.envpoetry run slack-mcp-server --env /path/to/.envuv run slack-mcp-server --env /path/to/.env
Using Command-line Argumentsโ
You can provide your API token directly as a command-line argument:
- pip
- poetry
- uv
slack-mcp-server --token your_slack_api_token
poetry run slack-mcp-server --token your_slack_api_token
uv run slack-mcp-server --token your_slack_api_token
Running the Serverโ
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:
- pip
- poetry
- uv
slack-mcp-server
poetry run slack-mcp-server
uv run 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:
- pip
- poetry
- uv
For HTTP streaming (default)
slack-mcp-server --transport streamable-http
For SSE
slack-mcp-server --transport sse
For HTTP streaming (default)
poetry run slack-mcp-server --transport streamable-http
For SSE
poetry run slack-mcp-server --transport sse
For HTTP streaming (default)
uv run slack-mcp-server --transport streamable-http
For SSE
uv run slack-mcp-server --transport sse
Custom Portโ
Run the server on a specific port:
- pip
- poetry
- uv
slack-mcp-server --port 8080
poetry run slack-mcp-server --port 8080
uv run slack-mcp-server --port 8080
Full Exampleโ
- pip
- poetry
- uv
slack-mcp-server --env /path/to/.env --transport sse --port 8080
poetry run slack-mcp-server --env /path/to/.env --transport sse --port 8080
uv run 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_TYPE | Description | Entry Point |
|---|---|---|
mcp (default) | MCP server only | slack-mcp-server |
webhook | Webhook server only | slack-events-server |
integrated | Combined MCP + webhook via MCP entry | slack-mcp-server --integrated |
integrated-webhook | Combined MCP + webhook via webhook entry | slack-events-server --integrated |
Environment Variables by Modeโ
๐ฏ Main Control Variableโ
| Environment Variable | Description | Default |
|---|---|---|
SERVICE_TYPE | Server mode: mcp, webhook, integrated, integrated-webhook | mcp |
๐ค MCP Server Variables (SERVICE_TYPE=mcp or integrated)โ
Core Configuration:
| Environment Variable | Description | Default |
|---|---|---|
SLACK_BOT_TOKEN | Slack bot token (required) - format: xoxb-... | - |
MCP_TRANSPORT | Transport mode: stdio, sse, streamable-http | stdio |
MCP_HOST | Host for HTTP transports | - |
MCP_PORT | Port for HTTP transports | - |
MCP_MOUNT_PATH | Mount path for HTTP transports | - |
MCP_LOG_LEVEL | Logging level (case-insensitive): debug, info, warning, error, critical | info |
MCP_LOG_FILE | Path to log file (enables file logging with auto-rotation) | - |
MCP_LOG_DIR | Directory for log files | logs |
MCP_LOG_FORMAT | Custom log format string | - |
MCP_ENV_FILE | Path to custom .env file | - |
MCP_NO_ENV_FILE | Disable .env file loading (set to true) | - |
MCP_INTEGRATED | Enable integrated mode (set to true) | - |
MCP_RETRY | Number of retry attempts for network operations | - |
๐ช Webhook Server Variables (SERVICE_TYPE=webhook or integrated-webhook)โ
Core Configuration:
| Environment Variable | Description | Default |
|---|---|---|
SLACK_BOT_TOKEN | Slack bot token (required) - format: xoxb-... | - |
SLACK_WEBHOOK_HOST | Host to listen on | - |
SLACK_WEBHOOK_PORT | Port to listen on | - |
SLACK_WEBHOOK_LOG_LEVEL | Logging level (case-insensitive): debug, info, warning, error, critical | info |
SLACK_WEBHOOK_LOG_FILE | Path to log file (enables file logging with auto-rotation) | - |
SLACK_WEBHOOK_LOG_DIR | Directory for log files | logs |
SLACK_WEBHOOK_LOG_FORMAT | Custom log format string | - |
SLACK_WEBHOOK_ENV_FILE | Path to custom .env file | - |
SLACK_WEBHOOK_NO_ENV_FILE | Disable .env file loading (set to true) | - |
SLACK_WEBHOOK_INTEGRATED | Enable integrated mode (set to true) | - |
SLACK_WEBHOOK_MCP_TRANSPORT | MCP transport for integrated mode | - |
SLACK_WEBHOOK_MCP_MOUNT_PATH | MCP mount path for integrated mode | - |
SLACK_WEBHOOK_RETRY | Number of retry attempts | - |
Docker Examples by Modeโ
๐ค MCP Server Modeโ
- stdio (default)
- stdio with logging
- SSE
- SSE with logging
- Streamable HTTP
# 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
# MCP server with stdio transport and file logging
docker run -d \
-e SERVICE_TYPE=mcp \
-e MCP_LOG_LEVEL=debug \
-e MCP_LOG_FILE=/app/logs/mcp.log \
-e SLACK_BOT_TOKEN=xoxb-your-token \
-v $(pwd)/logs:/app/logs \
chisanan232/slack-mcp-server
# MCP server with SSE transport
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 SLACK_BOT_TOKEN=xoxb-your-token \
chisanan232/slack-mcp-server
# MCP server with SSE transport and comprehensive logging
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 SLACK_BOT_TOKEN=xoxb-your-token \
-v $(pwd)/logs:/app/logs \
chisanan232/slack-mcp-server
# MCP server with streamable HTTP transport
docker run -d -p 8000:8000 \
-e SERVICE_TYPE=mcp \
-e MCP_TRANSPORT=streamable-http \
-e MCP_HOST=0.0.0.0 \
-e MCP_PORT=8000 \
-e SLACK_BOT_TOKEN=xoxb-your-token \
chisanan232/slack-mcp-server
๐ช Webhook Server Modeโ
- Basic
- With Logging
# 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
# Webhook server with file logging
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_WEBHOOK_LOG_LEVEL=debug \
-e SLACK_WEBHOOK_LOG_FILE=/app/logs/webhook.log \
-e SLACK_BOT_TOKEN=xoxb-your-token \
-v $(pwd)/logs:/app/logs \
chisanan232/slack-mcp-server
๐ Integrated Server Modeโ
- Via MCP Entry
- Via Webhook Entry
# 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
# Integrated server via webhook entry point
docker run -d -p 3000:3000 \
-e SERVICE_TYPE=integrated-webhook \
-e SLACK_WEBHOOK_HOST=0.0.0.0 \
-e SLACK_WEBHOOK_PORT=3000 \
-e SLACK_WEBHOOK_MCP_TRANSPORT=sse \
-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, orDebug- 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โ
| Level | Description | Use Case |
|---|---|---|
DEBUG | Detailed diagnostic information (verbose) | Development and troubleshooting |
INFO | General informational messages (default) | Production monitoring |
WARNING | Warning messages for potential issues | Production monitoring |
ERROR | Error messages for serious problems | Production error tracking |
CRITICAL | Critical error messages for fatal issues | Production 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โ
-
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 -
Use multi-stage builds for smaller images:
FROM chisanan232/slack-mcp-server:latest
# Add your custom configuration -
Run as non-root user:
docker run --user 1000:1000 \
-e SLACK_BOT_TOKEN=xoxb-your-token \
chisanan232/slack-mcp-server
๐ Monitoring and Loggingโ
-
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 -
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 -
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.