Call netx REST from native netx__* tools.

Drop the local python -m netx_mcp / mcp-client path so terminal users only need API URL + token.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
oliver 2026-09-04 23:38:24 +08:00
parent 5179eb74b1
commit ed219842d3
22 changed files with 1431 additions and 179 deletions

View file

@ -287,22 +287,6 @@ function NetxopsCard(props) {
props.resetField("lang");
}
}),
/* @__PURE__ */ jsx_runtime.jsx(ValueField, {
id: "netxops-python",
label: t("pythonCommand"),
hint: t("pythonCommandHint"),
field: state.pythonCommand,
overriddenLabel: t("overridden"),
resetLabel: t("reset"),
invalidLabel: t("invalid"),
disabled,
onEdit: (text) => {
props.edit("pythonCommand", text);
},
onReset: () => {
props.resetField("pythonCommand");
}
}),
/* @__PURE__ */ jsx_runtime.jsxs("div", {
className: "dsh-nx-footer",
children: [
@ -542,7 +526,7 @@ class NetxopsCardController {
constructor(scope, ctx) {
this.scope = scope;
this.ctx = ctx;
this.form = new CardForm(scope, [textField("apiUrl"), textField("lang"), textField("pythonCommand")], [{ field: API_TOKEN_FIELD, write: (text) => this.writeToken(text) }]);
this.form = new CardForm(scope, [textField("apiUrl"), textField("lang")], [{ field: API_TOKEN_FIELD, write: (text) => this.writeToken(text) }]);
this.store = this.form.bind(() => this.projection());
scope.subscribe(() => {
this.readCredential();
@ -566,7 +550,6 @@ class NetxopsCardController {
...this.form.shell(),
apiUrl: this.form.field("apiUrl"),
lang: this.form.field("lang"),
pythonCommand: this.form.field("pythonCommand"),
apiToken: this.form.field(API_TOKEN_FIELD),
apiTokenConfigured: this.credential.configured,
apiTokenWritable: this.credential.remoteReady && this.credential.writable,
@ -635,13 +618,11 @@ function refOf(snapshot) {
// src/client/locales.ts
var en = {
title: "Netx Ops",
description: "UME API endpoint and bearer token for mcp__netx__* tools.",
description: "UME API endpoint and bearer token for netx__* tools.",
apiUrl: "API URL",
apiUrlHint: "netx REST root, e.g. http://127.0.0.1:8890",
lang: "Language",
langHint: "Passed as NETX_LANG (zh / en).",
pythonCommand: "Python command",
pythonCommandHint: "Executable that can run `python -m netx_mcp`.",
langHint: "Response language hint (zh / en).",
apiToken: "API token",
apiTokenHint: "Stored as credential NETX_API_TOKEN (never written into settings). Leave blank to keep the current token.",
apiTokenUnavailable: "This DSH build does not expose remote.credentials. Set the token with scripts/set-netx-token.ps1 (or .sh), then restart is not required if credentials are watched.",
@ -661,13 +642,11 @@ var en = {
};
var zh = {
title: "Netx Ops",
description: "UME API 地址与 Bearer Token,供 mcp__netx__* 工具使用。",
description: "UME API 地址与 Bearer Token,供 netx__* 工具使用。",
apiUrl: "API 地址",
apiUrlHint: "netx REST 根地址,例如 http://127.0.0.1:8890",
lang: "语言",
langHint: "传给 MCP 的 NETX_LANG(zh / en)。",
pythonCommand: "Python 命令",
pythonCommandHint: "能执行 `python -m netx_mcp` 的解释器。",
langHint: "响应语言提示(zh / en)。",
apiToken: "API Token",
apiTokenHint: "写入凭据 NETX_API_TOKEN(不会进 settings)。留空表示保留已有 token。",
apiTokenUnavailable: "当前 DSH 未提供 remote.credentials。请用 scripts/set-netx-token.ps1(或 .sh)写入 token;若 harness 在监视凭据文件则无需重启。",