Skip to main content
Glot provides a Model Context Protocol (MCP) server that gives code agents direct access to i18n scanning and translation tools.

Setup

Before configuring the MCP server, make sure you have:
  1. Installed glotctl as a dev dependency (see Quick Start)
  2. Initialized the configuration with glot init
Adjust the command based on your package manager:
Package ManagerCommand
npm["npx", "glot", "serve"]
pnpm["pnpm", "exec", "glot", "serve"]
yarn["yarn", "glot", "serve"]
bun["bunx", "glot", "serve"]
The examples below use npm. Replace the command with the appropriate one for your package manager.

Claude Code

Option 1: Using CLI (recommended)
claude mcp add --transport stdio glot -- npx glot serve
Option 2: Using project configuration Create .mcp.json in your project root to share with your team:
{
  "mcpServers": {
    "glot": {
      "command": "npx",
      "args": ["glot", "serve"]
    }
  }
}

Cursor

Add glot to your Cursor MCP configuration. Create .cursor/mcp.json in your project (or ~/.cursor/mcp.json for global access):
{
  "mcpServers": {
    "glot": {
      "command": "npx",
      "args": ["glot", "serve"]
    }
  }
}

OpenCode

Configure glot in your project’s opencode.json file:
{
  "$schema": "https://opencode.ai/config.json",
  "mcp": {
    "glot": {
      "type": "local",
      "command": ["npx", "glot", "serve"],
      "enabled": true
    }
  }
}

Other MCP-Compatible Agents

For other agents that support MCP, run the glot server with:
npx glot serve
The server communicates over stdio using the MCP protocol.

Available Tools

The MCP server provides 7 tools. All tools require the project_root_path parameter.

get_config

Returns the current glot configuration. Input:
ParameterTypeRequiredDescription
project_root_pathstringYesPath to the project root directory
Output:
{
  "fromFile": true,
  "config": {
    "primaryLocale": "en",
    "messagesDir": "./messages",
    "includes": ["src/app/[locale]", "src/components"],
    "ignores": [],
    "ignoreTestFiles": true,
    "ignoreTexts": [],
    "checkedAttributes": ["placeholder", "title", "alt", "aria-label"]
  }
}

get_locales

Lists available locale files with key counts. Input:
ParameterTypeRequiredDescription
project_root_pathstringYesPath to the project root directory
Output:
{
  "messagesDir": "./messages",
  "primaryLocale": "en",
  "locales": [
    { "locale": "en", "filePath": "./messages/en.json", "keyCount": 156 },
    { "locale": "es", "filePath": "./messages/es.json", "keyCount": 152 }
  ]
}

scan_overview

Returns statistics of all i18n issues in the project. Use this first to understand the overall state. Input:
ParameterTypeRequiredDescription
project_root_pathstringYesPath to the project root directory
Output:
{
  "hardcoded": {
    "totalCount": 12,
    "fileCount": 5
  },
  "primaryMissing": {
    "totalCount": 4
  },
  "replicaLag": {
    "totalCount": 8,
    "affectedLocales": ["es", "fr"]
  }
}

scan_hardcoded

Returns detailed hardcoded text issues with pagination support. Input:
ParameterTypeRequiredDescription
project_root_pathstringYesPath to the project root directory
limitnumberNoResults per page (default: 20, max: 100)
offsetnumberNoOffset for pagination (default: 0)
Output:
{
  "totalCount": 12,
  "totalFileCount": 5,
  "items": [
    {
      "filePath": "./src/components/Button.tsx",
      "line": 5,
      "col": 22,
      "text": "Submit",
      "sourceLine": "    return <button>Submit</button>;"
    }
  ],
  "pagination": {
    "offset": 0,
    "limit": 20,
    "hasMore": false
  }
}

scan_primary_missing

Lists translation keys used in code but missing from the primary locale file. Input:
ParameterTypeRequiredDescription
project_root_pathstringYesPath to the project root directory
limitnumberNoResults per page (default: 50, max: 100)
offsetnumberNoOffset for pagination (default: 0)
Output:
{
  "totalCount": 4,
  "items": [
    {
      "key": "common.submit",
      "filePath": "./src/components/Button.tsx",
      "line": 15
    }
  ],
  "pagination": {
    "offset": 0,
    "limit": 50,
    "hasMore": false
  }
}

scan_replica_lag

Lists keys that exist in the primary locale but are missing from other locales. Input:
ParameterTypeRequiredDescription
project_root_pathstringYesPath to the project root directory
limitnumberNoResults per page (default: 50, max: 100)
offsetnumberNoOffset for pagination (default: 0)
Output:
{
  "totalCount": 8,
  "items": [
    {
      "key": "common.newFeature",
      "value": "New Feature",
      "existsIn": "en",
      "missingIn": ["es", "fr"]
    }
  ],
  "pagination": {
    "offset": 0,
    "limit": 50,
    "hasMore": false
  }
}

add_translations

Adds new translation keys to one or more locale files. Supports nested keys (e.g., common.buttons.submit). Input:
ParameterTypeRequiredDescription
project_root_pathstringYesPath to the project root directory
translationsarrayYesArray of translation entries
Each translation entry:
FieldTypeDescription
localestringLocale code (e.g., “en”, “zh-CN”)
keysobjectKey-value pairs to add
Example Input:
{
  "project_root_path": "/path/to/project",
  "translations": [
    {
      "locale": "en",
      "keys": {
        "common.submit": "Submit",
        "common.cancel": "Cancel"
      }
    },
    {
      "locale": "es",
      "keys": {
        "common.submit": "Enviar",
        "common.cancel": "Cancelar"
      }
    }
  ]
}
Output:
{
  "success": true,
  "results": [
    {
      "locale": "en",
      "success": true,
      "filePath": "./messages/en.json",
      "addedCount": 2,
      "updatedCount": 0
    }
  ],
  "summary": {
    "totalLocales": 2,
    "successfulLocales": 2,
    "failedLocales": 0,
    "totalKeysAdded": 4,
    "totalKeysUpdated": 0
  }
}
The MCP server instructions guide code agents to follow this workflow:
1. scan_overview      → Understand the overall state
2. Fix hardcoded     → Replace text with t() calls, add keys
3. Fix primary_missing → Add missing keys to primary locale
4. Fix replica_lag    → Sync keys to other locales
This order is important! Fixing hardcoded issues may create new primary_missing issues, and fixing those may create new replica_lag issues.