MCP HubMCP Hub
sooperset

mcp-client-slackbot

by: sooperset

Simple Slackbot MCP Client

72created 08/03/2025
Visit
Slackbot
Client

📌Overview

Purpose:
To provide a simple, extensible Slack bot that leverages the Model Context Protocol (MCP) and large language models (LLMs) to enhance its conversational abilities and integrate with external tools.

Overview:
MCP Simple Slackbot is designed to act as an intelligent assistant within Slack, combining AI-powered conversational capabilities with robust tool integration via MCP. It operates seamlessly in Slack channels, direct messages, and the App Home tab, offering broad support for different LLM providers and easy interaction with external tools and databases.

Key Features:

  • AI-Powered Assistant:
    Utilizes LLMs (OpenAI, Groq, Anthropic) to respond intelligently to Slack messages in channels and direct messages, providing conversational support and task automation.

  • MCP Integration:
    Connects to MCP servers to discover, access, and utilize powerful external tools (such as SQLite and web fetching) directly from Slack conversations, enhancing user productivity and flexibility.


MCP Simple Slackbot

A simple Slack bot that uses the Model Context Protocol (MCP) to enhance its capabilities with external tools.

Features

  • AI-Powered Assistant: Responds to messages using LLM capabilities
  • MCP Integration: Access to tools like SQLite databases and web fetching
  • Multi-LLM Support: Works with OpenAI, Groq, and Anthropic models
  • App Home Tab: Shows available tools and usage info

Setup

1. Create a Slack App

  1. Go to api.slack.com/apps and create a new app.
  2. Choose "From an app manifest" and select your workspace.
  3. Copy the contents of the mcp_simple_slackbot/manifest.yaml file into the manifest editor.
  4. Create the app and install it to your workspace.
  5. In "Basic Information," generate an App-Level Token:
    • Add the connections:write scope
    • Click "Generate"
  6. Note your:
    • Bot Token (xoxb-...) from "OAuth & Permissions"
    • App Token (xapp-...)

2. Install Dependencies

python -m venv venv
source venv/bin/activate  # On Windows: venv\Scripts\activate
pip install -r mcp_simple_slackbot/requirements.txt

3. Configure Environment Variables

Create a .env file in the mcp_simple_slackbot directory (see .env.example):

SLACK_BOT_TOKEN=xoxb-your-token
SLACK_APP_TOKEN=xapp-your-token

OPENAI_API_KEY=sk-your-openai-key
# or GROQ_API_KEY or ANTHROPIC_API_KEY

LLM_MODEL=gpt-4-turbo

Running the Bot

cd mcp_simple_slackbot
python main.py

The bot will connect to MCP servers, discover available tools, start the Slack app in Socket Mode, and listen for mentions and direct messages.

Usage

  • Direct Messages: Send a direct message to the bot
  • Channel Mentions: Mention the bot in a channel with @MCP Assistant
  • App Home: View available tools in the App Home tab

Architecture

  • SlackMCPBot: Manages Slack events and messages
  • LLMClient: Handles interaction with LLM APIs
  • Server: Connects with MCP servers
  • Tool: Represents tools from MCP servers

Workflow:

  1. Message is sent to the LLM with available tools
  2. If tool use is required, the tool is executed
  3. Results are returned to the LLM and interpreted
  4. Final response is delivered to the user

Credits

Based on the MCP Simple Chatbot example.

License

MIT License