@zerolingua/mcp 0.3.1 → 0.4.0
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 +6 -2
- package/index.js +1 -1
- package/package.json +1 -1
- package/tools.js +27 -38
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,10 @@ tool, authenticated with the user's own Application Password.
|
|
|
123
123
|
|
|
124
124
|
## Versions
|
|
125
125
|
|
|
126
|
+
- **0.4.0** — `keep_original`: a brand or a name is marked «keep original»
|
|
127
|
+
instead of saved as a copy of its source (needs Zerø Lingua 0.11.2).
|
|
128
|
+
`translate_batch`, deprecated since 0.3.0, is gone: Zerø Lingua 0.12 removed
|
|
129
|
+
its route. Use `translate_set` with the same items as `selector.targets`.
|
|
126
130
|
- **0.3.0** — the selector tools: `translate_set`, `approve_set` and
|
|
127
131
|
`queue_status` (they need Zerø Lingua 0.8.0). `translate_batch` is deprecated
|
|
128
132
|
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.0' } );
|
|
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.0",
|
|
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' ];
|
|
@@ -186,7 +186,8 @@ export const TOOLS = [
|
|
|
186
186
|
'approve_set (or a human in the panel) signs it off — never treat a save as published. The ' +
|
|
187
187
|
'response reports `saved` and `skipped` honestly, and `skipped_at` lists the indexes of the ' +
|
|
188
188
|
'skipped entries; skipped means a guard refused it (placeholder or markup mismatch, rights, ' +
|
|
189
|
-
'unknown hash), not a partial success.'
|
|
189
|
+
'unknown hash), not a partial success. A text that needs no translation (a brand, a wine, a name) ' +
|
|
190
|
+
'is never saved as a copy of its source: mark it with keep_original.',
|
|
190
191
|
method: 'POST',
|
|
191
192
|
route: 'save-translations',
|
|
192
193
|
input: z.object( {
|
|
@@ -226,34 +227,6 @@ export const TOOLS = [
|
|
|
226
227
|
lang: z.string().describe('target language code'),
|
|
227
228
|
} ),
|
|
228
229
|
},
|
|
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
230
|
{
|
|
258
231
|
name: 'translate_set',
|
|
259
232
|
title: "Translate a set with the site's AI engine",
|
|
@@ -361,6 +334,29 @@ export const TOOLS = [
|
|
|
361
334
|
id: z.string().optional().describe( 'a job id from translate_set `jobs[].id`; omit to list the live jobs' ),
|
|
362
335
|
} ),
|
|
363
336
|
},
|
|
337
|
+
{
|
|
338
|
+
name: 'keep_original',
|
|
339
|
+
title: 'Keep a text in its original',
|
|
340
|
+
description:
|
|
341
|
+
'Mark a SET of texts as needing no translation (a brand, a wine, a product name): every language ' +
|
|
342
|
+
'then serves the original as written, no count shows them as pending, and neither the AI nor an ' +
|
|
343
|
+
'import translates them. The mark belongs to the text, not to a language: `langs` only has to be ' +
|
|
344
|
+
'valid. `locked: false` takes it off, and the text is translated again. item_strings says `locked` ' +
|
|
345
|
+
'for a marked text. Use it instead of saving a translation identical to the source. ' +
|
|
346
|
+
'(1) Call with `dry_run: true` FIRST and tell the user `strings` (texts whose mark would change) ' +
|
|
347
|
+
'and `refused[]`. (2) Call with the SAME selector and no `dry_run`; while `done` is false, call ' +
|
|
348
|
+
'again with the SAME selector and the returned `cursor`. What was NOT marked arrives by identity ' +
|
|
349
|
+
'in `refused[]` — relay it: `approve_tier` (a site-wide text an editor must mark), `forbidden`, ' +
|
|
350
|
+
'`not_found`. A text already in the asked state is not a refusal.',
|
|
351
|
+
method: 'POST',
|
|
352
|
+
route: 'keep-original',
|
|
353
|
+
input: z.object( {
|
|
354
|
+
selector: SELECTOR,
|
|
355
|
+
dry_run: DRY_RUN,
|
|
356
|
+
cursor: CURSOR,
|
|
357
|
+
locked: z.boolean().optional().describe( 'default true; false takes the mark off' ),
|
|
358
|
+
} ),
|
|
359
|
+
},
|
|
364
360
|
];
|
|
365
361
|
|
|
366
362
|
/** One honest error result: the agent should relay this, not retry blindly. */
|
|
@@ -377,13 +373,6 @@ function nextStep( tool, body ) {
|
|
|
377
373
|
if ( ! body || 'object' !== typeof body ) {
|
|
378
374
|
return '';
|
|
379
375
|
}
|
|
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
376
|
const stopped = body.stopped ? ` stopped (${ body.stopped.reason }): ${ body.stopped.message } Tell the user.` : '';
|
|
388
377
|
if ( 'queue' === body.mode && Array.isArray( body.jobs ) ) {
|
|
389
378
|
return (
|
|
@@ -477,7 +466,7 @@ export async function callTool( tool, args, env ) {
|
|
|
477
466
|
return err(
|
|
478
467
|
`The site has no route for ${ tool.name } (404 rest_no_route): Zerø Lingua is inactive there, or ` +
|
|
479
468
|
'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
|
|
469
|
+
'later. Tell the user; until they update, use approve_item and save_translations.'
|
|
481
470
|
);
|
|
482
471
|
}
|
|
483
472
|
if ( 429 === response.status ) {
|