Lara Translate MCP Server for Contextual Translations
Enable contextual, accurate translations with the Lara Translate MCP server, featuring language detection, translation memories, and glossary management.
npx -y @translated/lara-mcpOverview
Lara Translate MCP Server is a Model Context Protocol (MCP) adapter that exposes Lara Translate’s translation functionality to MCP-compatible AI applications. It acts as a bridge between LLMs or other MCP-aware tools and Lara Translate’s API, enabling contextual, glossary-aware translations, language detection, and reuse of translation memories without embedding API credentials in the consuming application.
By running this MCP server alongside an LLM or other AI client, you enable tool discovery and tool invocation through the MCP standard. The server receives structured requests (translate, detect language, list glossaries, etc.), forwards them securely to the Lara Translate API, and returns structured results that the AI application can incorporate into its responses.
Features
- Exposes Lara Translate capabilities over MCP:
- Context-aware machine translation
- Language detection
- Glossary management and application
- Translation memory (TM) lookups and suggestions
- Two hosting modes:
- HTTP-based MCP connection for networked clients
- STDIO mode for embedding directly in LLM runtimes that speak MCP over stdin/stdout
- Keeps Lara Translate credentials local to the server; clients call MCP tools instead of the Lara API directly
- Configurable translation options: source/target languages, context, glossary and TM usage, and custom instructions
- Docker image and npm package for easy deployment
GitHub: https://github.com/translated/lara-mcp
Installation / Configuration
Install via npm (local or global):
# install as a dependency
# run with npx (if the package exposes a CLI)
Run with Docker (recommended for isolated deployments):
# HTTP mode: expose a port so MCP-aware clients can connect over HTTP
# STDIO mode: useful when launching the MCP server as a subprocess for an LLM runtime
Environment variables (common):
- LARA_API_KEY — required. Your Lara Translate API key.
- LOG_LEVEL — optional. e.g., info, debug, warn.
- PORT / HTTP_PORT — optional. Port to bind for HTTP MCP mode (defaults depend on the build).
Configuration tips:
- Keep LARA_API_KEY scoped and rotated regularly.
- Use network policies and container runtime secrets to protect credentials.
- For production, pair the container with TLS termination or run behind a secure proxy.
Verification:
- Check container logs to confirm startup and tool registration:
- For STDIO mode, the server will advertise available tools on standard output per the MCP protocol.
Available Tools / Resources
The MCP server exposes a set of translation-related tools. Typical tools include:
- translate
- Input: array of text blocks [{ text, translatable }], target (e.g., “it-IT”), optional source, context, instructions, glossaries, translation memory usage
- Output: translated segments, confidence, applied glossary/TM metadata
- detect-language
- Input: text
- Output: detected language code and confidence
- list-glossaries / get-glossary / create-glossary
- Manage glossaries to enforce terminology during translation
- list-translation-memories / apply-translation-memory
- Query and reuse previously approved translations for consistency
Example parameter matrix for the translate tool:
| Parameter | Type | Description |
|---|---|---|
| text | array | Text blocks to be translated; each block can be flagged translatable |
| source | string | Optional source language hint (e.g., en-EN) |
| target | string | Target language code (required) |
| context | string | Optional extra context to improve quality |
| instructions | string[] | Fine-tune translation behaviour (tone, formality) |
| glossaries | array | References to glossaries to apply during translation |
| source_hint | string | Short hint to assist language detection |
Use Cases
- Translating UI strings with terminology enforcement
- Upload product UI strings as text blocks, attach a glossary for product names, and call the translate tool to produce consistent localized resources.
- Pre-processing user input for a multilingual chatbot
- Detect the user’s language with detect-language, invoke translate to a bridged language for the LLM, and translate the response back to the user’s language.
- LLM-assisted content generation with domain-specific terminology
- Let the LLM call the Lara Translate MCP server for professional-grade translations of generated content, or to apply translation memories and glossaries for domain correctness.
- Batch localization pipelines
- Integrate the MCP server into CI pipelines to automatically translate new content, using translation memories to keep consistency