Prototype · Preview: every server in the official registry, synced every 30 minutes. Sign in with Google to write reviews.Prototype · updated every 30 min
PopNx MCPMCP servers for people who use AI · explained in plain words Sign in

MCP Local Translate

by damoqiongqiuversion 0.1.11i★ 0iRuns on your computerRepository ↗
Registry nameio.github.damoqiongqiu/mcp-local-translate

How to install

What it does

Local NLLB translation for 200+ languages. Zero cloud, zero cost, runs entirely on your machine.

  • Connects Runs on your computer
  • Account or key No key needed
  • Category Docs, sheets & office work

Use together with

Skills that teach the AI this kind of work; they work alongside this one

MinerU

Transforms complex documents like PDFs and Office docs into LLM-ready markdown/JSON for your Agentic workflows.

by opendatalab★ 83,9721 skills

Skill · How-to guideNo license stated

watermarks-remover

A privacy-first app that strips AI watermarks from content you own.

by guillaumemeyer★ 27,7961 skills

Skill · How-to guide

obsidian-skills

Agent skills for Obsidian. Teach your agent to use Obsidian CLI and open formats including Markdown, Bases, JSON Canvas.

by kepano★ 53,183 (whole repo)5 skills

Skill · How-to guide

Why it ranks here

Lists are ordered by a usage score (out of 100) built from these parts

Popularity0/80GitHub stars or weekly downloads: the larger counts 60, the smaller 20
Freshness3/12Full marks for a release or code change within 30 days
Still answering0/8The cloud endpoint answered at the last check
Usage score3/100

Quality: Passed 3/3 basic checks (shown, not used for ordering) · Momentum: No data yet (Used only on the Trending tab)

Install

Pick the AI app you use, then copy the settings.

Let your AI install it with one sentence

Please install MCP Local Translate. Follow https://mcp.popnx.com/i/damoqiongqiu-mcp-local-translate.md, show me the commands and wait for my OK before running them.

Paste it into an AI that can work on your computer (such as Claude Code or Cursor). It reads our steps, shows you the commands and waits for your OK. No key, no sign-up. · See the full text your AI reads

Passed 3/3 checks · Runs on your computer · ✓ Commands checked Nov 14, 2026

First: which AI do you use?

Pick your app and the steps appear below.

Works with Claude, with some setup first

Install Node.js on your computer first (one time) · Only the Claude desktop app (Windows or Mac), not the web or phone

Let AI install it

Copy this message into a Claude chat. The AI checks your computer, tells you which file it will change, and waits for your OK every time.

Please install the MCP server MCP Local Translate for Claude on this computer, in this order: 1) Check Node.js with node -v. If it is missing, tell me to install it from https://nodejs.org/en/download; do not install it yourself. 2) Use only this config (already checked by PopNx MCP): { "mcpServers": { "local-translate": { "command": "npx", "args": [ "-y", "@damoqiongqiu/mcp-local-translate" ] } } } 3) Tell me the full path of the file you will change, or the command you will run, and wait for my OK. 4) No key is needed. 5) Do what we agreed, then check that the MCP Local Translate tools really show up.

This message has no key in it. If a key is needed, the AI will ask you to paste it yourself into the file or the app’s field.

  1. Install Node.js (if you don’t have it)

    Already installed? Check first · Open Terminal, type this command and press Enter

    node -v
    • A version number such as v26.13.1 = installed, skip this step
    • "command not found" (on Windows: "is not recognized") = not installed yet, or installed but Terminal needs to be closed and reopened
    How to open Terminal

    Mac: press ⌘ + Space, type Terminal, press Enter

    Windows: open Start, type Windows PowerShell, then Open

    Not installed: Open the official download page, pick the LTS version and the click-through installer: .pkg on Mac · .msi on Windows. Double-click and follow it to the end. No curl command needed

    Open the Node.js download page ↗

    When it’s done, close Terminal, open it again and run the same command. You should see a version number: node -v

    Install once; it works for everything that needs Node.js

  2. Open the Claude desktop app’s settings file

    SettingsDeveloperEdit Config

  3. Paste these settings and save the file

    {
      "mcpServers": {
        "local-translate": {
          "command": "npx",
          "args": [
            "-y",
            "@damoqiongqiu/mcp-local-translate"
          ]
        }
      }
    }
  4. Quit Claude and open it again

  5. Try it

    Use MCP Local Translate and tell me what you can do for me, then show me one thing

    ✓ If Claude says it is using MCP Local Translate or shows a MCP Local Translate tool in the answer, you are connected

