Dex is a production-grade personal AI assistant built on the Model Context Protocol (MCP) architecture. Unlike generic chatbots, Dex is designed to be a persistent, memory-aware assistant that:
- π§ Remembers your conversations, notes, and preferences
- β° Tracks reminders and sends alerts via WhatsApp/Telegram
- π Syncs seamlessly across Web, WhatsApp, and Telegram
- π Handles file uploads and context-aware responses
- π Traces all interactions via Opik for observability
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β Dex Architecture β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ€
β β
β βββββββββββββββ βββββββββββββββ βββββββββββββββ β
β β Web UI β β WhatsApp β β Telegram β β
β β (Vite) β β Bot β β Bot β β
β β :5173 β β Baileys β β grammY β β
β ββββββββ¬βββββββ ββββββββ¬βββββββ ββββββββ¬βββββββ β
β β β β β
β ββββββββββββββββββββΌβββββββββββββββββββ β
β βΌ β
β βββββββββββββββββββ β
β β MCP Runtime β β
β β (FastAPI) β β
β β :8000 β β
β ββββββββββ¬βββββββββ β
β β β
β ββββββββββββββββββββΌβββββββββββββββββββ β
β βΌ βΌ βΌ β
β ββββββ
8000
βββββββββ βββββββββββββββ βββββββββββββββ β
β β Orchestratorβ β Prompt β β Tools β β
β β + Session β β Registry β β (Echo,Calc)β β
β βββββββββββββββ βββββββββββββββ βββββββββββββββ β
β β β
β βΌ β
β βββββββββββββββ βββββββββββββββ β
β β Gemini 2.0 β β Opik β β
β β Flash β β Tracing β β
β βββββββββββββββ βββββββββββββββ β
β β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
dex/
βββ ui/ # Frontend (Vite + React + TypeScript)
β βββ components/
β β βββ InputArea.tsx # Message input with file upload
β β βββ LeftSidebar.tsx # Conversation history
β β βββ RightSidebar.tsx # Quick Access panel
β β βββ MessageBubble.tsx # Chat messages
β β βββ WelcomeScreen.tsx # Landing screen
β βββ services/
β β βββ api.ts # Backend API integration
β βββ App.tsx # Main application
β βββ types.ts # TypeScript interfaces
β
βββ services/
β βββ mcp_runtime/ # Core MCP Runtime
β β βββ main.py # FastAPI app + endpoints
β β βββ orchestrator.py # Message orchestration
β β βββ llm.py # Gemini client
β β βββ session.py # Session management
β β βββ gateway.py # WebSocket gateway
β β βββ schemas.py # Pydantic models
β β
β βββ prompt_registry/ # Prompt Management
β β βββ registry.py # Prompt loader
β β βββ prompts/
β β βββ dex_core.yaml # Dex persona definition
β β
β βββ tools/ # Tool Definitions
β β βββ definitions.py # Echo, Calculator tools
β β
β βββ channels/ # Multi-Channel Adapters
β βββ discord/ # Discord bot
β βββ telegram/ # Telegram bot (grammY)
β βββ whatsapp/ # WhatsApp bot (Baileys)
β
βββ web/ # Legacy Next.js UI (deprecated)
βββ k8s/ # Kubernetes manifests
βββ scripts/ # Utility scripts
βββ .env # Environment variables
- Python 3.11+
- Node.js 18+
- Gemini API Key from Google AI Studio
# Clone the repository
git clone https://github.com/STiFLeR7/dex.git
cd dex
# Create Python virtual environment
python -m venv venv
.\venv\Scripts\Activate.ps1
# Install Python dependencies
pip install fastapi uvicorn httpx python-dotenv pyyaml opik pytz python-multipartCreate a .env file in the project root:
# Gemini API (Get from https://aistudio.google.com/apikey)
GEMINI_API_KEY=your_gemini_api_key_here
# Opik Tracing (Optional - for observability)
OPIK_API_KEY=your_opik_api_key
OPIK_WORKSPACE=your_workspace
# Channel Tokens (Optional - for multi-channel)
DISCORD_BOT_TOKEN=your_discord_token
TELEGRAM_BOT_TOKEN=your_telegram_token# From project root with venv activated
uvicorn services.mcp_runtime.main:app --reload --port 8000# In a new terminal
cd ui
npm install
npm run devOpen http://localhost:5173 in your browser.
| Endpoint | Method | Description |
|---|---|---|
/ |
GET | Health check |
/v1/process |
POST | Process message (main endpoint) |
/v1/whatsapp/status |
GET | Check WhatsApp connection |
/v1/whatsapp/connect |
POST | Mark WhatsApp connected |
/v1/notes |
GET/POST | Manage saved notes |
/v1/reminders |
GET/POST | Manage reminders |
/v1/upload |
POST | Upload files |
/ws/{conversation_id} |
WebSocket | Real-time messaging |
curl -X POST http://localhost:8000/v1/process \
-H "Content-Type: application/json" \
-d '{
"context_id": "123",
"assistant": {"name": "Dex", "persona_version": "2.0.0"},
"session": {"type": "web", "conversation_id": "conv-1"},
"user_input": {"message": "Hello Dex!"},
"prompt": {"id": "dex-core", "version": "2.0.0"},
"tools_available": ["echo", "calculator"]
}'| Feature | Description |
|---|---|
| Dark Theme | Professional grey (#1a1a1a) with green accents (#22c55e) |
| File Upload | Attach images, PDFs, docs via paperclip button |
| Conversation History | Persisted in localStorage, grouped by date |
| Quick Access Panel | Real-time date/time, notes, reminders |
| Channel Connect | Connect WhatsApp/Telegram from UI |
| Responsive | Works on desktop, tablet, mobile |
cd services/channels/whatsapp
npm install
npm start
# Scan QR code when prompted# Set TELEGRAM_BOT_TOKEN in .env first
cd services/channels/telegram
npm install
npm start# Set DISCORD_BOT_TOKEN in .env first
cd services/channels/discord
npm install
npm startDex is configured via services/prompt_registry/prompts/dex_core.yaml:
id: dex-core
version: "2.0.0"
system_prompt: |
You are **Dex**, a personal AI assistant.
## IDENTITY
- Your name is **Dex** - always introduce yourself by name
- You are friendly, helpful, and precise
- You remember context from conversations
## CURRENT CONTEXT
- Current Date: {current_date}
- Current Time: {current_time}
- Timezone: {timezone}
- Day of Week: {day_of_week}The orchestrator automatically injects the current date/time into every response.
Dex uses Opik for tracing and observability:
- All interactions are logged with trace IDs
- View traces at Comet Opik Dashboard
- Traces include: messages, LLM calls, tool executions
| Component | Status |
|---|---|
| MCP Runtime | β Complete |
| Gemini Integration | β Complete |
| Web UI (Vite) | β Complete |
| File Upload | β Complete |
| Session Management | β Complete |
| Opik Tracing | β Complete |
| WhatsApp Bot | π§ Ready (needs testing) |
| Telegram Bot | π§ Ready (needs testing) |
| Discord Bot | π§ Ready (needs testing) |
| Kubernetes Deployment | π Prepared |
- Persistent database for notes/reminders
- User authentication system
- Voice input/output
- Advanced tool integrations
- Mobile app (React Native)
MIT License - See LICENSE for details.
Built with β€οΈ by STIFLER