MCP server for page-level i18n translation using Alibaba Cloud Qwen models, supporting incremental translation, glossary, and multiple target languages.
SaferSkills independently audited mcp-i18n (MCP Server) and scored it 100/100 (green). The audit ran 55 deterministic rules across Security, Supply Chain, Maintenance, Transparency, and Community; it found 0 high-severity and 0 lower-severity findings. The full rule-by-rule trace and per-finding evidence are below. Free, methodology-open.
Findings & checks · 0 flagged
Every scanned point with the score it earned and what moved between them.
First recorded scan — no prior version to compare against.
The primary manifest — the file an agent reads to learn what this artifact does.
基于 MCP (Model Context Protocol) 的页面级 i18n 翻译服务,使用阿里云百炼 Qwen 模型进行翻译。
export default {})npm install
npm run build访问 阿里云百炼控制台 创建 API Key。
cp .env.example .env
# 编辑 .env 文件,填入 DASHSCOPE_API_KEY编辑配置文件:
~/Library/Application Support/Claude/claude_desktop_config.json%APPDATA%/Claude/claude_desktop_config.json{
"mcpServers": {
"i18n-translator": {
"command": "node",
"args": ["/path/to/mcp-i18n/dist/index.js"],
"env": {
"DASHSCOPE_API_KEY": "sk-your-api-key"
}
}
}
}在 Claude 对话中说:
i18n翻译mockupA页面,basePath是/packages/web/src/locale源文件位置:
{basePath}/{pageName}/en-US/
├── index.ts
└── other.ts生成的翻译文件:
{basePath}/{pageName}/
├── en-US/
│ └── index.ts # 源文件
├── zh-CN/
│ └── index.ts # 中文翻译
├── ja-JP/
│ └── index.ts # 日语翻译
├── fr-FR/
│ └── index.ts # 法语翻译
└── de-DE/
└── index.ts # 德语翻译源文件必须使用 export default 导出对象:
// en-US/index.ts
export default {
title: "Welcome to Pacdora",
description: "Create your custom packaging",
buttons: {
save: "Save",
cancel: "Cancel"
}
};生成的翻译文件:
// zh-CN/index.ts
export default {
title: "欢迎使用 Pacdora",
description: "创建您的定制包装",
buttons: {
save: "保存",
cancel: "取消"
}
};| 参数 | 必填 | 默认值 | 说明 |
|---|---|---|---|
pageName | 是 | - | 页面名称,如 mockupA |
basePath | 是 | - | locale 目录的基础路径 |
sourceLocale | 否 | en-US | 源语言代码 |
targetLocales | 否 | ["zh-CN", "ja-JP", "fr-FR", "de-DE"] | 目标语言列表 |
model | 否 | qwen-turbo | Qwen 模型 |
incremental | 否 | true | 是否增量翻译 |
内置术语表确保专业术语翻译一致:
| 术语 | zh-CN | ja-JP | fr-FR | de-DE |
|---|---|---|---|---|
| Pacdora | Pacdora | Pacdora | Pacdora | Pacdora |
| Dieline | 刀板 | テンプレート | Gabarit | Stanzlinie |
修改 src/glossary.ts 可自定义术语表。
| 模型 | 特点 |
|---|---|
qwen-turbo | 平衡性能和成本(默认) |
qwen-plus | 更高质量 |
qwen-max | 最高质量 |
qwen-flash | 极速响应 |
mcp-i18n/
├── src/
│ ├── index.ts # MCP 服务器入口
│ ├── scanner.ts # 目录扫描和 TS 文件解析
│ ├── translator.ts # Qwen API 翻译引擎
│ ├── generator.ts # 翻译文件生成器
│ └── glossary.ts # 术语表
├── dist/ # 编译输出
└── package.jsonnpm run dev # 监听模式编译
npm run build # 编译
npm start # 运行服务MIT
~30 seconds. Free. No account. Every finding cites a rule and a line of evidence.