5 optional setting(s) (works without them)

The command above works without these. Add them only if you want to change something, following the maker’s description.

  • HF_ENDPOINT HuggingFace endpoint override for downloading models (e.g. https://hf-mirror.com for China).
  • HF_AUTO_MIRROR Auto-detect HuggingFace mirror for China. Set to '0' or 'false' to disable.
  • CACHE_DIR Directory where Transformers.js models are cached (defaults to ./models/).
  • TRANSLATE_DEVICE Execution device: 'cpu' (default) or 'webgpu' for GPU acceleration.
  • HTTPS_PROXY Proxy URL for model downloads. Also supports HTTP_PROXY and lowercase variants.

Descriptions are as written by the maker.

Menu names checked against Anthropic’s help page on Nov 11, 2026 · your screen may differ slightly by app version

ChatGPT cannot connect MCP Local Translate yet

MCP Local Translate runs on your computer, but ChatGPT can only connect servers that run on the web

What you can do instead

A · Use an app that can connect MCP Local Translate

  • Install Node.js on your computer first (one time) · Only the Claude desktop app (Windows or Mac), not the web or phone
  • Install Node.js on your computer first (one time)
  • Install Node.js on your computer first (one time)
  • Install Node.js on your computer first (one time)

B · Others in Docs, sheets & office work that work with ChatGPT

Picked from the most used in the same category, only ones that connect by address with no key

Works with Claude Code, with some setup first

Install Node.js on your computer first (one time)

Let AI install it

Copy this message into a Claude Code chat. The AI checks your computer, tells you which file it will change, and waits for your OK every time.

Please install the MCP server MCP Local Translate for Claude Code on this computer, in this order: 1) Check Node.js with node -v. If it is missing, tell me to install it from https://nodejs.org/en/download; do not install it yourself. 2) Use only this config (already checked by PopNx MCP): claude mcp add --scope user local-translate -- npx -y @damoqiongqiu/mcp-local-translate 3) Tell me the full path of the file you will change, or the command you will run, and wait for my OK. 4) No key is needed. 5) Do what we agreed, then check that the MCP Local Translate tools really show up.

This message has no key in it. If a key is needed, the AI will ask you to paste it yourself into the file or the app’s field.

  1. Install Node.js (if you don’t have it)

    Already installed? Check first · Open Terminal, type this command and press Enter

    node -v
    • A version number such as v26.13.1 = installed, skip this step
    • "command not found" (on Windows: "is not recognized") = not installed yet, or installed but Terminal needs to be closed and reopened
    How to open Terminal

    Mac: press ⌘ + Space, type Terminal, press Enter

    Windows: open Start, type Windows PowerShell, then Open

    Not installed: Open the official download page, pick the LTS version and the click-through installer: .pkg on Mac · .msi on Windows. Double-click and follow it to the end. No curl command needed

    Open the Node.js download page ↗

    When it’s done, close Terminal, open it again and run the same command. You should see a version number: node -v

    Install once; it works for everything that needs Node.js

  2. Open Terminal

    Mac: press Command+Space and type Terminal · Windows: open PowerShell

  3. Paste this command and press Enter

    claude mcp add --scope user local-translate -- npx -y @damoqiongqiu/mcp-local-translate
  4. Type /mcp in Claude Code

    You should see MCP Local Translate listed as connected

  5. Try it

    Use MCP Local Translate and tell me what you can do for me, then show me one thing

    ✓ If Claude Code says it is using MCP Local Translate or shows a MCP Local Translate tool in the answer, you are connected

5 optional setting(s) (works without them)

