Slack MCP Server¶
Enhanced Slack MCP server for comprehensive workspace integration with channels, DMs, and message management.
This template extends the powerful korotovsky/slack-mcp-server and provides seamless integration with the MCP Platform ecosystem.
Overview¶
The Slack MCP Server provides a comprehensive interface to Slack workspaces, enabling AI assistants and automation tools to interact with Slack channels, direct messages, and threads. It supports both official OAuth authentication and stealth mode using browser cookies.
Key Features¶
- Dual Authentication: OAuth tokens or browser cookies (stealth mode)
- Message Management: Fetch, search, and post messages with safety controls
- Thread Support: Complete thread conversation handling
- Channel Operations: List, lookup, and manage channels
- User Management: User information and DM handling
- Smart Pagination: Efficient message history with date/count limits
- Enterprise Ready: Proxy support and security features
Architecture¶
The Slack MCP server follows a modular architecture:
- Authentication Layer: Handles OAuth and stealth mode authentication
- API Interface: Manages Slack Web API communication
- Caching System: Improves performance with configurable TTL
- Safety Controls: Message posting restrictions and read-only mode
- Transport Layer: Supports stdio and SSE protocols
Quick Start¶
OAuth Mode (Recommended)¶
# Create Slack app and get bot token
python -m mcp_platform deploy slack \
--config slack_token=xoxb-your-bot-token
Stealth Mode¶
# Extract browser cookies and deploy
python -m mcp_platform deploy slack \
--config stealth_mode=true \
--config slack_cookie="d=xoxd-your-cookie" \
--config slack_workspace=yourteam
Usage & API Reference¶
For comprehensive usage examples, tool documentation, and integration guides:
The usage guide includes: - Available Tools - Complete list of tools with parameters and examples - Integration Examples - Python, JavaScript, and CLI usage - HTTP API - REST endpoint documentation - Configuration - Setup and deployment options - Best Practices - Tips for optimal usage
Usage & API Reference¶
For comprehensive usage examples, tool documentation, and integration guides:
The usage guide includes: - Available Tools - Complete list of tools with parameters and examples - Integration Examples - Python, JavaScript, and CLI usage - HTTP API - REST endpoint documentation - Configuration - Setup and deployment options - Best Practices - Tips for optimal usage
Configuration¶
Authentication Options¶
Method | Tokens Required | Permissions | Setup Complexity |
---|---|---|---|
OAuth Bot | slack_token (xoxb-) |
Bot scopes | Medium |
OAuth User | slack_user_token (xoxp-) |
User scopes | Medium |
OAuth App | slack_app_token (xapp-) |
App-level | High |
Stealth | slack_cookie (browser) |
User session | Low |
Environment Variables¶
Variable | Description | Default |
---|---|---|
SLACK_TOKEN |
Bot OAuth token | - |
SLACK_USER_TOKEN |
User OAuth token | - |
SLACK_COOKIE |
Browser cookie for stealth | - |
SLACK_WORKSPACE |
Workspace domain | - |
STEALTH_MODE |
Enable stealth authentication | false |
ENABLE_MESSAGE_POSTING |
Allow posting messages | false |
ALLOWED_CHANNELS |
Posting channel restrictions | - |
CACHE_ENABLED |
Enable user/channel caching | true |
READ_ONLY_MODE |
Restrict to read operations | false |
Safety Features¶
- Message posting disabled by default - Requires explicit enabling
- Channel restrictions - Limit posting to specific channels
- Read-only mode - Complete write protection
- Token validation - Automatic credential verification
conversations_history¶
Get messages from channels, DMs, or group DMs with smart pagination.
Parameters:
- channel_id
: Channel ID (C123...) or name (#general, @user)
- limit
: Time period (1d, 7d, 30d) or message count
- include_activity_messages
: Include join/leave events
- cursor
: Pagination cursor for next page
Example:
conversations_replies¶
Get all messages in a thread conversation.
Parameters:
- channel_id
: Channel containing the thread
- thread_ts
: Thread timestamp (1234567890.123456)
- limit
: Message limit or time period
- cursor
: Pagination cursor
Example:
client.call("conversations_replies", {
"channel_id": "#general",
"thread_ts": "1234567890.123456"
})
conversations_add_message¶
Post messages to channels or DMs (requires explicit enabling).
Parameters:
- channel_id
: Target channel or DM
- text
: Message content
- thread_ts
: Reply to thread (optional)
Example:
search_messages¶
Search messages across the workspace with filters.
Parameters:
- query
: Search terms and filters
- sort
: Sort by timestamp or relevance
- count
: Number of results
Example:
client.call("search_messages", {
"query": "MCP platform in:#general",
"sort": "timestamp",
"count": 20
})
Channel and User Management¶
Additional tools for workspace management:
list_channels
: Get all accessible channelsget_channel_info
: Channel details and metadataget_user_info
: User profile informationlist_dms
: Direct message conversations
Transport Modes¶
Stdio Transport¶
Perfect for Claude Desktop and MCP clients:
# Direct stdio usage
python server.py --slack-token xoxb-your-token
# Docker stdio
docker run -i --rm \
-e SLACK_TOKEN=xoxb-your-token \
dataeverything/mcp-slack
Server-Sent Events (SSE)¶
For web applications and real-time integration:
# Start SSE server
python -m mcp_platform deploy slack \
--config mcp_transport=sse \
--config mcp_port=3003
# Connect via HTTP
curl -N http://localhost:3003/sse
Claude Desktop¶
Add to your Claude Desktop configuration:
{
"mcpServers": {
"slack": {
"command": "docker",
"args": [
"run", "-i", "--rm",
"-e", "SLACK_TOKEN=xoxb-your-token",
"dataeverything/mcp-slack:latest"
]
}
}
}
Custom Application¶
import asyncio
from fastmcp.client import FastMCPClient
async def slack_integration():
client = FastMCPClient(endpoint="http://localhost:3003")
# Get recent messages
messages = await client.call("conversations_history", {
"channel_id": "#general",
"limit": "1d"
})
# Search for issues
issues = await client.call("search_messages", {
"query": "error OR failed OR bug",
"sort": "timestamp"
})
await client.close()
asyncio.run(slack_integration())
Enterprise Deployment¶
Docker Compose¶
version: '3.8'
services:
slack-mcp:
image: dataeverything/mcp-slack:latest
ports:
- "3003:3003"
environment:
SLACK_TOKEN: xoxb-your-token
CACHE_ENABLED: true
READ_ONLY_MODE: true
LOG_LEVEL: INFO
networks:
- mcp-platform
networks:
mcp-platform:
external: true
Kubernetes¶
apiVersion: apps/v1
kind: Deployment
metadata:
name: slack-mcp
spec:
replicas: 2
selector:
matchLabels:
app: slack-mcp
template:
metadata:
labels:
app: slack-mcp
spec:
containers:
- name: slack-mcp
image: dataeverything/mcp-slack:latest
ports:
- containerPort: 3003
env:
- name: SLACK_TOKEN
valueFrom:
secretKeyRef:
name: slack-secrets
key: token
- name: CACHE_ENABLED
value: "true"
- name: READ_ONLY_MODE
value: "true"
Troubleshooting¶
Authentication Issues¶
- Invalid Token: Verify token format and permissions
- Expired Cookies: Update browser cookies for stealth mode
- Permission Denied: Check bot/app scopes in Slack
Performance Issues¶
- Slow Responses: Enable caching and reduce history limits
- Rate Limiting: Implement exponential backoff
- Memory Usage: Adjust cache TTL and concurrent requests
Network Issues¶
- Proxy Configuration: Set HTTP_PROXY and HTTPS_PROXY
- Firewall: Ensure port 3003 is accessible
- SSL/TLS: Verify certificate trust for enterprise networks
Best Practices¶
Security¶
- Use read-only mode for monitoring applications
- Restrict message posting to specific channels
- Rotate tokens regularly and monitor usage
- Use environment variables for sensitive data
Performance¶
- Enable caching for better response times
- Set appropriate history limits
- Use pagination for large datasets
- Monitor resource usage and adjust accordingly
Reliability¶
- Implement error handling and retries
- Use health checks for production deployments
- Monitor token expiration and refresh
- Set up logging and alerting
Contributing¶
Contributions to improve the Slack MCP server template are welcome! Please:
- Fork the repository
- Create a feature branch
- Add tests for new functionality
- Update documentation
- Submit a pull request
License¶
This template extends the korotovsky/slack-mcp-server project. Please refer to the original project's license terms.
Support¶
- Template Issues: MCP Platform Repository
- Slack Server Issues: korotovsky/slack-mcp-server
- Documentation: MCP Platform Docs
Usage & API Reference¶
For comprehensive usage examples, tool documentation, and integration guides:
The usage guide includes: - Available Tools - Complete list of tools with parameters and examples - Integration Examples - Python, JavaScript, and CLI usage - HTTP API - REST endpoint documentation - Configuration - Setup and deployment options - Best Practices - Tips for optimal usage
Configuration Options¶
Property | Type | Environment Variable | Default | Description |
---|---|---|---|---|
slack_mcp_log_level |
string | SLACK_MCP_LOG_LEVEL |
info |
Logging level (debug, info, warn, error, panic, fatal) |
slack_mcp_port |
integer | SLACK_MCP_PORT |
13080 |
Port for the MCP server to listen on |
slack_mcp_host |
string | SLACK_MCP_HOST |
127.0.0.1 |
Host for the MCP server to listen on |
slack_mcp_xoxc_token |
string | SLACK_MCP_XOXC_TOKEN |
`` | Slack browser token (xoxc-...) for cookie authentication |
slack_mcp_xoxd_token |
string | SLACK_MCP_XOXD_TOKEN |
`` | Slack browser cookie d (xoxd-...) for cookie authentication |
slack_mcp_xoxp_token |
string | SLACK_MCP_XOXP_TOKEN |
`` | User OAuth token (xoxp-...) - alternative to xoxc/xoxd |
slack_mcp_sse_api_key |
string | SLACK_MCP_SSE_API_KEY |
`` | Bearer token for SSE transport authentication |
slack_mcp_proxy |
string | SLACK_MCP_PROXY |
`` | Proxy URL for outgoing requests |
slack_mcp_user_agent |
string | SLACK_MCP_USER_AGENT |
`` | Custom User-Agent for Enterprise Slack environments |
slack_mcp_custom_tls |
boolean | SLACK_MCP_CUSTOM_TLS |
False |
Send custom TLS-handshake to Slack servers (for Enterprise Slack) |
slack_mcp_server_ca |
string | SLACK_MCP_SERVER_CA |
`` | Path to CA certificate for custom TLS |
slack_mcp_server_ca_toolkit |
boolean | SLACK_MCP_SERVER_CA_TOOLKIT |
False |
Inject HTTPToolkit CA certificate for MitM debugging |
slack_mcp_server_ca_insecure |
boolean | SLACK_MCP_SERVER_CA_INSECURE |
False |
Trust all insecure requests (NOT RECOMMENDED) |
slack_mcp_add_message_tool |
string | SLACK_MCP_ADD_MESSAGE_TOOL |
`` | Enable message posting: 'true' for all channels, comma-separated channel IDs for whitelist, or '!channel_id' to exclude channels |
slack_mcp_add_message_mark |
boolean | SLACK_MCP_ADD_MESSAGE_MARK |
False |
Automatically mark posted messages as read |
slack_mcp_add_message_unfurling |
string | SLACK_MCP_ADD_MESSAGE_UNFURLING |
`` | Enable link unfurling: 'true' for all domains or comma-separated list like 'github.com,slack.com' |
slack_mcp_users_cache |
string | SLACK_MCP_USERS_CACHE |
.users_cache.json |
Path to users cache file for improved performance |
slack_mcp_channels_cache |
string | SLACK_MCP_CHANNELS_CACHE |
.channels_cache_v2.json |
Path to channels cache file for improved performance |