Files
paymog__slack-cli/docs/01-authentication-setup.md
T
Sanghoon Hong bb9469d3e6 Add bot token (xoxb) support
- Add support for bot tokens as an alternative authentication method
- Conditionally register search tool only for non-bot tokens (bots cannot use search.messages API)
- Update isOAuth definition to include both xoxp and xoxb tokens for cleaner implementation
- Add bot token configuration to manifest-dxt.json for DXT extension
- Document bot token limitations in README and authentication setup guide

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-19 01:26:48 +09:00

103 lines
4.1 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
### 1. Authentication Setup
Open up your Slack in your browser and login.
> **Note**: You only need one of the following: an `xoxp-*` User OAuth token, an `xoxb-*` Bot token, or both `xoxc-*` and `xoxd-*` session tokens. User/Bot tokens are more secure and do not require a browser session. If multiple are provided, priority is `xoxp` > `xoxb` > `xoxc/xoxd`.
#### Option 1: Using `SLACK_MCP_XOXC_TOKEN`/`SLACK_MCP_XOXD_TOKEN` (Browser session)
##### Lookup `SLACK_MCP_XOXC_TOKEN`
- Open your browser's Developer Console.
- In Firefox, under `Tools -> Browser Tools -> Web Developer tools` in the menu bar
- In Chrome, click the "three dots" button to the right of the URL Bar, then select
`More Tools -> Developer Tools`
- Switch to the console tab.
- Type "allow pasting" and press ENTER.
- Paste the following snippet and press ENTER to execute:
`JSON.parse(localStorage.localConfig_v2).teams[document.location.pathname.match(/^\/client\/([A-Z0-9]+)/)[1]].token`
Token value is printed right after the executed command (it starts with
`xoxc-`), save it somewhere for now.
##### Lookup `SLACK_MCP_XOXD_TOKEN`
- Switch to "Application" tab and select "Cookies" in the left navigation pane.
- Find the cookie with the name `d`. That's right, just the letter `d`.
- Double-click the Value of this cookie.
- Press Ctrl+C or Cmd+C to copy it's value to clipboard.
- Save it for later.
#### Option 2: Using `SLACK_MCP_XOXP_TOKEN` (User OAuth)
Instead of using browser-based tokens (`xoxc`/`xoxd`), you can use a User OAuth token:
1. Go to [api.slack.com/apps](https://api.slack.com/apps) and create a new app
2. Under "OAuth & Permissions", add the following scopes:
- `channels:history` - View messages in public channels
- `channels:read` - View basic information about public channels
- `groups:history` - View messages in private channels
- `groups:read` - View basic information about private channels
- `im:history` - View messages in direct messages.
- `im:read` - View basic information about direct messages
- `im:write` - Start direct messages with people on a users behalf (new since `v1.1.18`)
- `mpim:history` - View messages in group direct messages
- `mpim:read` - View basic information about group direct messages
- `mpim:write` - Start group direct messages with people on a users behalf (new since `v1.1.18`)
- `users:read` - View people in a workspace.
- `chat:write` - Send messages on a users behalf. (new since `v1.1.18`)
- `search:read` - Search a workspaces content. (new since `v1.1.18`)
3. Install the app to your workspace
4. Copy the "User OAuth Token" (starts with `xoxp-`)
##### App manifest (preconfigured scopes)
To create the app from a manifest with permissions preconfigured, use the following code snippet:
```json
{
"display_information": {
"name": "Slack MCP"
},
"oauth_config": {
"scopes": {
"user": [
"channels:history",
"channels:read",
"groups:history",
"groups:read",
"im:history",
"im:read",
"im:write",
"mpim:history",
"mpim:read",
"mpim:write",
"users:read",
"chat:write",
"search:read"
]
}
},
"settings": {
"org_deploy_enabled": false,
"socket_mode_enabled": false,
"token_rotation_enabled": false
}
}
```
#### Option 3: Using `SLACK_MCP_XOXB_TOKEN` (Bot Token)
You can also use a Bot token instead of a User token:
1. Go to [api.slack.com/apps](https://api.slack.com/apps) and create a new app
2. Under "OAuth & Permissions", add Bot Token Scopes (same as User scopes above, except `search:read`)
3. Install the app to your workspace
4. Copy the "Bot User OAuth Token" (starts with `xoxb-`)
5. **Important**: Bot must be invited to channels for access
> **Note**: Bot tokens cannot use `search.messages` API, so `conversations_search_messages` tool will not be available.
See next: [Installation](02-installation.md)