Slack MCP Server
A Model Context Protocol server that enables LLMs to interact with Slack workspaces through OAuth 2.0 authentication. It provides tools for listing channels and posting messages while supporting secure token persistence and dynamic client registration.
README
Slack MCP Server
A Model Context Protocol (MCP) server that enables LLMs to interact with Slack workspaces through OAuth 2.0 authentication.
Features
- 🔐 OAuth 2.0 Authentication: Secure Slack OAuth flow with automatic token management
- 🚀 FastMCP Framework: Built with the official MCP SDK's FastMCP framework
- 💾 Token Persistence: Tokens are saved locally or in DynamoDB for cloud deployments
- 📱 Slack Integration: Post messages and list channels in Slack workspaces
- 🔄 Dynamic Client Registration: Supports VSCode MCP extension and other clients
- ☁️ GitHub + App Runner: Deploy directly from GitHub with AWS App Runner
Prerequisites
- Python 3.11+
- Slack App with OAuth 2.0 configured
- uv (Python package manager)
Quick Start
1. Slack App Configuration
- Create a new Slack App at https://api.slack.com/apps
- Add OAuth Scopes in "OAuth & Permissions":
chat:write- Post messageschannels:read- List channels
- Add Redirect URLs:
- Local:
http://localhost:8080/slack/callback - Production:
https://your-domain.com/slack/callback
- Local:
- Copy the Client ID and Client Secret
2. Installation
# Clone the repository
git clone https://github.com/miyatsuki/study-slack-remote-mcp.git
cd study-slack-remote-mcp
# Install dependencies using uv
uv sync
3. Configuration
Create a .env file:
# Required: Slack OAuth credentials
SLACK_CLIENT_ID=your_client_id
SLACK_CLIENT_SECRET=your_client_secret
# Optional: Service base URL (for production deployments)
# SERVICE_BASE_URL=https://your-apprunner-url.awsapprunner.com
4. Run the Server
# Start the server
uv run python server.py
# Or run in background
nohup uv run python server.py > server.log 2>&1 &
Usage
With VSCode MCP Extension
- Install the MCP extension for VSCode
- Connect to the server URL:
http://localhost:8080/mcp/ - The OAuth flow will start automatically when you first use a tool
With Claude Desktop
Add to your Claude Desktop configuration:
macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
Windows: %APPDATA%\Claude\claude_desktop_config.json
{
"mcpServers": {
"slack": {
"command": "uv",
"args": [
"--directory",
"/path/to/slack-mcp-server",
"run",
"python",
"server.py"
]
}
}
}
Available Tools
-
list_channels: Get a list of Slack channels
Returns: Dictionary mapping channel names to IDs -
post_message: Post a message to a Slack channel
Args: - channel_id: Channel ID (required) - text: Message text (required) Returns: Success/failure message -
get_auth_status: Check authentication status
Returns: Current authentication state and session info
Authentication Flow
- When a tool is first used, the OAuth flow automatically starts
- A browser window opens for Slack authorization
- After authorization, the token is saved for future use
- Subsequent requests use the cached token
Authentication
The server uses FastMCP's built-in OAuth 2.0 support with dynamic client registration. This allows compatibility with various MCP clients including VSCode's MCP extension.
Token Management
- OAuth tokens are mapped between MCP tokens and Slack tokens internally
- Tokens are persisted locally in memory (or DynamoDB in cloud)
- OAuth flow starts automatically when tools are first used
- Dynamic client registration supported for VSCode and other clients
Port Configuration
The server uses a single port:
- 8080: MCP server endpoint (includes health check and OAuth callback routes)
AWS App Runner Deployment (ECR-based)
The project uses ECR-based deployment with AWS App Runner for production:
# First, set up AWS Systems Manager parameters:
aws ssm put-parameter --name "/slack-mcp/dev/client-id" --value "your-client-id" --type "String"
aws ssm put-parameter --name "/slack-mcp/dev/client-secret" --value "your-secret" --type "SecureString"
aws ssm put-parameter --name "/slack-mcp/dev/service-base-url" --value "https://your-apprunner-url.awsapprunner.com" --type "String"
# Build and push Docker image to ECR:
./build-and-push.sh
# Create App Runner service (if not exists) or update existing service
aws apprunner update-service --service-arn <your-service-arn> --source-configuration '...'
App Runner provides:
- Deployment from ECR with pre-built Docker images
- Built-in HTTPS with automatic certificates
- Manual deployment control (auto-deploy disabled by default)
- Auto-scaling and simplified management
- Avoids Python 3.11 build issues with App Runner's source code deployment
Project Structure
study-slack-remote-mcp/
├── server.py # Main MCP server using FastMCP framework
├── slack_oauth_provider.py # Slack OAuth provider implementation
├── storage_interface.py # Storage abstraction (local/cloud)
├── storage_dynamodb.py # DynamoDB storage for AWS
├── token_storage.py # Local file-based token storage
├── Dockerfile # Docker container configuration
├── build-and-push.sh # ECR deployment script
├── requirements.txt # Python dependencies for Docker
├── pyproject.toml # Project dependencies
├── uv.lock # Locked dependencies
├── tests/ # Unit tests
├── infrastructure/ # AWS CDK deployment code
├── CLAUDE.md # Development guidelines
└── .env # Environment variables (create from .env.example)
Development
Testing
# Check server health
curl http://localhost:8080/health
# Test with MCP client
mcp run uv --directory /path/to/study-slack-remote-mcp run python server.py
Debugging
Enable debug logging by checking server.log:
tail -f server.log
Troubleshooting
Port Already in Use
# Check what's using port 8080
lsof -i :8080
# Kill process using port 8080 if needed
kill -9 $(lsof -ti:8080)
OAuth Errors
-
bad_redirect_uri: Ensure the redirect URL in Slack app matches exactly:
- Must include the full path:
http://localhost:8080/slack/callback - Port must be 8080 (MCP server port)
- Must include the full path:
-
invalid_client_id: Verify SLACK_CLIENT_ID in .env
-
Token not found: Complete OAuth by authorizing in browser
Security Considerations
- OAuth tokens are mapped between MCP tokens and Slack tokens
- Tokens stored in memory locally, DynamoDB in production
- Dynamic client registration supports various MCP clients
- OAuth callbacks use HTTPS in production (App Runner)
Contributing
- Fork the repository
- Create a feature branch
- Follow the guidelines in CLAUDE.md
- Submit a pull request
License
MIT License - see LICENSE file for details
References
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。