Provides a secure MCP endpoint to manage Slack workspaces, including posting messages, reading history, and listing channels.
Configuration
View docs{
"mcpServers": {
"cnye36-slack-mcp-server": {
"url": "http://localhost:8080/mcp",
"headers": {
"HOST": "0.0.0.0",
"PORT": "8080",
"SLACK_SCOPES": "chat:write,channels:history,channels:read",
"ALLOWED_ORIGINS": "https://yourdomain.com",
"PUBLIC_BASE_URL": "http://localhost:8080",
"SLACK_CLIENT_ID": "YOUR_CLIENT_ID",
"SLACK_REDIRECT_URI": "https://yourdomain.com/slack/oauth/callback",
"SLACK_CLIENT_SECRET": "YOUR_CLIENT_SECRET",
"AFFINITYBOTS_MCP_API_KEY": "YOUR_API_KEY"
}
}
}
}You run a production-ready MCP server that lets an AI assistant securely interact with Slack workspaces. It supports secure OAuth, multi-tenant installations, automatic token rotation, and a structured MCP endpoint for tool usage like posting messages, reading history, and listing channels.
Connect your MCP client to the MCP endpoint at the serverβs base URL followed by /mcp, authenticate with your API key, and start issuing MCP commands to interact with Slack. You can post messages, read channel history, and list channels across multiple workspaces from a single MCP server. Ensure your client includes the required team_id and channel identifiers to operate in the correct Slack workspace.
Prerequisites include Node.js version 18 or later and a compatible package manager. You will also need a Slack app configured for OAuth and an API key for the MCP endpoint.
Step 1: Install dependencies with your package manager.
pnpm installStep 2: Configure environment variables. Create a .env file based on the example and populate it with your Slack app credentials and MCP API key.
cp .env.example .envSet at minimum the following variables in your environment or in the .env file.
SLACK_CLIENT_ID=your_client_id
SLACK_CLIENT_SECRET=your_client_secret
SLACK_REDIRECT_URI=https://yourdomain.com/slack/oauth/callback
SLACK_SCOPES=chat:write,channels:history,channels:read
AFFINITYBOTS_MCP_API_KEY=your_secret_keyStep 3: Run the development server.
pnpm devPrepare a production-ready environment and ensure all security measures are in place before going live. The server exposes an MCP endpoint at /mcp and the Slack OAuth flow at /slack/install and /slack/oauth/callback.
Check that the server is running and reachable.
curl http://localhost:8080/healthPost a message to a Slack channel, optionally within a thread.
Retrieve messages from a Slack channel with an adjustable limit.
List channels in the Slack workspace, with type and limit controls.