nothingworry commited on
Commit
ba6735b
Β·
1 Parent(s): 3d54b55

first commit

Browse files
Files changed (1) hide show
  1. README.md +385 -0
README.md ADDED
@@ -0,0 +1,385 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # **IntegraChat β€” Multi-Tenant Autonomous MCP Platform**
2
+
3
+ ### **Enterprise-grade AI with autonomous agents, secure multi-tenant RAG, real-time web search, red-flag governance, and analytics.**
4
+
5
+ ---
6
+
7
+ ## **πŸ“Œ Overview**
8
+
9
+ **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.
10
+
11
+ It combines **autonomous tool-using agents**, **RAG retrieval**, **live web search**, and **admin governance** under strict **tenant isolation**, powered by Groq's **Llama-3.1-8B**.
12
+
13
+ IntegraChat is a complete "**MCP in Action**" ecosystem β€” ideal for enterprise demos, research, production scaffolds, and governance-focused AI deployments.
14
+
15
+ ---
16
+
17
+ # **🎯 Purpose**
18
+
19
+ IntegraChat showcases how MCP can power **intelligent, governed, multi-tenant AI systems** with real-world requirements:
20
+
21
+ * Isolation & access control
22
+ * Compliance & red-flag detection
23
+ * Tool-aware autonomous reasoning
24
+ * RAG + web search hybrid AI
25
+ * Analytics & observability
26
+ * Admin governance workflows
27
+
28
+ ---
29
+
30
+ # **🧩 Key Features**
31
+
32
+ ## **1. Autonomous MCP Agents**
33
+
34
+ Agents can:
35
+
36
+ * Analyze user intent
37
+ * Detect sensitive or unsafe content
38
+ * Dynamically select tools (RAG, Web, Admin, etc.)
39
+ * Retrieve tenant-private knowledge
40
+ * Pull real-time data from the internet
41
+ * Trigger admin alerts
42
+ * Respond using Groq's **Llama-3.1-8B**
43
+
44
+ ## **2. Enterprise RAG System**
45
+
46
+ * MiniLM embeddings
47
+ * Supabase + pgvector
48
+ * Strict multi-tenant RLS enforcement
49
+ * PDF / DOCX / TXT / URL ingestion
50
+ * Chunking + semantic search
51
+
52
+ ## **3. Live Web Search Tool**
53
+
54
+ * Real-time news
55
+ * General web search
56
+ * Fact-checking & fresh data retrieval
57
+
58
+ ## **4. Red-Flag Governance Engine**
59
+
60
+ Admins configure rules to:
61
+
62
+ * Block unsafe queries
63
+ * Log violations
64
+ * Trigger admin alerts
65
+
66
+ Examples: `salary`, `delete all data`, `confidential client info`.
67
+
68
+ ## **5. Analytics Dashboard**
69
+
70
+ Includes insights for:
71
+
72
+ * Query volume
73
+ * Tool usage
74
+ * RAG performance
75
+ * Red-flag violations
76
+ * Agent reasoning traces
77
+ * Tenant activity
78
+
79
+ ## **6. Multi-Tenant Isolation**
80
+
81
+ Each tenant gets:
82
+
83
+ * Private agents
84
+ * Private knowledge base
85
+ * Private admin rules
86
+ * Private analytics
87
+
88
+ Isolation is guaranteed via **Supabase RLS**.
89
+
90
+ ---
91
+
92
+ # **πŸ›  Technology Stack**
93
+
94
+ ## **Backend**
95
+
96
+ * FastAPI
97
+ * MCP Client + MCP Servers
98
+ * Supabase (Auth + Storage + pgvector)
99
+ * MiniLM Embeddings
100
+ * Groq Llama-3.1-8B
101
+ * DuckDuckGo Search
102
+ * Slack / Email alerting
103
+
104
+ ## **Frontend**
105
+
106
+ * React 18
107
+ * TailwindCSS
108
+ * Zustand
109
+ * WebSocket streaming
110
+ * Admin dashboard + analytics
111
+
112
+ ---
113
+
114
+ # **🧱 System Architecture**
115
+
116
+ ```
117
+ Frontend (React)
118
+
119
+ - Chat UI
120
+
121
+ - Admin Panel
122
+
123
+ - Analytics / Insights
124
+
125
+ - WebSocket streaming
126
+
127
+
128
+
129
+ MCP Client (FastAPI)
130
+
131
+ - Intent handling
132
+
133
+ - Red-flag scanning
134
+
135
+ - Tool selection logic
136
+
137
+ - Calls Groq Llama-3.1
138
+
139
+ - Event logging
140
+
141
+
142
+
143
+ MCP Servers:
144
+
145
+ - RAG Server (private knowledge)
146
+
147
+ - Web Search Server (live data)
148
+
149
+ - Admin Server (alerts / governance)
150
+
151
+
152
+
153
+ Database:
154
+
155
+ - Supabase (Auth + Storage + pgvector + RLS)
156
+ ```
157
+
158
+ ---
159
+
160
+ # **πŸ“ Project Structure**
161
+
162
+ ```
163
+ IntegraChat/
164
+ β”œβ”€β”€ backend/
165
+ β”‚ β”œβ”€β”€ api/
166
+ β”‚ β”‚ β”œβ”€β”€ main.py
167
+ β”‚ β”‚ β”œβ”€β”€ routes/
168
+ β”‚ β”‚ β”‚ β”œβ”€β”€ agent.py
169
+ β”‚ β”‚ β”‚ β”œβ”€β”€ rag.py
170
+ β”‚ β”‚ β”‚ β”œβ”€β”€ web.py
171
+ β”‚ β”‚ β”‚ β”œβ”€β”€ admin.py
172
+ β”‚ β”‚ β”‚ └── analytics.py
173
+ β”‚ β”‚ β”œβ”€β”€ services/
174
+ β”‚ β”‚ β”‚ β”œβ”€β”€ agent_orchestrator.py
175
+ β”‚ β”‚ β”‚ β”œβ”€β”€ intent_classifier.py
176
+ β”‚ β”‚ β”‚ β”œβ”€β”€ redflag_detector.py
177
+ β”‚ β”‚ β”‚ β”œβ”€β”€ tool_selector.py
178
+ β”‚ β”‚ β”‚ β”œβ”€β”€ prompt_builder.py
179
+ β”‚ β”‚ β”‚ └── llm_client.py
180
+ β”‚ β”‚ β”œβ”€β”€ mcp_clients/
181
+ β”‚ β”‚ β”‚ β”œβ”€β”€ rag_client.py
182
+ β”‚ β”‚ β”‚ β”œβ”€β”€ web_client.py
183
+ β”‚ β”‚ β”‚ └── admin_client.py
184
+ β”‚ β”‚ β”œβ”€β”€ models/
185
+ β”‚ β”‚ β”‚ β”œβ”€β”€ requests.py
186
+ β”‚ β”‚ β”‚ β”œβ”€β”€ responses.py
187
+ β”‚ β”‚ β”‚ β”œβ”€β”€ agent_decision.py
188
+ β”‚ β”‚ β”‚ └── embeddings.py
189
+ β”‚ β”‚ β”œβ”€β”€ utils/
190
+ β”‚ β”‚ β”‚ β”œβ”€β”€ logging.py
191
+ β”‚ β”‚ β”‚ β”œβ”€β”€ supabase_client.py
192
+ β”‚ β”‚ β”‚ β”œβ”€β”€ tenant_context.py
193
+ β”‚ β”‚ β”‚ └── security.py
194
+ β”‚ β”‚ └── config.py
195
+ β”‚ β”‚
196
+ β”‚ β”œβ”€β”€ mcp_servers/
197
+ β”‚ β”‚ β”œβ”€β”€ rag_server/
198
+ β”‚ β”‚ β”‚ β”œβ”€β”€ main.py
199
+ β”‚ β”‚ β”‚ β”œβ”€β”€ chunker.py
200
+ β”‚ β”‚ β”‚ β”œβ”€β”€ search.py
201
+ β”‚ β”‚ β”‚ β”œβ”€β”€ embeddings.py
202
+ β”‚ β”‚ β”‚ β”œβ”€β”€ ingestion/
203
+ β”‚ β”‚ β”‚ β”‚ β”œβ”€β”€ ingest_pdf.py
204
+ β”‚ β”‚ β”‚ β”‚ β”œβ”€β”€ ingest_docx.py
205
+ β”‚ β”‚ β”‚ β”‚ β”œβ”€β”€ ingest_txt.py
206
+ β”‚ β”‚ β”‚ β”‚ └── ingest_url.py
207
+ β”‚ β”‚ β”‚ β”œβ”€β”€ db/
208
+ β”‚ β”‚ β”‚ β”‚ β”œβ”€β”€ documents_repo.py
209
+ β”‚ β”‚ β”‚ β”‚ └── embeddings_repo.py
210
+ β”‚ β”‚ β”‚ └─�� config.py
211
+ β”‚ β”‚ β”‚
212
+ β”‚ β”‚ β”œβ”€β”€ web_server/
213
+ β”‚ β”‚ β”‚ β”œβ”€β”€ main.py
214
+ β”‚ β”‚ β”‚ β”œβ”€β”€ providers/
215
+ β”‚ β”‚ β”‚ β”‚ β”œβ”€β”€ ddg.py
216
+ β”‚ β”‚ β”‚ β”‚ β”œβ”€β”€ serpapi.py (optional)
217
+ β”‚ β”‚ β”‚ β”‚ └── bing.py (optional)
218
+ β”‚ β”‚ β”‚ └── utils.py
219
+ β”‚ β”‚ β”‚
220
+ β”‚ β”‚ └── admin_server/
221
+ β”‚ β”‚ β”œβ”€β”€ main.py
222
+ β”‚ β”‚ β”œβ”€β”€ redflag_rules.py
223
+ β”‚ β”‚ β”œβ”€β”€ alerts/
224
+ β”‚ β”‚ β”‚ β”œβ”€β”€ slack.py
225
+ β”‚ β”‚ β”‚ β”œβ”€β”€ email.py
226
+ β”‚ β”‚ β”‚ └── webhook.py
227
+ β”‚ β”‚ └── audit_logs.py
228
+ β”‚ β”‚
229
+ β”‚ β”œβ”€β”€ workers/
230
+ β”‚ β”‚ β”œβ”€β”€ ingestion_worker.py
231
+ β”‚ β”‚ β”œβ”€β”€ analytics_worker.py
232
+ β”‚ β”‚ β”œβ”€β”€ scheduler.py
233
+ β”‚ β”‚ └── celeryconfig.py
234
+ β”‚ β”‚
235
+ β”‚ β”œβ”€β”€ tests/
236
+ β”‚ β”‚ β”œβ”€β”€ test_agent.py
237
+ β”‚ β”‚ β”œβ”€β”€ test_rag.py
238
+ β”‚ β”‚ β”œβ”€β”€ test_admin.py
239
+ β”‚ β”‚ β”œβ”€β”€ test_web.py
240
+ β”‚ β”‚ └── test_end_to_end.py
241
+ β”‚ β”‚
242
+ β”‚ └── Dockerfile
243
+ β”‚
244
+ β”œβ”€β”€ frontend/
245
+ β”‚ β”œβ”€β”€ src/
246
+ β”‚ β”‚ β”œβ”€β”€ components/
247
+ β”‚ β”‚ β”‚ β”œβ”€β”€ chat/ChatWindow.jsx
248
+ β”‚ β”‚ β”‚ β”œβ”€β”€ chat/MessageBubble.jsx
249
+ β”‚ β”‚ β”‚ β”œβ”€β”€ chat/ToolTraces.jsx
250
+ β”‚ β”‚ β”‚ β”œβ”€β”€ admin/RedFlagEditor.jsx
251
+ β”‚ β”‚ β”‚ β”œβ”€β”€ admin/TenantManager.jsx
252
+ β”‚ β”‚ β”‚ β”œβ”€β”€ analytics/QueryStats.jsx
253
+ β”‚ β”‚ β”‚ β”œβ”€β”€ analytics/ToolUsageChart.jsx
254
+ β”‚ β”‚ β”‚ └── analytics/RagEffectiveness.jsx
255
+ β”‚ β”‚ β”œβ”€β”€ pages/
256
+ β”‚ β”‚ β”‚ β”œβ”€β”€ ChatPage.jsx
257
+ β”‚ β”‚ β”‚ β”œβ”€β”€ AdminPage.jsx
258
+ β”‚ β”‚ β”‚ └── AnalyticsPage.jsx
259
+ β”‚ β”‚ β”œβ”€β”€ store/
260
+ β”‚ β”‚ β”‚ β”œβ”€β”€ chatStore.js
261
+ β”‚ β”‚ β”‚ β”œβ”€β”€ adminStore.js
262
+ β”‚ β”‚ β”‚ └── analyticsStore.js
263
+ β”‚ β”‚ β”œβ”€β”€ utils/
264
+ β”‚ β”‚ β”‚ β”œβ”€β”€ websocket.js
265
+ β”‚ β”‚ β”‚ β”œβ”€β”€ api.js
266
+ β”‚ β”‚ β”‚ └── formatters.js
267
+ β”‚ β”‚ β”œβ”€β”€ App.jsx
268
+ β”‚ β”‚ └── main.jsx
269
+ β”‚ β”œβ”€β”€ public/
270
+ β”‚ └── package.json
271
+ β”‚
272
+ β”œβ”€β”€ supabase/
273
+ β”‚ β”œβ”€β”€ migrations/
274
+ β”‚ β”‚ β”œβ”€β”€ 001_init.sql
275
+ β”‚ β”‚ β”œβ”€β”€ 002_embeddings.sql
276
+ β”‚ β”‚ β”œβ”€β”€ 003_redflag_rules.sql
277
+ β”‚ β”‚ └── 004_analytics_tables.sql
278
+ β”‚ β”œβ”€β”€ seed/
279
+ β”‚ β”‚ β”œβ”€β”€ default_redflags.sql
280
+ β”‚ β”‚ └── demo_tenants.sql
281
+ β”‚ β”œβ”€β”€ policies/
282
+ β”‚ β”‚ β”œβ”€β”€ rls_tenant_documents.sql
283
+ β”‚ β”‚ β”œβ”€β”€ rls_tenant_embeddings.sql
284
+ β”‚ β”‚ └── rls_admin_rules.sql
285
+ β”‚ β”œβ”€β”€ functions/
286
+ β”‚ β”‚ └── vector_search.sql
287
+ β”‚ └── README.md
288
+ β”‚
289
+ β”œβ”€β”€ docs/
290
+ β”‚ β”œβ”€β”€ architecture-diagram.png
291
+ β”‚ β”œβ”€β”€ sequence-mcp-agent.png
292
+ β”‚ β”œβ”€β”€ api-spec.md
293
+ β”‚ β”œβ”€β”€ mcp-server-protocol.md
294
+ β”‚ └── rag-pipeline.md
295
+ β”‚
296
+ β”œβ”€β”€ scripts/
297
+ β”‚ β”œβ”€β”€ run_dev.sh
298
+ β”‚ β”œβ”€β”€ build_all.sh
299
+ β”‚ β”œβ”€β”€ reset_db.sh
300
+ β”‚ └── run_workers.sh
301
+ β”‚
302
+ β”œβ”€β”€ docker-compose.yml
303
+ β”œβ”€β”€ README.md
304
+ └── LICENSE
305
+ ```
306
+
307
+ ---
308
+
309
+ # **πŸš€ Getting Started**
310
+
311
+ ## **Prerequisites**
312
+
313
+ * Python 3.10+
314
+ * Node.js 18+
315
+ * Supabase project
316
+ * Groq API key
317
+ * DuckDuckGo Search key (if configured)
318
+ * Slack/Email webhook for alerts (optional)
319
+
320
+ ---
321
+
322
+ ## **Backend Setup**
323
+
324
+ ```sh
325
+ cd backend
326
+ pip install -r requirements.txt
327
+ cp .env.example .env # Fill in Supabase + Groq keys
328
+ uvicorn app:app --reload
329
+ ```
330
+
331
+ ## **Frontend Setup**
332
+
333
+ ```sh
334
+ cd frontend
335
+ npm install
336
+ npm run dev
337
+ ```
338
+
339
+ ---
340
+
341
+ # **✨ Why IntegraChat Stands Out**
342
+
343
+ * **True MCP-native autonomous agents** (not static prompts)
344
+ * **Enterprise governance system** with regex-based red-flag rules
345
+ * **Hybrid RAG + web search** reasoning
346
+ * **Production-grade multi-tenant design** with strict Supabase RLS
347
+ * **Full observability**: logs, analytics, tool events, violations
348
+ * **Demo-ready**: perfect for enterprise presentations
349
+
350
+ ---
351
+
352
+ # **🏷 Submission Metadata**
353
+
354
+ **Track:** MCP in Action
355
+
356
+ **Category:** Enterprise
357
+
358
+ **Tag:** `mcp-in-action-track-enterprise`
359
+
360
+ **Project Name:** **IntegraChat**
361
+
362
+ ### **Short Summary**
363
+
364
+ > IntegraChat is a multi-tenant AI platform where autonomous MCP-powered agents retrieve private knowledge using RAG, access live web information, and enforce admin-defined safety rules via a red-flag compliance system. It includes an analytics dashboard, tool-selection engine, and strict tenant isolation.
365
+
366
+ ---
367
+
368
+ # **πŸ“„ License**
369
+
370
+ Add your license here (MIT recommended).
371
+
372
+ ---
373
+
374
+ # **πŸ“¬ Contact**
375
+
376
+ If you'd like, I can generate:
377
+
378
+ * βœ” Pitch deck
379
+ * βœ” Notion documentation
380
+ * βœ” Demo video script
381
+ * βœ” Architecture diagram SVG
382
+ * βœ” Full API reference
383
+
384
+ ---
385
+