@i18n-bakery/tray
v1.0.9
Published
The Silver Tray. Delivers i18n-bakery capabilities directly to AI agents via the Model Context Protocol (MCP), making translation workflows effortlessly accessible.
Maintainers
Readme
@i18n-bakery/tray 🍽️
The Silver Tray — delivers the i18n-bakery kitchen directly to AI agents via the Model Context Protocol (MCP).
tray makes translation workflows accessible to any MCP-compatible AI agent (Claude, Cursor, Copilot, etc.), enabling fully automated i18n pipelines without human intervention.
What it does
Instead of a human running CLI commands, an AI agent can:
- Detect missing translations across all locales
- Extract new keys after UI changes
- Write translated strings directly to locale files
- Compile production bundles with hashing and minification
Tools
| Tool | Description |
|---|---|
| fry_batter | Scans source files for t() calls and writes keys to locale files |
| bake_bundle | Compiles locale files into optimized production bundles |
| check_pantry | Status report: completion %, missing keys per locale |
| update_recipe | Writes/updates a single translation key in a locale file |
Typical AI Agent Workflow
1. check_pantry → "es-MX is 60% complete, missing 12 keys"
2. fry_batter → "Found 3 new keys after the latest component changes"
3. update_recipe → write each translated key
4. bake_bundle → compile for productionInstallation
pnpm add @i18n-bakery/trayUsage
As an MCP Server (stdio)
# Start the MCP server via stdio
npx i18n-bakery-trayClaude Desktop Configuration
{
"mcpServers": {
"i18n-bakery": {
"command": "npx",
"args": ["i18n-bakery-tray"],
"cwd": "/path/to/your/project"
}
}
}Programmatic Usage
import { createTrayServer } from '@i18n-bakery/tray';
import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';
const server = createTrayServer();
const transport = new StdioServerTransport();
await server.connect(transport);Architecture
Follows Clean Architecture with SOLID principles:
src/
domain/ Pure types — no runtime dependencies
use-cases/ Orchestration: BatterUseCase, BakeUseCase, PantryUseCase, RecipeUseCase
adapters/ Infrastructure: SilentLogger
tools/ Atomic MCP tool registrations (one file per tool)
shared/ DRY utilities: flatten/unflatten, deep key access, path validation
index.ts Server assembly — pure DI, no business logicSecurity
- All user-provided path segments are validated against directory traversal
- Prototype pollution is prevented at every object merge
- Encryption key is required when encryption is enabled (validated at tool level)
