Get the FREE Ultimate OpenClaw Setup Guide →

bolt-js-slack

A sample app that features an agent that leverages Slack's MCP

Installation
Run this command in your terminal to add the MCP server to Claude Code.
Run in terminal:
Command
claude mcp add --transport stdio slack-samples-bolt-js-slack-mcp-server node app.js \
  --env OPENAI_API_KEY="Your OpenAI API key" \
  --env SLACK_CLIENT_ID="Your Slack app client ID" \
  --env SLACK_INSTALL_URL="https://<APP_INSTALLATION_URL>/slack/install" \
  --env SLACK_STATE_SECRET="Your state secret" \
  --env SLACK_CLIENT_SECRET="Your Slack app client secret" \
  --env SLACK_SIGNING_SECRET="Your Slack signing secret"

How to use

This MCP server template integrates Slack's Bolt for JavaScript with OpenAI-backed AI capabilities to create AI-assisted Slack apps. It exposes an MCP endpoint that runs a Bolt-based Slack app which can authenticate users, respond to events, and leverage OpenAI for generating responses within Slack conversations. The project structure includes an entry point (app.js), Slack listeners for the assistant UI, and an llm module that configures the OpenAI API. Use it to rapidly build AI-enabled Slack experiences such as chat prompts, canvases, and contextual assistant responses within DMs or channels. To use it, clone the repository, install dependencies, configure your Slack app credentials and OpenAI key in a .env file, and start the server with npm start. After starting, the app will listen for Slack events and process user messages through the MCP-backed AI flow.

How to install

Prerequisites:

  • Node.js and npm installed on your machine
  • A Slack workspace and a Slack app manifest prepared for the Bolt app
  • An OpenAI API key

Step-by-step installation:

  1. Clone the repository git clone https://github.com/slack-samples/bolt-js-slack-mcp-server.git
  2. Change into the project directory cd bolt-js-slack-mcp-server
  3. Install dependencies npm install
  4. Create and configure environment variables
    • Rename .env.sample to .env
    • Populate the following values in .env: SLACK_CLIENT_ID=YOUR_APP_CLIENT_ID SLACK_CLIENT_SECRET=YOUR_APP_CLIENT_SECRET SLACK_SIGNING_SECRET=YOUR_APP_SIGNING_SECRET SLACK_STATE_SECRET=your-state-secret SLACK_INSTALL_URL=https://<APP_INSTALLATION_URL>/slack/install OPENAI_API_KEY=YOUR_OPENAI_API_KEY
  5. Start the Bolt server npm start

Optional:

  • Run a linter to ensure code quality npm run lint

Additional notes

Tips and common issues:

  • Ensure your Slack app has the correct Redirect URL and Event Subscriptions configured when using OAuth.
  • The OPENAI_API_KEY must be valid and have access to the models you intend to use.
  • When exposing the app to the internet for OAuth, use a tunneling solution like ngrok and set SLACK_INSTALL_URL accordingly.
  • The environment variable values in .env should be kept secure and not committed to source control.
  • If you encounter TLS or webhook verification issues, verify that SLACK_SIGNING_SECRET is correct and that the server is reachable at the public URL.
  • This template is in beta; expect breaking changes as the MCP beta evolves.

Related MCP Servers

Sponsor this space

Reach thousands of developers