An AI-driven workspace intelligence dashboard and conversational auditor for Slack. Slack Intelligence Copilot leverages the Model Context Protocol (MCP) to interact securely with Slack workspace data, caches conversations locally, generates vector embeddings, enables semantic search, and executes ReAct-style reasoning loops to summarize channels, track decisions, and draft posts with human-in-the-loop validation.
flowchart TD
subgraph Client ["Frontend (React + Vite + TypeScript)"]
Dashboard["Workspace Dashboard"]
Chat["ReAct Agent Chat UI"]
Audit["Audit Log Viewer"]
end
subgraph Service ["Backend (FastAPI)"]
API["FastAPI App (main.py)"]
Agent["Copilot Agent (agent.py)"]
RAG["Local Knowledge Layer (rag.py)"]
DB[(SQLite / PostgreSQL Cache)]
end
subgraph Slack ["External Services"]
MCP["Slack MCP Server (FastMCP)"]
SlackAPI["Slack Web API"]
LLM["LLM & Embeddings (Gemini / OpenAI)"]
end
%% Interactions
Dashboard -->|Get Stats & Logs| API
Chat -->|Agent Query Stream| API
API -->|ReAct Loop| Agent
Agent -->|Call Read Tools| MCP
Agent -->|Request Confirmations| Chat
API -->|Index & Vector Search| RAG
RAG -->|Read/Write| DB
RAG -->|Generate Embeddings| LLM
MCP -->|Read/Write API| SlackAPI
Agent -->|Generate Thoughts| LLM
- Workspace Sentiment Tracking: Real-time sentiment metrics calculated from message contexts to gauge team morale.
- Activity & Engagement Trends: Beautiful charts visualizing workspace message volume over time.
- Automatic Action Item Extraction: Detects and organizes pending tasks, assignments, and follow-ups.
- Trending Topics Analysis: Keyword frequency tracking to highlight what your team is discussing most.
- Live Streaming Reasoning: Streams the model's inner thoughts (Thoughts) and tool calls in real time to the Chat UI.
- Intelligent Entity Resolution: Automatically maps natural language references (e.g.,
#generalor names likeTeja) to precise Slack IDs. - Smart Synthesis Templates: Generates executive-level channel summaries, key insights, action items, and risk logs.
- High-Performance Caching: Saves channel metadata, users, and message history to avoid Slack API rate-limiting.
- Vector Embeddings & Semantic Search: Generates cosine-similarity vector embeddings using Google Gemini (
text-embedding-004) or OpenAI (text-embedding-3-small) with automatic SQLite full-text search fallback. - Dialect-Agnostic Database Adapter: Supports seamless SQLite (development) and PostgreSQL (production) schemas with auto-translating queries.
- Write Confirmations: The agent suspends execution and requests manual confirmation in the UI before sending Slack messages or modifying workspace states.
- API Diagnostics Panel: Secure, masked credential configuration with built-in diagnostic tools to verify keys before storing them.
- Immutable Audit Trail: Log tracking for setting changes, synchronizations, agent actions, and authorization events.
Before you begin, ensure you have the following:
- Python 3.10+
- Node.js 18+ & npm
- Slack Bot User OAuth Token (
xoxb-...) containing scopes:channels:read,groups:read,channels:history,groups:history,users:read,chat:write
- Google Gemini API Key (or OpenAI API Key) for model reasoning and embedding generation.
- Navigate to the backend directory:
cd backend - Create and activate a Python virtual environment:
- Windows (PowerShell):
python -m venv venv .\venv\Scripts\activate - macOS/Linux:
python -m venv venv source venv/bin/activate
- Windows (PowerShell):
- Install the required dependencies:
pip install -r requirements.txt
- Configure environment variables:
- Copy the template file:
cp .env.example .env
- Open
.envand fill inSLACK_BOT_TOKEN,GEMINI_API_KEY(orOPENAI_API_KEY), and setDATABASE_URLif using a remote database (otherwise, it defaults to a local SQLite database fileslack_copilot.db).
- Copy the template file:
- Launch the FastAPI server:
python main.py
- The API server runs at
http://127.0.0.1:8000. - FastMCP launches the Slack MCP server dynamically as a child process.
- The API server runs at
- Navigate to the frontend directory:
cd ../frontend - Install npm packages:
npm install
- Configure environment variables:
- Copy the template file:
cp .env.example .env
- Verify that
VITE_API_BASEpoints to your backend URL (defaults tohttp://localhost:8000/api/v1).
- Copy the template file:
- Start the Vite development server:
npm run dev
- Open
http://localhost:5173in your browser to view the application.
- Open
Because the project is architected as decoupled services, the frontend and backend can be hosted independently.
- Deploy Python Web Service:
- Root Directory:
backend/ - Build Command:
pip install -r requirements.txt - Start Command:
uvicorn main:app --host 0.0.0.0 --port $PORT
- Root Directory:
- Environment Variables:
- Ensure
SLACK_BOT_TOKEN,GEMINI_API_KEY(orOPENAI_API_KEY), andLLM_PROVIDERare defined.
- Ensure
- Database Configuration:
- SQLite (with persistent volume): If using SQLite, mount a persistent disk (e.g., 1GB mounted at
/app/data/) and updateDB_PATHin your environment variables to point to the persistent disk path. - PostgreSQL (e.g., Supabase): Define the
DATABASE_URLenvironment variable. The backend features automatic connection healing logic built specifically for the Supabase Transaction Pooler, including URL-decoding credentials and username formatting to prevent connection issues.
- SQLite (with persistent volume): If using SQLite, mount a persistent disk (e.g., 1GB mounted at
- Deploy static Vite App:
- Root Directory:
frontend/ - Build Command:
npm run build - Output Directory:
dist
- Root Directory:
- Environment Variables:
- Configure
VITE_API_BASEto point to your live backend API URL (e.g.,https://your-backend-api.com/api/v1).
- Configure
- Human-in-the-Loop Verification: Any mutating operations, such as posting messages or thread replies, require explicit human confirmation in the dashboard interface before execution.
- Safe Configuration Storage: API keys and credentials can be securely entered and updated through a masked settings panel, validating credentials before persisting them safely in the database.
- Immutable Logs: Audit trail preserves records of workspace synchronization, credentials testing, and user approvals to ensure accountability.