Skip to main content
Version: 0.1.0

Deployment Guide

This guide covers common deployment patterns for both MCP server and webhook server implementations. Both servers share similar deployment requirements and can be deployed using the same infrastructure patterns.

Extras Overview
  • [mcp]: installs the MCP server feature set.
  • [webhook]: installs the webhook server feature set.
  • [all]: installs everything (MCP + webhook).

Quick Start Deployment

Local Development Setup

# Clone and setup
git clone <repository-url>
cd slack-mcp-server

# Install dependencies
pip install -e .

# Create environment file
cat > .env << EOF
SLACK_BOT_TOKEN=xoxb-your-development-token
QUEUE_BACKEND=memory
EOF

# Start MCP server
slack-mcp-server

Production Setup

# Install from PyPI
pip install "slack-mcp[mcp]"

# Create production environment file
cat > .env.production << EOF
SLACK_BOT_TOKEN=xoxb-your-production-token
QUEUE_BACKEND=redis
REDIS_URL=redis://localhost:6379/0
EOF

# Start with production settings
slack-mcp-server --log-level INFO

Docker Deployment

Create a docker-compose.yml file for easy multi-service deployment:

version: '3.8'

services:
mcp-server:
build: .
environment:
- 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"
volumes:
- redis_data:/data
restart: unless-stopped

volumes:
redis_data:

Dockerfile Examples

FROM python:3.11-slim

# Set working directory
WORKDIR /app

# Install system dependencies
RUN apt-get update && apt-get install -y \
build-essential \
&& rm -rf /var/lib/apt/lists/*

# Copy requirements and install Python dependencies
COPY pyproject.toml .
RUN pip install -e .

# Copy application code
COPY . .

# Create non-root user
RUN useradd --create-home --shell /bin/bash app
RUN chown -R app:app /app
USER app

# Expose port (for webhook server)
EXPOSE 3000

# Default command (override for specific server)
CMD ["slack-mcp-server"]

Running with Docker

# Build image
docker build -t slack-mcp-server .

# Run with environment file
docker run --env-file .env.production slack-mcp-server

# Run with individual environment variables
docker run \
-e SLACK_BOT_TOKEN="xoxb-your-token" \
-e QUEUE_BACKEND="memory" \
slack-mcp-server

Cloud Deployment

Kubernetes Deployment

apiVersion: apps/v1
kind: Deployment
metadata:
name: mcp-server
spec:
replicas: 3
selector:
matchLabels:
app: mcp-server
template:
metadata:
labels:
app: mcp-server
spec:
containers:
- name: mcp-server
image: slack-mcp-server:latest
env:
- name: SLACK_BOT_TOKEN
valueFrom:
secretKeyRef:
name: slack-secrets
key: bot-token
- name: QUEUE_BACKEND
value: "redis"
- name: REDIS_URL
value: "redis://redis-service:6379/0"
resources:
requests:
memory: "128Mi"
cpu: "100m"
limits:
memory: "256Mi"
cpu: "200m"
---
apiVersion: v1
kind: Secret
metadata:
name: slack-secrets
type: Opaque
data:
bot-token: <base64-encoded-token>

Heroku Deployment

# Create Heroku app
heroku create your-mcp-server

# Set environment variables
heroku config:set SLACK_BOT_TOKEN="xoxb-your-token"
heroku config:set QUEUE_BACKEND="memory"

# Create Procfile
echo "worker: slack-mcp-server" > Procfile

# Deploy
git add .
git commit -m "Deploy MCP server"
git push heroku main

Process Management

Using systemd (Linux)

[Unit]
Description=Slack MCP Server
After=network.target

[Service]
Type=simple
User=slack-mcp
WorkingDirectory=/opt/slack-mcp-server
EnvironmentFile=/opt/slack-mcp-server/.env.production
ExecStart=/opt/slack-mcp-server/venv/bin/slack-mcp-server
Restart=always
RestartSec=10

[Install]
WantedBy=multi-user.target
# Enable and start services
sudo systemctl enable slack-mcp-server
sudo systemctl start slack-mcp-server
sudo systemctl status slack-mcp-server

Using Supervisor

[program:mcp-server]
command=/opt/slack-mcp-server/venv/bin/slack-mcp-server
directory=/opt/slack-mcp-server
environment=SLACK_BOT_TOKEN="xoxb-token",QUEUE_BACKEND="redis"
user=slack-mcp
autostart=true
autorestart=true
redirect_stderr=true
stdout_logfile=/var/log/mcp-server.log

Environment-Specific Configurations

Development Environment

# .env.development
SLACK_BOT_TOKEN="xoxb-dev-token"
SLACK_TEST_CHANNEL="#dev-testing"
QUEUE_BACKEND="memory"
LOG_LEVEL="DEBUG"

Staging Environment

# .env.staging
SLACK_BOT_TOKEN="xoxb-staging-token"
QUEUE_BACKEND="redis"
REDIS_URL="redis://staging-redis:6379/0"
LOG_LEVEL="INFO"

Production Environment

# .env.production
SLACK_BOT_TOKEN="xoxb-prod-token"
SLACK_SIGNING_SECRET="prod-signing-secret"
QUEUE_BACKEND="redis"
REDIS_URL="redis://prod-redis:6379/0"
LOG_LEVEL="WARNING"

Monitoring and Logging

Health Checks

# Basic health check (check if process is running)
pgrep -f slack-mcp-server

# Check logs for errors
tail -f /var/log/mcp-server.log | grep ERROR

Log Management

# Rotate logs with logrotate
cat > /etc/logrotate.d/slack-servers << EOF
/var/log/mcp-server.log
/var/log/webhook-server.log {
daily
rotate 30
compress
delaycompress
missingok
notifempty
create 0644 slack-mcp slack-mcp
}
EOF

Troubleshooting Common Deployment Issues

Connection Issues

# Test Slack API connectivity
curl -H "Authorization: Bearer $SLACK_BOT_TOKEN" \
https://slack.com/api/auth.test

# Test Redis connectivity (if using Redis backend)
redis-cli -u $REDIS_URL ping

Permission Issues

# Fix file permissions
chown -R slack-mcp:slack-mcp /opt/slack-mcp-server
chmod +x /opt/slack-mcp-server/venv/bin/slack-mcp-server

# Check firewall rules (for webhook server)
sudo ufw status
sudo ufw allow 3000/tcp

Resource Issues

# Check memory usage
free -h
ps aux | grep slack

# Check disk space
df -h
du -sh /opt/slack-*-server/

Security Considerations

Network Security

  • Use HTTPS for webhook endpoints
  • Implement proper firewall rules
  • Use VPN or private networks for internal communication

Token Security

  • Store tokens in secure secret management systems
  • Rotate tokens regularly
  • Use different tokens for different environments

Container Security

  • Use non-root users in containers
  • Keep base images updated
  • Scan containers for vulnerabilities

For server-specific deployment details, see: