A simple Slack bot that uses the Model Context Protocol (MCP) to enhance its capabilities with external tools.
- AI-Powered Assistant: Responds to messages in channels and DMs using LLM capabilities
 - MCP Integration: Full access to MCP tools like SQLite database and web fetching
 - Multi-LLM Support: Works with OpenAI, Groq, and Anthropic models
 - App Home Tab: Shows available tools and usage information
 
- Go to 
api.slack.com/apps and click "Create New App"  - Choose "From an app manifest" and select your workspace
 - Copy the contents of 
mcp_simple_slackbot/manifest.yamlinto the manifest editor - Create the app and install it to your workspace
 - Under the "Basic Information" section, scroll down to "App-Level Tokens"
 - Click "Generate Token and Scopes" and:
- Enter a name like "mcp-assistant"
 - Add the 
connections:writescope - Click "Generate"
 
 - Take note of both your:
- Bot Token (
xoxb-...) found in "OAuth & Permissions" - App Token (
xapp-...) that you just generated 
 - Bot Token (
 
# Create a virtual environment
python -m venv venv
# Activate the virtual environment
source venv/bin/activate  # On Windows: venv\Scripts\activate
# Install project dependencies
pip install -r mcp_simple_slackbot/requirements.txtCreate a .env file in the mcp_simple_slackbot directory (see .env.example for a template):
# Slack API credentials
SLACK_BOT_TOKEN=xoxb-your-token
SLACK_APP_TOKEN=xapp-your-token
# LLM API credentials
OPENAI_API_KEY=sk-your-openai-key
# or use GROQ_API_KEY or ANTHROPIC_API_KEY
# LLM configuration
LLM_MODEL=gpt-4-turbo
# Navigate to the module directory
cd mcp_simple_slackbot
# Run the bot directly
python main.pyThe bot will:
- Connect to all configured MCP servers
 - Discover available tools
 - Start the Slack app in Socket Mode
 - Listen for mentions and direct messages
 
- Direct Messages: Send a direct message to the bot
 - Channel Mentions: Mention the bot in a channel with 
@MCP Assistant - App Home: Visit the bot's App Home tab to see available tools
 
The bot is designed with a focused architecture:
- SlackMCPBot: Core class managing Slack events and message processing
 - LLMClient: Handles communication with LLM APIs (OpenAI, Groq, Anthropic)
 - Server: Manages communication with MCP servers
 - Tool: Represents available tools from MCP servers
 
When a message is received, the bot:
- Sends the message to the LLM along with available tools
 - If the LLM response includes a tool call, executes the tool
 - Returns the result to the LLM for interpretation
 - Delivers the final response to the user
 
This project is based on the MCP Simple Chatbot example.
MIT License
