@zerolingua/mcp 0.3.2 → 0.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +10 -2
- package/index.js +1 -1
- package/package.json +1 -1
- package/tools.js +36 -41
package/README.md
CHANGED
|
@@ -63,11 +63,11 @@ The server needs **Node.js 20** or later, as the MCP SDK v2 it runs on does.
|
|
|
63
63
|
| `translate_set` | translate a set with the site's own AI engine (dry run first) |
|
|
64
64
|
| `approve_set` | sign off a set, chunk by chunk, by cursor |
|
|
65
65
|
| `queue_status` | follow the queued jobs `translate_set` started |
|
|
66
|
-
| `
|
|
66
|
+
| `keep_original` | mark texts that need no translation (served as written) |
|
|
67
67
|
|
|
68
68
|
`translate_set`, `approve_set` and `queue_status` need **Zerø Lingua 0.8.0** or
|
|
69
69
|
later on the site; against an older plugin they answer `404 rest_no_route`, and
|
|
70
|
-
the
|
|
70
|
+
the others keep working.
|
|
71
71
|
|
|
72
72
|
## Working with sets
|
|
73
73
|
|
|
@@ -123,6 +123,14 @@ tool, authenticated with the user's own Application Password.
|
|
|
123
123
|
|
|
124
124
|
## Versions
|
|
125
125
|
|
|
126
|
+
- **0.4.1** — the tools say what Zerø Lingua 0.12.1 does: what an agent saves
|
|
127
|
+
stays a draft unless the site publishes AI without review everywhere
|
|
128
|
+
(Settings → automation), and a sentence whose ⟦0⟧ changes the word before it
|
|
129
|
+
(de → d') is rewritten so it does not depend on it.
|
|
130
|
+
- **0.4.0** — `keep_original`: a brand or a name is marked «keep original»
|
|
131
|
+
instead of saved as a copy of its source (needs Zerø Lingua 0.11.2).
|
|
132
|
+
`translate_batch`, deprecated since 0.3.0, is gone: Zerø Lingua 0.12 removed
|
|
133
|
+
its route. Use `translate_set` with the same items as `selector.targets`.
|
|
126
134
|
- **0.3.0** — the selector tools: `translate_set`, `approve_set` and
|
|
127
135
|
`queue_status` (they need Zerø Lingua 0.8.0). `translate_batch` is deprecated
|
|
128
136
|
in its description and keeps working. The descriptions are rewritten:
|
package/index.js
CHANGED
|
@@ -37,7 +37,7 @@ if ( missing.length ) {
|
|
|
37
37
|
* the opening exchange and pins one instance to it.
|
|
38
38
|
*/
|
|
39
39
|
function buildServer() {
|
|
40
|
-
const server = new McpServer( { name: 'zero-lingua', version: '0.
|
|
40
|
+
const server = new McpServer( { name: 'zero-lingua', version: '0.4.1' } );
|
|
41
41
|
for ( const tool of TOOLS ) {
|
|
42
42
|
server.registerTool(
|
|
43
43
|
tool.name,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zerolingua/mcp",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.4.1",
|
|
4
4
|
"description": "MCP server for Zerø Lingua — lets AI agents read a site's strings, write translations, and approve pending work through the plugin's licensed REST surface. Speaks MCP 2026-07-28 and the 2025 era.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"scripts": {
|
package/tools.js
CHANGED
|
@@ -20,7 +20,7 @@ const WORKFLOW =
|
|
|
20
20
|
'Typical session: site_status (languages) → pending_overview (what is left) → ' +
|
|
21
21
|
'list_items / item_strings (read) → save_translations (your own text) or translate_set (the ' +
|
|
22
22
|
"site's AI engine: dry_run first) → approve_item (one page) or approve_set (a whole set) → " +
|
|
23
|
-
'queue_status (follow queued work).';
|
|
23
|
+
'queue_status (follow queued work). A brand or a name that needs no translation: keep_original.';
|
|
24
24
|
|
|
25
25
|
/** The contract's status words and their two aliases (SELECTOR-CONTRACT.md § Enums). */
|
|
26
26
|
const STATUS = [ 'translated', 'needs_review', 'in_progress', 'not_translated', 'done', 'todo' ];
|
|
@@ -179,14 +179,21 @@ export const TOOLS = [
|
|
|
179
179
|
'Write translations YOU produced (for the site\'s own AI engine use translate_set instead). ' +
|
|
180
180
|
'Every entry must carry a `hash` from item_strings — source-only entries are rejected on this ' +
|
|
181
181
|
'surface. Placeholder tokens wrapped in ⟦ ⟧ must be preserved in the translation EXACTLY as they ' +
|
|
182
|
-
'appear in the source, or that entry is skipped.
|
|
182
|
+
'appear in the source, or that entry is skipped. One translation serves every value a token ' +
|
|
183
|
+
'takes: when the value changes the word before it (Catalan de → d\', French le → l\'), rewrite ' +
|
|
184
|
+
'the sentence so it does not depend on it, e.g. «Veure la carta: ⟦0⟧», not «Veure la carta de ⟦0⟧». ' +
|
|
185
|
+
'Inline HTML holds to the same rule: when the ' +
|
|
183
186
|
'source carries tags (a link, a bold), the translation must carry the same tags, in the same ' +
|
|
184
187
|
'order, with the same attributes — adding, repointing or dropping one gets the entry skipped. ' +
|
|
185
|
-
'Saves land as DRAFTS behind the review gate: nothing serves publicly until approve_item or ' +
|
|
186
|
-
'approve_set (or a human in the panel) signs it off
|
|
188
|
+
'Saves land as DRAFTS behind the review gate: nothing new serves publicly until approve_item or ' +
|
|
189
|
+
'approve_set (or a human in the panel) signs it off, and a text already live keeps serving until ' +
|
|
190
|
+
'then — unless the site owner chose «publish AI without review everywhere» (settings → automation), ' +
|
|
191
|
+
'when a save serves at once. The response\'s `review` says which: "approved" only when every saved ' +
|
|
192
|
+
'entry is live, "draft" otherwise; never treat a save as published without it. The ' +
|
|
187
193
|
'response reports `saved` and `skipped` honestly, and `skipped_at` lists the indexes of the ' +
|
|
188
194
|
'skipped entries; skipped means a guard refused it (placeholder or markup mismatch, rights, ' +
|
|
189
|
-
'unknown hash), not a partial success.'
|
|
195
|
+
'unknown hash), not a partial success. A text that needs no translation (a brand, a wine, a name) ' +
|
|
196
|
+
'is never saved as a copy of its source: mark it with keep_original.',
|
|
190
197
|
method: 'POST',
|
|
191
198
|
route: 'save-translations',
|
|
192
199
|
input: z.object( {
|
|
@@ -226,34 +233,6 @@ export const TOOLS = [
|
|
|
226
233
|
lang: z.string().describe('target language code'),
|
|
227
234
|
} ),
|
|
228
235
|
},
|
|
229
|
-
{
|
|
230
|
-
name: 'translate_batch',
|
|
231
|
-
title: "Translate items with the site's AI engine (deprecated)",
|
|
232
|
-
description:
|
|
233
|
-
'DEPRECATED — prefer translate_set, which takes these same items as `selector.targets` (or a ' +
|
|
234
|
-
'whole `scope`), counts before it spends (`dry_run`) and finishes the set itself, by cursor or on ' +
|
|
235
|
-
'the queue. This tool keeps working exactly as before, for agents already built on it. It ' +
|
|
236
|
-
"translates items with the SITE'S OWN configured AI engine — its provider, prompts and " +
|
|
237
|
-
'glossary. `items`: [{id, kind}] (ids/kinds from list_items). AI output lands as DRAFTS unless ' +
|
|
238
|
-
'the site auto-approves. `capped: true` in the response means the per-request budget ran out ' +
|
|
239
|
-
'before every item was done: do not split and resend the list yourself — send the same items to ' +
|
|
240
|
-
'translate_set as `targets`; what is already translated is not paid for again. A LOCAL model ' +
|
|
241
|
-
'endpoint can take minutes per call. For translations you produced yourself use save_translations.',
|
|
242
|
-
method: 'POST',
|
|
243
|
-
route: 'translate-batch',
|
|
244
|
-
input: z.object( {
|
|
245
|
-
items: z
|
|
246
|
-
.array(
|
|
247
|
-
z.object({
|
|
248
|
-
id: z.union( [ z.string(), z.number() ] ),
|
|
249
|
-
kind: z.enum( [ 'post', 'term', 'menu', 'form', 'loop', 'string' ] ).optional().describe('default post'),
|
|
250
|
-
})
|
|
251
|
-
)
|
|
252
|
-
.max(500),
|
|
253
|
-
lang: z.string().describe('target language code'),
|
|
254
|
-
force: z.boolean().optional().describe('re-translate strings that already have a translation'),
|
|
255
|
-
} ),
|
|
256
|
-
},
|
|
257
236
|
{
|
|
258
237
|
name: 'translate_set',
|
|
259
238
|
title: "Translate a set with the site's AI engine",
|
|
@@ -361,6 +340,29 @@ export const TOOLS = [
|
|
|
361
340
|
id: z.string().optional().describe( 'a job id from translate_set `jobs[].id`; omit to list the live jobs' ),
|
|
362
341
|
} ),
|
|
363
342
|
},
|
|
343
|
+
{
|
|
344
|
+
name: 'keep_original',
|
|
345
|
+
title: 'Keep a text in its original',
|
|
346
|
+
description:
|
|
347
|
+
'Mark a SET of texts as needing no translation (a brand, a wine, a product name): every language ' +
|
|
348
|
+
'then serves the original as written, no count shows them as pending, and neither the AI nor an ' +
|
|
349
|
+
'import translates them. The mark belongs to the text, not to a language: `langs` only has to be ' +
|
|
350
|
+
'valid. `locked: false` takes it off, and the text is translated again. item_strings says `locked` ' +
|
|
351
|
+
'for a marked text. Use it instead of saving a translation identical to the source. ' +
|
|
352
|
+
'(1) Call with `dry_run: true` FIRST and tell the user `strings` (texts whose mark would change) ' +
|
|
353
|
+
'and `refused[]`. (2) Call with the SAME selector and no `dry_run`; while `done` is false, call ' +
|
|
354
|
+
'again with the SAME selector and the returned `cursor`. What was NOT marked arrives by identity ' +
|
|
355
|
+
'in `refused[]` — relay it: `approve_tier` (a site-wide text an editor must mark), `forbidden`, ' +
|
|
356
|
+
'`not_found`. A text already in the asked state is not a refusal.',
|
|
357
|
+
method: 'POST',
|
|
358
|
+
route: 'keep-original',
|
|
359
|
+
input: z.object( {
|
|
360
|
+
selector: SELECTOR,
|
|
361
|
+
dry_run: DRY_RUN,
|
|
362
|
+
cursor: CURSOR,
|
|
363
|
+
locked: z.boolean().optional().describe( 'default true; false takes the mark off' ),
|
|
364
|
+
} ),
|
|
365
|
+
},
|
|
364
366
|
];
|
|
365
367
|
|
|
366
368
|
/** One honest error result: the agent should relay this, not retry blindly. */
|
|
@@ -377,13 +379,6 @@ function nextStep( tool, body ) {
|
|
|
377
379
|
if ( ! body || 'object' !== typeof body ) {
|
|
378
380
|
return '';
|
|
379
381
|
}
|
|
380
|
-
if ( 'translate_batch' === tool.name && true === body.capped ) {
|
|
381
|
-
return (
|
|
382
|
-
'NOTE capped: true — the per-request AI budget ran out before every item was done. Do not split ' +
|
|
383
|
-
'the list yourself: send the same items to translate_set as `selector.targets` (dry_run first); ' +
|
|
384
|
-
'what is already translated is not paid for again.'
|
|
385
|
-
);
|
|
386
|
-
}
|
|
387
382
|
const stopped = body.stopped ? ` stopped (${ body.stopped.reason }): ${ body.stopped.message } Tell the user.` : '';
|
|
388
383
|
if ( 'queue' === body.mode && Array.isArray( body.jobs ) ) {
|
|
389
384
|
return (
|
|
@@ -477,7 +472,7 @@ export async function callTool( tool, args, env ) {
|
|
|
477
472
|
return err(
|
|
478
473
|
`The site has no route for ${ tool.name } (404 rest_no_route): Zerø Lingua is inactive there, or ` +
|
|
479
474
|
'older than this client — translate_set, approve_set and queue_status need Zerø Lingua 0.8.0 or ' +
|
|
480
|
-
'later. Tell the user; until they update, use approve_item and
|
|
475
|
+
'later. Tell the user; until they update, use approve_item and save_translations.'
|
|
481
476
|
);
|
|
482
477
|
}
|
|
483
478
|
if ( 429 === response.status ) {
|