@zltquant/zlt-mcp 0.4.1 → 0.4.2
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 +9 -9
- package/package.json +1 -1
- package/zlt-mcp-proxy.bundle.cjs +54 -15
package/README.md
CHANGED
|
@@ -7,7 +7,14 @@
|
|
|
7
7
|
|
|
8
8
|
## 接入
|
|
9
9
|
|
|
10
|
-
|
|
10
|
+
WorkBuddy 使用配套 Skill,并由 Skill 调用 npm CLI 完成任务,无需配置 MCP 连接器:
|
|
11
|
+
|
|
12
|
+
```powershell
|
|
13
|
+
npx -y @zltquant/zlt-mcp list --json
|
|
14
|
+
npx -y @zltquant/zlt-mcp call zlt-runtime-doctor --args-json '{}'
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
其他支持原生 MCP 的客户端(Trae / Claude Code / Cursor 等)可以使用下面的配置:
|
|
11
18
|
|
|
12
19
|
```json
|
|
13
20
|
{
|
|
@@ -20,17 +27,10 @@
|
|
|
20
27
|
}
|
|
21
28
|
```
|
|
22
29
|
|
|
23
|
-
WorkBuddy 也可以不配置 MCP,直接由 Skill 调用 CLI:
|
|
24
|
-
|
|
25
|
-
```powershell
|
|
26
|
-
npx -y @zltquant/zlt-mcp list --json
|
|
27
|
-
npx -y @zltquant/zlt-mcp call mcp-get-strategy-list --args-json '{"status":0,"treeId":0}'
|
|
28
|
-
```
|
|
29
|
-
|
|
30
30
|
首次使用前请从 https://api.zltquant.com/login 获取 Key,并由用户自己创建
|
|
31
31
|
`%USERPROFILE%\.zltquant\credentials.json`(只填 `apiKey`)。
|
|
32
32
|
|
|
33
|
-
|
|
33
|
+
其他客户端无法使用 npx 时,也可以固定安装后用 node 启动 MCP 服务:
|
|
34
34
|
|
|
35
35
|
```powershell
|
|
36
36
|
npm i @zltquant/zlt-mcp --prefix "$env:USERPROFILE\.zlt-quant" --registry https://registry.npmmirror.com
|
package/package.json
CHANGED
package/zlt-mcp-proxy.bundle.cjs
CHANGED
|
@@ -18374,8 +18374,21 @@ function parsePackageList(value) {
|
|
|
18374
18374
|
|
|
18375
18375
|
// ../zlt-runtime-core/dist/registry.js
|
|
18376
18376
|
var import_child_process = require("child_process");
|
|
18377
|
-
var
|
|
18378
|
-
var
|
|
18377
|
+
var POWERSHELL_EXE = "powershell.exe";
|
|
18378
|
+
var REGISTRY_SUBKEY_ENV = "ZLT_REGISTRY_SUBKEY_B64";
|
|
18379
|
+
var REGISTRY_VALUE_NAME_ENV = "ZLT_REGISTRY_VALUE_NAME_B64";
|
|
18380
|
+
var READ_REGISTRY_VALUE_SCRIPT = [
|
|
18381
|
+
"$subKey = [Text.Encoding]::UTF8.GetString([Convert]::FromBase64String($env:ZLT_REGISTRY_SUBKEY_B64))",
|
|
18382
|
+
"$valueName = [Text.Encoding]::UTF8.GetString([Convert]::FromBase64String($env:ZLT_REGISTRY_VALUE_NAME_B64))",
|
|
18383
|
+
"$key = [Microsoft.Win32.Registry]::LocalMachine.OpenSubKey($subKey)",
|
|
18384
|
+
"if ($null -eq $key) { exit 1 }",
|
|
18385
|
+
"try {",
|
|
18386
|
+
" if ($key.GetValueKind($valueName) -ne [Microsoft.Win32.RegistryValueKind]::String) { exit 1 }",
|
|
18387
|
+
" $value = $key.GetValue($valueName, $null, [Microsoft.Win32.RegistryValueOptions]::DoNotExpandEnvironmentNames)",
|
|
18388
|
+
" if ($null -eq $value) { exit 1 }",
|
|
18389
|
+
" [Console]::Out.Write([string]$value)",
|
|
18390
|
+
"} finally { $key.Dispose() }"
|
|
18391
|
+
].join("\n");
|
|
18379
18392
|
function buildAssistantRegistryKey(registryKeyName) {
|
|
18380
18393
|
return `HKLM\\SOFTWARE\\WOW6432Node\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\${registryKeyName}`;
|
|
18381
18394
|
}
|
|
@@ -18393,26 +18406,45 @@ function getRegistryKeyNames(config2) {
|
|
|
18393
18406
|
}
|
|
18394
18407
|
return names;
|
|
18395
18408
|
}
|
|
18396
|
-
function
|
|
18397
|
-
const
|
|
18398
|
-
|
|
18399
|
-
|
|
18409
|
+
function buildPowerShellRegistryEnvironment(registryKey, valueName) {
|
|
18410
|
+
const subKey = registryKey.replace(/^HKLM\\/i, "");
|
|
18411
|
+
return {
|
|
18412
|
+
...process.env,
|
|
18413
|
+
[REGISTRY_SUBKEY_ENV]: Buffer.from(subKey, "utf-8").toString("base64"),
|
|
18414
|
+
[REGISTRY_VALUE_NAME_ENV]: Buffer.from(valueName, "utf-8").toString("base64")
|
|
18415
|
+
};
|
|
18416
|
+
}
|
|
18417
|
+
function buildPowerShellRegistryArgs() {
|
|
18418
|
+
return ["-NoLogo", "-NoProfile", "-NonInteractive", "-Command", READ_REGISTRY_VALUE_SCRIPT];
|
|
18419
|
+
}
|
|
18420
|
+
function readRegistryValueWithPowerShell(registryKey, valueName) {
|
|
18421
|
+
return new Promise((resolve8, reject) => {
|
|
18422
|
+
(0, import_child_process.execFile)(POWERSHELL_EXE, buildPowerShellRegistryArgs(), {
|
|
18423
|
+
encoding: "utf-8",
|
|
18424
|
+
env: buildPowerShellRegistryEnvironment(registryKey, valueName),
|
|
18425
|
+
windowsHide: true
|
|
18426
|
+
}, (error2, stdout) => {
|
|
18427
|
+
if (error2)
|
|
18428
|
+
reject(error2);
|
|
18429
|
+
else
|
|
18430
|
+
resolve8(stdout.trim());
|
|
18431
|
+
});
|
|
18432
|
+
});
|
|
18400
18433
|
}
|
|
18401
|
-
async function readAssistantRegistryStringValue(config2, valueName,
|
|
18434
|
+
async function readAssistantRegistryStringValue(config2, valueName, _suppressStderr = true) {
|
|
18402
18435
|
const registryKeyNames = getRegistryKeyNames(config2);
|
|
18403
18436
|
const registryKey = buildAssistantRegistryKey(registryKeyNames[0]);
|
|
18404
18437
|
if (process.platform !== "win32")
|
|
18405
18438
|
return { registryKey, valueName };
|
|
18406
|
-
const stderrRedirect = suppressStderr ? " 2>nul" : "";
|
|
18407
18439
|
for (const registryKeyName of registryKeyNames) {
|
|
18408
18440
|
const candidateRegistryKey = buildAssistantRegistryKey(registryKeyName);
|
|
18409
18441
|
try {
|
|
18410
|
-
const
|
|
18442
|
+
const stdout = await readRegistryValueWithPowerShell(candidateRegistryKey, valueName);
|
|
18411
18443
|
return {
|
|
18412
18444
|
registryKey: candidateRegistryKey,
|
|
18413
18445
|
valueName,
|
|
18414
18446
|
stdout,
|
|
18415
|
-
value:
|
|
18447
|
+
value: stdout
|
|
18416
18448
|
};
|
|
18417
18449
|
} catch {
|
|
18418
18450
|
}
|
|
@@ -27468,7 +27500,8 @@ function runtimeRecoveryStopData(message, extra = {}, handler = "runtimeStart")
|
|
|
27468
27500
|
|
|
27469
27501
|
// src/index.ts
|
|
27470
27502
|
var CLI_NAME = "zlt-mcp";
|
|
27471
|
-
var
|
|
27503
|
+
var CLI_FALLBACK_PACKAGE_NAME = "@zltquant/zlt-mcp";
|
|
27504
|
+
var CLI_FALLBACK_VERSION = "0.4.2";
|
|
27472
27505
|
if (process.argv.length <= 2) {
|
|
27473
27506
|
startMcpServer();
|
|
27474
27507
|
} else {
|
|
@@ -27486,7 +27519,7 @@ if (process.argv.length <= 2) {
|
|
|
27486
27519
|
maxTotalTimeoutMs: parseTimeoutOption(options.maxTotalTimeoutMs, "--max-total-timeout-ms"),
|
|
27487
27520
|
showProgress: options.progress !== false
|
|
27488
27521
|
});
|
|
27489
|
-
process.stdout.write(JSON.stringify(result) + "\n");
|
|
27522
|
+
process.stdout.write(JSON.stringify(withCliProvenance(result)) + "\n");
|
|
27490
27523
|
if (result.isError === true) process.exitCode = 1;
|
|
27491
27524
|
} catch (error2) {
|
|
27492
27525
|
const message = error2 instanceof Error ? error2.message : String(error2);
|
|
@@ -27499,7 +27532,7 @@ if (process.argv.length <= 2) {
|
|
|
27499
27532
|
try {
|
|
27500
27533
|
const result = await listMcpTools();
|
|
27501
27534
|
if (options.json) {
|
|
27502
|
-
process.stdout.write(JSON.stringify(result) + "\n");
|
|
27535
|
+
process.stdout.write(JSON.stringify(withCliProvenance(result)) + "\n");
|
|
27503
27536
|
return;
|
|
27504
27537
|
}
|
|
27505
27538
|
const tools = Array.isArray(result.tools) ? result.tools : [];
|
|
@@ -27564,13 +27597,16 @@ if (process.argv.length <= 2) {
|
|
|
27564
27597
|
});
|
|
27565
27598
|
}
|
|
27566
27599
|
function resolveCliVersion() {
|
|
27600
|
+
return resolveCliPackageProvenance().packageVersion;
|
|
27601
|
+
}
|
|
27602
|
+
function resolveCliPackageProvenance() {
|
|
27567
27603
|
let current = path14.dirname(path14.resolve(process.argv[1] || process.cwd()));
|
|
27568
27604
|
for (let depth = 0; depth < 6; depth += 1) {
|
|
27569
27605
|
const manifestPath = path14.join(current, "package.json");
|
|
27570
27606
|
try {
|
|
27571
27607
|
const manifest = JSON.parse(fs13.readFileSync(manifestPath, "utf-8"));
|
|
27572
27608
|
if ((manifest.name === "@zltquant/zlt-mcp" || manifest.name === "zlt-mcp-proxy") && typeof manifest.version === "string") {
|
|
27573
|
-
return manifest.version;
|
|
27609
|
+
return { packageName: manifest.name, packageVersion: manifest.version };
|
|
27574
27610
|
}
|
|
27575
27611
|
} catch {
|
|
27576
27612
|
}
|
|
@@ -27578,7 +27614,10 @@ function resolveCliVersion() {
|
|
|
27578
27614
|
if (parent === current) break;
|
|
27579
27615
|
current = parent;
|
|
27580
27616
|
}
|
|
27581
|
-
return CLI_FALLBACK_VERSION;
|
|
27617
|
+
return { packageName: CLI_FALLBACK_PACKAGE_NAME, packageVersion: CLI_FALLBACK_VERSION };
|
|
27618
|
+
}
|
|
27619
|
+
function withCliProvenance(result) {
|
|
27620
|
+
return { ...result, cliProvenance: resolveCliPackageProvenance() };
|
|
27582
27621
|
}
|
|
27583
27622
|
function parseTimeoutOption(value, flag) {
|
|
27584
27623
|
if (value === void 0) return void 0;
|