@zerolingua/mcp 0.1.0 → 0.2.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 -0
- package/index.js +22 -11
- package/package.json +4 -4
- package/tools.js +12 -12
package/README.md
CHANGED
|
@@ -57,6 +57,12 @@ unaffected.
|
|
|
57
57
|
| `approve_item` | sign off a post + language (the review gate) |
|
|
58
58
|
| `translate_batch` | translate with the site's own configured AI engine |
|
|
59
59
|
|
|
60
|
+
## Protocol
|
|
61
|
+
|
|
62
|
+
Speaks MCP revision **2026-07-28** (the stateless core) via SDK v2, and still
|
|
63
|
+
serves hosts that open with the 2025-era `initialize` handshake — the same tool
|
|
64
|
+
map backs both, so no host is left behind while the ecosystem moves.
|
|
65
|
+
|
|
60
66
|
## Safety model
|
|
61
67
|
|
|
62
68
|
Agent writes land as **drafts behind the review gate** — nothing serves
|
package/index.js
CHANGED
|
@@ -6,10 +6,14 @@
|
|
|
6
6
|
* every tool is one HTTP call, authenticated with the user's own WordPress
|
|
7
7
|
* Application Password. All validation, authorization and the review gate live
|
|
8
8
|
* server-side; see tools.js for the tool map and README.md for setup.
|
|
9
|
+
*
|
|
10
|
+
* Speaks the 2026-07-28 protocol revision through SDK v2 — and, because
|
|
11
|
+
* serveStdio defaults to `legacy: 'serve'`, still speaks the 2025 era to hosts
|
|
12
|
+
* that open with `initialize`. One tool map, both eras, no branch of ours.
|
|
9
13
|
*/
|
|
10
14
|
|
|
11
|
-
import { McpServer } from '@modelcontextprotocol/
|
|
12
|
-
import {
|
|
15
|
+
import { McpServer } from '@modelcontextprotocol/server';
|
|
16
|
+
import { serveStdio } from '@modelcontextprotocol/server/stdio';
|
|
13
17
|
import { TOOLS, callTool } from './tools.js';
|
|
14
18
|
|
|
15
19
|
const env = {
|
|
@@ -27,14 +31,21 @@ if ( missing.length ) {
|
|
|
27
31
|
process.exit( 1 );
|
|
28
32
|
}
|
|
29
33
|
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
)
|
|
34
|
+
/**
|
|
35
|
+
* One server per connection, built on demand. The factory is what lets a
|
|
36
|
+
* single definition serve both protocol eras: serveStdio decides the era from
|
|
37
|
+
* the opening exchange and pins one instance to it.
|
|
38
|
+
*/
|
|
39
|
+
function buildServer() {
|
|
40
|
+
const server = new McpServer( { name: 'zero-lingua', version: '0.2.0' } );
|
|
41
|
+
for ( const tool of TOOLS ) {
|
|
42
|
+
server.registerTool(
|
|
43
|
+
tool.name,
|
|
44
|
+
{ title: tool.title, description: tool.description, inputSchema: tool.input },
|
|
45
|
+
async ( args ) => callTool( tool, args ?? {}, env )
|
|
46
|
+
);
|
|
47
|
+
}
|
|
48
|
+
return server;
|
|
38
49
|
}
|
|
39
50
|
|
|
40
|
-
|
|
51
|
+
serveStdio( () => buildServer() );
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zerolingua/mcp",
|
|
3
|
-
"version": "0.
|
|
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.",
|
|
3
|
+
"version": "0.2.0",
|
|
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
|
"bin": {
|
|
7
7
|
"zero-lingua-mcp": "index.js"
|
|
@@ -28,8 +28,8 @@
|
|
|
28
28
|
},
|
|
29
29
|
"homepage": "https://zerolingua.studio",
|
|
30
30
|
"dependencies": {
|
|
31
|
-
"@modelcontextprotocol/
|
|
32
|
-
"zod": "^
|
|
31
|
+
"@modelcontextprotocol/server": "^2.0.0",
|
|
32
|
+
"zod": "^4.4.3"
|
|
33
33
|
},
|
|
34
34
|
"license": "GPL-2.0-or-later"
|
|
35
35
|
}
|
package/tools.js
CHANGED
|
@@ -31,7 +31,7 @@ export const TOOLS = [
|
|
|
31
31
|
WORKFLOW,
|
|
32
32
|
method: 'GET',
|
|
33
33
|
route: 'site-status',
|
|
34
|
-
input: {},
|
|
34
|
+
input: z.object( {} ),
|
|
35
35
|
},
|
|
36
36
|
{
|
|
37
37
|
name: 'pending_overview',
|
|
@@ -44,7 +44,7 @@ export const TOOLS = [
|
|
|
44
44
|
"Use this to answer “what's left to do, where?”.",
|
|
45
45
|
method: 'GET',
|
|
46
46
|
route: 'pending-overview',
|
|
47
|
-
input: {},
|
|
47
|
+
input: z.object( {} ),
|
|
48
48
|
},
|
|
49
49
|
{
|
|
50
50
|
name: 'list_items',
|
|
@@ -56,12 +56,12 @@ export const TOOLS = [
|
|
|
56
56
|
'`search` filters by title. Each item carries `id` and `kind` — pass those to item_strings.',
|
|
57
57
|
method: 'GET',
|
|
58
58
|
route: 'list-items',
|
|
59
|
-
input: {
|
|
59
|
+
input: z.object( {
|
|
60
60
|
type: z.string().describe('page | wp_template | wp_block | json-loops | strings | a public post-type slug'),
|
|
61
61
|
offset: z.number().int().min(0).optional(),
|
|
62
62
|
limit: z.number().int().min(1).max(100).optional().describe('default 30, max 100'),
|
|
63
63
|
search: z.string().optional().describe('title filter'),
|
|
64
|
-
},
|
|
64
|
+
} ),
|
|
65
65
|
},
|
|
66
66
|
{
|
|
67
67
|
name: 'item_strings',
|
|
@@ -74,10 +74,10 @@ export const TOOLS = [
|
|
|
74
74
|
'wrapped in ⟦ ⟧ (dynamic values, inline markup) — they must survive translation exactly.',
|
|
75
75
|
method: 'GET',
|
|
76
76
|
route: 'item-strings',
|
|
77
|
-
input: {
|
|
77
|
+
input: z.object( {
|
|
78
78
|
id: z.string().describe('post/component ID, loop id, or the string hash itself'),
|
|
79
79
|
kind: z.enum( [ 'post', 'component', 'loop', 'string' ] ).optional().describe('default post'),
|
|
80
|
-
},
|
|
80
|
+
} ),
|
|
81
81
|
},
|
|
82
82
|
{
|
|
83
83
|
name: 'save_translations',
|
|
@@ -92,7 +92,7 @@ export const TOOLS = [
|
|
|
92
92
|
'refused it (placeholder mismatch, rights, unknown hash), not a partial success.',
|
|
93
93
|
method: 'POST',
|
|
94
94
|
route: 'save-translations',
|
|
95
|
-
input: {
|
|
95
|
+
input: z.object( {
|
|
96
96
|
lang: z.string().optional().describe('default target language for entries that omit lang'),
|
|
97
97
|
entries: z
|
|
98
98
|
.array(
|
|
@@ -104,7 +104,7 @@ export const TOOLS = [
|
|
|
104
104
|
)
|
|
105
105
|
.min(1)
|
|
106
106
|
.max(500),
|
|
107
|
-
},
|
|
107
|
+
} ),
|
|
108
108
|
},
|
|
109
109
|
{
|
|
110
110
|
name: 'approve_item',
|
|
@@ -116,10 +116,10 @@ export const TOOLS = [
|
|
|
116
116
|
'and counted in `skipped`, never silently — a human with broader rights finishes those in the panel.',
|
|
117
117
|
method: 'POST',
|
|
118
118
|
route: 'approve-item',
|
|
119
|
-
input: {
|
|
119
|
+
input: z.object( {
|
|
120
120
|
post_id: z.number().int().describe('the post whose drafts to approve'),
|
|
121
121
|
lang: z.string().describe('target language code'),
|
|
122
|
-
},
|
|
122
|
+
} ),
|
|
123
123
|
},
|
|
124
124
|
{
|
|
125
125
|
name: 'translate_batch',
|
|
@@ -133,7 +133,7 @@ export const TOOLS = [
|
|
|
133
133
|
'endpoint can take minutes per call. For translations you produced yourself use save_translations.',
|
|
134
134
|
method: 'POST',
|
|
135
135
|
route: 'translate-batch',
|
|
136
|
-
input: {
|
|
136
|
+
input: z.object( {
|
|
137
137
|
items: z
|
|
138
138
|
.array(
|
|
139
139
|
z.object({
|
|
@@ -144,7 +144,7 @@ export const TOOLS = [
|
|
|
144
144
|
.max(500),
|
|
145
145
|
lang: z.string().describe('target language code'),
|
|
146
146
|
force: z.boolean().optional().describe('re-translate strings that already have a translation'),
|
|
147
|
-
},
|
|
147
|
+
} ),
|
|
148
148
|
},
|
|
149
149
|
];
|
|
150
150
|
|