Compare commits
4 Commits
worktree-c
...
worktree-m
| Author | SHA1 | Date | |
|---|---|---|---|
| adb9586055 | |||
| 09c737bddf | |||
| 95571e0f05 | |||
| 1f2ff4f1ec |
@@ -52,6 +52,41 @@
|
||||
- **אפס עלות API** — claude CLI משתמש ב-claude.ai subscription של chaim. הנחת היסוד של `claude_session.py` (claude CLI מקומי בלבד) נשמרת.
|
||||
- Coolify dependency: ה-Service Definition של legal-ai חייב להכיל `extra_hosts: host.docker.internal:host-gateway` (אחרת ה-proxy יקבל ConnectError).
|
||||
|
||||
### legal-mcp-http — שרת ה-MCP ב-HTTP (מאוגוסט 2026)
|
||||
- פורט: `127.0.0.1:8790` (loopback בלבד) · קונפיג: [`scripts/legal-mcp-http.config.cjs`](../scripts/legal-mcp-http.config.cjs)
|
||||
- **הדלת של סוכני הפלטפורמה** אל 108 כלי ה-MCP. סשן אינטראקטיבי מגיע לאותו שרת ב-stdio דרך `~/.claude.json` — **אותו קוד, שתי תחבורות** (G2).
|
||||
- שער Bearer (`MCP_HTTP_SHARED_SECRET`); השרת **מסרב לעלות** בלי טוקן. בדיקה: ללא טוקן → `401`, עם טוקן → `200`.
|
||||
- **⚠️ שינוי קוד ב-`mcp-server/` לא נכנס לתוקף עד `pm2 restart legal-mcp-http`.** זה תהליך ארוך-חיים, בניגוד ל-stdio שנטען מחדש בכל סשן. אחרי מיזוג שנוגע ב-`mcp-server/` — להפעיל מחדש, אחרת הסוכנים ירוצו על קוד ישן בשקט.
|
||||
|
||||
> #### ✅ תצורת האחסון והאחזור מיושרת לקונטיינר (2026-08-05)
|
||||
> `STORAGE_BACKEND=s3` ו-`MULTIMODAL_ENABLED=true` — זהים לקונטיינר, כך שמסמך
|
||||
> שסוכן כותב דרך MCP הוא זה שה-web קורא, ושתי הדלתות מדרגות את אותו קורפוס
|
||||
> באותה צורה (G2).
|
||||
>
|
||||
> **הסודות:** `MINIO_ENDPOINT` · `MINIO_ACCESS_KEY` · `MINIO_SECRET_KEY` נוצרו
|
||||
> ב-Infisical תחת `/apps/legal-ai` (tag `credentials`), ונטענים ל-`~/.legal-mcp-http.env`
|
||||
> (chmod 600) — אותו דפוס כמו `MCP_HTTP_SHARED_SECRET`. **רוטציה:** לעדכן
|
||||
> ב-Infisical → למשוך מחדש לקובץ → `pm2 restart legal-mcp-http`.
|
||||
>
|
||||
> **⚠️ מלכודת — `aioboto3` מיובא עצלנית.** מסלול ה-S3 מייבא אותו רק בקריאה
|
||||
> הראשונה, ולכן venv בלי החבילה **עולה בהצלחה** ונשבר רק בפעולת-הקובץ הראשונה
|
||||
> — כשל שקט עד לשימוש. הוא מוצהר ב-`mcp-server/pyproject.toml`, אבל לא היה
|
||||
> מותקן ב-venv המקומי. אחרי כל בנייה מחדש של ה-venv:
|
||||
> `~/legal-ai/mcp-server/.venv/bin/pip install -e ~/legal-ai/mcp-server`.
|
||||
>
|
||||
> **אימות לפני הפעלה** (הרץ מהמארח, לא מהקונטיינר):
|
||||
> ```bash
|
||||
> cd ~/legal-ai/mcp-server && set -a && . ~/.legal-mcp-http.env && set +a
|
||||
> STORAGE_BACKEND=s3 HOME=/home/chaim DOTENV_PATH=/home/chaim/.env \
|
||||
> .venv/bin/python -c "import asyncio;from legal_mcp.services import storage
|
||||
> async def m():
|
||||
> st=storage.get_storage()
|
||||
> print(len(await st.list_keys('', bucket=storage.Bucket.DOCUMENTS)))
|
||||
> asyncio.run(m())"
|
||||
> ```
|
||||
> מצופה: מספר האובייקטים בדלי (היו 2,283 ב-2026-08-05). שגיאת
|
||||
> `ModuleNotFoundError: aioboto3` = ה-venv חסר את התלות.
|
||||
|
||||
---
|
||||
|
||||
## מבנה תיקיות
|
||||
|
||||
@@ -56,6 +56,26 @@ const env = {
|
||||
// transports read exactly the same corpus.
|
||||
DOTENV_PATH: "/home/chaim/.env",
|
||||
DATA_DIR: "/home/chaim/legal-ai/data",
|
||||
// Retrieval flags must match the container's, or the two doors into the same
|
||||
// corpus rank differently (G2 — a parallel path that drifts). The container
|
||||
// runs MULTIMODAL_ENABLED=true; without this the MCP door skipped the
|
||||
// page-image merge entirely, so an agent and the web UI could answer the same
|
||||
// question from different result sets. ~/.env sets neither, so both fell to
|
||||
// the code defaults (false) — the drift was silent.
|
||||
//
|
||||
// Blob storage must match the container too, for the same reason: a document
|
||||
// an agent writes through MCP has to be the one the web reads back. The MinIO
|
||||
// credentials now live in Infisical (/apps/legal-ai) and are loaded from the
|
||||
// runtime file below, exactly like MCP_HTTP_SHARED_SECRET.
|
||||
//
|
||||
// Verified from the host before enabling: put/get/delete round-trip against
|
||||
// https://s3.nautilus.marcusgroup.org, plus a read of an existing production
|
||||
// blob out of 2,283 objects. Note the S3 path imports aioboto3 LAZILY, so a
|
||||
// missing dependency does not fail at boot — it fails on the first blob
|
||||
// operation. It is declared in mcp-server/pyproject.toml; make sure the venv
|
||||
// actually has it (`.venv/bin/pip install -e mcp-server`).
|
||||
STORAGE_BACKEND: "s3",
|
||||
MULTIMODAL_ENABLED: "true",
|
||||
MCP_TRANSPORT: "streamable-http",
|
||||
MCP_HTTP_HOST: "127.0.0.1",
|
||||
MCP_HTTP_PORT: "8790",
|
||||
|
||||
Reference in New Issue
Block a user