Translations MCP Server
Enables automatic discovery and fast searching of translation files in projects, supporting partial/exact key-value matching with file watching and multiple translation file formats.
README
Translations MCP Server
A Model Context Protocol (MCP) server that automatically discovers and searches translation files in your projects.
Features
- Configurable path: Specify exact translation file path via configuration (recommended)
- Auto-discovery: Automatically finds translation files in
enfolders as fallback - Fast search: Indexed search through translation keys and values
- Partial/exact matching: Support for both partial and exact match searches
- File watching: Automatically reloads when translation files change
- Multiple file formats: Supports common translation file names
- TypeScript: Fully typed with proper interfaces and modular architecture
Quick Start
Method 1: Configured Path (Recommended)
Configure your MCP server to use a specific translation file:
{
"mcpServers": {
"translations-mcp": {
"command": "translations-mcp",
"args": ["path/to/your/translation.json"]
}
}
}
Method 2: Environment Variable
{
"mcpServers": {
"translations-mcp": {
"command": "translations-mcp",
"env": {
"TRANSLATION_FILE_PATH": "src/assets/locales/en/translation.json"
}
}
}
}
Method 3: Auto-Discovery (Fallback)
If no path is configured, the server will automatically search for translation files:
{
"mcpServers": {
"translations-mcp": {
"command": "translations-mcp"
}
}
}
Architecture
The project is organized into focused modules for better maintainability:
src/
├── index.ts # Main server entry point with MCP server setup
├── translation-discovery.ts # File discovery and search functionality
└── types.ts # TypeScript interfaces and types
Module Descriptions
index.ts: Main MCP server setup, tool handlers, and entry pointtranslation-discovery.ts: Handles file discovery, indexing, and search functionalitytypes.ts: TypeScript interfaces for type safety across modules
Usage
The server provides two main tools:
1. find_translation
Search for translation keys and values:
{
"name": "find_translation",
"arguments": {
"query": "search term",
"exact": false
}
}
query: String to search for in translation keys or valuesexact: Boolean (optional) - whether to perform exact matching (default: false)
2. refresh_translations
Manually refresh the translation index (useful after file changes):
{
"name": "refresh_translations",
"arguments": {}
}
Returns the current number of indexed entries and refresh status.
Configuration Examples
For React/Next.js Projects
{
"mcpServers": {
"translations-mcp": {
"command": "translations-mcp",
"args": ["public/locales/en/translation.json"]
}
}
}
For ASP.NET Core + React Projects
{
"mcpServers": {
"translations-mcp": {
"command": "translations-mcp",
"args": ["ClientApp/public/locales/en/translation.json"]
}
}
}
Absolute Path
{
"mcpServers": {
"translations-mcp": {
"command": "translations-mcp",
"args": ["C:/projects/my-app/locales/en/translation.json"]
}
}
}
How It Works
- Discovery: On startup, recursively searches for translation files in folders named
en - Indexing: Builds an in-memory search index of all translation keys and values
- Search: Provides fast lookups with support for partial and exact matching
Supported Project Structures
The server can find translation files in various project structures:
./en/translation.json(simple)./locales/en/translation.json(common)./src/assets/locales/en/translation.json(React/Angular)./ClientApp/public/locales/en/translation.json(ASP.NET Core with React)./Project.Name/ClientApp/public/locales/en/translation.json(deep .NET structures)
Installation
Install globally via npm:
npm install -g translations-mcp
Development
# Install dependencies
npm install
# Build
npm run build
# Run tests
npm run test
# Development mode
npm run dev
Testing
The project includes several test scripts:
npm run test:server- Test basic server functionalitynpm run test:find- Test search functionalitynpm run test:quick- Quick integration testnpm run test:all- Run all tests
Supported File Names
The server looks for these translation files in en folders:
- translation.json
- translations.json
- common.json
- messages.json
Adding to Claude Desktop
Recommended: Specify Your Translation File Path
{
"mcpServers": {
"translations": {
"command": "translations-mcp",
"args": ["path/to/your/translation.json"]
}
}
}
Alternative: Auto-Discovery
{
"mcpServers": {
"translations": {
"command": "translations-mcp"
}
}
}
Benefits of Configured Path
✅ Eliminates confusion - No more loading wrong translation files
✅ Faster startup - No need to search directories
✅ Predictable behavior - Always uses the exact file you specify
✅ Works anywhere - Not limited to specific folder structures
✅ Production ready - Points to your actual translation files, not test data
npm run clean- Remove compiled filesnpm test- Run the main server functionality testnpm run test:server- Run comprehensive server tests with response parsingnpm run test:quick- Run quick global installation testnpm run test:all- Run all tests (server + quick)
Development Workflow
- Clone or download this package
- Run
npm installto install dependencies - Make your changes to files in the
src/directory - Test with
npm run devfor development ornpm testto verify functionality - Build for production with
npm run build && npm start
License
MIT
推荐服务器
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 模型以安全和受控的方式获取实时的网络信息。