A read-only MCP (Model Context Protocol) server for Slack with OAuth authentication and multi-user session support.
slack_mcp_demo.mp4
slack_get_channel_messages- Retrieve messages from channelsslack_get_thread_replies- Get conversation thread repliesslack_search_messages- Advanced message search with filtersslack_get_users- List workspace users or get specific profilesslack_get_channels- List channels or get detailed infoslack_get_oauth_url- Generate OAuth authorization URL
- Visit Slack API Apps and create a new app
- Under App Credentials, copy your
Client IDandClient Secret - Navigate to OAuth & Permissions and add these User Token Scopes:
channels:historygroups:historyim:historympim:historychannels:readgroups:readim:readmpim:readusers:readusers:read.emailsearch:read - Add Redirect URL under OAuth & Permissions:
- For local testing: Use an HTTPS proxy like ngrok (E.g:
https://abc123.ngrok.io/oauth2callback). See local development setup below. - For production:
https://your-domain.com/oauth2callback
- For local testing: Use an HTTPS proxy like ngrok (E.g:
uv syncSlack requires HTTPS for OAuth callbacks. For local development, use ngrok or a similar HTTPS proxy:
# Visit https://ngrok.com/ to download ngrok and start the proxy
ngrok http 8001Copy the HTTPS forwarding URL (e.g., https://abc123.ngrok.io/oauth2callback) and add it as a Redirect URL in your Slack app settings.
Set required environment variables:
export SLACK_CLIENT_ID="your_client_id"
export SLACK_CLIENT_SECRET="your_client_secret"
# Use https://your-domain.com for production.
export SLACK_MCP_BASE_URI="http://localhost"
# Use https://your-domain.com for production.
export SLACK_EXTERNAL_URL="https://abc123.ngrok.io"
# Optional, if you want to run the MCP server on a different port.
export SLACK_MCP_PORT=8001uv run python main.pyThe server will start on http://localhost:8001 by default. Make sure your ngrok proxy is running alongside it for OAuth to work.
Add to your MCP client configuration (e.g. ~/.cursor/mcp.json for Cursor):
{
"mcpServers": {
"slack": { "url": "http://localhost:8001/mcp", "transport": "http" }
}
}Call slack_get_oauth_url() MCP tool to get the authorization URL, visit it in your browser, and approve access the first time you use the MCP server.
For production deployment, you can run it inside docker:
docker build -t slack-mcp .
docker run -p 8001:8001 \
-e SLACK_CLIENT_ID="your_client_id" \
-e SLACK_CLIENT_SECRET="your_client_secret" \
-e SLACK_MCP_BASE_URI="https://your-domain.com" \
-e SLACK_EXTERNAL_URL="https://your-domain.com" \
slack-mcpRun tests with uv run pytest.
This project is licensed under the Apache License 2.0 - see the LICENSE file for details.
Duolingo is hiring! Apply at https://www.duolingo.com/careers