TranslateGemma MCP Server

TranslateGemma MCP Server

Enables on-device text translation via a local TranslateGemma LLM API, supporting multiple language pairs with automatic retries and rate limiting for privacy and low latency.

Category
Visit Server

README

🌐 TranslateGemma MCP Server

A Model Context Protocol (MCP) server that provides high-quality text translation via the local TranslateGemma LLM API. Designed for low-latency, private, and secure on-device translation with full control over the underlying model.

✨ Features

  • Local Translation Inference: Leverages TranslateGemma (or compatible OpenAI-like API) on your machine — no external data leaves your device.
  • Multi-Language Support: Translate between any language pairs using standardized BCP-47 codes (en, de-DE, fr-FR, ja-JP, etc.).
  • Automatic Retries & Rate Limiting: Built-in exponential backoff and 30 req/min rate limiting for stability.
  • Robust Error Handling: Graceful failures with clear, actionable error messages.
  • Browser/Client Friendly: CORS-enabled HTTP endpoint for direct integration.
  • LLM-Ready Output: Clean, structured responses optimized for tool-use workflows.

🛠️ Requirements

  • Python 3.9+
  • fastmcp, uvicorn, httpx, and starlette
  • A local TranslateGemma-compatible server (e.g., running via ollama, vllm, or custom server) exposing an OpenAI /v1/chat/completions endpoint.
pip install fastmcp uvicorn httpx starlette

🚀 Installation & Usage

1. Clone & Prepare

git clone https://github.com/your-username/translategemma-mcp-server.git
cd translategemma-mcp-server

2. Start TranslateGemma Backend

Ensure your TranslateGemma API is accessible at http://127.0.0.1:8080/v1/chat/completions (or configure via --api-url).

llama-server -ngl 99 -m translategemma-27b-it.Q6_K.gguf -c 8000 --no-jinja

3. Launch the MCP Server

python3 server.py --host 0.0.0.0 --port 3000

Or override the API endpoint:

python3 server.py --api-url http://192.168.1.100:8000/v1/chat/completions

The server exposes an MCP-compatible HTTP endpoint at http://localhost:3000/mcp.


🧰 Available Tools

translate

Translates text using TranslateGemma with intelligent language handling.

async def translate(
    text: str,
    source_lang_code: str,
    target_lang_code: str,
    ctx: Context,
    max_retries: int = 2,
) -> str

Parameters

Name Type Description
text str Required. The text to translate (up to ~2k chars recommended).
source_lang_code str Required. Source language code (e.g., "en", "auto", "zh-Hans").
target_lang_code str Required. Target language code (e.g., "de-DE", "fr-FR", "ja-JP").
ctx Context MCP context (auto-injected). Used for logging.
max_retries int Retry attempts on transient failures (default: 2).

Returns

  • ✅ Translated text (clean, trimmed)
  • ❌ Error message (prefixed with / ⚠️) on failure

⚙️ Configuration

CLI Flag Environment Default Description
--host HOST 127.0.0.1 Server host (use 0.0.0.0 for external access)
--port PORT 3000 Server port
--api-url API_URL http://127.0.0.1:8080/v1/chat/completions TranslateGemma API endpoint

🔒 Security & Privacy

  • All translation is performed locally on your machine.
  • No telemetry, external tracking, or data collection.
  • CORS configured permissively (*) for local dev — restrict origins in production.

📄 License

MIT License — see LICENSE for details.


Recommended Servers

playwright-mcp

playwright-mcp

A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.

Official
Featured
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.

Official
Featured
Local
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.

Official
Featured
Local
TypeScript
VeyraX MCP

VeyraX MCP

Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.

Official
Featured
Local
graphlit-mcp-server

graphlit-mcp-server

The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.

Official
Featured
TypeScript
Kagi MCP Server

Kagi MCP Server

An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.

Official
Featured
Python
E2B

E2B

Using MCP to run code via e2b.

Official
Featured
Neon Database

Neon Database

MCP server for interacting with Neon Management API and databases

Official
Featured
Exa Search

Exa Search

A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.

Official
Featured
Qdrant Server

Qdrant Server

This repository is an example of how to create a MCP server for Qdrant, a vector search engine.

Official
Featured