MCP server
easyi18n mcp runs an MCP server over standard input and output. The client
launches it; you do not run it in a terminal yourself. It exposes tools, two
prompts (setup and translate) and server instructions that tell the agent
the safety rules and the translation loop.
Configuration
The server reads its settings from the environment the client gives it.
| Variable | Meaning |
|---|---|
EASYI18N_TOKEN | A project API key, for CI or an agent whose spending waits for approval; use an agent key and start the server with --require-agent-key. Unset, blank or the eik_YOUR_AGENT_KEY placeholder, the server sends the login of the machine, read on every call. A tool that needs a credential and finds neither returns no_credential. |
EASYI18N_PROJECT_DIR | The project directory, when the client does not start the server in it. |
EASYI18N_MCP_MAX_CREDITS | The most one authorization may ask for, in credits. Default 50; 0 disables real pushes and syncs. |
EASYI18N_MCP_APPROVAL_WAIT_SECONDS | How long the agent keeps waiting for an approval, in seconds. Default and maximum 600; a smaller value shortens the wait, for tests. |
EASYI18N_BASE_URL | An API origin to trust besides the easyi18n API, for a staging backend. |
Every tool accepts project_dir, an absolute path. The server resolves the
project from project_dir, then EASYI18N_PROJECT_DIR, then its working
directory, and reads easyi18n.yaml there.
The key never travels as a tool argument: tool schemas reject unknown
arguments, so a token argument is refused. The server also refuses to send
the key to a baseUrl from easyi18n.yaml unless it is the easyi18n API over
HTTPS, a loopback host, or the exact origin in EASYI18N_BASE_URL. A
repository you open cannot redirect your key to another host.
Tools
The list is fixed and ordered: core tools first, then each adapter's tools.
Clients show them with their own prefix, for example
mcp__easyi18n__push.
Core tools
| Tool | What it does | Main inputs | Key scope |
|---|---|---|---|
init | Detects the stack and writes easyi18n.yaml, the adapter's setup and the AGENTS.md block. A named stack picks among the stacks detected in the directory. With no workspace and project and no easyi18n.yaml, it reads the project from your key. Safe to repeat. | workspace, project or project_id, stack (flutter, xcode, web, android, angular, auto; default auto), mode, format, output, catalog, force, write_agents, dry_run | none |
doctor | Checks config, credential, AGENTS.md, published state and the adapter's wiring. Before init, it reports the missing easyi18n.yaml as a failed check, not an error. Read-only and free. | source_dir | read, optional |
status | Compares the published version with your last pull, and lists languages, the family and the stack. Before init, it answers initialized: false with the project your key belongs to and next: init. | none | read |
authorize | With an agent key, asks the server for an operation and returns its approval_url. With operation_id, it reads the operation and, while it waits for you, keeps the call open up to 45 seconds; the agent calls it again until you approve or deny, for up to 10 minutes. With your login it mints no operation and answers approval: not_needed with the tool to call next, unless the server says that login needs an approval. | action (translate, publish, rollback), max_credits, operation_id, plus the scope of the action | the action's |
fill_status | One poll: is the translation complete? Reconciles requests left unresolved by a lost response or a restart. | langs, tracking_tokens | translate |
publish | Freezes and serves a new version. With an agent key, needs an approved publish operation; with your login, omit operation_id when authorize returns approval: not_needed. Refuses an incomplete project unless require_complete is false. | operation_id, approved_only, require_complete (default true), incomplete_mode, skip_if_identical | publish |
rollback | Restores an earlier version as a new version. With an agent key, needs an approved rollback operation; with your login, omit operation_id when authorize returns approval: not_needed. | operation_id, version (default previous) | publish |
pull | Writes the published files or catalog and returns their paths, never their contents. It never writes the base-language file of a web project. | version, lang, dry_run, require_complete, key_policy | read |
add_language | Adds a language to the project, or changes its fill mode. | code, fill_mode (ai, manual) | write |
Code-first tools: Dart and Flutter
| Tool | What it does | Main inputs | Key scope |
|---|---|---|---|
extract | Scans tr() calls against easyi18n.lock, offline and free. Paginated. | source_dir, limit, offset | none |
push_preview | Estimates the credits a push would spend. Free. | langs, source_dir | translate |
push | Registers the strings, writes easyi18n.lock and queues the translation. Spends credits. | operation_id, langs, source_dir, prune | translate |
apply | Rewrites tr() literals corrected in source review. Previews unless write is true. | write, source_dir | read |
File-first tools: Xcode, web, Android and Angular
| Tool | What it does | Main inputs | Key scope |
|---|---|---|---|
sync_preview | Uploads the catalog, or the base-language file of a web project, as a dry run: keys created and updated, conflicts, diagnostics and estimated credits. Free. | on_conflict (server, file) | translate |
sync | Uploads the same file and queues the translation. Spends credits. | operation_id, on_conflict | translate |
An adapter tool called on a project of the other family returns
wrong_family with the name of the tool to use instead. status tells the
agent the family before it starts.
Spending and publishing
With an agent key, push, sync, publish and rollback need the
operation_id of an operation a person approved in the dashboard. A push or
sync whose preview costs 0 credits runs without one. With your
login they run without an operation_id, as you
would in the dashboard. Operations and approvals
describes the approval flow as HTTP requests.
For a translation, authorize computes the maximum as the estimate plus 20 %,
rounded up and capped at EASYI18N_MCP_MAX_CREDITS. If that cap is below the
estimate, it returns ceiling_below_estimate before creating anything, and only
the person who configured the client can raise it. The approved maximum is
enforced by the easyi18n server: the translation stops before it would charge
more.
push and sync write each request to .easyi18n/operations/ before sending
it. If a response is lost or the client restarts, fill_status asks the server
what happened to that request instead of sending it again.
In Claude Code 2.1.199 or later, push, sync, publish and rollback also
ask for your permission on every call. Other clients use their own tool
approval settings. The dashboard approval applies in every client.
Errors
A failure comes back as a tool result with isError and an error object
with message, code, statusCode and retryable. The message says what to
do next.
| Code | Meaning |
|---|---|
no_credential | The server found neither a login nor EASYI18N_TOKEN. Tell the human to run easyi18n login, or to fix the client configuration; do not paste a key into the chat. |
wrong_family | The tool belongs to the other family. The result names the tool to use. |
unsupported_stack | init found no stack it can set up in the directory: stack: auto detected none, or the stack you named is not there. The error also carries supported and roadmap, each a list of stack names. If the app is in a subdirectory, call init again with project_dir on it. If another stack is detected there, the message names it: call init with that stack or with auto. Otherwise easyi18n does not support the repository yet: tell the human, with both lists, and do not add dependencies or files to make init accept it. |
catalog_scope_unknown | The web input declaration is missing, invalid, or cannot be inspected. Declare sourceRoot and sourceLayout as described in Web input layouts. After inspecting the input it carries fields, the settings to fix, and files: the JSON files under the declared root, or the ones beside source: when sourceRoot is missing. Nothing was uploaded. |
several_files_per_locale | A web project keeps its base language in more than one file and its sourceLayout does not take them: a second file under locale-files or base-tree, or a file namespaces or scopes has no place for. The error carries source and files, the paths it found. Set the layout described in Web input layouts. Nothing was uploaded. |
catalog_key_collision | Under namespaces or scopes, a key of one base file would be stored under the namespace or scope of another, such as a Transloco root key admin.title next to the scope admin. The error carries key and files, the two files. Rename the key. Nothing was uploaded. |
edited_targets | A locale file changed since the pull that wrote it, and the call would replace it. edited lists each one as {file}. Nothing was uploaded or written. Tell the human: the change belongs in the dashboard, and easyi18n pull --force discards it. No tool overwrites the file. |
authorization_required | The call needs an approved operation. Run authorize. |
scope_changed | The work no longer matches what was approved, for example after the source changed. Authorize again. |
ceiling_below_estimate, above_ceiling | The estimate or the operation exceeds EASYI18N_MCP_MAX_CREDITS. |
ingests_disabled | EASYI18N_MCP_MAX_CREDITS is 0. |
nothing_to_authorize | The preview costs nothing; push or sync without an operation. |
request_unresolved | An earlier request has no known outcome. Run fill_status before sending more. |
fill_incomplete | publish found untranslated or refused cells in the version it would freeze. |
invalid_project_dir, source_dir_outside_project | A path argument is not absolute, or points outside the project. |
output_too_large | The result exceeds the 32 KiB output budget even after truncating its lists. |
List fields in results are truncated to fit 32 KiB, with truncated: true and
the total count. Tool results contain text written by your project's users,
such as keys, source strings and error messages; the server instructions tell
the agent to treat it as data.
Prompts
setup takes a repository from nothing to ready to translate: it detects the
stack, reads the project from your key (or asks you for the key and the
project when there is none), runs init and doctor, and shows what would be
translated without spending anything. translate runs the loop,
including both approvals, the fill_status polling and the final pull.
Clients that support MCP prompts list them; the Claude Code plugin ships them
as skills.