The command above works without these. Add them only if you want to change something, following the maker’s description.

  • HF_ENDPOINT HuggingFace endpoint override for downloading models (e.g. https://hf-mirror.com for China).
  • HF_AUTO_MIRROR Auto-detect HuggingFace mirror for China. Set to '0' or 'false' to disable.
  • CACHE_DIR Directory where Transformers.js models are cached (defaults to ./models/).
  • TRANSLATE_DEVICE Execution device: 'cpu' (default) or 'webgpu' for GPU acceleration.
  • HTTPS_PROXY Proxy URL for model downloads. Also supports HTTP_PROXY and lowercase variants.

Descriptions are as written by the maker.

Menu names checked against Anthropic’s help page on Nov 11, 2026 · your screen may differ slightly by app version

Works with Cursor, with some setup first

Install Node.js on your computer first (one time)

Let AI install it

Copy this message into a Cursor chat. The AI checks your computer, tells you which file it will change, and waits for your OK every time.

Please install the MCP server MCP Local Translate for Cursor on this computer, in this order: 1) Check Node.js with node -v. If it is missing, tell me to install it from https://nodejs.org/en/download; do not install it yourself. 2) Use only this config (already checked by PopNx MCP): { "mcpServers": { "local-translate": { "command": "npx", "args": [ "-y", "@damoqiongqiu/mcp-local-translate" ] } } } 3) Tell me the full path of the file you will change, or the command you will run, and wait for my OK. 4) No key is needed. 5) Do what we agreed, then check that the MCP Local Translate tools really show up.

This message has no key in it. If a key is needed, the AI will ask you to paste it yourself into the file or the app’s field.

  1. Install Node.js (if you don’t have it)

    Already installed? Check first · Open Terminal, type this command and press Enter

    node -v
    • A version number such as v26.13.1 = installed, skip this step
    • "command not found" (on Windows: "is not recognized") = not installed yet, or installed but Terminal needs to be closed and reopened
    How to open Terminal

    Mac: press ⌘ + Space, type Terminal, press Enter

    Windows: open Start, type Windows PowerShell, then Open

    Not installed: Open the official download page, pick the LTS version and the click-through installer: .pkg on Mac · .msi on Windows. Double-click and follow it to the end. No curl command needed

    Open the Node.js download page ↗

    When it’s done, close Terminal, open it again and run the same command. You should see a version number: node -v

    Install once; it works for everything that needs Node.js

  2. Click this button to open Cursor

    Open in Cursor

    Cursor asks you to confirm; click Install

  3. Open the AI chat in Cursor in Agent mode

  4. Try it

    Use MCP Local Translate and tell me what you can do for me, then show me one thing

    ✓ If Cursor says it is using MCP Local Translate or shows a MCP Local Translate tool in the answer, you are connected

5 optional setting(s) (works without them)

The command above works without these. Add them only if you want to change something, following the maker’s description.

  • HF_ENDPOINT HuggingFace endpoint override for downloading models (e.g. https://hf-mirror.com for China).
  • HF_AUTO_MIRROR Auto-detect HuggingFace mirror for China. Set to '0' or 'false' to disable.
  • CACHE_DIR Directory where Transformers.js models are cached (defaults to ./models/).
  • TRANSLATE_DEVICE Execution device: 'cpu' (default) or 'webgpu' for GPU acceleration.
  • HTTPS_PROXY Proxy URL for model downloads. Also supports HTTP_PROXY and lowercase variants.

Descriptions are as written by the maker.

Menu names checked against Cursor’s help page on Nov 11, 2026 · your screen may differ slightly by app version

Works with VS Code, with some setup first

Install Node.js on your computer first (one time)

Let AI install it

Copy this message into a VS Code chat. The AI checks your computer, tells you which file it will change, and waits for your OK every time.

Please install the MCP server MCP Local Translate for VS Code on this computer, in this order: 1) Check Node.js with node -v. If it is missing, tell me to install it from https://nodejs.org/en/download; do not install it yourself. 2) Use only this config (already checked by PopNx MCP): { "servers": { "local-translate": { "type": "stdio", "command": "npx", "args": [ "-y", "@damoqiongqiu/mcp-local-translate" ] } } } 3) Tell me the full path of the file you will change, or the command you will run, and wait for my OK. 4) No key is needed. 5) Do what we agreed, then check that the MCP Local Translate tools really show up.

This message has no key in it. If a key is needed, the AI will ask you to paste it yourself into the file or the app’s field.

  1. Install Node.js (if you don’t have it)

    Already installed? Check first · Open Terminal, type this command and press Enter

    node -v
    • A version number such as v26.13.1 = installed, skip this step
    • "command not found" (on Windows: "is not recognized") = not installed yet, or installed but Terminal needs to be closed and reopened
    How to open Terminal

    Mac: press ⌘ + Space, type Terminal, press Enter

    Windows: open Start, type Windows PowerShell, then Open

    Not installed: Open the official download page, pick the LTS version and the click-through installer: .pkg on Mac · .msi on Windows. Double-click and follow it to the end. No curl command needed

    Open the Node.js download page ↗

    When it’s done, close Terminal, open it again and run the same command. You should see a version number: node -v

    Install once; it works for everything that needs Node.js

  2. Click this button to open VS Code

    Open in VS Code

    VS Code asks you to confirm; click Install

  3. Open the AI chat in VS Code in Agent mode

  4. Try it

    Use MCP Local Translate and tell me what you can do for me, then show me one thing

    ✓ If VS Code says it is using MCP Local Translate or shows a MCP Local Translate tool in the answer, you are connected

