MCP I18n Extractor

by martincik

123 downloads Not rated yet MIT license

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

License
MIT license

Explore

- 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)

npm install @access-intelligence/mcp-i18n

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

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

- 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

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.