Slack Search MCP Server

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.

Category
Visit Server

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

  1. Create an app at Slack API
  2. Under OAuth & Permissions, add the following scopes:
    • search:read (required for searching messages)
  3. Install the app to your workspace
  4. 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 string
  • count (integer, optional): Number of results to return (default: 20)
  • cursor (string, optional): Pagination cursor for getting more results
  • highlight (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:read scope
  • 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 .env file
  • Never commit tokens to version control
  • Use User OAuth tokens with minimal required scopes
  • Consider using environment-specific tokens for different deployments

Recommended Servers

playwright-mcp

playwright-mcp

A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.

Official
Featured
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.

Official
Featured
Local
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.

Official
Featured
Local
TypeScript
VeyraX MCP

VeyraX MCP

Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.

Official
Featured
Local
Kagi MCP Server

Kagi MCP Server

An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.

Official
Featured
Python
graphlit-mcp-server

graphlit-mcp-server

The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.

Official
Featured
TypeScript
E2B

E2B

Using MCP to run code via e2b.

Official
Featured
Neon Database

Neon Database

MCP server for interacting with Neon Management API and databases

Official
Featured
Exa Search

Exa Search

A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.

Official
Featured
Qdrant Server

Qdrant Server

This repository is an example of how to create a MCP server for Qdrant, a vector search engine.

Official
Featured