@infinum/polyglot-mcp
v0.2.0
Published
MCP server for Polyglot, allows pushing translations to Polyglot
Readme
Polyglot MCP
An MCP server that connects Cursor and Claude Code to Polyglot, enabling you to fetch all translations for a project and create new translation keys with values across multiple locales.
Requirements
- Node.js 18+
- A Polyglot API token
Installation
Configure Cursor (MCP)
Add a custom MCP server entry for Polyglot in Cursor. You can do this via Cursor Settings → MCP or by editing your MCP configuration JSON. Use one of the options below. It can also be added to project at {project}/.cursor/mcp.json
{
"mcpServers": {
"polyglot-mcp": {
"command": "npx",
"args": ["-y", "@infinum/polyglot-mcp", "--polyglot-token=YOUR_POLYGLOT_TOKEN"]
}
}
}Notes:
- The server communicates over stdio, so no ports are required.
--polyglot-token=...must be provided as an argument.
Configure Claude Code (MCP)
Add the Polyglot MCP server to Claude Code using the following command:
claude mcp add polyglot --transport stdio -- npx -y @infinum/polyglot-mcp --polyglot-token=${POLYGLOT_TOKEN}Notes:
- Replace
${POLYGLOT_TOKEN}with your actual Polyglot API token or set it as an environment variable. - The server communicates over stdio, so no ports are required.
Project configuration (.polyglot-mcp.json)
Create a .polyglot-mcp.json file in the root of the project you are working on (the same folder you open in Cursor or Claude Code). The MCP server reads the Polyglot project ID from this file.
Example:
{
"projectId": 123
}Usage
What the server exposes
- "fetch all translations": returns all languages and the full translation mapping for the configured Polyglot project.
- "create translations": creates translation keys and values for multiple locales. The payload is a map of translation keys to
{ locale: value }objects.
Payload shape for creating translations (for reference):
{
"welcome_message": {
"en_US": "Welcome",
"cs_CZ": "Vítejte"
},
"logout_button": {
"en_US": "Log out",
"cs_CZ": "Odhlásit se"
}
}Rules example to be used with this MCP
# Translations workflow
When creating new screens and adding text to the code:
1. Build screens and add raw text initially.
2. Propose translation key-value pairs. Use snake_case for translation keys.
3. Verify that the proposed keys are not already in use.
4. Push new translations to Polyglot MCP.
5. After the keys are successfully created in Polyglot, run `polyglothq pull` in the terminal to sync.
6. Replace raw text with translation keys in code.Development (Contributing)
Build
bun install
bun run buildMCP Inspector
For local development (TypeScript without building):
bun run inspectThis runs the MCP server in dev mode. For Cursor integration, prefer a built artifact or the linked CLI as shown below.
Link (optional)
Link the CLI so the polyglot-mcp command is available on your PATH:
npm linkConfigure Cursor (MCP)
Add a custom MCP server entry for Polyglot in Cursor.
{
"mcpServers": {
"polyglot-mcp": {
"command": "polyglot-mcp",
"args": ["--polyglot-token=YOUR_POLYGLOT_TOKEN"]
}
}
}