Your entire Slack, from the terminal.
Browse channels. Post messages. React. Search. Power AI agents.
Getting Started • CLI • MCP Server • API • Contributing
Slack's official API requires bot tokens, OAuth apps, and admin approval. PostCLI Slack works like the web client: it grabs your session from the Slack desktop app and talks directly to the same endpoints your browser uses. No bots, no apps, no admin.
|
CLI Full command suite for channels, messages, threads, search, reactions, and status. Pipe-friendly |
MCP Server 16 tools for Claude, GPT, and any MCP-compatible AI agent. Read, write, react, and search through natural language. |
Multi-workspace Auto-detects all workspaces from your Slack desktop app. Switch between them seamlessly. |
- Node.js 18+ (LTS recommended)
- Slack desktop app logged into your workspace(s)
- macOS or Linux
npm install -g @postcli/slackPostCLI grabs session tokens directly from the Slack desktop app (Flatpak, native, or snap):
postcli-slack auth loginIt auto-detects your workspaces:
Found 4 token(s). Detecting workspaces...
Apache Airflow Community (@andre451)
Building AI Together by Union.ai (@andre259)
Provero (@andre)
Apache Hamilton Open Source (@andre)
Connected as andre451 in workspace Apache Airflow Community
Credentials saved to .env
Alternative: manual token paste from browser DevTools with postcli-slack auth setup.
postcli-slack auth test
# Connected as andre451 in workspace Apache Airflow Communitypostcli-slack channels list # list channels
postcli-slack channels info general # channel details
postcli-slack messages history general --limit 20 # message history
postcli-slack messages thread general 1234567890.123 # read a thread
postcli-slack users list # list users
postcli-slack users info kumare3 # user details
postcli-slack search messages "from:kumare3" # search messagespostcli-slack post send general "Hello from the terminal" # post a message
postcli-slack post reply general 1234.5678 "Good point" # reply in thread
postcli-slack post edit general 1234.5678 "Updated text" # edit message
postcli-slack post delete general 1234.5678 # delete messagepostcli-slack post react general 1234.5678 thumbsup # add reaction
postcli-slack post unreact general 1234.5678 thumbsup # remove reaction
postcli-slack post pin general 1234.5678 # pin message
postcli-slack post star general 1234.5678 # star messagepostcli-slack status set "In a meeting" -e ":calendar:" # set status
postcli-slack status set "BRB" -d 30 # auto-clear in 30min
postcli-slack status clear # clear status
postcli-slack status away # set away
postcli-slack status active # set activeEvery command supports --json for piping and scripting:
postcli-slack channels list --json | jq '.[].name'
postcli-slack search messages "deploy" --json | jq '.messages[].text'Connect your Slack to Claude, GPT, or any AI agent via the Model Context Protocol.
postcli-slack --mcpAdd to .claude/settings.json:
{
"mcpServers": {
"slack": {
"command": "postcli-slack",
"args": ["--mcp"]
}
}
}Add to claude_desktop_config.json:
{
"mcpServers": {
"slack": {
"command": "postcli-slack",
"args": ["--mcp"]
}
}
}| Tool | Description |
|---|---|
test_connection |
Test authentication |
list_channels |
List workspace channels |
get_messages |
Message history from a channel |
get_thread |
All replies in a thread |
list_users |
List workspace users |
get_user |
User details by ID or username |
search_messages |
Search across channels |
post_message |
Post a message |
reply_to_thread |
Reply in a thread |
edit_message |
Edit a message |
delete_message |
Delete a message |
add_reaction |
React with emoji |
remove_reaction |
Remove a reaction |
set_status |
Set your status |
pin_message |
Pin a message |
mark_read |
Mark channel as read |
Use the client in your own Node.js projects:
import { SlackClient } from '@postcli/slack/client';
const client = new SlackClient({
token: process.env.SLACK_TOKEN,
cookie: process.env.SLACK_COOKIE,
workspace: 'slack',
});
// Read
const channels = await client.listChannels();
const messages = await client.getMessages('C01234ABCD', { limit: 10 });
const thread = await client.getThread('C01234ABCD', '1234567890.123456');
const results = await client.searchMessages('from:kumare3');
// Write
await client.postMessage('C01234ABCD', 'Hello from API');
await client.replyToThread('C01234ABCD', '1234.5678', 'Great point');
await client.addReaction('C01234ABCD', '1234.5678', 'thumbsup');
await client.setStatus('Coding', ':computer:');src/
cli/
commands/ # auth, channels, messages, users, search, post, status
chrome-cookies.ts # Slack desktop cookie + token extraction
lib/
slack.ts # SlackClient (core API wrapper)
http.ts # HTTP client with throttling + cookie auth
models.ts # Domain models (Channel, Message, User, Thread)
mcp/
index.ts # MCP stdio server
tools.ts # 16 tool definitions + handlers
client.ts # Client initialization & config
plugin.ts # Plugin registration for PostCLI ecosystem
types.ts # Slack API response types
PostCLI Slack extracts credentials directly from the Slack desktop app. No bot tokens, no OAuth apps, no admin approval needed.
Slack's web client uses two pieces to authenticate API calls:
| Credential | Format | Scope | Where it lives |
|---|---|---|---|
Cookie d |
xoxd-... (URL-encoded) |
Shared across all workspaces | SQLite cookie DB (Cookies file) |
Token xoxc- |
xoxc-TEAM-USER-RANDOM-HASH |
One per workspace | LevelDB LocalStorage |
The cookie d is a single session cookie stored at .slack.com, valid for every workspace you're logged into. The token xoxc- is workspace-specific and identifies which team you're acting on.
Cookie DB (SQLite):
| Installation | Path |
|---|---|
| Flatpak | ~/.var/app/com.slack.Slack/config/Slack/Cookies |
| Native (deb/rpm) | ~/.config/Slack/Cookies |
| Snap | ~/snap/slack/common/.config/Slack/Cookies |
| macOS | ~/Library/Application Support/Slack/Cookies |
Token storage (LevelDB):
Same base directory, under Local Storage/leveldb/. Tokens are written when you navigate to a workspace in the Slack app. If you only have one workspace active, only that token will be in storage. Navigate to other workspaces to make their tokens available.
The cookie d is encrypted with AES-128-CBC. The encryption key is derived via PBKDF2 from a password stored in the OS keyring:
| OS | Keyring lookup |
|---|---|
| Linux | secret-tool lookup application Slack |
| macOS | Keychain: "Slack Safe Storage" |
This is the same key derivation that Chrome/Electron uses for its cookie encryption (PBKDF2 with saltysalt, 1 iteration on Linux, 1003 on macOS).
- Finds the Slack desktop app directory (Flatpak, native, snap, or macOS)
- Scans LevelDB files for
xoxc-tokens (binary scan, no LevelDB library needed) - Decrypts the
dcookie from the SQLite database - Calls
auth.testwith each token to identify the workspace name and user - Saves the selected token + cookie to
~/.config/postcli/.env(0600 permissions)
No data leaves your machine. The saved credentials are the same ones your Slack desktop app uses.
git clone https://github.com/postcli/slack.git
cd slack
npm install
npm run build
npm testnpm run cli -- channels list # run CLI in dev mode
npm run dev:mcp # MCP with inspector
npm test # run tests- Open an issue first to discuss the change
- Fork the repo and create a branch from
main - Write tests for new functionality
- Run
npm testandnpm run buildbefore submitting - Keep PRs focused on a single change
This is an unofficial tool, not affiliated with or endorsed by Slack. It interacts with undocumented internal APIs that may change without notice. Use at your own risk.