|
| 1 | +# Groupem |
| 2 | + |
| 3 | +Cross-browser tab grouping extension with secure MCP server and optional ML microservice. |
| 4 | + |
| 5 | +## Components |
| 6 | +- Extension (Chrome/Firefox) in `extension/` |
| 7 | +- MCP Server (Node/TypeScript + Prisma + SQLite) in `mcp-server/` |
| 8 | +- ML Service (FastAPI) in `ml-service/` |
| 9 | +- Shared models in `shared/` |
| 10 | + |
| 11 | +## Quick Start (PowerShell) |
| 12 | +```powershell |
| 13 | +# Install root deps |
| 14 | +npm install |
| 15 | +
|
| 16 | +# Generate Prisma client |
| 17 | +setx DATABASE_URL "file:./dev.db" |
| 18 | +cd mcp-server; npx prisma generate; cd .. |
| 19 | +
|
| 20 | +# Run server (port 8080 default; will auto-increment if busy) |
| 21 | +# Optionally set explicit port |
| 22 | +$env:PORT=8080; npm run dev:mcp |
| 23 | +
|
| 24 | +# Run extension build (dev) |
| 25 | +cd extension; npm run dev |
| 26 | +``` |
| 27 | + |
| 28 | +## ML Service |
| 29 | +```powershell |
| 30 | +cd ml-service |
| 31 | +python -m venv .venv |
| 32 | +. .venv/Scripts/Activate.ps1 |
| 33 | +pip install -r requirements.txt |
| 34 | +uvicorn app.main:app --reload --port 8000 |
| 35 | +
|
| 36 | +### Health |
| 37 | +MCP server exposes `GET /ml/health` reflecting reachability of `ML_URL` (default `http://localhost:8000`). |
| 38 | +Set a custom ML URL: |
| 39 | +```powershell |
| 40 | +$env:ML_URL="http://localhost:9000"; npm run dev:mcp |
| 41 | +``` |
| 42 | +If unreachable, embeddings in extension fall back to: |
| 43 | +1. (Future) Local ONNX model (placeholder) |
| 44 | +2. Server-side TF-IDF stub |
| 45 | +Check server logs for: `ML service unreachable at ...`. |
| 46 | + |
| 47 | +### Ports |
| 48 | +Server attempts desired `$env:PORT` (default 8080) then increments up to 10 times if occupied. |
| 49 | +Use `/` root route for basic health and `/ml/health` for ML status. |
| 50 | + |
| 51 | +## Environment Variables |
| 52 | +See `.env.example` for documented defaults: |
| 53 | +- `PORT` – MCP server port (auto-increment fallback) |
| 54 | +- `JWT_SECRET` – Signing key (change for production) |
| 55 | +- `DATABASE_URL` – Prisma SQLite path |
| 56 | +- `ML_URL` – Base URL for ML microservice |
| 57 | + |
| 58 | +## CI |
| 59 | +GitHub Actions workflow (`.github/workflows/ci.yml`) installs dependencies, builds all packages, runs tests, and executes a Chromium Playwright project (soft-fail for E2E). |
| 60 | + |
| 61 | +## Contributing |
| 62 | +See `CONTRIBUTING.md` for guidelines, scripts, and commit style. |
| 63 | + |
| 64 | +## Release Checklist |
| 65 | +- Update version numbers (extension + server) if public release. |
| 66 | +- Run `npm run build` and `npm test`. |
| 67 | +- Tag release: `git tag -a vX.Y.Z -m "Release vX.Y.Z"; git push --tags`. |
| 68 | +- Upload packaged extension (zip `extension/dist`). |
| 69 | +``` |
| 70 | +
|
| 71 | +## Tests |
| 72 | +```powershell |
| 73 | +# (After installing deps) build shared & server |
| 74 | +npm -w shared run build |
| 75 | +npm -w mcp-server run build |
| 76 | +npm test |
| 77 | +``` |
| 78 | + |
| 79 | +## Security Notes |
| 80 | +- Argon2id used for password hashing. |
| 81 | +- AES-GCM encryption of sessions and storage with per-user random key unwrapped at login (kept in-memory only). |
| 82 | +- TOTP enrollment and verification endpoints provided. |
| 83 | +- Simplified WebAuthn (mock) endpoints included; not production secure. |
| 84 | +- Registration now supports optional `phone` and automatic TOTP secret provisioning (returned in `totpSecret`). Store it in an authenticator app to use during login. |
| 85 | + |
| 86 | +## Embeddings |
| 87 | +Current implementation uses a simple TF-IDF style embedding in the server; ML service provides higher quality embeddings & clustering if integrated via future enhancement. |
| 88 | + |
| 89 | +## Disclaimer |
| 90 | +This repository is a functional baseline but additional hardening, full WebAuthn ceremony, and production deployment considerations (HTTPS, key management) are required before production use. |
0 commit comments