i18n-mcp

i18n-mcp

MCP server for managing i18n JSON translation files. Provides Claude with structured read/write access to translation files for adding keys, checking coverage, and finding duplicates.

Category
访问服务器

README

i18n-mcp

npm

Vibe coded project — built fast, works well, but may have rough edges. Missing a feature or hit a bug? Open an issue — contributions welcome.

MCP server for managing i18n JSON translation files. Gives Claude structured read/write access to your translation files — add keys, check coverage, find duplicates — without ever leaving your editor.

Works with monorepos. Supports both flat (en.json) and i18next folder (en/translation.json) structures, auto-detected per namespace.

Quick Start

Run this once in your project root:

npx @robinheat/i18n-mcp install

This installs the Claude Code skills and adds the MCP server to your project's .mcp.json. Then:

  1. Restart Claude Code
  2. Run /i18n-setup — auto-detects your translation files, infers tone and brand terms, writes .i18n-mcp.json

Configuration

.i18n-mcp.json lives in your project root:

{
  "primaryLocale": "en",
  "style": {
    "tone": "informal",
    "glossary": {
      "Wärmepumpe": "heat pump"
    },
    "doNotTranslate": ["Robin", "COP"]
  },
  "namespaces": [
    {
      "name": "common",
      "description": "Shared UI strings",
      "path": "packages/ui/locales"
    },
    {
      "name": "web",
      "description": "Web app strings",
      "path": "apps/web/locales"
    }
  ]
}
Field Required Description
primaryLocale Yes Source-of-truth locale (used for integrity checks)
namespaces Yes Array of namespace definitions
namespaces[].name Yes Short name used in tool calls
namespaces[].description Yes Helps Claude choose the right namespace
namespaces[].path Yes Path to locale directory, relative to project root
style.tone No "informal" or "formal"
style.glossary No Terms with fixed translations
style.doNotTranslate No Terms that should never be translated

File Structure Support

Both layouts are auto-detected per namespace:

Flat:

locales/
  en.json
  de.json
  fr.json

i18next folder style:

locales/
  en/
    translation.json
  de/
    translation.json

Tools

All tools are available to Claude once the MCP server is running.

get_translation

Returns translations for a single key across all locales. Faster than get_translations for targeted spot-checks.

get_translation("common", "button.save")
// → { "en": "Save", "de": "Speichern" }

get_namespace_keys

Returns a sorted list of all dot-notation keys in a namespace without values. Use to plan batch translation work without loading full locale content.

get_namespace_keys("common")
// → ["button.cancel", "button.save", "title"]

get_translations

Returns all keys for a namespace as { "key.path": { "en": "...", "de": "..." } }.

get_translations("common")
get_translations("common", "button.*")      // glob filter on keys
get_translations("common", "save")          // substring filter on values

add_translation

Adds or updates a single key. Only the provided locales are written.

add_translation("common", "button.save", {
  en: "Save",
  de: "Speichern",
  fr: "Enregistrer"
})

add_multiple_translations

Batch version — one disk write per locale file regardless of entry count.

add_multiple_translations("common", [
  { key: "button.save",   translations: { en: "Save",   de: "Speichern" } },
  { key: "button.cancel", translations: { en: "Cancel", de: "Abbrechen" } }
])

// Only write "de" even if other locales are provided:
add_multiple_translations("common", [...], ["de"])

delete_translation

Removes a key from all locale files in a namespace.

delete_translation("common", "button.save")

find_untranslated_values

Finds keys where the translated value is identical to the primary locale — placeholder translations that were never actually translated. Terms in doNotTranslate are excluded.

find_untranslated_values("web")           // all non-primary locales
find_untranslated_values("web", "de")     // one locale

Returns { locale: { key: primaryValue } } for each stale entry found.

check_translation_quality

Checks specific keys for quality issues across all non-primary locales. Returns issues per locale per key: untranslated (value identical to primary), empty (missing or blank), short (< 30% of primary value length for strings longer than 15 chars). Terms in doNotTranslate are excluded from the untranslated check.

check_translation_quality("web", ["header.title", "onboarding.description"])

copy_from_primary

Copies the primary locale value verbatim to specified locales for specified keys. Use for brand names, units, prices, and other terms that should not be translated. Returns an error if any key is missing from the primary locale.

copy_from_primary("common", ["brand.name", "unit.percent"], ["de", "fr"])

check_translation_integrity

Compares all locales against primaryLocale. Returns missing keys, extra keys, and empty values per locale.

check_translation_integrity()           // check all namespaces
check_translation_integrity("common")   // check one namespace

Array Values

JSON arrays are not supported as leaf values. Use indexed dot-keys instead — this is what i18next expects when you call t('key', { returnObjects: true }) anyway.

In your translation file:

{
  "steps": {
    "0": "Connect your device",
    "1": "Open the app",
    "2": "Follow the setup guide"
  }
}

Adding via tools:

add_multiple_translations("common", [
  { key: "steps.0", translations: { en: "Connect your device", de: "Gerät verbinden" } },
  { key: "steps.1", translations: { en: "Open the app",        de: "App öffnen" } },
  { key: "steps.2", translations: { en: "Follow the setup guide", de: "Setup-Anleitung folgen" } }
])

Reading via tools:

get_translations("common", "steps.*")

Integrity checks and missing-key detection work the same as for any other key.

Usage Skills

For day-to-day work (small edits, targeted key additions):

/i18n-usage

Guides Claude to check integrity first, search before adding, always add all locales at once, and verify coverage when done.

For large translation jobs (20+ keys or 3+ locales):

/i18n-translate

Orchestrates parallel agents — one per locale — so large jobs run faster without self-review loops or sequential batching.

Manual Installation (without npm)

Add the server to .mcp.json in your project root:

{
  "mcpServers": {
    "i18n-mcp": {
      "command": "npx",
      "args": ["-y", "@robinheat/i18n-mcp@latest"]
    }
  }
}

Then create .i18n-mcp.json in your project root manually.

Development

npm test          # run tests (85 tests)
npm run build     # compile to dist/
npm run dev       # run server directly with tsx (needs .i18n-mcp.json in cwd)

License

MIT

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选