@zerolingua/mcp 0.4.2 → 0.5.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 +16 -4
- package/index.js +1 -1
- package/package.json +1 -1
- package/tools.js +83 -14
package/README.md
CHANGED
|
@@ -64,10 +64,13 @@ The server needs **Node.js 20** or later, as the MCP SDK v2 it runs on does.
|
|
|
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
|
+
| `get_settings` | read writing style (all roles) or non-secret site settings (admin), with optional text sample |
|
|
68
|
+
| `update_settings` | adjust writing style: site brief, formality, per-language tone and glossary (admin, dry run first) |
|
|
67
69
|
|
|
68
70
|
`translate_set`, `approve_set` and `queue_status` need **Zerø Lingua 0.8.0** or
|
|
69
|
-
later on the site
|
|
70
|
-
|
|
71
|
+
later on the site, `keep_original` needs **0.11.2**, and `get_settings` /
|
|
72
|
+
`update_settings` need **0.16.0**; against an older plugin they answer
|
|
73
|
+
`404 rest_no_route`, and the others keep working.
|
|
71
74
|
|
|
72
75
|
## Working with sets
|
|
73
76
|
|
|
@@ -116,7 +119,11 @@ map backs both, so no host is left behind while the ecosystem moves.
|
|
|
116
119
|
|
|
117
120
|
Agent writes land as **drafts behind the review gate** — nothing serves
|
|
118
121
|
publicly until a human (or an agent with publish rights on that content)
|
|
119
|
-
approves it.
|
|
122
|
+
approves it. If the site publishes AI without review (Settings → automation,
|
|
123
|
+
everywhere or for that content's type), what an agent saves serves at once but
|
|
124
|
+
stays «to approve · live»: what an agent saves is never approved (approving
|
|
125
|
+
is its own tool). Saving the same text again changes nothing, and a translation
|
|
126
|
+
a person locked is refused (`skipped_why`: `translation_locked`). Placeholders wrapped in ⟦ ⟧ and inline markup (a link, a bold) are
|
|
120
127
|
guarded server-side: an entry that drops, adds or repoints one is skipped, never
|
|
121
128
|
saved broken. All authorization is the server's:
|
|
122
129
|
this process holds zero domain logic and zero secrets — it is one HTTP call per
|
|
@@ -124,8 +131,13 @@ tool, authenticated with the user's own Application Password.
|
|
|
124
131
|
|
|
125
132
|
## Versions
|
|
126
133
|
|
|
134
|
+
- **0.5.0** (Zerø Lingua 0.16.0): `get_settings` and `update_settings`. Translators can read the writing style (site brief, formality, per-language tone, glossary); administrators can read all non-secret settings (plus an optional 12-text sample) and patch those five writing-style fields with `dry_run: true` first and an undoable `previous` patch. API keys, endpoints, licence, privacy and agent settings are never returned or writable.
|
|
135
|
+
- **0.4.3** — the tools say what Zerø Lingua 0.13 does: `translate_set` with `force` never
|
|
136
|
+
re-translates what a person wrote or locked; a save an agent sends with the same text writes
|
|
137
|
+
nothing; a locked text is refused as `translation_locked`, and `skipped_why` names each refusal.
|
|
127
138
|
- **0.4.2** — `status` takes `to_approve` (Zerø Lingua 0.13): `needs_review` plus what is
|
|
128
|
-
live and read by nobody, the set «approve» signs.
|
|
139
|
+
live and read by nobody, the set «approve» signs. With AI published without review
|
|
140
|
+
(everywhere or for the content's type), a save serves «to approve · live», never approved.
|
|
129
141
|
- **0.4.1** — the tools say what Zerø Lingua 0.12.1 does: what an agent saves
|
|
130
142
|
stays a draft unless the site publishes AI without review everywhere
|
|
131
143
|
(Settings → automation), and a sentence whose ⟦0⟧ changes the word before it
|
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.5.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.5.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
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* The
|
|
2
|
+
* The twelve Zerø Lingua tools: their schemas, their teaching descriptions, and
|
|
3
3
|
* the one HTTP call each of them is.
|
|
4
4
|
*
|
|
5
5
|
* This process holds ZERO domain logic on purpose. Placeholder guarding, the
|
|
@@ -97,6 +97,12 @@ const CURSOR = z
|
|
|
97
97
|
.optional()
|
|
98
98
|
.describe( 'the `cursor` of the previous answer of this run; send it with the SAME selector' );
|
|
99
99
|
|
|
100
|
+
/** The three registers a language takes: '' inherits the site's, as get_settings shows. */
|
|
101
|
+
const FORMALITY = z.enum( [ '', 'formal', 'informal' ] );
|
|
102
|
+
|
|
103
|
+
/** One level of an update_settings patch: the known keys described, any other one still sent, so the server names it. */
|
|
104
|
+
const open = ( shape ) => z.object( shape ).catchall( z.unknown() );
|
|
105
|
+
|
|
100
106
|
export const TOOLS = [
|
|
101
107
|
{
|
|
102
108
|
name: 'site_status',
|
|
@@ -120,7 +126,8 @@ export const TOOLS = [
|
|
|
120
126
|
'vocabulary — `translated`, `needs_review`, `in_progress`, `not_translated` — which are the words a ' +
|
|
121
127
|
"selector's `status` takes in translate_set and approve_set. An item with nothing to translate in a " +
|
|
122
128
|
'language (only locked texts, figures with a unit or machine values, or a language it does not exist ' +
|
|
123
|
-
'in) is counted in `items.none` and in no word.
|
|
129
|
+
'in) is counted in `items.none` and in no word. Only approved text serves (an AI text the owner publishes ' +
|
|
130
|
+
'without review counts as approved here), so ' +
|
|
124
131
|
'`needs_review` work is NOT live yet. The scan is bounded: when `scanned.complete` is false, drill ' +
|
|
125
132
|
"into list_items per type for the rest. Use this to answer “what's left to do, where?”.",
|
|
126
133
|
method: 'GET',
|
|
@@ -187,12 +194,14 @@ export const TOOLS = [
|
|
|
187
194
|
'order, with the same attributes — adding, repointing or dropping one gets the entry skipped. ' +
|
|
188
195
|
'Saves land as DRAFTS behind the review gate: nothing new serves publicly until approve_item or ' +
|
|
189
196
|
'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
|
|
191
|
-
'
|
|
197
|
+
'then — unless the site owner chose «publish AI without review» (settings → automation) everywhere or ' +
|
|
198
|
+
'for the type of every page holding the text: then a save serves at once, marked «to approve · live» ' +
|
|
199
|
+
'(nobody has read it). The response\'s `review` says which: "approved" only when every saved ' +
|
|
192
200
|
'entry is live, "draft" otherwise; never treat a save as published without it. The ' +
|
|
193
201
|
'response reports `saved` and `skipped` honestly, and `skipped_at` lists the indexes of the ' +
|
|
194
|
-
'skipped entries; skipped means a guard refused it
|
|
195
|
-
'
|
|
202
|
+
'skipped entries, `skipped_why` the reason of each by index; skipped means a guard refused it ' +
|
|
203
|
+
'(placeholder or markup mismatch, rights, unknown hash, `translation_locked`: a person locked that ' +
|
|
204
|
+
'translation), not a partial success. Saving the same text again changes nothing. A text that needs no translation (a brand, a wine, a name) ' +
|
|
196
205
|
'is never saved as a copy of its source: mark it with keep_original.',
|
|
197
206
|
method: 'POST',
|
|
198
207
|
route: 'save-translations',
|
|
@@ -262,12 +271,12 @@ export const TOOLS = [
|
|
|
262
271
|
'listing up to 200, with the whole count in `refused_total` where the answer has one — relay it, ' +
|
|
263
272
|
'do not retry it: `not_found`, `forbidden` (you ' +
|
|
264
273
|
'cannot edit that post), `translate_tier` (a string shared beyond your rights), ' +
|
|
265
|
-
'`
|
|
274
|
+
'`answer_refused` (the engine answered but lost a mark or a ' +
|
|
266
275
|
'link of the original, so nothing was placed; `text` is the opening of its source, for the user to ' +
|
|
267
276
|
'find it and translate it by hand). A string that is already translated is not a refusal: it ' +
|
|
268
|
-
'is simply not sent again. `force: true` re-translates existing translations
|
|
269
|
-
'mode
|
|
270
|
-
'translations as they are
|
|
277
|
+
'is simply not sent again. `force: true` re-translates existing translations (in request ' +
|
|
278
|
+
'mode; over a whole `scope.type` it is queued) and always leaves locked and human-written ' +
|
|
279
|
+
'translations as they are: the dry-run counts them in `spared`. AI output lands as ' +
|
|
271
280
|
'DRAFTS unless the site auto-approves — sign it off with approve_item / approve_set. For ' +
|
|
272
281
|
'translations you produced yourself use save_translations.',
|
|
273
282
|
method: 'POST',
|
|
@@ -279,7 +288,7 @@ export const TOOLS = [
|
|
|
279
288
|
force: z
|
|
280
289
|
.boolean()
|
|
281
290
|
.optional()
|
|
282
|
-
.describe( 're-translate strings that already have a translation;
|
|
291
|
+
.describe( 're-translate strings that already have a translation, never the locked or human-written ones; in request mode, except a whole `scope.type`' ),
|
|
283
292
|
} ),
|
|
284
293
|
},
|
|
285
294
|
{
|
|
@@ -329,9 +338,9 @@ export const TOOLS = [
|
|
|
329
338
|
'the site\'s per-action ceiling), or `unknown` — neither in the queue nor among the last 20 ' +
|
|
330
339
|
'finished jobs. `unknown` cannot tell a job that never existed from one that was cleared or one ' +
|
|
331
340
|
'that finished long ago: it is neither success nor failure, so read the result in ' +
|
|
332
|
-
'pending_overview or list_items. Without `id`: `jobs[]` ({id, lang}) lists
|
|
341
|
+
'pending_overview or list_items. Without `id`: `jobs[]` ({id, lang}) lists your live set jobs (all for administrators); foreign jobs return `unknown`. ' +
|
|
333
342
|
'Every answer carries `queue` (the AI queue — a non-empty `stopped`, with its `cause`, means it is ' +
|
|
334
|
-
'paused: tell the user) and `budget` (the
|
|
343
|
+
'paused: tell the user) and `budget` (only `over`, or the full meter for administrators). Queued work runs in the background and ' +
|
|
335
344
|
'the provider\'s batch mode can take hours: poll at a relaxed pace, never in a tight loop, and ' +
|
|
336
345
|
'never re-send translate_set to hurry it.',
|
|
337
346
|
method: 'GET',
|
|
@@ -363,6 +372,66 @@ export const TOOLS = [
|
|
|
363
372
|
locked: z.boolean().optional().describe( 'default true; false takes the mark off' ),
|
|
364
373
|
} ),
|
|
365
374
|
},
|
|
375
|
+
{
|
|
376
|
+
name: 'get_settings',
|
|
377
|
+
title: 'Read the writing style and settings',
|
|
378
|
+
description:
|
|
379
|
+
'How this site wants its translations written. Every translator reads the writing style: `ai.context` ' +
|
|
380
|
+
'(the site brief sent with every AI translation), `ai.formality`, each language\'s `formality` and `tone` ' +
|
|
381
|
+
'in `languages[]` (an empty `formality` inherits `ai.formality`) and the `glossary` (`keep`: terms never ' +
|
|
382
|
+
'translated; `terms`: a preferred translation per language). The answer depends on your role, so read ' +
|
|
383
|
+
'`tier`: `translator` gets only that style; `admin` also gets every other setting an agent may read ' +
|
|
384
|
+
'(languages, URLs, switcher, content, the AI engine without its keys, automation), `writable` (what ' +
|
|
385
|
+
'update_settings accepts, with its limits) and `pinned` (what a wp-config constant or a filter fixes). ' +
|
|
386
|
+
'`can_update` says whether update_settings is open to you. `only` narrows an admin answer to some groups, ' +
|
|
387
|
+
'for example ["ai","glossary"]. `sample: true` (admin) adds up to 12 recent texts of the site: read them ' +
|
|
388
|
+
'to learn its voice before you propose a brief or a tone. API keys, endpoints, licence, privacy and agent ' +
|
|
389
|
+
'settings are never returned.',
|
|
390
|
+
method: 'GET',
|
|
391
|
+
route: 'settings',
|
|
392
|
+
input: z.object( {
|
|
393
|
+
only: z.array( z.string() ).optional().describe( 'admin: the groups to return, such as ["ai","languages","glossary"]; omit for all' ),
|
|
394
|
+
sample: z.boolean().optional().describe( 'admin: add up to 12 recent texts of the site, to read its voice' ),
|
|
395
|
+
} ),
|
|
396
|
+
},
|
|
397
|
+
{
|
|
398
|
+
name: 'update_settings',
|
|
399
|
+
title: 'Adjust the writing style',
|
|
400
|
+
description:
|
|
401
|
+
'Adjust how the site\'s AI engine and its agents write FUTURE translations: the site brief, the formality, ' +
|
|
402
|
+
'the tone of each language and the glossary. Existing translations stay as they are; to redo them, use ' +
|
|
403
|
+
'translate_set. Administrators only; through Remote MCP the connection also needs the `zl:configure` ' +
|
|
404
|
+
'permission. `patch` is a merge patch in the shape get_settings reads: {"ai": {"context": "...", ' +
|
|
405
|
+
'"formality": "formal"}, "languages": {"es": {"formality": "informal", "tone": "..."}}, "glossary": ' +
|
|
406
|
+
'{"keep": {"Brand": true}, "terms": {"Read more": {"es": "Leer más"}}}}. In the glossary `null` deletes ' +
|
|
407
|
+
'a term, or one language of it (at most 20 deletions per call). Only those five settings are writable: ' +
|
|
408
|
+
'any other path is refused by name (`setting_read_only` says where a person changes it, ' +
|
|
409
|
+
'`setting_forbidden`, `setting_unknown`, `invalid_value`), and one refusal writes nothing. ' +
|
|
410
|
+
'(1) Call with `dry_run: true` FIRST and show the user `changed[]` ({path, from, to}). (2) Call again ' +
|
|
411
|
+
'without `dry_run`. Keep `previous`: sent back as `patch`, it undoes the call.',
|
|
412
|
+
method: 'POST',
|
|
413
|
+
route: 'settings',
|
|
414
|
+
input: z.object( {
|
|
415
|
+
patch: open( {
|
|
416
|
+
ai: open( {
|
|
417
|
+
context: z.string().optional().describe( 'the site brief: who the site is for, its voice, what to avoid' ),
|
|
418
|
+
formality: FORMALITY.optional(),
|
|
419
|
+
} ).optional(),
|
|
420
|
+
languages: z
|
|
421
|
+
.record( z.string(), open( { formality: FORMALITY.optional(), tone: z.string().optional() } ) )
|
|
422
|
+
.optional()
|
|
423
|
+
.describe( 'by language code from site_status' ),
|
|
424
|
+
glossary: open( {
|
|
425
|
+
keep: z.record( z.string(), z.boolean().nullable() ).optional().describe( 'term => true keeps it as written; null takes it off' ),
|
|
426
|
+
terms: z
|
|
427
|
+
.record( z.string(), z.record( z.string(), z.string().nullable() ).nullable() )
|
|
428
|
+
.optional()
|
|
429
|
+
.describe( 'term => {code: preferred translation}; null deletes the term or that language' ),
|
|
430
|
+
} ).optional(),
|
|
431
|
+
} ).describe( 'only the settings to change' ),
|
|
432
|
+
dry_run: z.boolean().optional().describe( 'true = say what would change and write nothing' ),
|
|
433
|
+
} ),
|
|
434
|
+
},
|
|
366
435
|
];
|
|
367
436
|
|
|
368
437
|
/** One honest error result: the agent should relay this, not retry blindly. */
|
|
@@ -459,7 +528,7 @@ export async function callTool( tool, args, env ) {
|
|
|
459
528
|
if ( 403 === response.status && 'license_required' === code ) {
|
|
460
529
|
return err(
|
|
461
530
|
`This site's Zerø Lingua license is not active, and the MCP surface is a Pro feature. ${ message } ` +
|
|
462
|
-
'Tell the user to activate their license in
|
|
531
|
+
'Tell the user to activate their license in Open console → settings → license & privacy — do not retry until they have.'
|
|
463
532
|
);
|
|
464
533
|
}
|
|
465
534
|
if ( 403 === response.status ) {
|