@zltquant/zlt-mcp 0.7.1-beta.0 → 0.7.1-beta.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/README.md +2 -0
- package/package.json +1 -1
- package/zlt-mcp-proxy.bundle.cjs +22 -12
package/README.md
CHANGED
|
@@ -62,6 +62,8 @@ Agent 将返回的 widget.arguments 传给宿主 show_widget(不支持则展
|
|
|
62
62
|
用户在网关页核对设备码并确认授权,CLI 保存凭据,只输出脱敏状态。
|
|
63
63
|
普通终端使用 auth login 前台等待。auth status 查看本地配置;auth logout 只删除
|
|
64
64
|
CLI 自己写入的默认凭据,不撤销共享 Key。已有凭据保持不变。
|
|
65
|
+
独立 CLI 只从凭据文件获取认证,不使用继承的 ZLTQUANT_API_KEY 或 ZLTQUANT_API_BASE;
|
|
66
|
+
ZLTQUANT_HOME 和 ZLTQUANT_CREDENTIALS 仍可指定凭据路径。原生 MCP 宿主注入不受此限制。
|
|
65
67
|
首次使用的网关尚未支持设备登录时,请从 https://api.zltquant.com/login 获取 Key,并由用户自己创建
|
|
66
68
|
`%USERPROFILE%\.zltquant\credentials.json`(只填 `apiKey`)。
|
|
67
69
|
|
package/package.json
CHANGED
package/zlt-mcp-proxy.bundle.cjs
CHANGED
|
@@ -22747,6 +22747,7 @@ function childEnvironment() {
|
|
|
22747
22747
|
const forwarded = {};
|
|
22748
22748
|
for (const [key, value] of Object.entries(process.env)) {
|
|
22749
22749
|
if (value === void 0) continue;
|
|
22750
|
+
if (/^ZLTQUANT_API_(KEY|BASE)$/i.test(key)) continue;
|
|
22750
22751
|
if (/^ZLT(?:QUANT)?_/i.test(key) || key === "PYTHONUTF8") forwarded[key] = value;
|
|
22751
22752
|
}
|
|
22752
22753
|
return forwarded;
|
|
@@ -22759,9 +22760,8 @@ function createMcpClient(options = {}) {
|
|
|
22759
22760
|
const transport = new StdioClientTransport({
|
|
22760
22761
|
command: process.execPath,
|
|
22761
22762
|
args: [entrypoint],
|
|
22762
|
-
// The child is a short-lived CLI adapter
|
|
22763
|
-
//
|
|
22764
|
-
// mcp-server does not persist the one-shot override to credentials.json.
|
|
22763
|
+
// The child is a short-lived CLI adapter using credential files. Do not
|
|
22764
|
+
// forward inherited API keys or allow startup to persist environment keys.
|
|
22765
22765
|
env: { ...childEnvironment(), ZLT_MCP_CLI: "1" },
|
|
22766
22766
|
stderr: "pipe"
|
|
22767
22767
|
});
|
|
@@ -28784,6 +28784,12 @@ var fs18 = __toESM(require("node:fs"), 1);
|
|
|
28784
28784
|
var path17 = __toESM(require("node:path"), 1);
|
|
28785
28785
|
var import_node_crypto4 = require("node:crypto");
|
|
28786
28786
|
var SOURCE = "zlt-mcp-device-login";
|
|
28787
|
+
var IGNORED_API_ENV = /* @__PURE__ */ new Set(["ZLTQUANT_API_KEY", "ZLTQUANT_API_BASE"]);
|
|
28788
|
+
function authCliEnv(env) {
|
|
28789
|
+
return Object.fromEntries(
|
|
28790
|
+
Object.entries(env).filter(([key]) => !IGNORED_API_ENV.has(key.toUpperCase()))
|
|
28791
|
+
);
|
|
28792
|
+
}
|
|
28787
28793
|
var client = {
|
|
28788
28794
|
start: () => startDeviceAuthorization(),
|
|
28789
28795
|
poll: (s, o) => pollDeviceAuthorization(s, o),
|
|
@@ -28855,7 +28861,7 @@ function drop(id, e = process.env) {
|
|
|
28855
28861
|
fs18.rmSync(sessionPath(id, e), { force: true });
|
|
28856
28862
|
}
|
|
28857
28863
|
function preflight(e) {
|
|
28858
|
-
if (e.ZLTQUANT_CREDENTIALS ||
|
|
28864
|
+
if (e.ZLTQUANT_CREDENTIALS || readCredentials(e))
|
|
28859
28865
|
throw Error("Authentication is already configured");
|
|
28860
28866
|
}
|
|
28861
28867
|
async function finish(s, e, c, json) {
|
|
@@ -28878,7 +28884,7 @@ async function finish(s, e, c, json) {
|
|
|
28878
28884
|
return o;
|
|
28879
28885
|
}
|
|
28880
28886
|
async function runAuthLogin(o = {}) {
|
|
28881
|
-
const e = o.env || process.env;
|
|
28887
|
+
const e = authCliEnv(o.env || process.env);
|
|
28882
28888
|
preflight(e);
|
|
28883
28889
|
const c = o.client || client, s = await c.start();
|
|
28884
28890
|
if (o.widget) {
|
|
@@ -28905,7 +28911,7 @@ async function runAuthLogin(o = {}) {
|
|
|
28905
28911
|
return finish(s, e, c, o.json);
|
|
28906
28912
|
}
|
|
28907
28913
|
async function runAuthWait(id, o = {}) {
|
|
28908
|
-
const e = o.env || process.env;
|
|
28914
|
+
const e = authCliEnv(o.env || process.env);
|
|
28909
28915
|
preflight(e);
|
|
28910
28916
|
const lockPath = sessionPath(id, e) + ".lock";
|
|
28911
28917
|
let lock;
|
|
@@ -28927,13 +28933,14 @@ async function runAuthWait(id, o = {}) {
|
|
|
28927
28933
|
fs18.rmSync(lockPath, { force: true });
|
|
28928
28934
|
}
|
|
28929
28935
|
}
|
|
28930
|
-
var authStatus = (e = process.env) => getAuthStatus(e);
|
|
28936
|
+
var authStatus = (e = process.env) => getAuthStatus(authCliEnv(e));
|
|
28931
28937
|
function authLogout(e = process.env) {
|
|
28932
|
-
|
|
28933
|
-
|
|
28934
|
-
|
|
28935
|
-
const
|
|
28936
|
-
|
|
28938
|
+
const authEnv = authCliEnv(e);
|
|
28939
|
+
if (authEnv.ZLTQUANT_CREDENTIALS)
|
|
28940
|
+
return { removed: false, status: getAuthStatus(authEnv) };
|
|
28941
|
+
const c = readCredentials(authEnv);
|
|
28942
|
+
const removed = !!c && c.source === SOURCE && removeCredentials({ apiKey: c.apiKey, source: SOURCE }, authEnv);
|
|
28943
|
+
return { removed, status: getAuthStatus(authEnv) };
|
|
28937
28944
|
}
|
|
28938
28945
|
|
|
28939
28946
|
// src/index.ts
|
|
@@ -28952,6 +28959,9 @@ function writeCliArgumentError(message, write2) {
|
|
|
28952
28959
|
if (process.argv.length <= 2) {
|
|
28953
28960
|
startMcpServer();
|
|
28954
28961
|
} else {
|
|
28962
|
+
for (const key of Object.keys(process.env)) {
|
|
28963
|
+
if (/^ZLTQUANT_API_(KEY|BASE)$/i.test(key)) delete process.env[key];
|
|
28964
|
+
}
|
|
28955
28965
|
let evidence;
|
|
28956
28966
|
let evidenceSetupError;
|
|
28957
28967
|
try {
|