Slack Search MCP Server
Enables searching and retrieving messages across Slack workspaces using Slack's search API. Supports pagination, filtered results, and returns message details including text, timestamps, users, channels, and permalinks.
README
slack-search-mcp
This is an MCP server for searching Slack messages using the Model Context Protocol (MCP).
Overview
This server provides integration with Slack's search API using the Model Context Protocol (MCP). You can search for messages across your Slack workspace from MCP clients such as Claude Code or Continue.dev. The server filters and returns relevant message information including text, timestamps, users, and channel details.
Features
- get_slack_search_results: Search Slack messages using the Slack search.messages API
- Filtered Results: Returns only necessary message information (text, timestamp, user, channel, permalink)
- Pagination Support: Supports cursor-based pagination for large result sets
- Error Handling: Comprehensive error handling for authentication, permissions, and rate limiting
- Configurable: Supports configuration via config.json file
Slack App Configuration
- Create an app at Slack API
- Under OAuth & Permissions, add the following scopes:
search:read(required for searching messages)
- Install the app to your workspace
- Copy the User OAuth Token (starts with
xoxp-)
Installation & Startup
1. Install uv
# Mac/Linux
curl -LsSf https://astral.sh/uv/install.sh | sh
# Windows (PowerShell)
iwr -useb https://astral.sh/uv/install.ps1 | iex
2. Project Setup
# Create a virtual environment
uv venv
# Activate the virtual environment
# Mac/Linux:
source .venv/bin/activate
# Windows:
.venv\Scripts\activate
# Install dependencies
uv pip install -r requirements.txt
3. Set Environment Variables
Create a .env file in the project root and set the following variables:
SLACK_USER_TOKEN=xoxp-your-user-token
DEFAULT_SEARCH_COUNT=20
Important: Use a User OAuth Token (xoxp-) with search:read scope, not a Bot Token.
4. Optional Configuration
Create a config.json file for additional configuration:
{
"slack": {
"default_channels": ["general", "random"],
"excluded_channels": [],
"max_results_per_search": 100
}
}
5. Using with MCP Clients
Configure your MCP client (e.g., Claude Code or Continue.dev) as follows:
{
"mcpServers": {
"slack-search": {
"command": "uv",
"args": ["run", "server.py"],
"cwd": "/path/to/slack-search-mcp"
}
}
}
To add the MCP server from the Claude Code command line:
claude mcp add slack-search uv run /path/to/slack-search-mcp/server.py
slack-search: Server name (arbitrary)uv run ...: Starts the server with automatic virtual environment and dependency resolution
After running this command, slack-search will be added to the list of MCP servers in Claude Code, and the get_slack_search_results tool will be available.
Note: Since it is not possible to grant command permissions from Slack, it is recommended to run the server in a safe environment with auto-run or dangerously-skip-permissions mode enabled, so that the server does not prompt for command permissions.
6. Debugging
uv run mcp dev server.py
- Command:
uv - Arguments:
run server.py
API Reference
get_slack_search_results
Searches for messages in your Slack workspace.
Parameters:
query(string, required): Search query stringcount(integer, optional): Number of results to return (default: 20)cursor(string, optional): Pagination cursor for getting more resultshighlight(boolean, optional): Whether to highlight matching terms (default: true)
Returns:
{
"messages": {
"matches": [
{
"text": "Message content",
"ts": "1234567890.123456",
"permalink": "https://workspace.slack.com/archives/...",
"user": "U1234567890",
"username": "username",
"channel": {
"id": "C1234567890",
"name": "channel-name"
}
}
],
"total": 42,
"pagination": {
"next_cursor": "dGVhbTpDMH..."
}
}
}
Error Handling
The server handles various Slack API errors:
- Authentication errors: Invalid or missing token
- Permission errors: Missing
search:readscope - Rate limiting: Automatic handling of Slack API rate limits
- Network errors: SSL certificate and connection issues
Security Notes
- Store your Slack token securely in the
.envfile - Never commit tokens to version control
- Use User OAuth tokens with minimal required scopes
- Consider using environment-specific tokens for different deployments
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。