MCP

Connect a coding agent to x18n over MCP, through stdio with x18n mcp, or over HTTP next to the UI.

x18n serves its tools over the Model Context Protocol (MCP), the protocol that coding agents use to call tools. The tools do the same work as the CLI: read keys, run checks, write messages and extract strings. There are two ways to connect.

stdio: x18n mcp

x18n mcp serves the tools over stdin and stdout. The agent starts the command itself. Most agents read a config like this one. The exact file and keys depend on the agent:

{
  "mcpServers": {
    "x18n": {
      "command": "pnpx",
      "args": ["@x18n/cli", "mcp"]
    }
  }
}

The agent must start the command in the root of the project, or pass --root <dir>. The server watches the files, so it sees edits from other tools.

HTTP: next to the UI

x18n ui also serves MCP over HTTP at /__mcp, on the same port as the UI. An agent and a human then work on the same project at the same time, and each sees the changes of the other.

The command prints the URL and a bearer token:

x18n UI at http://localhost:9999/
  auth code  123456
  or open    http://localhost:9999/#devframe_otp=123456
  MCP        http://localhost:9999/__mcp
  MCP token  Authorization: Bearer <token>

Pass the token in the Authorization header:

{
  "mcpServers": {
    "x18n": {
      "type": "http",
      "url": "http://localhost:9999/__mcp",
      "headers": {
        "Authorization": "Bearer <token>"
      }
    }
  }
}

x18n ui makes a new token each time it starts. Keep the token to yourself: anything with the token can edit the files of the project.

Tools

ToolDoes
x18n_statusLocales with coverage, counts, diagnostics by check and detected presets. Call it first.
x18n_keysKeys, paged, filtered by a missing locale, unused keys, namespace or glob.
x18n_getOne key: values, missing locales, usages with code and diagnostics.
x18n_usagesUsages of a key, of a file, or all, paged.
x18n_checkDiagnostics, paged, filtered by check and locale.
x18n_translate_promptThe translate prompt for a locale, as markdown.
x18n_set_messagesWrites many messages, in the shape of x18n apply. Refuses placeholder problems unless force: true.
x18n_rename_keyRenames a key or a parent key in locale files and code.
x18n_delete_keyDeletes a key or a parent key.
x18n_extract_planHard strings with a proposed key, message and replacement each.
x18n_extract_applyApplies the items of an extraction plan.

x18n_rename_key and x18n_delete_key return the plan first. A second call with confirm: true applies it. MCP tools lists the input fields of each tool.

In a monorepo, pass project to each tool. x18n_status lists the project names.