the-i18n-mcp
MCP server for managing i18n translation files — gives your AI agent full control over your app's translations without dumping entire locale files into context.
README
the-i18n-kit
Translation file management for developers and AI agents. Find missing keys, remove dead ones, rename across all locales at once — from the terminal or from inside your AI coding session.
The Problem
Managing i18n at scale is tedious:
- You add a new UI component and need to create the translation key in every locale file — manually
- Over time, removed components leave behind hundreds of orphan keys nobody uses
- You rename a key and have to hunt it down across 30+ JSON files
- Your AI agent writes
$t('some.key')and has no idea where the locale files live or what already exists translate_missingreturns 50KB of JSON that floods your agent's context window
The-i18n-kit solves all of this.
How It Works
The-i18n-kit auto-detects your project structure (Nuxt, Laravel, or any generic setup), then gives you two interfaces:
A CLI for direct use in the terminal:
the-i18n-cli missing # what's not translated yet?
the-i18n-cli orphans # what keys are dead code?
the-i18n-cli rename old.key new.key # rename across all locales at once
the-i18n-cli translate-key --layer root --key common.save --sourceLocale en-US --sourceValue "Save" # update one key and translate targets
the-i18n-cli cleanup # remove orphan keys (dry-run by default)
An MCP server that plugs into AI coding agents (Cursor, Claude, VS Code, Zed). Your agent can read, write, and maintain translation files as part of its normal workflow — with your glossary, tone notes, and layer rules loaded as context so translations stay consistent.
Agent adds $t('booking.confirm.title')
→ calls add_translations (writes exact values the agent provides)
→ calls translate_missing (fills remaining locales via MCP sampling)
Done. All 28 locales updated, consistent terminology, no manual work.
Agent changes wording for an existing key
→ calls translate_key with the source locale/value
→ MCP sampling refreshes target locales, including stale existing values when overwrite=true
Packages
| Package | Version | Description |
|---|---|---|
| the-i18n-cli | CLI + core library — install globally | |
| the-i18n-mcp | MCP server for AI agents |
Quick Start
CLI
npm install -g the-i18n-cli
the-i18n-cli detect # verify project is auto-detected
the-i18n-cli missing # find missing translations
the-i18n-cli orphans # find unused translation keys
the-i18n-cli search --query "save" # search keys and values
the-i18n-cli cleanup # remove orphan keys (dry-run by default)
MCP Server
Add to your MCP host (VS Code, Cursor, Claude Desktop, Zed):
{
"servers": {
"the-i18n-mcp": {
"type": "stdio",
"command": "npx",
"args": ["the-i18n-mcp@latest"]
}
}
}
Supported Frameworks
| Framework | Locale Format | Auto-Detection |
|---|---|---|
| Nuxt (v3+) | JSON | nuxt.config.ts with @nuxtjs/i18n |
| Laravel (9+) | PHP arrays | artisan, composer.json, lang/ |
| Generic | JSON or PHP | localeDirs + defaultLocale in .i18n-mcp.json |
Using with Any Framework (Generic Adapter)
For projects that aren't Nuxt or Laravel, create a .i18n-mcp.json at your project root:
{
"defaultLocale": "en",
"localeDirs": ["src/locales"],
"locales": ["en", "de", "fr", "es"]
}
All tools work immediately.
| Field | Required | Description |
|---|---|---|
defaultLocale |
✅ | Your reference locale — the source of truth for key completeness |
localeDirs |
✅ | Paths to locale directories (relative to project root) |
locales |
❌ | Explicit locale codes. If omitted, auto-discovered from filenames |
localeDirs supports both flat and layered setups:
// Flat: all locale files in one directory
"localeDirs": ["src/i18n"]
// Layered: multiple directories with named layers
"localeDirs": [
{ "path": "src/i18n/common", "layer": "common" },
{ "path": "src/i18n/dashboard", "layer": "dashboard" }
]
💡 Tip: Let your AI agent generate this config. Ask it to inspect your locale file layout and create the
.i18n-mcp.json— takes seconds.
Project Config
Drop a .i18n-mcp.json at your project root to give agents (and the CLI) project context:
{
"$schema": "node_modules/the-i18n-mcp/schema.json",
"context": "B2B SaaS booking platform",
"glossary": {
"Booking": "Core concept. Dutch: 'Boeking'.",
"Resource": "A bookable entity (room, desk, person)"
},
"translationPrompt": "Professional but approachable tone. Keep translations concise.",
"localeNotes": {
"de": "Informal German (du)",
"de-formal": "Formal German (Sie)"
}
}
This context is automatically loaded by detect_i18n_config before any translation work, so agents use the right terminology and tone across all locales.
<details> <summary><strong>All config options</strong></summary>
| Field | Purpose |
|---|---|
framework |
Force framework detection: "nuxt", "laravel", or "generic" |
context |
Free-form project background for the agent |
layerRules |
Rules for which layer a new key belongs to |
glossary |
Term dictionary for consistent translations |
translationPrompt |
System prompt for all translation requests |
localeNotes |
Per-locale instructions (formality, terminology) |
examples |
Few-shot translation examples |
orphanScan |
Per-layer ignore patterns for orphan detection |
reportOutput |
true or path — write large tool output to disk instead of returning it inline |
samplingPreferences |
Override model preferences for translate_missing |
localeDirs |
Locale directories for the generic adapter |
defaultLocale |
Default locale code (required for generic adapter) |
locales |
Explicit list of locale codes |
</details>
Agent Translation Workflow
When an AI agent builds a feature and adds new translation keys:
- Agent adds
$t('some.key')to the Vue/Blade component - Agent calls
detect_i18n_config→ loads.i18n-mcp.json(context, glossary, layerRules) into its session - Agent calls
add_translations— writes exact translations the agent provides. No separate sampling involved. - Agent calls
translate_missing→ MCP sampling fills any locales the agent didn't cover via a separate LLM call. - When source wording changes, agent calls
translate_keyto refresh one key across target locales (including existing stale translations whenoverwrite=true).
The add-feature-translations MCP prompt codifies this as a reusable workflow. It also checks for duplicate keys via search_translations before writing.
Exact writes vs translation tools:
add_translationsandupdate_translationsare pure write tools — they take locale-value maps and write them, no LLM involved.translate_missingfills only missing target values via sampling.translate_keytranslates one source key into target locales and can overwrite stale existing target values.
Handling Large Outputs
Tools like find_orphan_keys and get_missing_translations can return large payloads. Pass --output-file (CLI) or outputFile (MCP) to write the full report to disk and get only a compact summary back:
the-i18n-cli orphans --output-file /tmp/orphans.json
# → Wrote report to: /tmp/orphans.json
# → { orphanCount: 1103, filesScanned: 2526, ... }
// MCP call
{ "tool": "find_orphan_keys", "arguments": { "outputFile": "/tmp/orphans.json" } }
// → { "reportFile": "/tmp/orphans.json", "summary": { ... } }
Alternatively, set reportOutput: true in .i18n-mcp.json to always write reports to .i18n-reports/ in the project root.
How Orphan Detection Works
The scanner finds translation key references in source code:
Nuxt/Vue patterns: $t('key'), t('key'), $tc('key'), i18n.t('key'), template literals with $t
Laravel/PHP patterns: __('key'), trans('key'), @lang('key'), Lang::get('key'), trans_choice('key')
Bare string candidates: Any quoted dot-notation string in source ('some.key', "some.key") is treated as a potential key reference — regardless of whether it's inside a t() call. This catches patterns like { label: 'common.actions.save', i18n: true } and non-standard i18n call styles.
Dynamic key handling:
- Template literals:
$t(`status.${val}`)→ matches all keys understatus.* - String concatenation:
t('prefix.' + var)→ matches all keys underprefix.*(single-line and multiline forms both detected) - Keys matched by dynamic patterns are reported as "uncertain" separately and excluded from cleanup
Scan scope:
- Scans recursively from the project root — all source files, all layers
- Standard ignore dirs (
node_modules,.nuxt,.output,dist) excluded automatically
Development
pnpm install # Install all dependencies
pnpm build # Build all packages
pnpm test # Run all tests
pnpm lint # ESLint across all packages
pnpm typecheck # TypeScript check all packages
Set DEBUG=1 to enable verbose logging to stderr.
Roadmap
- [ ]
find_hardcoded_strings— detect user-facing strings not wrapped in translation calls - [ ]
move_translations— move keys between layers - [ ] Glossary validation — check translations against glossary terms
- [ ] Flat JSON support —
flatJson: truein vue-i18n config - [ ] Pluralization support — vue-i18n plural forms and Laravel
trans_choice
License
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。