MCP I18n Extractor

by martincik

123 downloads
Not rated
GitHub

About

MCP I18n Extractor is an MCP server that extracts i18n (internationalization) strings from JavaScript/TypeScript source files and outputs them as structured JSON files. It is designed for developers working on multilingual applications who need to automate the initial extraction…

Details

Author
martincik
Downloads
123
Categories
Other

- Extracts i18n strings from direct object exports (export default { ... })
- Preserves nested objects and arrays in the output JSON
- Handles template strings with variable interpolation
- Supports strings, numbers, booleans, null, and undefined
- Merges with existing JSON files instead of overwriting
- Replaces source files with a configurable migration message (can be disabled)

Install the npm package (@access-intelligence/mcp-i18n), then configure your MCP client to use the server. The server exposes a single tool operation, extract_i18n, which requires a sourcePath (path to the JS/TS file) and a targetPath (path for the output JSON).

MCP I18n Extractor

A Model Context Protocol (MCP) tool for extracting i18n strings from JavaScript/TypeScript code into JSON files.

Features

- Extracts i18n strings from direct object exports (export default { ... })
- Preserves nested objects and arrays
- Handles template strings with variable interpolation
- Supports various data types (strings, numbers, booleans, null, undefined)
- Merges with existing JSON files when present
- Replaces source files with a migration message (configurable)

Installation

npm install @access-intelligence/mcp-i18n

Usage with MCP

When used via MCP, the tool offers a single operation:

- extract_i18n: Extract i18n strings from source code to a JSON file

Example

extract_i18n(
  sourcePath: "/path/to/translations.js",
  targetPath: "/path/to/output.json"
)

Environment Variables

- DISABLE_SOURCE_REPLACEMENT: Set to 'true' to prevent replacement of source files after extraction
- WARNING_MESSAGE: Customize the warning message added to replaced source files

Testing

npm test

License

MIT

No reviews yet — be the first

Sign in to leave a review

Use Google, GitHub, or an email account so ratings stay tied to real people.

Email sign in

No reviews posted yet.