Skip to main content
Glama

mc-translator-mcp

Minecraft mod Chinese-translation MCP tool

Automatically extracts language files from mod jars, calls 通义千问 for batch translation, and generates Chinese resource packs.

Installation

cd mc-translator-mcp
pip install -e .

Related MCP server: NetEase ModSDK MCP Server

Configuration

Copy .env.example to .env and fill in your 通义千问 API Key:

cp .env.example .env
# 编辑 .env,填入 DASHSCOPE_API_KEY

API Key application: 阿里云百炼控制台

How to start

python -m mc_translator_mcp

Configure the MCP server in Trae/Claude Desktop:

{
  "mcpServers": {
    "mc-translator-mcp": {
      "command": "python",
      "args": ["-m", "mc_translator_mcp"]
    }
  }
}

CLI mode

# 检查 jar 语言文件
python -m mc_translator_mcp check <jar_path>

# 翻译单个 jar
python -m mc_translator_mcp mod <jar_path> [--batch-size 15] [--force-retranslate]

# 批量翻译目录下所有 jar
python -m mc_translator_mcp dir <directory> [--glob "*.jar"] [--batch-size 15]

Usage examples

Using the MCP tools in Trae conversations

Tell Trae directly:

"Help me translate this mod: /path/to/mymod.jar"

Trae will automatically call translate_mod or translate_all_mods_in_directory from the MCP tools.

Running locally

# 翻译单个模组
python -m mc_translator_mcp mod "C:/Users/kjds/Desktop/mods/myzombie.jar" --batch-size 20

# 批量翻译整个 mods 目录
python -m mc_translator_mcp dir "C:/Users/kjds/Desktop/.minecraft/mods" --glob "*.jar"

Output

Outputs to the output/ directory by default, and generates an independent resource pack for each mod:

output/
├── mymod-zh-cn/
│   ├── pack.mcmeta
│   └── assets/mymod/lang/zh_cn.json
├── zombie_mod-zh-cn/
│   ├── pack.mcmeta
│   └── assets/zombie_mod/lang/zh_cn.json
└── ...

To load it: copy the output/<modid>-zh-cn/ folder into Minecraft's resourcepacks/ directory.

Core modules

Module

Function

jar_parser.py

Parses the jar structure and discovers language files

lang_parser.py

Parses language files in .json / .lang format

translator.py

Batch translation with 通义千问 + local cache

pack_builder.py

Generates a resource pack or rewrites the jar

mcp_server.py

MCP server entry point, exposes two tools

Testing

python -m pytest tests/ -v

Design highlights

  1. Resource pack first: Generates an independent resource pack by default without modifying the original jar file.

  2. Smart caching: Entries with the same source text + modid are only translated once, avoiding duplicate token usage.

  3. Skip existing Chinese translations: Automatically skips when an existing zh_cn.json is detected, avoiding overwriting community translations.

  4. Batch translation: Translates up to BATCH_SIZE entries per batch, with a single API call returning all results.

  5. Format compatibility: Supports both .json (modern) and .lang (legacy) language file formats.

Available Tools

4 tools
dry_run_modA

预览翻译效果:解析单个模组并抽样翻译一小部分,不写入任何文件。

注意:本工具会调用 AI 翻译 API 并消耗少量 token(最多 limit 条样例), 只用来快速感受翻译质量,不会生成资源包、不改动原 jar。

Args: jar_path: 模组 jar 文件的绝对路径 limit: 最多预览(抽样翻译)的条目总数(默认 20) batch_size: 每批翻译的词条数(默认 15) Returns: 预览 JSON,含原文-译文对照样例

Inputs: jar_path (required), limit, batch_size. Returns: result

preview_modA

(零成本)预览单个模组的汉化范围:列出每个语言文件、条目数与预估 token。

只做 jar 扫描与文本解析,不调用任何 AI 翻译 API、不消耗 token、不写任何文件, 用于在真正翻译前评估工作量与费用。

Args: jar_path: 模组 jar 文件的绝对路径 Returns: 预览摘要 JSON(含每个 modid 的格式、条目数、是否已有 zh_cn、社区估算 token)

Inputs: jar_path (required). Returns: result

translate_all_mods_in_directoryB

批量翻译目录下所有模组 jar 包。

Args: directory: 包含模组 jar 的目录路径 glob_pattern: jar 文件匹配模式(默认 *.jar) batch_size: 每批翻译的词条数 force_retranslate: 强制重新翻译 Returns: 批量翻译汇总

Inputs: directory (required), batch_size, glob_pattern, force_retranslate. Returns: result

translate_modA

翻译单个 Minecraft 模组 jar 包,生成中文资源包。

Args: jar_path: 模组 jar 文件的绝对路径(如 C:...\mymod-1.2.0.jar) batch_size: 每批翻译的词条数(默认 15,越大越快但单次请求更长) force_retranslate: 强制重新翻译(忽略缓存,慎用) Returns: 翻译结果摘要(包含每个模组的输出路径)

Inputs: jar_path (required), batch_size, force_retranslate. Returns: result

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    A3.7/5.0

    Scored across 4 tools

    Disambiguation4/5

    preview_mod and dry_run_mod both preview a single mod, but one is a zero-cost scope review and the other samples actual AI translations, so the cost/AI distinction prevents most confusion. translate_mod and translate_all_mods_in_directory are clearly distinguished by single vs batch scope.

    Naming Consistency4/5

    All tool names use snake_case and follow an action_mod pattern, which is mostly consistent. The only minor deviation is dry_run_mod, which uses a compound action phrase rather than a simple verb_noun, and translate_all_mods_in_directory is noticeably longer than the others.

    Tool Count5/5

    Four tools are well-scoped for a Minecraft mod translation workflow: preview scope, preview quality, translate one, and translate many. No tool feels redundant, and the count matches the domain without being thin or bloated.

    Completeness4/5

    The surface covers the core translation lifecycle from cost estimation and sampled preview through single-mod and batch translation. Minor gaps remain around explicit output/language configuration or result validation, but agents can work around these.

    Related MCP Connectors

    Related MCP Servers