Spaces:
Sleeping
π IntegraChat
Multi-Tenant Autonomous MCP Platform
Enterprise-grade AI with autonomous agents, secure multi-tenant RAG, real-time web search, red-flag governance, and analytics.
π Table of Contents
- Overview
- Purpose
- Key Features
- Technology Stack
- System Architecture
- Project Structure
- Getting Started
- Why IntegraChat Stands Out
- Submission Metadata
- License
π Overview
IntegraChat is an enterprise-ready, multi-tenant AI platform built to demonstrate the full capabilities of the Model Context Protocol (MCP) in a real production-style environment.
It combines autonomous tool-using agents, RAG retrieval, live web search, and admin governance under strict tenant isolation, powered by Ollama (local) or Groq (cloud) LLM inference.
IntegraChat is a complete "MCP in Action" ecosystem β ideal for enterprise demos, research, production scaffolds, and governance-focused AI deployments.
π― Purpose
IntegraChat showcases how MCP can power intelligent, governed, multi-tenant AI systems with real-world requirements:
- π Isolation & Access Control - Strict tenant separation
- π‘οΈ Compliance & Red-Flag Detection - Automated safety monitoring
- π€ Tool-Aware Autonomous Reasoning - Dynamic tool selection
- π RAG + Web Search Hybrid AI - Best of both worlds
- π Analytics & Observability - Full system insights
- βοΈ Admin Governance Workflows - Enterprise-ready controls
π§© Key Features
1. π€ Autonomous MCP Agents
Agents can intelligently:
- β Analyze user intent and context
- β Detect sensitive or unsafe content
- β Dynamically select multiple tools in sequence (RAG + Web + LLM, Web + LLM, RAG + LLM, etc.)
- β Multi-step tool execution - Execute tools sequentially and synthesize results
- β Retrieve tenant-private knowledge
- β Pull real-time data from the internet
- β Trigger admin alerts when needed
- β Respond using Ollama (local) or Groq (cloud) LLM
2. π Enterprise RAG System
- MiniLM embeddings (384-dim) for semantic search
- Supabase + pgvector for vector storage
- Automatic database schema initialization on server startup
- Strict multi-tenant isolation with tenant_id filtering
- Intelligent text chunking (~300 words per chunk)
- Vector similarity search using cosine distance
3. π Live Web Search Tool
- Real-time news and information
- General web search capabilities
- English language results - Forces English content via region parameters
- Fact-checking & fresh data retrieval
- Multiple provider support (DuckDuckGo, SerpAPI, Bing)
4. π Multi-Tool Selection & Execution
The intelligent tool selector can:
- Pattern-based detection - Recognizes fact queries, freshness keywords, internal docs
- LLM-enhanced planning - Uses LLM to determine optimal tool combinations
- Sequential execution - Executes tools in order (RAG β Web β LLM)
- Result synthesis - Combines all tool outputs into comprehensive responses
Supported combinations:
RAG + LLM- Internal knowledge questionsWeb + LLM- Public fact questionsRAG + Web + LLM- Comprehensive queries needing both sourcesLLM only- Simple conversational queries
5. π¨ Red-Flag Governance Engine
Admins configure rules to:
- β Block unsafe queries automatically
- π Log violations for audit trails
- π Trigger admin alerts in real-time
Example rules: salary, delete all data, confidential client info
6. π Analytics Dashboard
Comprehensive insights for:
- π Query volume and trends
- π§ Tool usage statistics
- π― RAG performance metrics
- π¨ Red-flag violation tracking
- π§ Agent reasoning traces
- π₯ Tenant activity monitoring
7. π’ Multi-Tenant Isolation
Each tenant gets:
- π Private agents
- π¦ Private knowledge base
- βοΈ Private admin rules
- π Private analytics
Isolation is guaranteed via Supabase Row-Level Security (RLS).
π Technology Stack
Backend
| Technology | Purpose |
|---|---|
| FastAPI | High-performance API framework |
| MCP Client + Servers | Model Context Protocol implementation |
| Supabase | Auth + Storage + pgvector database |
| PostgreSQL + pgvector | Vector database for embeddings |
| MiniLM Embeddings | Semantic search embeddings (384-dim) |
| Ollama / Groq | LLM inference engine (configurable) |
| DuckDuckGo Search | Web search provider |
| Slack / Email | Alerting system |
Frontend
| Technology | Purpose |
|---|---|
| React 18 | Modern UI framework |
| TailwindCSS | Utility-first styling |
| Zustand | State management |
| WebSocket | Real-time streaming |
| Admin Dashboard | Analytics & governance UI |
π§± System Architecture
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β Frontend (React) β
β ββββββββββββ ββββββββββββ ββββββββββββ ββββββββββββ β
β β Chat UI β β Admin β βAnalytics β βWebSocket β β
β β β β Panel β β Dashboardβ βStreaming β β
β ββββββββββββ ββββββββββββ ββββββββββββ ββββββββββββ β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β HTTP/WebSocket
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β MCP Client (FastAPI) β
β β’ Intent handling β
β β’ Red-flag scanning β
β β’ Multi-tool selection logic β
β β’ Sequential tool execution β
β β’ Groq Llama-3.1 integration β
β β’ Event logging β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β MCP Protocol
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β MCP Servers β
β ββββββββββββββββ ββββββββββββββββ ββββββββββββββββ β
β β RAG Server β β Web Search β β Admin Server β β
β β (Knowledge) β β (Live/EN) β β (Governance) β β
β ββββββββββββββββ ββββββββββββββββ ββββββββββββββββ β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β Supabase Database β
β β’ Authentication β
β β’ pgvector (embeddings) β
β β’ Row-Level Security (RLS) β
β β’ Storage β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
π Project Structure
IntegraChat/
βββ backend/
β βββ api/
β β βββ main.py
β β βββ routes/
β β β βββ agent.py
β β β βββ rag.py
β β β βββ web.py
β β β βββ admin.py
β β β βββ analytics.py
β β βββ services/
β β β βββ agent_orchestrator.py
β β β βββ intent_classifier.py
β β β βββ redflag_detector.py
β β β βββ tool_selector.py
β β β βββ prompt_builder.py
β β β βββ llm_client.py
β β βββ mcp_clients/
β β β βββ rag_client.py
β β β βββ web_client.py
β β β βββ admin_client.py
β β βββ models/
β β β βββ requests.py
β β β βββ responses.py
β β β βββ agent_decision.py
β β β βββ embeddings.py
β β βββ utils/
β β β βββ logging.py
β β β βββ supabase_client.py
β β β βββ tenant_context.py
β β β βββ security.py
β β β βββ text_extractor.py
β β βββ config.py
β β
β βββ mcp_servers/
β β βββ main.py # RAG MCP Server (FastAPI)
β β βββ database.py # Supabase/PostgreSQL connection
β β βββ embeddings.py # Sentence transformers embeddings
β β
β βββ workers/
β β βββ ingestion_worker.py
β β βββ analytics_worker.py
β β βββ scheduler.py
β β βββ celeryconfig.py
β β
β βββ tests/
β β βββ test_agent.py
β β βββ test_rag.py
β β βββ test_admin.py
β β βββ test_web.py
β β βββ test_end_to_end.py
β β
β βββ Dockerfile
β
βββ frontend/
β βββ src/
β β βββ components/
β β β βββ chat/
β β β β βββ ChatWindow.jsx
β β β β βββ MessageBubble.jsx
β β β β βββ ToolTraces.jsx
β β β βββ admin/
β β β β βββ RedFlagEditor.jsx
β β β β βββ TenantManager.jsx
β β β βββ analytics/
β β β βββ QueryStats.jsx
β β β βββ ToolUsageChart.jsx
β β β βββ RagEffectiveness.jsx
β β βββ pages/
β β β βββ ChatPage.jsx
β β β βββ AdminPage.jsx
β β β βββ AnalyticsPage.jsx
β β βββ store/
β β β βββ chatStore.js
β β β βββ adminStore.js
β β β βββ analyticsStore.js
β β βββ utils/
β β β βββ websocket.js
β β β βββ api.js
β β β βββ formatters.js
β β βββ App.jsx
β β βββ main.jsx
β βββ public/
β βββ package.json
β
βββ supabase/
β βββ migrations/
β β βββ 001_init.sql
β β βββ 002_embeddings.sql
β β βββ 003_redflag_rules.sql
β β βββ 004_analytics_tables.sql
β βββ seed/
β β βββ default_redflags.sql
β β βββ demo_tenants.sql
β βββ policies/
β β βββ rls_tenant_documents.sql
β β βββ rls_tenant_embeddings.sql
β β βββ rls_admin_rules.sql
β βββ functions/
β β βββ vector_search.sql
β βββ README.md
β
βββ docs/
β βββ architecture-diagram.png
β βββ sequence-mcp-agent.png
β βββ api-spec.md
β βββ mcp-server-protocol.md
β βββ rag-pipeline.md
β
βββ scripts/
β βββ run_dev.sh
β βββ build_all.sh
β βββ reset_db.sh
β βββ run_workers.sh
β
βββ docker-compose.yml
βββ README.md
βββ LICENSE
π Getting Started
Prerequisites
Before you begin, ensure you have the following installed:
- β Python 3.10+
- β Node.js 18+ (for frontend)
- β Supabase project (with pgvector extension enabled)
- β PostgreSQL connection string (from Supabase)
- β Ollama (for local LLM) or Groq API key (for cloud LLM)
- β DuckDuckGo Search key (optional, if configured)
- β Slack/Email webhook for alerts (optional)
Backend Setup
Navigate to backend directory
cd backendInstall dependencies
pip install -r requirements.txtConfigure environment variables
Create a
.envfile in the project root with the following:# Database Configurationa POSTGRESQL_URL=postgresql://user:password@host:port/database SUPABASE_URL=https://your-project.supabase.co SUPABASE_SERVICE_KEY=your_service_role_key # MCP Server URLs RAG_MCP_URL=http://localhost:8001 WEB_MCP_URL=http://localhost:8002 ADMIN_MCP_URL=http://localhost:8003 # LLM Configuration OLLAMA_URL=http://localhost:11434 OLLAMA_MODEL=llama3 # Or use Groq instead: # GROQ_API_KEY=your_groq_api_keyStart the RAG MCP Server
cd backend/mcp_servers python main.pyThe server will automatically initialize the database schema on startup.
- Server runs on
http://localhost:8001 - API docs available at
http://localhost:8001/docs
- Server runs on
Run the main API server
cd backend uvicorn api.main:app --reload
RAG MCP Server API
The RAG MCP Server provides two main endpoints:
Ingest Documents:
curl -X POST http://localhost:8001/ingest \
-H "Content-Type: application/json" \
-d '{
"tenant_id": "tenant123",
"content": "Your document text here..."
}'
Semantic Search:
curl -X POST http://localhost:8001/search \
-H "Content-Type: application/json" \
-d '{
"tenant_id": "tenant123",
"query": "What are the HR policies?"
}'
Frontend Setup
Navigate to frontend directory
cd frontendInstall dependencies
npm installStart the development server
npm run dev
Quick Start with Docker
docker-compose up -d
β¨ Why IntegraChat Stands Out
| Feature | Description |
|---|---|
| π€ True MCP-Native | Autonomous agents (not static prompts) |
| π‘οΈ Enterprise Governance | Regex-based red-flag rules system |
| π Hybrid Intelligence | Multi-tool selection (RAG + Web + LLM combinations) |
| π Sequential Execution | Execute multiple tools in sequence and synthesize results |
| π English Web Search | Forces English language results for better accuracy |
| π’ Production-Grade | Multi-tenant design with strict Supabase RLS |
| π Full Observability | Logs, analytics, tool events, violations |
| π― Demo-Ready | Perfect for enterprise presentations |
π· Submission Metadata
| Field | Value |
|---|---|
| Track | MCP in Action |
| Category | Enterprise |
| Tag | mcp-in-action-track-enterprise |
| Project Name | IntegraChat |
Short Summary
IntegraChat is a multi-tenant AI platform where autonomous MCP-powered agents intelligently select and execute multiple tools in sequence (RAG + Web + LLM combinations), retrieve private knowledge using RAG, access live web information in English, and enforce admin-defined safety rules via a red-flag compliance system. It includes an analytics dashboard, advanced multi-tool selection engine, and strict tenant isolation.
π License
This project is licensed under the MIT License - see the LICENSE file for details.
π¬ Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
π Acknowledgments
- Built with Model Context Protocol (MCP)
- Powered by Ollama or Groq for LLM inference
- Database powered by Supabase
Made with β€οΈ for the MCP community