@zltquant/zlt-mcp 0.5.0 → 0.6.0-beta.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 +8 -1
- package/package.json +1 -1
- package/zlt-mcp-proxy.bundle.cjs +24 -4
package/README.md
CHANGED
|
@@ -7,13 +7,18 @@
|
|
|
7
7
|
|
|
8
8
|
## 接入
|
|
9
9
|
|
|
10
|
-
WorkBuddy
|
|
10
|
+
WorkBuddy 用户可从 SkillHub 安装 [zlt-quant Skill](https://skillhub.cn/skills/org-gir79457/zlt-quant),由 Skill 调用本包的 CLI 完成量化任务,无需配置 MCP 连接器。CLI 调用示例:
|
|
11
11
|
|
|
12
12
|
```powershell
|
|
13
13
|
npx -y @zltquant/zlt-mcp list --json
|
|
14
14
|
npx -y @zltquant/zlt-mcp call zlt-runtime-doctor --args-json '{}'
|
|
15
15
|
```
|
|
16
16
|
|
|
17
|
+
使用 `--help` 和 `call --help` 获取当前调用契约;`list --tool mcp-wait --json`
|
|
18
|
+
只查询一个工具的完整 schema,未知名字返回非零退出码。简单查询直接输出,无参数可省略参数选项;
|
|
19
|
+
复杂配置用 `--args-file`,大结果或下游证据才使用结果文件。保留独立 stderr 和 CLI 原始退出码,
|
|
20
|
+
调用成功后再解析结果,不通过管道隐藏失败。Skill 负责工作流,不维护第二份接口契约。
|
|
21
|
+
|
|
17
22
|
业务调用支持 `call --output-json <新文件路径>`:完整 JSON 写入文件,stdout 返回含
|
|
18
23
|
`ok`、`tool`、`resultFile`、`cliProvenance`、精简 `data` 的回执。
|
|
19
24
|
输出目录须已存在,已有文件会在执行工具前报错;每次使用新文件名。完整参数与大段数据从结果文件读取。
|
|
@@ -48,6 +53,8 @@ npm i @zltquant/zlt-mcp --prefix "$env:USERPROFILE\.zlt-quant" --registry https:
|
|
|
48
53
|
|
|
49
54
|
## 配套技能
|
|
50
55
|
|
|
56
|
+
推荐从 SkillHub 安装 [zlt-quant Skill](https://skillhub.cn/skills/org-gir79457/zlt-quant),用于策略生成、回测执行与验收、结果分析和环境准备。
|
|
57
|
+
|
|
51
58
|
量化技能(策略生成、回测执行与验收、结果分析、装机引导)见 gitee 组合仓,
|
|
52
59
|
克隆后运行 `install.ps1`:
|
|
53
60
|
|
package/package.json
CHANGED
package/zlt-mcp-proxy.bundle.cjs
CHANGED
|
@@ -27547,12 +27547,27 @@ if (process.argv.length <= 2) {
|
|
|
27547
27547
|
startMcpServer();
|
|
27548
27548
|
} else {
|
|
27549
27549
|
const program2 = new Command();
|
|
27550
|
-
program2.name(CLI_NAME).description("MCP proxy for ZLTHost IPC service").version(resolveCliVersion());
|
|
27550
|
+
program2.name(CLI_NAME).description("MCP proxy for ZLTHost IPC service").version(resolveCliVersion()).addHelpText("after", "\nDiscovery: list for names; list --tool <name> --json for one complete input schema.\nUse call --help for input, output and diagnostic handling.");
|
|
27551
27551
|
program2.command("__keepalive <kind> <id> [codePath]", { hidden: true }).action(async (kind, id, codePath) => {
|
|
27552
27552
|
if (kind !== "backtest") throw new Error(`Unsupported keepalive kind: ${kind}`);
|
|
27553
27553
|
await keepMcpBacktestAlive(id, codePath);
|
|
27554
27554
|
});
|
|
27555
|
-
program2.command("call <tool>").description("Call any MCP tool through the bundled MCP server").option("--args-json <json>", "JSON object containing tool arguments").option("--args-file <path>", "Read the JSON argument object from a file").option("--output-json <path>", "Save the complete result to a new JSON file and print a compact receipt").option("--timeout-ms <ms>", "MCP request inactivity timeout in milliseconds").option("--max-total-timeout-ms <ms>", "Optional hard upper bound for the request").option("--no-progress", "Suppress progress diagnostics on stderr").
|
|
27555
|
+
program2.command("call <tool>").description("Call any MCP tool through the bundled MCP server").option("--args-json <json>", "JSON object containing tool arguments").option("--args-file <path>", "Read the JSON argument object from a file").option("--output-json <path>", "Save the complete result to a new JSON file and print a compact receipt").option("--timeout-ms <ms>", "MCP request inactivity timeout in milliseconds").option("--max-total-timeout-ms <ms>", "Optional hard upper bound for the request").option("--no-progress", "Suppress progress diagnostics on stderr").addHelpText("after", `
|
|
27556
|
+
Input: omitted arguments mean {}; use --args-json for small objects and --args-file
|
|
27557
|
+
for nested configuration or shell-sensitive text. Follow the selected tool schema
|
|
27558
|
+
from list --tool <name> --json. Windows paths must be native paths (C:/...), not /c/....
|
|
27559
|
+
Output: by default stdout contains the complete MCP JSON envelope plus cliProvenance.
|
|
27560
|
+
JSON business responses are inside content[].text (or structuredContent when present).
|
|
27561
|
+
Use --output-json for large results or downstream evidence: it saves the complete
|
|
27562
|
+
envelope and prints only a compact receipt. The parent directory must exist and the
|
|
27563
|
+
file must be new. A receipt is not the full business response.
|
|
27564
|
+
Diagnostics: preserve stderr separately and check this process's exit code before
|
|
27565
|
+
parsing output. Do not discard stderr, merge it into JSON, or pipe calls through
|
|
27566
|
+
head/tail/parsers that can hide the CLI exit code. --no-progress only disables progress.
|
|
27567
|
+
If saving fails after execution, the complete response is on stdout; preserve it
|
|
27568
|
+
and inspect the returned state before retrying any operation that may have run.
|
|
27569
|
+
Credentials belong in the configured local credential store, never in arguments.
|
|
27570
|
+
`).action(async (tool, options) => {
|
|
27556
27571
|
let outputFd;
|
|
27557
27572
|
try {
|
|
27558
27573
|
const args = parseMcpArgs(options.argsJson, options.argsFile);
|
|
@@ -27592,9 +27607,14 @@ if (process.argv.length <= 2) {
|
|
|
27592
27607
|
if (outputFd !== void 0) fs13.closeSync(outputFd);
|
|
27593
27608
|
}
|
|
27594
27609
|
});
|
|
27595
|
-
program2.command("list").description("List MCP tools exposed by the bundled server").option("--json", "Emit the complete tools/list response as JSON").action(async (options) => {
|
|
27610
|
+
program2.command("list").description("List MCP tools exposed by the bundled server").option("--json", "Emit the complete tools/list response as JSON").option("--tool <name>", "Select one exact tool name; combine with --json for its complete schema").addHelpText("after", "\nReuse discovery within a task. Query one schema with list --tool <name> --json.\nUnknown names fail with exit code 1. Preserve stderr separately from JSON stdout.").action(async (options) => {
|
|
27596
27611
|
try {
|
|
27597
|
-
|
|
27612
|
+
let result = await listMcpTools();
|
|
27613
|
+
if (options.tool !== void 0) {
|
|
27614
|
+
const tools2 = Array.isArray(result.tools) ? result.tools.filter((tool) => tool.name === options.tool) : [];
|
|
27615
|
+
if (tools2.length === 0) throw new Error(`Unknown tool: ${options.tool}. Use list to discover available names.`);
|
|
27616
|
+
result = { ...result, tools: tools2 };
|
|
27617
|
+
}
|
|
27598
27618
|
if (options.json) {
|
|
27599
27619
|
process.stdout.write(JSON.stringify(withCliProvenance(result)) + "\n");
|
|
27600
27620
|
return;
|