mirror of
https://github.com/paymog/slack-cli.git
synced 2026-09-18 23:43:49 +08:00
2.5 KiB
2.5 KiB
1. Authentication Setup
Open up your Slack in your browser and login.
Lookup SLACK_MCP_XOXC_TOKEN
- Open your browser's Developer Console.
- In Firefox, under
Tools -> Browser Tools -> Web Developer toolsin 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 letterd. - Double-click the Value of this cookie.
- Press Ctrl+C or Cmd+C to copy it's value to clipboard.
- Save it for later.
Alternative: Using SLACK_MCP_XOXP_TOKEN (User OAuth)
Instead of using browser-based tokens (xoxc/xoxd), you can use a User OAuth token:
-
Go to api.slack.com/apps and create a new app
-
Under "OAuth & Permissions", add the following scopes:
channels:history- View messages in public channelschannels:read- View basic information about public channelsgroups:history- View messages in private channelsgroups:read- View basic information about private channelsim:history- View messages in direct messages.im:read- View basic information about direct messagesim:write- Start direct messages with people on a user’s behalf (new sincev1.1.18)mpim:history- View messages in group direct messagesmpim:read- View basic information about group direct messagesmpim:write- Start group direct messages with people on a user’s behalf (new sincev1.1.18)users:read- View people in a workspace.chat:write- Send messages on a user’s behalf. (new sincev1.1.18)search:read- Search a workspace’s content. (new sincev1.1.18)
-
Install the app to your workspace
-
Copy the "User OAuth Token" (starts with
xoxp-)
Note
: You only need either XOXP token or both XOXC/XOXD tokens. XOXP user tokens are more secure and don't require browser session extraction.
See next: Installation