9.6 KiB
Slack MCP Configuration Guide
This guide explains how to configure the Slack MCP server for use with Cursor IDE, specifically for the send-code-review-slack command.
Slack MCP Server Setup
This setup uses the custom Slack MCP server (ghcr.io/korotovsky/slack-mcp-server) which supports User OAuth Tokens (SLACK_MCP_XOXP_TOKEN). Messages will be posted as your authenticated user account, not as a bot.
Setup Overview
Workspace-Level Setup (One-Time, Done by Admin):
- Step 1: Create a Slack App
- Step 2: Configure User Token Scopes
User-Level Setup (Per Developer):
- Step 3: Install App to Workspace
- Step 4: Get Your User OAuth Token
- Step 5: Environment Variables
- Step 6: Restart Cursor
Step 1: Create a Slack App
Note: This is a one-time workspace setup step, typically done by a workspace admin. Once the app is created and configured, all users in the workspace can use it.
- Go to Slack API Apps
- Click "Create New App" → "From scratch"
- Name your app (e.g., "Opik Code Review")
- Select your workspace
- Click "Create App"
Step 2: Configure User Token Scopes
Note: This is a one-time workspace setup step, typically done by a workspace admin. Once the scopes are configured, all users in the workspace will have access to these scopes when they install the app.
CRITICAL: You must add scopes to "User Token Scopes" (NOT "Bot Token Scopes") for the User OAuth Token to appear.
- In your app settings, go to "OAuth & Permissions"
- Scroll down to the "Scopes" section
- Find "User Token Scopes" section (this is different from "Bot Token Scopes" which is above it)
- You'll see the description: "Scopes that access user data and act on behalf of users that authorize them."
- This confirms you're in the right section - these scopes allow the app to act as YOU, not as a bot
- Click "Add an OAuth Scope" under "User Token Scopes"
- Add the following scopes one by one:
chat:write- Send messages as your authenticated user accountchannels:read- View basic information about public channelsusers:read- Read user information (required by the MCP server for caching)channels:history- View messages in public channels (required by the MCP server for channel caching)
- Click "Save Changes"
Note: The users:read and channels:history scopes are required by the ghcr.io/korotovsky/slack-mcp-server to properly cache and access channel information. Without these, you may see "missing_scope" errors in the logs, though basic message posting may still work.
Step 3: Install App to Workspace
Note: This is a per-user step. Each developer needs to install the app to their workspace to authorize it and get their own User OAuth Token.
- Scroll to the top of "OAuth & Permissions"
- Click "Install to Workspace" (or "Reinstall to Workspace" if you already installed it)
- Review permissions and click "Allow"
- Note: The permission screen may say "Send messages as [App Name]" - this is just the app requesting permission. When you use the User OAuth Token, messages will be posted as your personal account, not as the app.
Step 4: Get Your User OAuth Token
After installing/reinstalling the app, you need to find your User OAuth Token:
- Stay on the "OAuth & Permissions" page (or refresh it)
- Scroll down to the "OAuth Tokens for Your Workspace" section
- Look for "User OAuth Token" (NOT "Bot User OAuth Token")
- If you only see "Bot User OAuth Token", you need to:
- Go back to Step 2 and make sure you added scopes to "User Token Scopes" (not "Bot Token Scopes")
- Then come back here and click "Reinstall to Workspace" again
- If you only see "Bot User OAuth Token", you need to:
- The User OAuth Token should start with
xoxp-(notxoxb-) - Click "Show" or "Reveal" to see the full token
- Copy this token - this is what will post messages as your authenticated user account
Step 5: Environment Variables
- Create or edit
.env.localin your project root and add your User OAuth Token:
SLACK_MCP_XOXP_TOKEN=xoxp-your-user-oauth-token-here
Important Configuration Options:
-
mcp-server --transport stdio: Required for the server to communicate with Cursor via the MCP protocol. Without these, the server will start an SSE server instead, which won't work with Cursor's MCP integration. -
SLACK_MCP_ADD_MESSAGE_TOOL: Required to enable theconversations_add_messagetool (disabled by default for safety).trueor1: Enable for all channels and DMs- Channel IDs (comma-separated): Enable only for specific channels (e.g.,
XXXXXXXX,YYYYYYYY) !XXXXXXXX: Enable for all channels except the specified one
- For the code review command: Use
trueto enable posting to#code-review
envFile: Points to${workspaceFolder}/.env.localwhere yourSLACK_MCP_XOXP_TOKENis stored securely.
Important:
- Replace
xoxp-your-user-oauth-token-herein.env.localwith your User OAuth Token from Step 4 (starts withxoxp-, NOTxoxb-) - The token is loaded from
.env.localvia theenvFileconfiguration, keeping it out ofmcp.json
Note: This configuration uses the custom Slack MCP server that supports User OAuth Tokens. Messages will be posted as your authenticated user account, not as a bot.
Requirements:
- Docker must be installed and running on your system
- The Docker image
ghcr.io/korotovsky/slack-mcp-server:latestwill be pulled automatically on first use .env.localshould be added to.gitignoreto prevent committing your token
Step 6: Restart Cursor
- Close and reopen Cursor IDE
- The Slack MCP server should now be available with message posting enabled
- You can verify by checking Cursor Settings > Features > MCP
- Test by running:
cursor send-code-review-slack
Security Notes
- Never commit tokens to Git:
- Add
.env.localto.gitignoreto prevent committing your token - The
mcp.jsonfile references the token via environment variable, but it may contain secrets, check it before committing - Token storage: The
SLACK_MCP_XOXP_TOKENis stored in.env.local(which should be in.gitignore), not directly inmcp.json
- Add
Troubleshooting
MCP Server Not Appearing
- Check that
mcp.jsonis in the correct location (.cursor/mcp.jsonor~/.cursor/mcp.json) - Verify JSON syntax is valid (use a JSON validator)
- Restart Cursor completely (quit and reopen, not just reload window)
- Check Cursor Settings > Features > MCP for error messages
- Verify Docker is installed and running:
docker --versionanddocker ps
Docker Command Errors
If you see errors like "Usage: docker [OPTIONS] COMMAND" in the MCP logs:
-
Verify Docker is running:
docker psIf this fails, start Docker Desktop or Docker daemon
-
Test the Docker command manually:
docker run -i --rm -e SLACK_MCP_XOXP_TOKEN=xoxp-your-token -e LOG_LEVEL=error ghcr.io/korotovsky/slack-mcp-server:latestThis should start the MCP server. If it fails, check the error message.
-
Pull the Docker image:
docker pull ghcr.io/korotovsky/slack-mcp-server:latest -
Check mcp.json structure: Ensure the
argsarray is properly formatted with each argument as a separate string element
Authentication Errors
- Verify your user token is correct (should start with
xoxp-, NOTxoxb-)- If you see
xoxb-in the logs, you're using a bot token instead of a user token - Go back to Step 4 and get the User OAuth Token (not Bot User OAuth Token)
- If you see
- Ensure the app has been installed to your workspace
- Verify user token scopes include all required scopes in User Token Scopes:
chat:write(required for posting messages)channels:read(required for channel access)users:read(required by MCP server for caching)channels:history(recommended for full functionality)
- Make sure you're using
SLACK_MCP_XOXP_TOKENin your Docker args (notSLACK_BOT_TOKEN) - Check your actual mcp.json file - the token in the Docker args should be
xoxp-... - Restart Cursor completely after updating the token in mcp.json
- Verify Docker is running and can pull the image
Missing Scope Errors
If you see "missing_scope" errors in the MCP logs:
- Check which scope is missing - the error message will indicate the specific scope
- Add the missing scope to your Slack app's User Token Scopes:
- Go to your Slack app's "OAuth & Permissions" page
- Scroll to "User Token Scopes"
- Click "Add an OAuth Scope" and add the missing scope
- Common missing scopes:
users:read,channels:history
- Reinstall the app to your workspace after adding scopes
- Update the token in
mcp.jsonif a new token was generated - Restart Cursor to reload the MCP configuration
Note: Some "missing_scope" errors may be warnings that don't prevent basic functionality (like posting messages), but adding all recommended scopes ensures full MCP server functionality.
Permission Errors
- Ensure the user token has
chat:writescope in User Token Scopes - Verify you have access to the
#code-reviewchannel - Check that you're a member of the channel
- If using Docker, ensure Docker has network access to reach Slack API