feat(translate-mcp): scaffold per-tenant translation MCP (CF-3122)
Node.js MCP server exposing translate/search_tm/upsert_glossary/record_correction over StreamableHTTP on :9222. Routes translation calls to gemini-2.5-flash via LiteLLM, augmented with per-tenant TM + glossary + tone profile from the SmartTranslate pgvector DB. Schema migration in sql/001_schema.sql already applied to smarttranslate DB. Fleet registration in Infrastructure/litellm/config.yaml. Refs: CF-3122 CF-3123 CF-3124 CF-3125
This commit is contained in:
46
README.md
Normal file
46
README.md
Normal file
@@ -0,0 +1,46 @@
|
||||
# translate-mcp
|
||||
|
||||
Per-tenant translation MCP. Routes translations to `gemini-2.5-flash` via LiteLLM,
|
||||
augmented with per-tenant translation memory, glossary, and tone profile stored in
|
||||
the shared SmartTranslate Postgres (pgvector).
|
||||
|
||||
- Epic: **CF-3122**
|
||||
- Scaffold: CF-3123 (this repo)
|
||||
- Schema migration: CF-3124 (see `sql/001_schema.sql`)
|
||||
- Gateway registration: CF-3125
|
||||
- Claude routing (CLAUDE.md + PreToolUse hook): CF-3126
|
||||
- Tenant profile seeding from memory: CF-3127
|
||||
|
||||
## Tools
|
||||
|
||||
| Tool | Purpose |
|
||||
|---|---|
|
||||
| `translate(text, tenant, target_lang, source_lang?)` | Main translation call; uses TM + glossary + tone. |
|
||||
| `search_tm(query, tenant, target_lang, ...)` | Vector TM lookup. |
|
||||
| `upsert_glossary(...)` | Manage per-tenant glossary. |
|
||||
| `record_correction(tm_id, corrected_target, tenant)` | Human-in-the-loop correction. |
|
||||
| `list_tenants()` / `get_tenant_profile(tenant)` | Inspect profiles. |
|
||||
|
||||
## Environment
|
||||
|
||||
```
|
||||
TRANSLATE_DB_DSN=postgresql://translate_mcp_rw:***@postgres.agiliton.internal:5432/smarttranslate
|
||||
LITELLM_URL=http://llm:4000
|
||||
LITELLM_API_KEY=sk-litellm-master-key
|
||||
TRANSLATE_MODEL=gemini-2.5-flash # override for cost tests
|
||||
TRANSLATE_EMBED_MODEL=mxbai-embed-large
|
||||
SENTRY_DSN=... # optional
|
||||
```
|
||||
|
||||
## Run locally (dev)
|
||||
|
||||
```
|
||||
uv pip install -e .
|
||||
export TRANSLATE_DB_DSN=postgresql://...
|
||||
python -m src.server
|
||||
```
|
||||
|
||||
## Deploy
|
||||
|
||||
Via LiteLLM MCP gateway: add block in `Infrastructure/litellm/config.yaml`
|
||||
(see CF-3125) and `agiliton-deploy litellm`.
|
||||
Reference in New Issue
Block a user