5 optional setting(s) (works without them)

The command above works without these. Add them only if you want to change something, following the maker’s description.

  • HF_ENDPOINT HuggingFace endpoint override for downloading models (e.g. https://hf-mirror.com for China).
  • HF_AUTO_MIRROR Auto-detect HuggingFace mirror for China. Set to '0' or 'false' to disable.
  • CACHE_DIR Directory where Transformers.js models are cached (defaults to ./models/).
  • TRANSLATE_DEVICE Execution device: 'cpu' (default) or 'webgpu' for GPU acceleration.
  • HTTPS_PROXY Proxy URL for model downloads. Also supports HTTP_PROXY and lowercase variants.

Descriptions are as written by the maker.

Menu names checked against VS Code’s help page on Nov 11, 2026 · your screen may differ slightly by app version

Other apps that use MCP, such as Windsurf, Zed or Gemini CLI, each add servers differently. See how in the app list.

See every app that uses MCP →

JSON settings are under “For developers” below

Stuck? Ask people who use MCP Local Translate💬 Discussion →
For developers: Terminal commands and JSON settings

Installed on your computer

Claude Code

claude mcp add --scope user local-translate -- npx -y @damoqiongqiu/mcp-local-translate

Claude Desktop (claude_desktop_config.json)

{
  "mcpServers": {
    "local-translate": {
      "command": "npx",
      "args": [
        "-y",
        "@damoqiongqiu/mcp-local-translate"
      ]
    }
  }
}

Cursor (~/.cursor/mcp.json)

{
  "mcpServers": {
    "local-translate": {
      "command": "npx",
      "args": [
        "-y",
        "@damoqiongqiu/mcp-local-translate"
      ]
    }
  }
}

VS Code (mcp.json)

{
  "servers": {
    "local-translate": {
      "type": "stdio",
      "command": "npx",
      "args": [
        "-y",
        "@damoqiongqiu/mcp-local-translate"
      ]
    }
  }
}

Values you fill in

  • HF_ENDPOINT env
    HuggingFace endpoint override for downloading models (e.g. https://hf-mirror.com for China).
  • HF_AUTO_MIRROR env
    Auto-detect HuggingFace mirror for China. Set to '0' or 'false' to disable.
  • CACHE_DIR env
    Directory where Transformers.js models are cached (defaults to ./models/).
  • TRANSLATE_DEVICE env
    Execution device: 'cpu' (default) or 'webgpu' for GPU acceleration.
  • HTTPS_PROXY env
    Proxy URL for model downloads. Also supports HTTP_PROXY and lowercase variants.

Descriptions are as written by the maker.

These settings are generated from the maker’s registry entry. If the README says otherwise, follow the README.

At a glance

Downloads per weeki
82/wk
Connection
Runs on your computer
Latest versioni
0.1.11
Published to registryi
Jul 12, 2026
Code last changedi
Jul 12, 2026
Maker
damoqiongqiu
Packages
npm: @damoqiongqiu/mcp-local-translate
Registry status
Active

Which apps can use it

Based on how this server connects and on each app’s own docs, checked Nov 10, 2026.

Run on your computer in

ClaudeGooseLM StudioMsty StudioCherry StudioCursorVS Code + GitHub CopilotVisual StudioWindsurf (Devin Desktop)ZedKiroClineContinueJetBrains AI AssistantClaude CodeCodex CLIGemini CLIOpenCodenodecodeWarpLibreChatRaycast

All apps, with pros and cons →

Related guides

What it can do

Runs on your computer; the tool list appears in your AI app after you install it.

Basic checksi

We check information anyone can see; we have not read the code. Checks that do not apply are left out of the count. · Checked Nov 20, 2026

  • ✓ Pass

    Maker matches the repo

    The registry name was verified with the GitHub account damoqiongqiu, which owns the repo

  • ✓ Pass

    Still maintained

    Code last changed 4 months ago

  • ✓ Pass

    Has a licence

    Uses MIT

  • – Not applicable

    Endpoint responds

    This one runs on your computer; there is no internet endpoint

  • – Not applicable

    Sign-in with OAuth

    Runs on your computer and uses local settings instead

  • … Not checked yet

    No hidden instructions in tool descriptions

    Runs on your computer; we can only read tool lists from internet endpoints

Published vulnerabilities (OSV.dev)

No entries on OSV.dev for @damoqiongqiu/mcp-local-translate@0.1.11

Checks only this package version, not every dependency · checked Nov 16, 2026

What we check → · JSON

Makers: ask for a re-check or report wrong info
For makers: add a badge to your README

If you made this, paste this code into your README. The badge links back to this page.

[![Featured on PopNx MCP](https://mcp.popnx.com/badge/damoqiongqiu-mcp-local-translate.svg)](https://mcp.popnx.com/en/servers/damoqiongqiu-mcp-local-translate)

Discussion

Ask, share a tip or report that it does not work. Sorted by what people marked helpful.

No posts yet. Be the first to ask or share.

Posts here are written by users, not the PopNx team.

Sign in to post

User reviews

No reviews yet

Sign in to write a review

Compared with others in Docs, sheets & office worki

  • More stars than 0% of the other 4155 servers in this category
  • Published to the registry more recently than 14% of the other 4155 servers in this category
  • Basic checks equal to or better than 99% of the other 4155 servers in this category

Compared with every active server in this category in the registry. Stars count only when the publisher owns the repo.

Common questions

Is MCP Local Translate safe?

It passed 3 of 3 applicable basic checks. We have not read the code. Before adding a key or token, see what access the server asks for and use a key with only the permissions you need.

What keys or codes does it need?

The registry does not list a required key, though some servers ask you to sign in on first use.

Does it run on my computer or in the cloud?

It runs on your computer. Your AI app starts it when needed, and data does not pass through the maker’s servers (unless it calls an online service itself).

Is it still maintained?

The GitHub repo last changed 4 months ago, and the latest version (0.1.11) reached the registry 4 months ago.

Which apps can use it?

Apps that support MCP, such as Claude Desktop, Claude Code, Cursor and VS Code. You also need Node.js on your computer.

What can I use instead?

In the same category: Puter MCP, XcodeBuildMCP, Vexa, Atlassian Rovo MCP Server, Anki MCP Server

Similar alternatives

Same category, other makers, commands already checked. Official ones first, then by stars.

Reading a card:↓ Downloads per weeki★ GitHub starsiThree pillars: reviews · checks · usageiUpdated = latest version published to the registryi

Puter MCP

Puter MCP enables AI tools to interact with Puter: manage files, websites, workers, and more

by HeyPuterWidely used★ 44.2KUpdated 5 months ago

Runs in the cloud✓ service owner · puter.com

XcodeBuildMCP

XcodeBuildMCP provides tools for Xcode project management, simulator management, and app utilities.

by getsentryWidely used↓ 130.5K/wk shared package★ 6.6KUpdated 4 months ago

Runs on your computer✓ service owner · xcodebuildmcp.com

Vexa

Meeting bot and transcripts for Google Meet, Teams and Zoom. Live or after, speakers labelled.

by Vexa-aiWidely used★ 3KUpdated 2 months ago

Runs in the cloud✓ service owner · vexa.ai

Atlassian Rovo MCP Server

Atlassian’s official server lets AI search and manage Jira work and Confluence pages. Connects to Atlassian’s cloud with OAuth sign-in.

by atlassianGrowing★ 1.2KUpdated 2 months ago

Runs in the cloud✓ service owner · atlassian.com

Anki MCP Server

MCP server for Anki flashcards: adaptive review, notes, media, and deck management via AnkiConnect.

by ankimcpGrowing↓ 1.1K/wk★ 570Updated 2 months ago

Runs on your computer✓ service owner · ankimcp.ai
Compared with similar ones
This one
MCP Local Translate
Puter MCPXcodeBuildMCPVexaAtlassian Rovo MCP ServerAnki MCP Server
Runs whereInstalls on your computerRuns in the cloud, nothing to installInstalls on your computerRuns in the cloud, nothing to installRuns in the cloud, nothing to installInstalls on your computer
Needs a keyNoNoNoYesNoNo
Add with + in ClaudeNoNoNoNoYesNo
Basic checks3/34/43/32/44/43/3
LicenseMITAGPL-3.0MITApache-2.0Apache-2.0MIT
PriceNo cost listed in the registryNo cost listed in the registryNo cost listed in the registryNo cost listed in the registryNo cost listed in the registryNo cost listed in the registry

README from the maker

Open the README

Copied from the maker’s repo as written. PopNx MCP has not reviewed or endorsed it. HTML, images and scripts are removed. Links lead off this site.

MCP Local Translate

🍴 Inspired by shinpr/mcp-local-rag — original architecture patterns by Shinsuke Kagawa

AI 编程助手的本地翻译引擎。基于 NLLB-200 模型,支持 200+ 语言互译——完全离线,数据不离开你的机器。为多语言开发、文档阅读、代码注释翻译而生。

📖 English


特性

  • 200+ 语言互译 基于 Meta NLLB-200 蒸馏模型(600M 参数),覆盖全球绝大多数语言——从主流语言到低资源语言。
  • 完全本地运行 无需 API Key,无需云服务。NLLB-200 模型在本地 CPU 上通过 Transformers.js 推理。数据从不离开你的机器。
  • 智能语言解析 支持 FLORES-200 精确码(zho_Hans)、ISO 639-1 简码(zh)、语言名称(Chinese)、中文别名(中文)——自动映射到正确的模型输入。
  • 长文本分块翻译 长文本在句子边界处自动分块(450 字符/块),每块独立翻译后拼接——突破 NLLB 的 512 token 限制。
  • 零摩擦上手 一条 npx 命令搞定。无需 Docker、Python、GPU。可通过 MCP 或 CLI 使用。
  • 三级镜像回退 自动探测 HF → hf-mirror.com → ModelScope 三级镜像链,国内网络环境下自动找到可用的模型下载源。

快速开始

配置 AI 编程工具

Cursor — 添加到 ~/.cursor/mcp.json:

{

"mcpServers": { "local-translate": { "command": "npx", "args": ["-y", "@damoqiongqiu/mcp-local-translate"], "env": { "CACHE_DIR": "/path/to/models" } } } }

Codex — 添加到 ~/.codex/config.toml:

[mcp_servers.local-translate]

command = "npx" args = ["-y", "@damoqiongqiu/mcp-local-translate"]

[mcp_servers.local-translate.env] CACHE_DIR = "/path/to/models"

Claude Code — 运行以下命令:

claude mcp add local-translate --scope user --env CACHE_DIR=/path/to/models -- npx -y @damoqiongqiu/mcp-local-translate

WorkBuddy — 打开「设置 → 自定义连接器 → 添加自定义连接器」:

{

"mcpServers": { "local-translate": { "command": "npx", "args": ["-y", "@damoqiongqiu/mcp-local-translate"], "env": { "CACHE_DIR": "/path/to/models" } } } }

⚠️ 首次添加后,必须在「自定义连接器」列表中点击「信任」按钮,否则 MCP 服务器不会启动。这是 WorkBuddy 的安全机制——未经信任的自定义连接器会被静默阻止。

重启工具后即可使用:

你: "把这段文档翻译成中文"

助手: [返回翻译结果]

你: "This error message is in Japanese — what does it say?" 助手: 那是「データベース接続に失敗しました」—— 数据库连接失败。

你: "列出所有支持的翻译语言" 助手: 共 204 种语言,包括 中文、英语、日语、法语...

也可直接作为 CLI 使用——无需启动 MCP 服务器:

npx @damoqiongqiu/mcp-local-translate translate "Hello, world!" --source en --target zh

npx @damoqiongqiu/mcp-local-translate list-languages --query "chinese"

就这些。无需 Docker,无需 Python,无需配置服务器。


为什么会有这个项目

你的 AI 编程助手可以帮你写代码,但当你面对非母语的文档、注释、错误日志时,仍然需要跳出编程环境去复制粘贴到在线翻译工具。

隐私。 把代码片段或内部文档粘贴到 Google Translate 本质上是数据泄露。这个工具完全在本地运行——没有人能看到你的文本。

离线可用。 配置完成后无需联网即可使用——飞机上、咖啡店无 WiFi、空气间隙环境。

低资源语言。 NLLB-200 覆盖了 Google Translate 和 DeepL 不支持的小语言(如藏语、维吾尔语、高棉语等)。

成本。 无需为翻译 API 付费。只需一次模型下载(~600MB),然后无限使用。


使用方式

mcp-local-translate 提供两种接口:MCP 服务器(供 AI 编程工具使用)和 CLI(供终端直接使用)。

通过 MCP 使用

MCP 服务器提供 2 个工具:translate 和 list_languages。

翻译文本
"把这段 React hooks 文档翻译成中文"

"Translate the error message to English" "这段日语注释是什么意思?"

translate 工具接受:

参数类型说明
textstring待翻译文本
source_langstring源语言代码(auto 自动检测)
target_langstring目标语言代码

语言代码支持三种格式:

  • FLORES-200 精确码:zho_Hans(简体中文)、eng_Latn(英语)、jpn_Jpan(日语)
  • ISO 639-1 简码:zh、en、ja、fr、de
  • 中文别名:中文、英语、日语、韩语
查看支持的语言
"这个翻译引擎支持多少种语言?"

"看看有没有藏语"

使用 list_languages 工具,可选 query 参数进行关键词过滤。

作为 CLI 使用

所有 MCP 工具也可以通过 CLI 命令使用——无需启动 MCP 服务器:

# 翻译文本

npx @damoqiongqiu/mcp-local-translate translate "Hello, world!" --source en --target zh

自动检测源语言

npx @damoqiongqiu/mcp-local-translate translate "Bonjour le monde" --source auto --target en

查看支持的语言

npx @damoqiongqiu/mcp-local-translate list-languages

按关键词过滤

npx @damoqiongqiu/mcp-local-translate list-languages --query "chinese"

⚠️ CLI 不会读取你的 MCP 客户端配置(mcp.json、config.toml 等)。通过命令行标志或环境变量配置 CLI,如下所示。


工作原理

简要:

  • 语言代码通过三级解析器(精确码 → 别名 → 模糊匹配)映射到 FLORES-200 格式
  • 长文本在句子边界处分块(450 字符/块),每块独立翻译
  • 翻译引擎使用 Transformers.js 加载 NLLB-200 蒸馏模型(600M 参数),在本地 ONNX Runtime 上以 CPU 推理
  • 结果按原始顺序拼接,保持段落和换行结构
详细说明

当你调用 translate 时:

  1. 语言解析:输入的语言代码经过三级解析——先尝试精确 FLORES-200 匹配(zho_Hans),再查 ISO 639-1 别名表(zh → zho_Hans),最后查中文别名表(中文 → zho_Hans)。如果全部失败,进行模糊搜索并给出建议。
  1. 文本预处理:超长文本(>450 字符)在句子边界处拆分(正则 /(?<=[.!?。!?\n])\s+/),确保不截断到句子中间。每块加上源语言和目标语言标记。
  1. 模型推理:每块通过 NLLB-200 蒸馏模型(Xenova/nllb-200-distilled-600M)翻译。模型通过懒加载初始化——首次翻译时下载并加载到内存,后续调用复用同一管道。
  1. 结果拼接:翻译结果按原始块顺序拼接,标记之间的段落和换行得以保留。

配置

环境变量

MCP 服务器仅通过环境变量配置——通过 MCP 客户端的 env 块传入。

环境变量默认值描述
CACHE_DIR系统默认模型缓存目录。NLLB-200 模型(~600MB)自动下载到此。建议使用绝对路径。
HF_ENDPOINThttps://huggingface.coHuggingFace 镜像端点。设置后跳过自动镜像检测。
HF_AUTO_MIRRORtrue自动镜像检测开关。设为 false 禁用。默认开启,首次下载前自动探测三级镜像链:huggingface.co → hf-mirror.com → modelscope.cn。
HTTPS_PROXY(未设置)HTTP 代理地址,用于下载模型(如 http://127.0.0.1:7890)。通过 setGlobalDispatcher 全局生效。
TRANSLATE_DEVICEcpu推理设备。直接传给 Transformers.js。目前仅推荐 cpu。

性能

在 MacBook Pro M1(16GB RAM)、Node.js 22 上测试:

首次启动:

  • 模型下载:1-3 分钟(取决于网络,~600MB)
  • 模型加载:~5s

翻译速度:

  • 短文本(<100 字符):<1s
  • 中等文本(500 字符):~3s
  • 长文本(2000 字符):~12s(4 个分块)

内存:空闲 ~300MB,翻译峰值 ~1.2GB

故障排查

模型下载失败

症状:启动日志中出现 fetch failed 或模型加载超时。

原因与排查:

  1. 网络无法直连 HuggingFace — 如果你在中国大陆或受限网络环境中,直连 huggingface.co 会超时。

首选方案:不用配置 — mcp-local-translate 默认自动探测三级镜像链:huggingface.co → hf-mirror.com → modelscope.cn,逐级回退直到找到可用镜像。

备选方案:配置代理:

   "env": {

"HTTPS_PROXY": "http://127.0.0.1:7890" }

手动指定镜像:

   "env": {

"HF_ENDPOINT": "https://hf-mirror.com" }

  1. 模型文件未写入 `CACHE_DIR` — 首次运行时会下载约 600MB 的 ONNX 模型。确认 CACHE_DIR 目录存在且包含 Xenova/nllb-200-distilled-600M/ 子目录。如果之前用不同的 CACHE_DIR 下载过模型,更新路径指向已有缓存即可避免重复下载。
  1. npx 缓存了旧版本 — 清除缓存后重启:
   rm -rf ~/.npm/_npx/
"无效的语言代码"

运行 list_languages 查看所有支持的语言及其代码。语言代码是 FLORES-200 格式(如 zho_Hans、eng_Latn),也可以使用 ISO 639-1 简码(如 zh、en)或中文别名(如 中文、英语)。

翻译速度慢

NLLB-200 在 CPU 上运行,翻译速度取决于你的硬件。长文本会被自动分块处理,每块约 2-3 秒。

常见问题

这真的私密吗? 是的。在模型下载之后,没有任何数据离开你的机器。可用网络监控验证。

可以离线使用吗? 可以,只要 NLLB-200 模型已缓存到本地。

与 Google Translate / DeepL 相比如何? 云端服务翻译质量更高(更大模型、更多训练数据),但需要将数据发送到外部。这个工具用一些质量换取完全隐私和零成本。

支持哪些语言? NLLB-200 支持 200+ 种语言。运行 list_languages 查看完整列表。

支持方言吗? NLLB-200 覆盖部分方言变体(如巴西葡萄牙语 por_Latn、拉美西班牙语等),但不像主流语言那样广泛。具体取决于模型训练数据。

翻译质量怎么样? 对主流语言对(英↔中、英↔法、英↔西等),600M 蒸馏模型提供不错的翻译质量。对低资源语言,质量会下降——可读但不保证优雅。

多用户支持? 不支持。专为单用户本地访问设计。

开发

从源码构建
git clone https://github.com/damoqiongqiu/mcp-local-translate.git

cd mcp-local-translate pnpm install

代码质量
pnpm run type-check    # TypeScript 检查

pnpm run check:fix # Lint 和格式化 pnpm run build # 编译

项目结构
src/

index.ts # 入口点 — 路由到 CLI 或 MCP 服务器 server-main.ts # MCP 服务器启动 server/ index.ts # MCP 工具处理器(translate、list_languages) types.ts # MCP 工具定义 translator/ index.ts # 核心翻译引擎(NLLB-200 管道、分块、懒加载) connectivity.ts # 镜像检测与代理配置 language-codes.ts # FLORES-200 语言代码与解析器 utils/ # 共享工具 skills/ # 随包发布的 Agent Skills


Agent Skills

Agent Skills 提供优化的提示词,帮助 AI 助手更有效地使用翻译工具:

# Claude Code(项目级别)

npx @damoqiongqiu/mcp-local-translate skills install --claude-code

Claude Code(用户级别)

npx @damoqiongqiu/mcp-local-translate skills install --claude-code --global

Codex

npx @damoqiongqiu/mcp-local-translate skills install --codex

Skills 包括:

  • 语言代码使用:FLORES-200、ISO 639-1、中文别名的映射规则
  • 长文本翻译:自动分块策略和结果解读
  • 国内网络配置:镜像设置和代理配置

贡献

欢迎贡献!参见 CONTRIBUTING.md 了解环境搭建和指南。

许可证

MIT License。免费用于个人和商业用途。

致谢

架构模式参考 mcp-local-rag by Shinsuke Kagawa。使用 Model Context Protocol by Anthropic 和 Transformers.js 构建。翻译模型:NLLB-200 by Meta AI。