Christian Gick e356cd93b5 fix(llm): use text-embedding-3-small with dimensions=1024 to match TM column
LiteLLM doesn't expose mxbai-embed-large; text-embedding-3-small with the
`dimensions` param produces 1024-dim vectors that fit translation_memory.embedding.

Refs: CF-3125
2026-04-14 16:33:57 +03:00

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.

Description
Per-tenant translation MCP (CF-3122)
Readme 39 KiB
Languages
JavaScript 71.5%
PLpgSQL 27.7%
Dockerfile 0.8%