lingual-mcp 0.0.0-stage → 0.1.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/LICENSE +21 -0
- package/README.md +83 -2
- package/bin/lingual-mcp.js +8 -0
- package/dist/index.cjs +552 -0
- package/dist/index.d.cts +27 -0
- package/dist/index.d.ts +27 -0
- package/dist/index.js +534 -0
- package/package.json +64 -4
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Jason Song
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,3 +1,84 @@
|
|
|
1
|
-
#
|
|
1
|
+
# lingual-mcp
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Model Context Protocol server for [`pi-lingual`](https://github.com/3ZEROS12/pi-lingual): the same mode engine, reachable from any MCP client.
|
|
4
|
+
|
|
5
|
+
Works with **Claude Code**, **Claude Desktop**, **Cursor**, **Windsurf**, **Cline**, and anything else that speaks MCP. Two run modes: **template mode** (no API key — the client's own model executes the compiled prompt) and **endpoint mode** (the server calls an OpenAI-compatible endpoint).
|
|
6
|
+
|
|
7
|
+
## Install
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
npm install -g lingual-mcp # or: npx -y lingual-mcp
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
Point the client at it:
|
|
14
|
+
|
|
15
|
+
```json
|
|
16
|
+
{
|
|
17
|
+
"mcpServers": {
|
|
18
|
+
"lingual": {
|
|
19
|
+
"command": "npx",
|
|
20
|
+
"args": ["-y", "lingual-mcp"]
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
From a checkout instead:
|
|
27
|
+
|
|
28
|
+
```json
|
|
29
|
+
{
|
|
30
|
+
"mcpServers": {
|
|
31
|
+
"lingual": {
|
|
32
|
+
"command": "node",
|
|
33
|
+
"args": ["D:/Workspace/projects/active/lingual-mcp/bin/lingual-mcp.js"]
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
## Tools
|
|
40
|
+
|
|
41
|
+
| Tool | Arguments | Purpose |
|
|
42
|
+
| :--- | :--- | :--- |
|
|
43
|
+
| `lingual_transform_spec` | `text`, `loadout`, `sourceLang?`, `targetLang?`, `reasoning?`, `context?`, `includeVocab?` | Compiles a draft into a preset's product: `spec`, `commit`, `oss`, `yap`, `direct`, or any custom mode id. Code fences and stack traces stay untouched. |
|
|
44
|
+
| `lingual_bilingual_companion` | `text`, `sourceLang?`, `targetLang?`, `reasoning?`, `includeVocab?` | Dual-register phrasing (spoken vs. written), native nuance, and vocabulary callouts, using the companion slots from your `lingual.json`. |
|
|
45
|
+
| `lingual_prompt_template` | `loadout`, `sourceLang?`, `targetLang?`, `includeVocab?` | Returns the compiled system prompt and slot schema so the host agent can run it with its own model. |
|
|
46
|
+
|
|
47
|
+
Shared argument semantics:
|
|
48
|
+
|
|
49
|
+
- `loadout` accepts the five presets (`spec`, `commit`, `oss`, `yap`, `direct`), `companion` where it applies, and **any mode id declared in `~/.pi/agent/lingual.json`**. Custom ids are resolved at request time and offered in the tool schema.
|
|
50
|
+
- `reasoning` is one of `off`, `minimal`, `low`, `medium`, `high`. An explicit value overrides the level the mode pins (`spec` pins `low`, the rest pin `off`).
|
|
51
|
+
- `context` injects extra material for context-aware modes: a staged diff for `commit`, the previous turn for a review mode.
|
|
52
|
+
- `includeVocab: false` drops the vocabulary slot from both the prompt and the response.
|
|
53
|
+
- `sourceLang` is auto-detected from the script when omitted; `targetLang` defaults to `en`.
|
|
54
|
+
|
|
55
|
+
## Prompts
|
|
56
|
+
|
|
57
|
+
| Prompt | Arguments | Purpose |
|
|
58
|
+
| :--- | :--- | :--- |
|
|
59
|
+
| `spec_prompt` | `raw_idea`, `source_lang?`, `target_lang?` | Reusable prompt that structures a raw idea into a specification. |
|
|
60
|
+
| `conventional_commit` | `changes_summary`, `source_lang?`, `target_lang?` | Reusable prompt that turns a change summary into a Conventional Commit. |
|
|
61
|
+
|
|
62
|
+
Both are compiled through the same mode resolution, so a custom `spec` or `commit` mode in `lingual.json` changes what the prompts emit.
|
|
63
|
+
|
|
64
|
+
## Endpoint mode
|
|
65
|
+
|
|
66
|
+
Set any of these to let the server call a model itself:
|
|
67
|
+
|
|
68
|
+
| Variable | Description |
|
|
69
|
+
| :--- | :--- |
|
|
70
|
+
| `LINGUAL_ENDPOINT` / `OPENAI_BASE_URL` | OpenAI-compatible base URL (e.g. `https://api.openai.com/v1` or `http://127.0.0.1:3425/v1`) |
|
|
71
|
+
| `LINGUAL_API_KEY` / `OPENAI_API_KEY` | API key; loopback endpoints default to `"local"` when omitted |
|
|
72
|
+
| `LINGUAL_MODEL` / `OPENAI_MODEL` | Model id (default: `gpt-4o-mini`) |
|
|
73
|
+
|
|
74
|
+
`~/.pi/agent/lingual.json` is also read, so `endpoint`, `apiKey`, `model`, `explainLang`, `globalKillList`, and `modes` carry over from your Pi setup.
|
|
75
|
+
|
|
76
|
+
Without credentials, the transform and companion tools return `unconfigured_zero_key_fallback` with a `compiledSystemPrompt` field; `lingual_prompt_template` and the MCP prompts work with no key at all.
|
|
77
|
+
|
|
78
|
+
## Notes
|
|
79
|
+
|
|
80
|
+
- The server reports its `package.json` version in the MCP handshake.
|
|
81
|
+
- Requires `pi-lingual` `^0.9.0` for the core engine.
|
|
82
|
+
- `lingual-mcp` is not a Pi extension: it runs beside your editor's agent, not inside Pi.
|
|
83
|
+
|
|
84
|
+
MIT © [Jason Song](https://github.com/3ZEROS12)
|
package/dist/index.cjs
ADDED
|
@@ -0,0 +1,552 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
|
|
20
|
+
// src/index.ts
|
|
21
|
+
var index_exports = {};
|
|
22
|
+
__export(index_exports, {
|
|
23
|
+
applyModeOverrides: () => applyModeOverrides,
|
|
24
|
+
createLingualMcpServer: () => createLingualMcpServer,
|
|
25
|
+
normalizeReasoningArg: () => normalizeReasoningArg,
|
|
26
|
+
resolveMcpLlmConfig: () => resolveMcpLlmConfig,
|
|
27
|
+
resolveMode: () => resolveMode,
|
|
28
|
+
runLingualMcpServer: () => runLingualMcpServer,
|
|
29
|
+
stripVocabSlots: () => stripVocabSlots
|
|
30
|
+
});
|
|
31
|
+
module.exports = __toCommonJS(index_exports);
|
|
32
|
+
var import_node_module = require("module");
|
|
33
|
+
var import_server = require("@modelcontextprotocol/sdk/server/index.js");
|
|
34
|
+
var import_stdio = require("@modelcontextprotocol/sdk/server/stdio.js");
|
|
35
|
+
var import_types = require("@modelcontextprotocol/sdk/types.js");
|
|
36
|
+
var import_core = require("pi-lingual/core");
|
|
37
|
+
var import_meta = {};
|
|
38
|
+
var require2 = (0, import_node_module.createRequire)(import_meta.url);
|
|
39
|
+
var manifest = require2("../package.json");
|
|
40
|
+
var PKG_VERSION = typeof manifest.version === "string" ? manifest.version : "0.0.0";
|
|
41
|
+
var REASONING_LEVELS = ["off", "minimal", "low", "medium", "high"];
|
|
42
|
+
var PRESET_IDS = ["spec", "commit", "oss", "yap", "direct"];
|
|
43
|
+
function isLoopbackUrl(urlStr) {
|
|
44
|
+
try {
|
|
45
|
+
const parsed = new URL(urlStr);
|
|
46
|
+
return parsed.hostname === "127.0.0.1" || parsed.hostname === "localhost" || parsed.hostname === "::1";
|
|
47
|
+
} catch {
|
|
48
|
+
return false;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
function resolveMcpLlmConfig(diskConfig, env = process.env) {
|
|
52
|
+
const rawEndpoint = env.LINGUAL_ENDPOINT || env.OPENAI_BASE_URL || diskConfig.endpoint;
|
|
53
|
+
const rawApiKey = env.LINGUAL_API_KEY || env.OPENAI_API_KEY || diskConfig.apiKey;
|
|
54
|
+
const rawModel = env.LINGUAL_MODEL || env.OPENAI_MODEL || diskConfig.model;
|
|
55
|
+
if (!rawEndpoint && !rawApiKey) {
|
|
56
|
+
return { configured: false };
|
|
57
|
+
}
|
|
58
|
+
const base = (rawEndpoint || "https://api.openai.com/v1").replace(/\/+$/, "");
|
|
59
|
+
const endpoint = base.endsWith("/chat/completions") ? base : `${base}/chat/completions`;
|
|
60
|
+
const apiKey = rawApiKey || (isLoopbackUrl(endpoint) ? "local" : void 0);
|
|
61
|
+
if (!apiKey) {
|
|
62
|
+
return { configured: false };
|
|
63
|
+
}
|
|
64
|
+
return {
|
|
65
|
+
configured: true,
|
|
66
|
+
endpoint,
|
|
67
|
+
apiKey,
|
|
68
|
+
model: rawModel || "gpt-4o-mini"
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
function normalizeReasoningArg(raw) {
|
|
72
|
+
const value = typeof raw === "string" ? raw.trim().toLowerCase() : "";
|
|
73
|
+
return REASONING_LEVELS.includes(value) ? value : void 0;
|
|
74
|
+
}
|
|
75
|
+
function resolveMode(id, sourceLang, explainLang, custom) {
|
|
76
|
+
const wanted = (id || "").trim().toLowerCase();
|
|
77
|
+
if (!wanted) return null;
|
|
78
|
+
const userMode = (custom || []).find((mode) => mode.id.toLowerCase() === wanted && mode.enabled !== false);
|
|
79
|
+
if (userMode) return userMode;
|
|
80
|
+
return (0, import_core.getPresetLoadout)(wanted, sourceLang, explainLang);
|
|
81
|
+
}
|
|
82
|
+
function stripVocabSlots(slots) {
|
|
83
|
+
return slots ? slots.filter((slot) => slot.role !== "vocab") : slots;
|
|
84
|
+
}
|
|
85
|
+
function applyModeOverrides(mode, options) {
|
|
86
|
+
const next = { ...mode };
|
|
87
|
+
if (options.reasoning) next.reasoning = options.reasoning;
|
|
88
|
+
if (options.includeVocab === false) {
|
|
89
|
+
next.vocab = false;
|
|
90
|
+
next.slots = stripVocabSlots(next.slots);
|
|
91
|
+
}
|
|
92
|
+
return next;
|
|
93
|
+
}
|
|
94
|
+
function modeIds(disk, extra = []) {
|
|
95
|
+
const custom = (disk.modes || []).filter((mode) => mode.enabled !== false).map((mode) => mode.id);
|
|
96
|
+
return Array.from(/* @__PURE__ */ new Set([...extra, ...PRESET_IDS, ...custom]));
|
|
97
|
+
}
|
|
98
|
+
function createLingualMcpServer(options = {}) {
|
|
99
|
+
const readDisk = () => options.diskConfig ?? (0, import_core.loadUserLingualConfig)();
|
|
100
|
+
const server = new import_server.Server(
|
|
101
|
+
{
|
|
102
|
+
name: "lingual-mcp",
|
|
103
|
+
version: PKG_VERSION
|
|
104
|
+
},
|
|
105
|
+
{
|
|
106
|
+
capabilities: {
|
|
107
|
+
tools: {},
|
|
108
|
+
prompts: {}
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
);
|
|
112
|
+
server.setRequestHandler(import_types.ListToolsRequestSchema, async () => {
|
|
113
|
+
const disk = readDisk();
|
|
114
|
+
const transformIds = modeIds(disk);
|
|
115
|
+
const templateIds = modeIds(disk, ["companion"]);
|
|
116
|
+
return {
|
|
117
|
+
tools: [
|
|
118
|
+
{
|
|
119
|
+
name: "lingual_transform_spec",
|
|
120
|
+
description: "Transform messy native-language thoughts or instructions into crisp, structured engineering specifications, conventional commits, or OSS maintainer peer comms while keeping code blocks & stack traces 100% untouched. Accepts any preset id or a mode id declared in ~/.pi/agent/lingual.json.",
|
|
121
|
+
inputSchema: {
|
|
122
|
+
type: "object",
|
|
123
|
+
properties: {
|
|
124
|
+
text: {
|
|
125
|
+
type: "string",
|
|
126
|
+
description: "The raw thought, feature requirement, issue draft, or commit message in any language."
|
|
127
|
+
},
|
|
128
|
+
loadout: {
|
|
129
|
+
type: "string",
|
|
130
|
+
enum: transformIds,
|
|
131
|
+
description: "Preset loadout: 'spec' (structured engineering specification), 'commit' (conventional commit <=72 chars), 'oss' (maintainer peer issue/PR feedback), 'yap' (high-density tech post for X/HN), 'direct' (clean technical English, code blocks and stack traces intact), or any custom mode id from lingual.json. Default: 'spec'.",
|
|
132
|
+
default: "spec"
|
|
133
|
+
},
|
|
134
|
+
sourceLang: {
|
|
135
|
+
type: "string",
|
|
136
|
+
description: "Source language code (e.g. 'zh', 'ja', 'en', 'es'). Auto-detected if omitted."
|
|
137
|
+
},
|
|
138
|
+
targetLang: {
|
|
139
|
+
type: "string",
|
|
140
|
+
description: "Target language code (e.g. 'en', 'ja', 'zh'). Default: 'en'.",
|
|
141
|
+
default: "en"
|
|
142
|
+
},
|
|
143
|
+
reasoning: {
|
|
144
|
+
type: "string",
|
|
145
|
+
enum: REASONING_LEVELS,
|
|
146
|
+
description: "Thinking effort for this call. Overrides the mode's pinned level (spec pins 'low', the rest pin 'off')."
|
|
147
|
+
},
|
|
148
|
+
context: {
|
|
149
|
+
type: "string",
|
|
150
|
+
description: "Extra context for context-aware modes, such as a staged git diff for 'commit' or the previous agent turn."
|
|
151
|
+
},
|
|
152
|
+
includeVocab: {
|
|
153
|
+
type: "boolean",
|
|
154
|
+
description: "Set false to drop the vocabulary slot from the prompt and the response. Default: true.",
|
|
155
|
+
default: true
|
|
156
|
+
}
|
|
157
|
+
},
|
|
158
|
+
required: ["text"]
|
|
159
|
+
}
|
|
160
|
+
},
|
|
161
|
+
{
|
|
162
|
+
name: "lingual_bilingual_companion",
|
|
163
|
+
description: "Generate dual-register phrasing (Spoken for Slack/standups vs. Written for RFCs/PRs), native nuance meanings, and key vocabulary highlights for any technical expression or thought.",
|
|
164
|
+
inputSchema: {
|
|
165
|
+
type: "object",
|
|
166
|
+
properties: {
|
|
167
|
+
text: {
|
|
168
|
+
type: "string",
|
|
169
|
+
description: "The natural language text or expression to unpack into technical dual-registers."
|
|
170
|
+
},
|
|
171
|
+
sourceLang: {
|
|
172
|
+
type: "string",
|
|
173
|
+
description: "Source language code (e.g. 'zh', 'ja'). Auto-detected if omitted."
|
|
174
|
+
},
|
|
175
|
+
targetLang: {
|
|
176
|
+
type: "string",
|
|
177
|
+
description: "Target language code (e.g. 'en', 'ja'). Default: 'en'.",
|
|
178
|
+
default: "en"
|
|
179
|
+
},
|
|
180
|
+
reasoning: {
|
|
181
|
+
type: "string",
|
|
182
|
+
enum: REASONING_LEVELS,
|
|
183
|
+
description: "Thinking effort for this call. Defaults to the companion mode's level ('off')."
|
|
184
|
+
},
|
|
185
|
+
includeVocab: {
|
|
186
|
+
type: "boolean",
|
|
187
|
+
description: "Set false to drop the vocabulary slot from the prompt and the response. Default: true.",
|
|
188
|
+
default: true
|
|
189
|
+
}
|
|
190
|
+
},
|
|
191
|
+
required: ["text"]
|
|
192
|
+
}
|
|
193
|
+
},
|
|
194
|
+
{
|
|
195
|
+
name: "lingual_prompt_template",
|
|
196
|
+
description: "Zero-key mode: extract the exact compiled system prompt and few-shot rules for any Lingual mode so the host agent can execute it directly without external API credentials. Custom modes from lingual.json are accepted.",
|
|
197
|
+
inputSchema: {
|
|
198
|
+
type: "object",
|
|
199
|
+
properties: {
|
|
200
|
+
loadout: {
|
|
201
|
+
type: "string",
|
|
202
|
+
enum: templateIds,
|
|
203
|
+
description: "Target mode or loadout id: any preset, 'companion', or a custom mode id from lingual.json.",
|
|
204
|
+
default: "spec"
|
|
205
|
+
},
|
|
206
|
+
sourceLang: {
|
|
207
|
+
type: "string",
|
|
208
|
+
description: "Source language code (e.g. 'zh', 'ja', 'en'). Default: 'zh'.",
|
|
209
|
+
default: "zh"
|
|
210
|
+
},
|
|
211
|
+
targetLang: {
|
|
212
|
+
type: "string",
|
|
213
|
+
description: "Target language code (e.g. 'en', 'ja'). Default: 'en'.",
|
|
214
|
+
default: "en"
|
|
215
|
+
},
|
|
216
|
+
includeVocab: {
|
|
217
|
+
type: "boolean",
|
|
218
|
+
description: "Set false to drop the vocabulary slot from the compiled prompt. Default: true.",
|
|
219
|
+
default: true
|
|
220
|
+
}
|
|
221
|
+
},
|
|
222
|
+
required: ["loadout"]
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
]
|
|
226
|
+
};
|
|
227
|
+
});
|
|
228
|
+
server.setRequestHandler(import_types.CallToolRequestSchema, async (request) => {
|
|
229
|
+
const { name, arguments: args } = request.params;
|
|
230
|
+
const disk = readDisk();
|
|
231
|
+
const llm = resolveMcpLlmConfig(disk);
|
|
232
|
+
if (name === "lingual_transform_spec") {
|
|
233
|
+
const text = String(args?.text || "");
|
|
234
|
+
const loadoutId = String(args?.loadout || "spec");
|
|
235
|
+
const targetLang = String(args?.targetLang || "en");
|
|
236
|
+
const sourceLang = args?.sourceLang ? String(args.sourceLang) : (0, import_core.detectScriptLanguage)(text) || disk.sourceLang || "zh";
|
|
237
|
+
const explainLang = disk.explainLang || sourceLang;
|
|
238
|
+
const reasoning = normalizeReasoningArg(args?.reasoning);
|
|
239
|
+
const includeVocab = args?.includeVocab !== false;
|
|
240
|
+
const context = typeof args?.context === "string" && args.context.trim() ? args.context.trim() : void 0;
|
|
241
|
+
const mode = resolveMode(loadoutId, sourceLang, explainLang, disk.modes);
|
|
242
|
+
if (!mode) {
|
|
243
|
+
return {
|
|
244
|
+
isError: true,
|
|
245
|
+
content: [
|
|
246
|
+
{
|
|
247
|
+
type: "text",
|
|
248
|
+
text: `Unknown loadout or mode: ${loadoutId}. Known ids: ${modeIds(disk).join(", ")}`
|
|
249
|
+
}
|
|
250
|
+
]
|
|
251
|
+
};
|
|
252
|
+
}
|
|
253
|
+
const runMode = applyModeOverrides(mode, { reasoning, includeVocab });
|
|
254
|
+
const sanitized = (0, import_core.sanitizePromptForTranslation)(text);
|
|
255
|
+
const inputToTransform = sanitized.distilledText || text;
|
|
256
|
+
if (!llm.configured) {
|
|
257
|
+
return {
|
|
258
|
+
content: [
|
|
259
|
+
{
|
|
260
|
+
type: "text",
|
|
261
|
+
text: JSON.stringify(
|
|
262
|
+
{
|
|
263
|
+
status: "unconfigured_zero_key_fallback",
|
|
264
|
+
message: "No external LLM credentials configured (set LINGUAL_ENDPOINT / OPENAI_BASE_URL and LINGUAL_API_KEY / OPENAI_API_KEY, or configure ~/.pi/agent/lingual.json). Use the compiledSystemPrompt below directly in your host agent.",
|
|
265
|
+
mode: runMode.id,
|
|
266
|
+
reasoning: runMode.reasoning ?? "off",
|
|
267
|
+
distilledInput: inputToTransform,
|
|
268
|
+
compiledSystemPrompt: (0, import_core.compileModeSystemPrompt)(runMode, {
|
|
269
|
+
sourceLang,
|
|
270
|
+
targetLang,
|
|
271
|
+
explainLang,
|
|
272
|
+
globalKillList: disk.globalKillList,
|
|
273
|
+
extraContext: context
|
|
274
|
+
})
|
|
275
|
+
},
|
|
276
|
+
null,
|
|
277
|
+
2
|
|
278
|
+
)
|
|
279
|
+
}
|
|
280
|
+
]
|
|
281
|
+
};
|
|
282
|
+
}
|
|
283
|
+
try {
|
|
284
|
+
const candidates = await (0, import_core.executeModeRunner)(inputToTransform, runMode, {
|
|
285
|
+
endpoint: llm.endpoint,
|
|
286
|
+
apiKey: llm.apiKey,
|
|
287
|
+
model: llm.model,
|
|
288
|
+
sourceLang,
|
|
289
|
+
targetLang,
|
|
290
|
+
explainLang,
|
|
291
|
+
globalKillList: disk.globalKillList,
|
|
292
|
+
extraContext: context,
|
|
293
|
+
reasoning
|
|
294
|
+
});
|
|
295
|
+
if (!candidates || candidates.length === 0) {
|
|
296
|
+
return {
|
|
297
|
+
content: [
|
|
298
|
+
{
|
|
299
|
+
type: "text",
|
|
300
|
+
text: JSON.stringify(
|
|
301
|
+
{
|
|
302
|
+
status: "fallback",
|
|
303
|
+
message: "LLM endpoint did not return transformed candidates; returning original input.",
|
|
304
|
+
mode: runMode.id,
|
|
305
|
+
transformed: text
|
|
306
|
+
},
|
|
307
|
+
null,
|
|
308
|
+
2
|
|
309
|
+
)
|
|
310
|
+
}
|
|
311
|
+
]
|
|
312
|
+
};
|
|
313
|
+
}
|
|
314
|
+
const primary = candidates[0];
|
|
315
|
+
const finalTransformed = sanitized.rawPayload ? (0, import_core.ensureCodeTokensPreserved)(sanitized.rawPayload, primary.content) : primary.content;
|
|
316
|
+
return {
|
|
317
|
+
content: [
|
|
318
|
+
{
|
|
319
|
+
type: "text",
|
|
320
|
+
text: JSON.stringify(
|
|
321
|
+
{
|
|
322
|
+
status: "success",
|
|
323
|
+
mode: runMode.id,
|
|
324
|
+
loadout: loadoutId,
|
|
325
|
+
reasoning: runMode.reasoning ?? "off",
|
|
326
|
+
transformed: finalTransformed,
|
|
327
|
+
explanation: primary.explanation,
|
|
328
|
+
vocab: primary.vocab,
|
|
329
|
+
sourceText: text
|
|
330
|
+
},
|
|
331
|
+
null,
|
|
332
|
+
2
|
|
333
|
+
)
|
|
334
|
+
}
|
|
335
|
+
]
|
|
336
|
+
};
|
|
337
|
+
} catch (err) {
|
|
338
|
+
return {
|
|
339
|
+
isError: true,
|
|
340
|
+
content: [{ type: "text", text: `Transformation failed: ${err instanceof Error ? err.message : String(err)}` }]
|
|
341
|
+
};
|
|
342
|
+
}
|
|
343
|
+
}
|
|
344
|
+
if (name === "lingual_bilingual_companion") {
|
|
345
|
+
const text = String(args?.text || "");
|
|
346
|
+
const targetLang = String(args?.targetLang || "en");
|
|
347
|
+
const sourceLang = args?.sourceLang ? String(args.sourceLang) : (0, import_core.detectScriptLanguage)(text) || disk.sourceLang || "zh";
|
|
348
|
+
const explainLang = disk.explainLang || sourceLang;
|
|
349
|
+
const reasoning = normalizeReasoningArg(args?.reasoning);
|
|
350
|
+
const includeVocab = args?.includeVocab !== false;
|
|
351
|
+
const companion = resolveMode("companion", sourceLang, explainLang, disk.modes);
|
|
352
|
+
const runMode = companion ? applyModeOverrides(companion, { reasoning, includeVocab }) : null;
|
|
353
|
+
if (!llm.configured) {
|
|
354
|
+
return {
|
|
355
|
+
content: [
|
|
356
|
+
{
|
|
357
|
+
type: "text",
|
|
358
|
+
text: JSON.stringify(
|
|
359
|
+
{
|
|
360
|
+
status: "unconfigured_zero_key_fallback",
|
|
361
|
+
message: "No external LLM credentials configured (set LINGUAL_ENDPOINT / OPENAI_BASE_URL and LINGUAL_API_KEY / OPENAI_API_KEY). Use compiledSystemPrompt in your host agent.",
|
|
362
|
+
compiledSystemPrompt: (0, import_core.compileModeSystemPrompt)(runMode ?? {}, {
|
|
363
|
+
sourceLang,
|
|
364
|
+
targetLang,
|
|
365
|
+
explainLang,
|
|
366
|
+
globalKillList: disk.globalKillList
|
|
367
|
+
}),
|
|
368
|
+
sourceText: text
|
|
369
|
+
},
|
|
370
|
+
null,
|
|
371
|
+
2
|
|
372
|
+
)
|
|
373
|
+
}
|
|
374
|
+
]
|
|
375
|
+
};
|
|
376
|
+
}
|
|
377
|
+
try {
|
|
378
|
+
const result = await (0, import_core.translateCore)(text, {
|
|
379
|
+
endpoint: llm.endpoint,
|
|
380
|
+
apiKey: llm.apiKey,
|
|
381
|
+
model: llm.model,
|
|
382
|
+
sourceLang,
|
|
383
|
+
targetLang,
|
|
384
|
+
explainLang,
|
|
385
|
+
slots: runMode?.slots,
|
|
386
|
+
killList: runMode?.killList,
|
|
387
|
+
globalKillList: disk.globalKillList,
|
|
388
|
+
reasoning: reasoning ?? runMode?.reasoning
|
|
389
|
+
});
|
|
390
|
+
if (!result) {
|
|
391
|
+
return {
|
|
392
|
+
content: [
|
|
393
|
+
{
|
|
394
|
+
type: "text",
|
|
395
|
+
text: JSON.stringify(
|
|
396
|
+
{
|
|
397
|
+
status: "empty",
|
|
398
|
+
message: "No translation generated (input might be pure code or bypassed by shield).",
|
|
399
|
+
sourceText: text
|
|
400
|
+
},
|
|
401
|
+
null,
|
|
402
|
+
2
|
|
403
|
+
)
|
|
404
|
+
}
|
|
405
|
+
]
|
|
406
|
+
};
|
|
407
|
+
}
|
|
408
|
+
return {
|
|
409
|
+
content: [
|
|
410
|
+
{
|
|
411
|
+
type: "text",
|
|
412
|
+
text: JSON.stringify(
|
|
413
|
+
{
|
|
414
|
+
status: "success",
|
|
415
|
+
spoken: result.spoken,
|
|
416
|
+
nativeSpoken: result.nativeSpoken,
|
|
417
|
+
written: result.written,
|
|
418
|
+
nativeWritten: result.nativeWritten,
|
|
419
|
+
vocab: result.vocab,
|
|
420
|
+
sourceText: result.original
|
|
421
|
+
},
|
|
422
|
+
null,
|
|
423
|
+
2
|
|
424
|
+
)
|
|
425
|
+
}
|
|
426
|
+
]
|
|
427
|
+
};
|
|
428
|
+
} catch (err) {
|
|
429
|
+
return {
|
|
430
|
+
isError: true,
|
|
431
|
+
content: [{ type: "text", text: `Companion mapping failed: ${err instanceof Error ? err.message : String(err)}` }]
|
|
432
|
+
};
|
|
433
|
+
}
|
|
434
|
+
}
|
|
435
|
+
if (name === "lingual_prompt_template") {
|
|
436
|
+
const loadoutId = String(args?.loadout || "spec");
|
|
437
|
+
const sourceLang = String(args?.sourceLang || "zh");
|
|
438
|
+
const targetLang = String(args?.targetLang || "en");
|
|
439
|
+
const explainLang = disk.explainLang || sourceLang;
|
|
440
|
+
const includeVocab = args?.includeVocab !== false;
|
|
441
|
+
const mode = resolveMode(loadoutId, sourceLang, explainLang, disk.modes);
|
|
442
|
+
if (!mode) {
|
|
443
|
+
return {
|
|
444
|
+
isError: true,
|
|
445
|
+
content: [
|
|
446
|
+
{
|
|
447
|
+
type: "text",
|
|
448
|
+
text: `Unknown loadout or mode: ${loadoutId}. Known ids: ${modeIds(disk, ["companion"]).join(", ")}`
|
|
449
|
+
}
|
|
450
|
+
]
|
|
451
|
+
};
|
|
452
|
+
}
|
|
453
|
+
return {
|
|
454
|
+
content: [
|
|
455
|
+
{
|
|
456
|
+
type: "text",
|
|
457
|
+
text: (0, import_core.compileModeSystemPrompt)(applyModeOverrides(mode, { includeVocab }), {
|
|
458
|
+
sourceLang,
|
|
459
|
+
targetLang,
|
|
460
|
+
explainLang,
|
|
461
|
+
globalKillList: disk.globalKillList
|
|
462
|
+
})
|
|
463
|
+
}
|
|
464
|
+
]
|
|
465
|
+
};
|
|
466
|
+
}
|
|
467
|
+
return {
|
|
468
|
+
isError: true,
|
|
469
|
+
content: [{ type: "text", text: `Unknown tool name: ${name}` }]
|
|
470
|
+
};
|
|
471
|
+
});
|
|
472
|
+
server.setRequestHandler(import_types.ListPromptsRequestSchema, async () => {
|
|
473
|
+
return {
|
|
474
|
+
prompts: [
|
|
475
|
+
{
|
|
476
|
+
name: "spec_prompt",
|
|
477
|
+
description: "Structure raw developer instructions into a rigorous technical specification.",
|
|
478
|
+
arguments: [
|
|
479
|
+
{ name: "raw_idea", description: "The raw thought or instruction to structure.", required: true },
|
|
480
|
+
{ name: "source_lang", description: "Optional source language code (default: auto/zh).", required: false },
|
|
481
|
+
{ name: "target_lang", description: "Optional target language code (default: en).", required: false }
|
|
482
|
+
]
|
|
483
|
+
},
|
|
484
|
+
{
|
|
485
|
+
name: "conventional_commit",
|
|
486
|
+
description: "Dehydrate plain explanation into a Conventional Commit (first line <= 72 chars).",
|
|
487
|
+
arguments: [
|
|
488
|
+
{ name: "changes_summary", description: "Description of what was changed and why.", required: true },
|
|
489
|
+
{ name: "source_lang", description: "Optional source language code (default: auto/zh).", required: false },
|
|
490
|
+
{ name: "target_lang", description: "Optional target language code (default: en).", required: false }
|
|
491
|
+
]
|
|
492
|
+
}
|
|
493
|
+
]
|
|
494
|
+
};
|
|
495
|
+
});
|
|
496
|
+
server.setRequestHandler(import_types.GetPromptRequestSchema, async (request) => {
|
|
497
|
+
const { name, arguments: args } = request.params;
|
|
498
|
+
const disk = readDisk();
|
|
499
|
+
const sourceLang = args?.source_lang || disk.sourceLang || "zh";
|
|
500
|
+
const targetLang = args?.target_lang || "en";
|
|
501
|
+
const explainLang = disk.explainLang || sourceLang;
|
|
502
|
+
const compile = (modeId) => {
|
|
503
|
+
const mode = resolveMode(modeId, sourceLang, explainLang, disk.modes);
|
|
504
|
+
return mode ? (0, import_core.compileModeSystemPrompt)(mode, { sourceLang, targetLang, explainLang, globalKillList: disk.globalKillList }) : null;
|
|
505
|
+
};
|
|
506
|
+
if (name === "spec_prompt") {
|
|
507
|
+
const idea = args?.raw_idea || "";
|
|
508
|
+
const sys = compile("spec");
|
|
509
|
+
if (!sys) throw new Error("Spec mode is unavailable");
|
|
510
|
+
return {
|
|
511
|
+
description: "Transform idea into an engineering specification",
|
|
512
|
+
messages: [
|
|
513
|
+
{ role: "user", content: { type: "text", text: `${sys}
|
|
514
|
+
|
|
515
|
+
Task to structure:
|
|
516
|
+
${idea}` } }
|
|
517
|
+
]
|
|
518
|
+
};
|
|
519
|
+
}
|
|
520
|
+
if (name === "conventional_commit") {
|
|
521
|
+
const summary = args?.changes_summary || "";
|
|
522
|
+
const sys = compile("commit");
|
|
523
|
+
if (!sys) throw new Error("Commit mode is unavailable");
|
|
524
|
+
return {
|
|
525
|
+
description: "Transform change summary into Conventional Commit",
|
|
526
|
+
messages: [
|
|
527
|
+
{ role: "user", content: { type: "text", text: `${sys}
|
|
528
|
+
|
|
529
|
+
Changes to commit:
|
|
530
|
+
${summary}` } }
|
|
531
|
+
]
|
|
532
|
+
};
|
|
533
|
+
}
|
|
534
|
+
throw new Error(`Prompt not found: ${name}`);
|
|
535
|
+
});
|
|
536
|
+
return server;
|
|
537
|
+
}
|
|
538
|
+
async function runLingualMcpServer() {
|
|
539
|
+
const server = createLingualMcpServer();
|
|
540
|
+
const transport = new import_stdio.StdioServerTransport();
|
|
541
|
+
await server.connect(transport);
|
|
542
|
+
}
|
|
543
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
544
|
+
0 && (module.exports = {
|
|
545
|
+
applyModeOverrides,
|
|
546
|
+
createLingualMcpServer,
|
|
547
|
+
normalizeReasoningArg,
|
|
548
|
+
resolveMcpLlmConfig,
|
|
549
|
+
resolveMode,
|
|
550
|
+
runLingualMcpServer,
|
|
551
|
+
stripVocabSlots
|
|
552
|
+
});
|
package/dist/index.d.cts
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { Server } from '@modelcontextprotocol/sdk/server/index.js';
|
|
2
|
+
import { LingualConfig, CustomModeConfig, ReasoningEffort, PromptSlotConfig } from 'pi-lingual/core';
|
|
3
|
+
|
|
4
|
+
interface McpServerOptions {
|
|
5
|
+
/** Replaces the on-disk `lingual.json` snapshot; tests and embedders pin their own config. */
|
|
6
|
+
diskConfig?: Partial<LingualConfig>;
|
|
7
|
+
}
|
|
8
|
+
interface ResolvedMcpLlmConfig {
|
|
9
|
+
configured: boolean;
|
|
10
|
+
endpoint?: string;
|
|
11
|
+
apiKey?: string;
|
|
12
|
+
model?: string;
|
|
13
|
+
}
|
|
14
|
+
declare function resolveMcpLlmConfig(diskConfig: Partial<LingualConfig>, env?: NodeJS.ProcessEnv): ResolvedMcpLlmConfig;
|
|
15
|
+
declare function normalizeReasoningArg(raw: unknown): ReasoningEffort | undefined;
|
|
16
|
+
/** Resolves a preset, a factory mode, or a user mode declared in `lingual.json`. */
|
|
17
|
+
declare function resolveMode(id: string, sourceLang: string, explainLang: string, custom?: CustomModeConfig[]): CustomModeConfig | null;
|
|
18
|
+
declare function stripVocabSlots(slots?: PromptSlotConfig[]): PromptSlotConfig[] | undefined;
|
|
19
|
+
/** An explicit request-level reasoning level wins over the level a mode pins. */
|
|
20
|
+
declare function applyModeOverrides(mode: CustomModeConfig, options: {
|
|
21
|
+
reasoning?: ReasoningEffort;
|
|
22
|
+
includeVocab?: boolean;
|
|
23
|
+
}): CustomModeConfig;
|
|
24
|
+
declare function createLingualMcpServer(options?: McpServerOptions): Server;
|
|
25
|
+
declare function runLingualMcpServer(): Promise<void>;
|
|
26
|
+
|
|
27
|
+
export { type McpServerOptions, type ResolvedMcpLlmConfig, applyModeOverrides, createLingualMcpServer, normalizeReasoningArg, resolveMcpLlmConfig, resolveMode, runLingualMcpServer, stripVocabSlots };
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { Server } from '@modelcontextprotocol/sdk/server/index.js';
|
|
2
|
+
import { LingualConfig, CustomModeConfig, ReasoningEffort, PromptSlotConfig } from 'pi-lingual/core';
|
|
3
|
+
|
|
4
|
+
interface McpServerOptions {
|
|
5
|
+
/** Replaces the on-disk `lingual.json` snapshot; tests and embedders pin their own config. */
|
|
6
|
+
diskConfig?: Partial<LingualConfig>;
|
|
7
|
+
}
|
|
8
|
+
interface ResolvedMcpLlmConfig {
|
|
9
|
+
configured: boolean;
|
|
10
|
+
endpoint?: string;
|
|
11
|
+
apiKey?: string;
|
|
12
|
+
model?: string;
|
|
13
|
+
}
|
|
14
|
+
declare function resolveMcpLlmConfig(diskConfig: Partial<LingualConfig>, env?: NodeJS.ProcessEnv): ResolvedMcpLlmConfig;
|
|
15
|
+
declare function normalizeReasoningArg(raw: unknown): ReasoningEffort | undefined;
|
|
16
|
+
/** Resolves a preset, a factory mode, or a user mode declared in `lingual.json`. */
|
|
17
|
+
declare function resolveMode(id: string, sourceLang: string, explainLang: string, custom?: CustomModeConfig[]): CustomModeConfig | null;
|
|
18
|
+
declare function stripVocabSlots(slots?: PromptSlotConfig[]): PromptSlotConfig[] | undefined;
|
|
19
|
+
/** An explicit request-level reasoning level wins over the level a mode pins. */
|
|
20
|
+
declare function applyModeOverrides(mode: CustomModeConfig, options: {
|
|
21
|
+
reasoning?: ReasoningEffort;
|
|
22
|
+
includeVocab?: boolean;
|
|
23
|
+
}): CustomModeConfig;
|
|
24
|
+
declare function createLingualMcpServer(options?: McpServerOptions): Server;
|
|
25
|
+
declare function runLingualMcpServer(): Promise<void>;
|
|
26
|
+
|
|
27
|
+
export { type McpServerOptions, type ResolvedMcpLlmConfig, applyModeOverrides, createLingualMcpServer, normalizeReasoningArg, resolveMcpLlmConfig, resolveMode, runLingualMcpServer, stripVocabSlots };
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,534 @@
|
|
|
1
|
+
// src/index.ts
|
|
2
|
+
import { createRequire } from "module";
|
|
3
|
+
import { Server } from "@modelcontextprotocol/sdk/server/index.js";
|
|
4
|
+
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
|
|
5
|
+
import {
|
|
6
|
+
CallToolRequestSchema,
|
|
7
|
+
ListToolsRequestSchema,
|
|
8
|
+
ListPromptsRequestSchema,
|
|
9
|
+
GetPromptRequestSchema
|
|
10
|
+
} from "@modelcontextprotocol/sdk/types.js";
|
|
11
|
+
import {
|
|
12
|
+
translateCore,
|
|
13
|
+
executeModeRunner,
|
|
14
|
+
compileModeSystemPrompt,
|
|
15
|
+
loadUserLingualConfig,
|
|
16
|
+
getPresetLoadout,
|
|
17
|
+
sanitizePromptForTranslation,
|
|
18
|
+
ensureCodeTokensPreserved,
|
|
19
|
+
detectScriptLanguage
|
|
20
|
+
} from "pi-lingual/core";
|
|
21
|
+
var require2 = createRequire(import.meta.url);
|
|
22
|
+
var manifest = require2("../package.json");
|
|
23
|
+
var PKG_VERSION = typeof manifest.version === "string" ? manifest.version : "0.0.0";
|
|
24
|
+
var REASONING_LEVELS = ["off", "minimal", "low", "medium", "high"];
|
|
25
|
+
var PRESET_IDS = ["spec", "commit", "oss", "yap", "direct"];
|
|
26
|
+
function isLoopbackUrl(urlStr) {
|
|
27
|
+
try {
|
|
28
|
+
const parsed = new URL(urlStr);
|
|
29
|
+
return parsed.hostname === "127.0.0.1" || parsed.hostname === "localhost" || parsed.hostname === "::1";
|
|
30
|
+
} catch {
|
|
31
|
+
return false;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
function resolveMcpLlmConfig(diskConfig, env = process.env) {
|
|
35
|
+
const rawEndpoint = env.LINGUAL_ENDPOINT || env.OPENAI_BASE_URL || diskConfig.endpoint;
|
|
36
|
+
const rawApiKey = env.LINGUAL_API_KEY || env.OPENAI_API_KEY || diskConfig.apiKey;
|
|
37
|
+
const rawModel = env.LINGUAL_MODEL || env.OPENAI_MODEL || diskConfig.model;
|
|
38
|
+
if (!rawEndpoint && !rawApiKey) {
|
|
39
|
+
return { configured: false };
|
|
40
|
+
}
|
|
41
|
+
const base = (rawEndpoint || "https://api.openai.com/v1").replace(/\/+$/, "");
|
|
42
|
+
const endpoint = base.endsWith("/chat/completions") ? base : `${base}/chat/completions`;
|
|
43
|
+
const apiKey = rawApiKey || (isLoopbackUrl(endpoint) ? "local" : void 0);
|
|
44
|
+
if (!apiKey) {
|
|
45
|
+
return { configured: false };
|
|
46
|
+
}
|
|
47
|
+
return {
|
|
48
|
+
configured: true,
|
|
49
|
+
endpoint,
|
|
50
|
+
apiKey,
|
|
51
|
+
model: rawModel || "gpt-4o-mini"
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
function normalizeReasoningArg(raw) {
|
|
55
|
+
const value = typeof raw === "string" ? raw.trim().toLowerCase() : "";
|
|
56
|
+
return REASONING_LEVELS.includes(value) ? value : void 0;
|
|
57
|
+
}
|
|
58
|
+
function resolveMode(id, sourceLang, explainLang, custom) {
|
|
59
|
+
const wanted = (id || "").trim().toLowerCase();
|
|
60
|
+
if (!wanted) return null;
|
|
61
|
+
const userMode = (custom || []).find((mode) => mode.id.toLowerCase() === wanted && mode.enabled !== false);
|
|
62
|
+
if (userMode) return userMode;
|
|
63
|
+
return getPresetLoadout(wanted, sourceLang, explainLang);
|
|
64
|
+
}
|
|
65
|
+
function stripVocabSlots(slots) {
|
|
66
|
+
return slots ? slots.filter((slot) => slot.role !== "vocab") : slots;
|
|
67
|
+
}
|
|
68
|
+
function applyModeOverrides(mode, options) {
|
|
69
|
+
const next = { ...mode };
|
|
70
|
+
if (options.reasoning) next.reasoning = options.reasoning;
|
|
71
|
+
if (options.includeVocab === false) {
|
|
72
|
+
next.vocab = false;
|
|
73
|
+
next.slots = stripVocabSlots(next.slots);
|
|
74
|
+
}
|
|
75
|
+
return next;
|
|
76
|
+
}
|
|
77
|
+
function modeIds(disk, extra = []) {
|
|
78
|
+
const custom = (disk.modes || []).filter((mode) => mode.enabled !== false).map((mode) => mode.id);
|
|
79
|
+
return Array.from(/* @__PURE__ */ new Set([...extra, ...PRESET_IDS, ...custom]));
|
|
80
|
+
}
|
|
81
|
+
function createLingualMcpServer(options = {}) {
|
|
82
|
+
const readDisk = () => options.diskConfig ?? loadUserLingualConfig();
|
|
83
|
+
const server = new Server(
|
|
84
|
+
{
|
|
85
|
+
name: "lingual-mcp",
|
|
86
|
+
version: PKG_VERSION
|
|
87
|
+
},
|
|
88
|
+
{
|
|
89
|
+
capabilities: {
|
|
90
|
+
tools: {},
|
|
91
|
+
prompts: {}
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
);
|
|
95
|
+
server.setRequestHandler(ListToolsRequestSchema, async () => {
|
|
96
|
+
const disk = readDisk();
|
|
97
|
+
const transformIds = modeIds(disk);
|
|
98
|
+
const templateIds = modeIds(disk, ["companion"]);
|
|
99
|
+
return {
|
|
100
|
+
tools: [
|
|
101
|
+
{
|
|
102
|
+
name: "lingual_transform_spec",
|
|
103
|
+
description: "Transform messy native-language thoughts or instructions into crisp, structured engineering specifications, conventional commits, or OSS maintainer peer comms while keeping code blocks & stack traces 100% untouched. Accepts any preset id or a mode id declared in ~/.pi/agent/lingual.json.",
|
|
104
|
+
inputSchema: {
|
|
105
|
+
type: "object",
|
|
106
|
+
properties: {
|
|
107
|
+
text: {
|
|
108
|
+
type: "string",
|
|
109
|
+
description: "The raw thought, feature requirement, issue draft, or commit message in any language."
|
|
110
|
+
},
|
|
111
|
+
loadout: {
|
|
112
|
+
type: "string",
|
|
113
|
+
enum: transformIds,
|
|
114
|
+
description: "Preset loadout: 'spec' (structured engineering specification), 'commit' (conventional commit <=72 chars), 'oss' (maintainer peer issue/PR feedback), 'yap' (high-density tech post for X/HN), 'direct' (clean technical English, code blocks and stack traces intact), or any custom mode id from lingual.json. Default: 'spec'.",
|
|
115
|
+
default: "spec"
|
|
116
|
+
},
|
|
117
|
+
sourceLang: {
|
|
118
|
+
type: "string",
|
|
119
|
+
description: "Source language code (e.g. 'zh', 'ja', 'en', 'es'). Auto-detected if omitted."
|
|
120
|
+
},
|
|
121
|
+
targetLang: {
|
|
122
|
+
type: "string",
|
|
123
|
+
description: "Target language code (e.g. 'en', 'ja', 'zh'). Default: 'en'.",
|
|
124
|
+
default: "en"
|
|
125
|
+
},
|
|
126
|
+
reasoning: {
|
|
127
|
+
type: "string",
|
|
128
|
+
enum: REASONING_LEVELS,
|
|
129
|
+
description: "Thinking effort for this call. Overrides the mode's pinned level (spec pins 'low', the rest pin 'off')."
|
|
130
|
+
},
|
|
131
|
+
context: {
|
|
132
|
+
type: "string",
|
|
133
|
+
description: "Extra context for context-aware modes, such as a staged git diff for 'commit' or the previous agent turn."
|
|
134
|
+
},
|
|
135
|
+
includeVocab: {
|
|
136
|
+
type: "boolean",
|
|
137
|
+
description: "Set false to drop the vocabulary slot from the prompt and the response. Default: true.",
|
|
138
|
+
default: true
|
|
139
|
+
}
|
|
140
|
+
},
|
|
141
|
+
required: ["text"]
|
|
142
|
+
}
|
|
143
|
+
},
|
|
144
|
+
{
|
|
145
|
+
name: "lingual_bilingual_companion",
|
|
146
|
+
description: "Generate dual-register phrasing (Spoken for Slack/standups vs. Written for RFCs/PRs), native nuance meanings, and key vocabulary highlights for any technical expression or thought.",
|
|
147
|
+
inputSchema: {
|
|
148
|
+
type: "object",
|
|
149
|
+
properties: {
|
|
150
|
+
text: {
|
|
151
|
+
type: "string",
|
|
152
|
+
description: "The natural language text or expression to unpack into technical dual-registers."
|
|
153
|
+
},
|
|
154
|
+
sourceLang: {
|
|
155
|
+
type: "string",
|
|
156
|
+
description: "Source language code (e.g. 'zh', 'ja'). Auto-detected if omitted."
|
|
157
|
+
},
|
|
158
|
+
targetLang: {
|
|
159
|
+
type: "string",
|
|
160
|
+
description: "Target language code (e.g. 'en', 'ja'). Default: 'en'.",
|
|
161
|
+
default: "en"
|
|
162
|
+
},
|
|
163
|
+
reasoning: {
|
|
164
|
+
type: "string",
|
|
165
|
+
enum: REASONING_LEVELS,
|
|
166
|
+
description: "Thinking effort for this call. Defaults to the companion mode's level ('off')."
|
|
167
|
+
},
|
|
168
|
+
includeVocab: {
|
|
169
|
+
type: "boolean",
|
|
170
|
+
description: "Set false to drop the vocabulary slot from the prompt and the response. Default: true.",
|
|
171
|
+
default: true
|
|
172
|
+
}
|
|
173
|
+
},
|
|
174
|
+
required: ["text"]
|
|
175
|
+
}
|
|
176
|
+
},
|
|
177
|
+
{
|
|
178
|
+
name: "lingual_prompt_template",
|
|
179
|
+
description: "Zero-key mode: extract the exact compiled system prompt and few-shot rules for any Lingual mode so the host agent can execute it directly without external API credentials. Custom modes from lingual.json are accepted.",
|
|
180
|
+
inputSchema: {
|
|
181
|
+
type: "object",
|
|
182
|
+
properties: {
|
|
183
|
+
loadout: {
|
|
184
|
+
type: "string",
|
|
185
|
+
enum: templateIds,
|
|
186
|
+
description: "Target mode or loadout id: any preset, 'companion', or a custom mode id from lingual.json.",
|
|
187
|
+
default: "spec"
|
|
188
|
+
},
|
|
189
|
+
sourceLang: {
|
|
190
|
+
type: "string",
|
|
191
|
+
description: "Source language code (e.g. 'zh', 'ja', 'en'). Default: 'zh'.",
|
|
192
|
+
default: "zh"
|
|
193
|
+
},
|
|
194
|
+
targetLang: {
|
|
195
|
+
type: "string",
|
|
196
|
+
description: "Target language code (e.g. 'en', 'ja'). Default: 'en'.",
|
|
197
|
+
default: "en"
|
|
198
|
+
},
|
|
199
|
+
includeVocab: {
|
|
200
|
+
type: "boolean",
|
|
201
|
+
description: "Set false to drop the vocabulary slot from the compiled prompt. Default: true.",
|
|
202
|
+
default: true
|
|
203
|
+
}
|
|
204
|
+
},
|
|
205
|
+
required: ["loadout"]
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
]
|
|
209
|
+
};
|
|
210
|
+
});
|
|
211
|
+
server.setRequestHandler(CallToolRequestSchema, async (request) => {
|
|
212
|
+
const { name, arguments: args } = request.params;
|
|
213
|
+
const disk = readDisk();
|
|
214
|
+
const llm = resolveMcpLlmConfig(disk);
|
|
215
|
+
if (name === "lingual_transform_spec") {
|
|
216
|
+
const text = String(args?.text || "");
|
|
217
|
+
const loadoutId = String(args?.loadout || "spec");
|
|
218
|
+
const targetLang = String(args?.targetLang || "en");
|
|
219
|
+
const sourceLang = args?.sourceLang ? String(args.sourceLang) : detectScriptLanguage(text) || disk.sourceLang || "zh";
|
|
220
|
+
const explainLang = disk.explainLang || sourceLang;
|
|
221
|
+
const reasoning = normalizeReasoningArg(args?.reasoning);
|
|
222
|
+
const includeVocab = args?.includeVocab !== false;
|
|
223
|
+
const context = typeof args?.context === "string" && args.context.trim() ? args.context.trim() : void 0;
|
|
224
|
+
const mode = resolveMode(loadoutId, sourceLang, explainLang, disk.modes);
|
|
225
|
+
if (!mode) {
|
|
226
|
+
return {
|
|
227
|
+
isError: true,
|
|
228
|
+
content: [
|
|
229
|
+
{
|
|
230
|
+
type: "text",
|
|
231
|
+
text: `Unknown loadout or mode: ${loadoutId}. Known ids: ${modeIds(disk).join(", ")}`
|
|
232
|
+
}
|
|
233
|
+
]
|
|
234
|
+
};
|
|
235
|
+
}
|
|
236
|
+
const runMode = applyModeOverrides(mode, { reasoning, includeVocab });
|
|
237
|
+
const sanitized = sanitizePromptForTranslation(text);
|
|
238
|
+
const inputToTransform = sanitized.distilledText || text;
|
|
239
|
+
if (!llm.configured) {
|
|
240
|
+
return {
|
|
241
|
+
content: [
|
|
242
|
+
{
|
|
243
|
+
type: "text",
|
|
244
|
+
text: JSON.stringify(
|
|
245
|
+
{
|
|
246
|
+
status: "unconfigured_zero_key_fallback",
|
|
247
|
+
message: "No external LLM credentials configured (set LINGUAL_ENDPOINT / OPENAI_BASE_URL and LINGUAL_API_KEY / OPENAI_API_KEY, or configure ~/.pi/agent/lingual.json). Use the compiledSystemPrompt below directly in your host agent.",
|
|
248
|
+
mode: runMode.id,
|
|
249
|
+
reasoning: runMode.reasoning ?? "off",
|
|
250
|
+
distilledInput: inputToTransform,
|
|
251
|
+
compiledSystemPrompt: compileModeSystemPrompt(runMode, {
|
|
252
|
+
sourceLang,
|
|
253
|
+
targetLang,
|
|
254
|
+
explainLang,
|
|
255
|
+
globalKillList: disk.globalKillList,
|
|
256
|
+
extraContext: context
|
|
257
|
+
})
|
|
258
|
+
},
|
|
259
|
+
null,
|
|
260
|
+
2
|
|
261
|
+
)
|
|
262
|
+
}
|
|
263
|
+
]
|
|
264
|
+
};
|
|
265
|
+
}
|
|
266
|
+
try {
|
|
267
|
+
const candidates = await executeModeRunner(inputToTransform, runMode, {
|
|
268
|
+
endpoint: llm.endpoint,
|
|
269
|
+
apiKey: llm.apiKey,
|
|
270
|
+
model: llm.model,
|
|
271
|
+
sourceLang,
|
|
272
|
+
targetLang,
|
|
273
|
+
explainLang,
|
|
274
|
+
globalKillList: disk.globalKillList,
|
|
275
|
+
extraContext: context,
|
|
276
|
+
reasoning
|
|
277
|
+
});
|
|
278
|
+
if (!candidates || candidates.length === 0) {
|
|
279
|
+
return {
|
|
280
|
+
content: [
|
|
281
|
+
{
|
|
282
|
+
type: "text",
|
|
283
|
+
text: JSON.stringify(
|
|
284
|
+
{
|
|
285
|
+
status: "fallback",
|
|
286
|
+
message: "LLM endpoint did not return transformed candidates; returning original input.",
|
|
287
|
+
mode: runMode.id,
|
|
288
|
+
transformed: text
|
|
289
|
+
},
|
|
290
|
+
null,
|
|
291
|
+
2
|
|
292
|
+
)
|
|
293
|
+
}
|
|
294
|
+
]
|
|
295
|
+
};
|
|
296
|
+
}
|
|
297
|
+
const primary = candidates[0];
|
|
298
|
+
const finalTransformed = sanitized.rawPayload ? ensureCodeTokensPreserved(sanitized.rawPayload, primary.content) : primary.content;
|
|
299
|
+
return {
|
|
300
|
+
content: [
|
|
301
|
+
{
|
|
302
|
+
type: "text",
|
|
303
|
+
text: JSON.stringify(
|
|
304
|
+
{
|
|
305
|
+
status: "success",
|
|
306
|
+
mode: runMode.id,
|
|
307
|
+
loadout: loadoutId,
|
|
308
|
+
reasoning: runMode.reasoning ?? "off",
|
|
309
|
+
transformed: finalTransformed,
|
|
310
|
+
explanation: primary.explanation,
|
|
311
|
+
vocab: primary.vocab,
|
|
312
|
+
sourceText: text
|
|
313
|
+
},
|
|
314
|
+
null,
|
|
315
|
+
2
|
|
316
|
+
)
|
|
317
|
+
}
|
|
318
|
+
]
|
|
319
|
+
};
|
|
320
|
+
} catch (err) {
|
|
321
|
+
return {
|
|
322
|
+
isError: true,
|
|
323
|
+
content: [{ type: "text", text: `Transformation failed: ${err instanceof Error ? err.message : String(err)}` }]
|
|
324
|
+
};
|
|
325
|
+
}
|
|
326
|
+
}
|
|
327
|
+
if (name === "lingual_bilingual_companion") {
|
|
328
|
+
const text = String(args?.text || "");
|
|
329
|
+
const targetLang = String(args?.targetLang || "en");
|
|
330
|
+
const sourceLang = args?.sourceLang ? String(args.sourceLang) : detectScriptLanguage(text) || disk.sourceLang || "zh";
|
|
331
|
+
const explainLang = disk.explainLang || sourceLang;
|
|
332
|
+
const reasoning = normalizeReasoningArg(args?.reasoning);
|
|
333
|
+
const includeVocab = args?.includeVocab !== false;
|
|
334
|
+
const companion = resolveMode("companion", sourceLang, explainLang, disk.modes);
|
|
335
|
+
const runMode = companion ? applyModeOverrides(companion, { reasoning, includeVocab }) : null;
|
|
336
|
+
if (!llm.configured) {
|
|
337
|
+
return {
|
|
338
|
+
content: [
|
|
339
|
+
{
|
|
340
|
+
type: "text",
|
|
341
|
+
text: JSON.stringify(
|
|
342
|
+
{
|
|
343
|
+
status: "unconfigured_zero_key_fallback",
|
|
344
|
+
message: "No external LLM credentials configured (set LINGUAL_ENDPOINT / OPENAI_BASE_URL and LINGUAL_API_KEY / OPENAI_API_KEY). Use compiledSystemPrompt in your host agent.",
|
|
345
|
+
compiledSystemPrompt: compileModeSystemPrompt(runMode ?? {}, {
|
|
346
|
+
sourceLang,
|
|
347
|
+
targetLang,
|
|
348
|
+
explainLang,
|
|
349
|
+
globalKillList: disk.globalKillList
|
|
350
|
+
}),
|
|
351
|
+
sourceText: text
|
|
352
|
+
},
|
|
353
|
+
null,
|
|
354
|
+
2
|
|
355
|
+
)
|
|
356
|
+
}
|
|
357
|
+
]
|
|
358
|
+
};
|
|
359
|
+
}
|
|
360
|
+
try {
|
|
361
|
+
const result = await translateCore(text, {
|
|
362
|
+
endpoint: llm.endpoint,
|
|
363
|
+
apiKey: llm.apiKey,
|
|
364
|
+
model: llm.model,
|
|
365
|
+
sourceLang,
|
|
366
|
+
targetLang,
|
|
367
|
+
explainLang,
|
|
368
|
+
slots: runMode?.slots,
|
|
369
|
+
killList: runMode?.killList,
|
|
370
|
+
globalKillList: disk.globalKillList,
|
|
371
|
+
reasoning: reasoning ?? runMode?.reasoning
|
|
372
|
+
});
|
|
373
|
+
if (!result) {
|
|
374
|
+
return {
|
|
375
|
+
content: [
|
|
376
|
+
{
|
|
377
|
+
type: "text",
|
|
378
|
+
text: JSON.stringify(
|
|
379
|
+
{
|
|
380
|
+
status: "empty",
|
|
381
|
+
message: "No translation generated (input might be pure code or bypassed by shield).",
|
|
382
|
+
sourceText: text
|
|
383
|
+
},
|
|
384
|
+
null,
|
|
385
|
+
2
|
|
386
|
+
)
|
|
387
|
+
}
|
|
388
|
+
]
|
|
389
|
+
};
|
|
390
|
+
}
|
|
391
|
+
return {
|
|
392
|
+
content: [
|
|
393
|
+
{
|
|
394
|
+
type: "text",
|
|
395
|
+
text: JSON.stringify(
|
|
396
|
+
{
|
|
397
|
+
status: "success",
|
|
398
|
+
spoken: result.spoken,
|
|
399
|
+
nativeSpoken: result.nativeSpoken,
|
|
400
|
+
written: result.written,
|
|
401
|
+
nativeWritten: result.nativeWritten,
|
|
402
|
+
vocab: result.vocab,
|
|
403
|
+
sourceText: result.original
|
|
404
|
+
},
|
|
405
|
+
null,
|
|
406
|
+
2
|
|
407
|
+
)
|
|
408
|
+
}
|
|
409
|
+
]
|
|
410
|
+
};
|
|
411
|
+
} catch (err) {
|
|
412
|
+
return {
|
|
413
|
+
isError: true,
|
|
414
|
+
content: [{ type: "text", text: `Companion mapping failed: ${err instanceof Error ? err.message : String(err)}` }]
|
|
415
|
+
};
|
|
416
|
+
}
|
|
417
|
+
}
|
|
418
|
+
if (name === "lingual_prompt_template") {
|
|
419
|
+
const loadoutId = String(args?.loadout || "spec");
|
|
420
|
+
const sourceLang = String(args?.sourceLang || "zh");
|
|
421
|
+
const targetLang = String(args?.targetLang || "en");
|
|
422
|
+
const explainLang = disk.explainLang || sourceLang;
|
|
423
|
+
const includeVocab = args?.includeVocab !== false;
|
|
424
|
+
const mode = resolveMode(loadoutId, sourceLang, explainLang, disk.modes);
|
|
425
|
+
if (!mode) {
|
|
426
|
+
return {
|
|
427
|
+
isError: true,
|
|
428
|
+
content: [
|
|
429
|
+
{
|
|
430
|
+
type: "text",
|
|
431
|
+
text: `Unknown loadout or mode: ${loadoutId}. Known ids: ${modeIds(disk, ["companion"]).join(", ")}`
|
|
432
|
+
}
|
|
433
|
+
]
|
|
434
|
+
};
|
|
435
|
+
}
|
|
436
|
+
return {
|
|
437
|
+
content: [
|
|
438
|
+
{
|
|
439
|
+
type: "text",
|
|
440
|
+
text: compileModeSystemPrompt(applyModeOverrides(mode, { includeVocab }), {
|
|
441
|
+
sourceLang,
|
|
442
|
+
targetLang,
|
|
443
|
+
explainLang,
|
|
444
|
+
globalKillList: disk.globalKillList
|
|
445
|
+
})
|
|
446
|
+
}
|
|
447
|
+
]
|
|
448
|
+
};
|
|
449
|
+
}
|
|
450
|
+
return {
|
|
451
|
+
isError: true,
|
|
452
|
+
content: [{ type: "text", text: `Unknown tool name: ${name}` }]
|
|
453
|
+
};
|
|
454
|
+
});
|
|
455
|
+
server.setRequestHandler(ListPromptsRequestSchema, async () => {
|
|
456
|
+
return {
|
|
457
|
+
prompts: [
|
|
458
|
+
{
|
|
459
|
+
name: "spec_prompt",
|
|
460
|
+
description: "Structure raw developer instructions into a rigorous technical specification.",
|
|
461
|
+
arguments: [
|
|
462
|
+
{ name: "raw_idea", description: "The raw thought or instruction to structure.", required: true },
|
|
463
|
+
{ name: "source_lang", description: "Optional source language code (default: auto/zh).", required: false },
|
|
464
|
+
{ name: "target_lang", description: "Optional target language code (default: en).", required: false }
|
|
465
|
+
]
|
|
466
|
+
},
|
|
467
|
+
{
|
|
468
|
+
name: "conventional_commit",
|
|
469
|
+
description: "Dehydrate plain explanation into a Conventional Commit (first line <= 72 chars).",
|
|
470
|
+
arguments: [
|
|
471
|
+
{ name: "changes_summary", description: "Description of what was changed and why.", required: true },
|
|
472
|
+
{ name: "source_lang", description: "Optional source language code (default: auto/zh).", required: false },
|
|
473
|
+
{ name: "target_lang", description: "Optional target language code (default: en).", required: false }
|
|
474
|
+
]
|
|
475
|
+
}
|
|
476
|
+
]
|
|
477
|
+
};
|
|
478
|
+
});
|
|
479
|
+
server.setRequestHandler(GetPromptRequestSchema, async (request) => {
|
|
480
|
+
const { name, arguments: args } = request.params;
|
|
481
|
+
const disk = readDisk();
|
|
482
|
+
const sourceLang = args?.source_lang || disk.sourceLang || "zh";
|
|
483
|
+
const targetLang = args?.target_lang || "en";
|
|
484
|
+
const explainLang = disk.explainLang || sourceLang;
|
|
485
|
+
const compile = (modeId) => {
|
|
486
|
+
const mode = resolveMode(modeId, sourceLang, explainLang, disk.modes);
|
|
487
|
+
return mode ? compileModeSystemPrompt(mode, { sourceLang, targetLang, explainLang, globalKillList: disk.globalKillList }) : null;
|
|
488
|
+
};
|
|
489
|
+
if (name === "spec_prompt") {
|
|
490
|
+
const idea = args?.raw_idea || "";
|
|
491
|
+
const sys = compile("spec");
|
|
492
|
+
if (!sys) throw new Error("Spec mode is unavailable");
|
|
493
|
+
return {
|
|
494
|
+
description: "Transform idea into an engineering specification",
|
|
495
|
+
messages: [
|
|
496
|
+
{ role: "user", content: { type: "text", text: `${sys}
|
|
497
|
+
|
|
498
|
+
Task to structure:
|
|
499
|
+
${idea}` } }
|
|
500
|
+
]
|
|
501
|
+
};
|
|
502
|
+
}
|
|
503
|
+
if (name === "conventional_commit") {
|
|
504
|
+
const summary = args?.changes_summary || "";
|
|
505
|
+
const sys = compile("commit");
|
|
506
|
+
if (!sys) throw new Error("Commit mode is unavailable");
|
|
507
|
+
return {
|
|
508
|
+
description: "Transform change summary into Conventional Commit",
|
|
509
|
+
messages: [
|
|
510
|
+
{ role: "user", content: { type: "text", text: `${sys}
|
|
511
|
+
|
|
512
|
+
Changes to commit:
|
|
513
|
+
${summary}` } }
|
|
514
|
+
]
|
|
515
|
+
};
|
|
516
|
+
}
|
|
517
|
+
throw new Error(`Prompt not found: ${name}`);
|
|
518
|
+
});
|
|
519
|
+
return server;
|
|
520
|
+
}
|
|
521
|
+
async function runLingualMcpServer() {
|
|
522
|
+
const server = createLingualMcpServer();
|
|
523
|
+
const transport = new StdioServerTransport();
|
|
524
|
+
await server.connect(transport);
|
|
525
|
+
}
|
|
526
|
+
export {
|
|
527
|
+
applyModeOverrides,
|
|
528
|
+
createLingualMcpServer,
|
|
529
|
+
normalizeReasoningArg,
|
|
530
|
+
resolveMcpLlmConfig,
|
|
531
|
+
resolveMode,
|
|
532
|
+
runLingualMcpServer,
|
|
533
|
+
stripVocabSlots
|
|
534
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,66 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "lingual-mcp",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
|
|
3
|
+
"version": "0.1.1",
|
|
4
|
+
"description": "Universal Model Context Protocol (MCP) server for pi-lingual — bring 0ms dual-register phrasing, intent compilation, and code-token-safe prompt templates to Claude Code, Cursor, Windsurf, Cline, and any MCP client.",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "dist/index.js",
|
|
7
|
+
"module": "dist/index.js",
|
|
8
|
+
"types": "dist/index.d.ts",
|
|
9
|
+
"exports": {
|
|
10
|
+
".": {
|
|
11
|
+
"types": "./dist/index.d.ts",
|
|
12
|
+
"import": "./dist/index.js",
|
|
13
|
+
"require": "./dist/index.cjs"
|
|
14
|
+
}
|
|
15
|
+
},
|
|
16
|
+
"files": [
|
|
17
|
+
"dist",
|
|
18
|
+
"bin",
|
|
19
|
+
"README.md",
|
|
20
|
+
"LICENSE"
|
|
21
|
+
],
|
|
22
|
+
"bin": {
|
|
23
|
+
"lingual-mcp": "bin/lingual-mcp.js"
|
|
24
|
+
},
|
|
25
|
+
"engines": {
|
|
26
|
+
"node": ">=22.19.0"
|
|
27
|
+
},
|
|
28
|
+
"scripts": {
|
|
29
|
+
"build": "tsup src/index.ts --format esm,cjs --dts --clean --no-splitting",
|
|
30
|
+
"typecheck": "tsc --noEmit",
|
|
31
|
+
"pretest": "npm run build",
|
|
32
|
+
"test": "npx tsx --test tests/**/*.test.ts",
|
|
33
|
+
"check": "npm run typecheck && npm test"
|
|
34
|
+
},
|
|
35
|
+
"keywords": [
|
|
36
|
+
"mcp",
|
|
37
|
+
"model-context-protocol",
|
|
38
|
+
"prompt-optimizer",
|
|
39
|
+
"bilingual",
|
|
40
|
+
"pi-lingual",
|
|
41
|
+
"claude-code",
|
|
42
|
+
"cursor",
|
|
43
|
+
"windsurf",
|
|
44
|
+
"developer-tools"
|
|
45
|
+
],
|
|
46
|
+
"author": "Jason Song",
|
|
47
|
+
"license": "MIT",
|
|
48
|
+
"repository": {
|
|
49
|
+
"type": "git",
|
|
50
|
+
"url": "git+https://github.com/3ZEROS12/lingual-mcp.git"
|
|
51
|
+
},
|
|
52
|
+
"homepage": "https://github.com/3ZEROS12/lingual-mcp#readme",
|
|
53
|
+
"bugs": {
|
|
54
|
+
"url": "https://github.com/3ZEROS12/lingual-mcp/issues"
|
|
55
|
+
},
|
|
56
|
+
"dependencies": {
|
|
57
|
+
"@modelcontextprotocol/sdk": "^1.32.2",
|
|
58
|
+
"pi-lingual": "^0.9.0"
|
|
59
|
+
},
|
|
60
|
+
"devDependencies": {
|
|
61
|
+
"@types/node": "^26.6.2",
|
|
62
|
+
"tsup": "^8.5.1",
|
|
63
|
+
"tsx": "^4.23.15",
|
|
64
|
+
"typescript": "^5.8.2"
|
|
65
|
+
}
|
|
66
|
+
}
|