slack-messages
Allows fuzzy search and browsing of Slack messages, including recent messages, users, channels, threads, and filtering by sender or date range.
Click on "Install Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@slack-messagessearch for quarterly report"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
slack-messages
Fuzzy search and browse Slack messages from the command line or as an MCP server.
Features
Fuzzy search with typo tolerance across all your Slack messages
Browse recent messages, users, and channels
User name resolution - shows display names instead of user IDs
Context display - see messages before/after each match
Filter by sender or date range
Thread support - indexes thread replies alongside parent messages
Incremental updates - quickly fetch only new messages
Multiple interfaces - CLI or MCP server
Related MCP server: Slack MCP
Requirements
Node.js 22+
Slack user token with appropriate scopes (see below)
Installation
npm
npm install -g @cardmagic/slack-messagesFrom source
git clone https://github.com/cardmagic/slack-messages.git
cd slack-messages
pnpm install
pnpm build
npm linkGetting a Slack Token
You need a User OAuth Token (starts with xoxp-), NOT a Bot token.
Important: Bot tokens (
xoxb-...) only see the bot's own empty DMs. You must use a User token (xoxp-...) to access your messages.
Required Scopes
Add these under "User Token Scopes" (not "Bot Token Scopes"):
Scope | Purpose |
| Read public channel messages |
| Read private channel messages |
| Read DM messages |
| Read group DM messages |
| Get user display names |
| List public channels |
| List private channels |
| List DMs |
| List group DMs |
Step-by-Step: Create a Slack App
Go to the Slack API portal
Visit api.slack.com/apps
Sign in to your Slack workspace if prompted
Create a new app
Click "Create New App"
Choose "From scratch"
Enter a name (e.g., "Message Search")
Select your workspace
Click "Create App"
Add User Token Scopes (this is critical!)
In the left sidebar, click "OAuth & Permissions"
Scroll down to find "User Token Scopes"
⚠️ NOT "Bot Token Scopes" - that's a different section!
Click "Add an OAuth Scope" and add ALL of these:
channels:historychannels:readgroups:historygroups:readim:historyim:readmpim:historympim:readusers:read
Install the app to your workspace
Scroll back up to "OAuth Tokens for Your Workspace"
Click "Install to Workspace"
Review the permissions and click "Allow"
Copy the correct token
After installing, you'll see TWO tokens on the OAuth page:
✅ "User OAuth Token" - starts with
xoxp-- USE THIS ONE❌ "Bot User OAuth Token" - starts with
xoxb-- don't use this
Copy the
xoxp-token
Add it to slack-messages
slack-messages auth # Paste your token when prompted (input is hidden)
Verify Your Token
After adding your token, verify it's correct:
slack-messages indexIf you see "Messages: 0" but you know you have messages, you likely used a Bot token by mistake. Go back to step 5 and get the User OAuth Token.
Security Notes
Your token is stored locally in
~/.slack-messages/config.jsonNever commit or share your token
You can revoke the token anytime from api.slack.com/apps
Usage
Initial Setup
# Add your Slack workspace (token is prompted securely)
slack-messages auth
# Build the search index (fetches all messages)
slack-messages index
# For incremental updates later
slack-messages index --updateCLI Commands
Browse Commands
# Show most recent messages
slack-messages recent
# List users by recent activity
slack-messages contacts --limit 10
# List channels/DMs with message counts
slack-messages conversations
# Show recent messages from someone
slack-messages from "John Smith"
# Show full conversation in a channel
slack-messages thread "general" --after 2024-12-01Search Commands
# Search for messages
slack-messages search "quarterly report"
# Filter by sender
slack-messages search "project update" --from "Sarah"
# Filter by date
slack-messages search "meeting" --after 2024-01-01
# Adjust result count and context
slack-messages search "deadline" --limit 20 --context 5
# Show index statistics
slack-messages statsWorkspace Management
# List configured workspaces
slack-messages workspaces
# Remove a workspace
slack-messages remove T0123456789Search Options
Option | Description |
| Filter by sender name |
| Only messages after date (YYYY-MM-DD) |
| Max results (default: 10) |
| Messages before/after (default: 2) |
MCP Server
Run as an MCP server for Claude Code integration:
slack-messages --mcp
# or
slack-messages mcpAdd to your Claude Code configuration:
claude mcp add --transport stdio slack-messages -- slack-messages --mcpOr manually in your MCP config:
{
"mcpServers": {
"slack-messages": {
"command": "npx",
"args": ["-y", "@cardmagic/slack-messages", "--mcp"]
}
}
}Available MCP Tools:
Tool | Description |
| Search messages with fuzzy matching |
| Get most recent messages |
| List users by activity |
| List channels/DMs with counts |
| Get conversation in a channel |
| Get index statistics |
How It Works
Authentication: Store your Slack user token locally
Indexing: Fetch messages via Slack API and build local indexes:
Lists all conversations (channels, DMs, group DMs)
Fetches message history for each conversation
Fetches thread replies for messages with replies
Caches user information for name resolution
Storage: Index files in
~/.slack-messages/:config.json- Workspace tokensindex.db- SQLite FTS5 databasefuzzy.json- MiniSearch index for typo tolerancestats.json- Index statistics and cursors for incremental updatesusers.json- Cached user information
Rate Limiting
The Slack API has rate limits. The tool uses the official @slack/web-api client which handles retries automatically. For large workspaces, initial indexing may take a while.
License
MIT
This server cannot be installed
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Latest Blog Posts
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/cardmagic/slack-messages'
If you have feedback or need assistance with the MCP directory API, please join our Discord server