Provides examples for accessing the MCP server's endpoints using curl with bearer token authentication.
Uses .env files to manage environment variables including Slack tokens and RSA keys for authentication.
Supports Server-Sent Events (SSE) connections from JavaScript clients with authenticated access to the MCP server.
Uses JWT for authentication, securing all API endpoints with bearer token authentication based on RSA keypairs.
Implemented in Python with utilities for generating client tokens and running the server.
Provides read-only access to Slack data, allowing users to list channels, get channel details, read messages, list users, and get user information from a Slack workspace.
Slack MCP Server
A Model Context Protocol (MCP) server for Slack built with FastMCP. This server provides read-only access to Slack data, including messages, channels, and users, and secures all API endpoints with bearer token authentication.
Features
- List all channels in a workspace
- Get detailed information about a specific channel
- Read messages from channels
- List all users in a workspace
- Get detailed information about a specific user
- Secure API access via bearer token authentication
Setup
- Install dependencies:
- Create a
.env
file with your Slack bot token: - Edit the
.env
file and add your Slack Bot User OAuth Token:The server uses JWT (JSON Web Tokens) for authentication. You must also add your RSA keypair as base64-encoded PEM strings:- If you do not have these values, run the server or
python generate_client_token.py
once; it will print out the base64-encoded keys to add to your.env
file. - The keys must be base64-encoded (not raw PEM).
- If you do not have these values, run the server or
Getting a Slack Bot Token
- Go to https://api.slack.com/apps
- Create a new app (or use an existing one)
- Navigate to "OAuth & Permissions"
- Add the following scopes to your bot:
channels:read
channels:history
groups:read
groups:history
users:read
- Install the app to your workspace
- Copy the "Bot User OAuth Token" that starts with
xoxb-
Running the Server
Start the server with:
The server will run at http://localhost:8000
. By default, all API endpoints are protected with bearer token authentication.
Available API Tools
The server exposes the following MCP tools:
list_channels
Lists all channels in the workspace.
get_channel_info
Gets detailed information about a specific channel.
get_messages
Gets messages from a channel with pagination support.
list_users
Lists all users in the workspace.
get_user_info
Gets detailed information about a specific user.
Authentication
All requests to the MCP server require JWT bearer token authentication. When you start the server, it will display a JWT token that can be used for authentication.
To authenticate your requests, include the following header with the token provided by the server:
This applies to both HTTP API endpoints and the Server-Sent Events (SSE) connection.
Example with curl
Example with JavaScript for SSE
Note: The JWT token is generated when the server starts. If you restart the server, it will use the same keypair (stored in
jwt_keys.json
), but you may need to get a new token from the server output.
Integration with LLM
This MCP server can be integrated with LLMs to provide them with read-only access to Slack data. The LLM can query channels, users, and messages but cannot send messages or modify any data. When integrating with LLMs, ensure you securely pass the API token to the client code that establishes the connection.
This server cannot be installed
A Model Context Protocol server that provides read-only access to Slack data including messages, channels, and users through secure API endpoints.
Related MCP Servers
- -securityAlicense-qualityA Model Context Protocol server implementation that enables AI assistants to interact with Slack workspaces, allowing them to browse channels, send messages, reply to threads, add reactions, and retrieve user information.Last updated -201JavaScriptApache 2.0
- AsecurityAlicenseAqualityA server implementing Model Context Protocol that enables AI assistants to interact with Slack API through a standardized interface, providing tools for messaging, channel management, user information retrieval, and more.Last updated -953JavaScriptApache 2.0
- -securityAlicense-qualityEnables AI assistants to interact with Slack workspaces through the Model Context Protocol, providing tools for reading/sending messages, managing channels, and accessing Slack API functionality.Last updated -PythonMIT License
- -securityFlicense-qualityA Model Context Protocol server that integrates with Slack API, allowing users to send messages, view channel history, manage channels, send direct messages, and retrieve user lists from Slack workspaces.Last updated -Python