@modootoday/datalab-extension-mcp 1.11.4 → 1.12.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.en.md +10 -10
- package/README.md +10 -10
- package/dist/{chunk-RF6L4PSA.js → chunk-OOT6JOYE.js} +116 -43
- package/dist/cli.js +16 -10
- package/dist/{dist-ITPO7PMQ.js → dist-H4FFG2Z2.js} +229 -7
- package/dist/index.d.ts +5 -13
- package/dist/index.js +1 -1
- package/package.json +1 -1
package/README.en.md
CHANGED
|
@@ -58,13 +58,13 @@ Avoid sharing a screenshot or the copied setup. This one key is what goes into t
|
|
|
58
58
|
One command finds **every** AI app on your computer and connects them automatically. Nothing to do per app.
|
|
59
59
|
|
|
60
60
|
1. **Open a terminal** — on Windows type `cmd` in the search box → "Command Prompt"; on Mac press `⌘+Space` and type `Terminal`; on Linux open your terminal app (often `Ctrl+Alt+T`).
|
|
61
|
-
2. **Paste this command and press Enter.** The
|
|
61
|
+
2. **Paste this command and press Enter.** The helper installs this version of the connector on your computer (`npm install -g`) and registers that installed copy with your AI apps, so an app does not download the connector again each time it starts. Once connected, the connector checks the canonical release and installs a newer version for the next start. Diagnostic environments can opt out with `--no-self-update`.
|
|
62
62
|
|
|
63
63
|
```
|
|
64
|
-
npx -y @modootoday/datalab-extension-mcp@1.
|
|
64
|
+
npx -y @modootoday/datalab-extension-mcp@1.12.0 install
|
|
65
65
|
```
|
|
66
66
|
|
|
67
|
-
Lines of English scrolling by is normal. This
|
|
67
|
+
Lines of English scrolling by is normal. This installs the connector and adds only our entry to your AI apps' settings — it touches nothing else. Without permission for global npm installs, it falls back to having each app download and run the connector at start (a slower start).
|
|
68
68
|
|
|
69
69
|
The helper runs in four chapters — `[1/4]` check the connection key, `[2/4]` find AI programs, `[3/4]` connect, `[4/4] 결과` (results).
|
|
70
70
|
|
|
@@ -151,10 +151,10 @@ diagnosis, Place reputation, Pumasi, photo/video production, and automatic tool
|
|
|
151
151
|
discovery. Press Enter to keep the recommended set.
|
|
152
152
|
|
|
153
153
|
```
|
|
154
|
-
npx -y @modootoday/datalab-extension-mcp@1.
|
|
155
|
-
npx -y @modootoday/datalab-extension-mcp@1.
|
|
156
|
-
npx -y @modootoday/datalab-extension-mcp@1.
|
|
157
|
-
npx -y @modootoday/datalab-extension-mcp@1.
|
|
154
|
+
npx -y @modootoday/datalab-extension-mcp@1.12.0 skills list
|
|
155
|
+
npx -y @modootoday/datalab-extension-mcp@1.12.0 skills status
|
|
156
|
+
npx -y @modootoday/datalab-extension-mcp@1.12.0 skills attach <name>
|
|
157
|
+
npx -y @modootoday/datalab-extension-mcp@1.12.0 skills detach <name>
|
|
158
158
|
```
|
|
159
159
|
|
|
160
160
|
- `list` shows everything in this version, name and description.
|
|
@@ -244,7 +244,7 @@ Exactly what it says. Open Chrome, keep the DataLab Tools side panel open, and i
|
|
|
244
244
|
|
|
245
245
|
That's expected — **it's deliberate.**
|
|
246
246
|
|
|
247
|
-
There are
|
|
247
|
+
There are 218 tools. Sending all of them as a list runs into the cap each AI app
|
|
248
248
|
sets: some quietly drop whatever doesn't fit, some refuse the connection outright.
|
|
249
249
|
So only the discovery tools go in the list, and **the rest are selected from the
|
|
250
250
|
user's intent and handed over as an answer.**
|
|
@@ -275,7 +275,7 @@ Start it again after a full quit and it picks the tools up. If they still aren't
|
|
|
275
275
|
- **When the connection disappears** — run the very command you used at the start once more; it safely re-registers. (Some AI apps clean up their settings file and drop the connection.)
|
|
276
276
|
|
|
277
277
|
```
|
|
278
|
-
npx -y @modootoday/datalab-extension-mcp@1.
|
|
278
|
+
npx -y @modootoday/datalab-extension-mcp@1.12.0 install
|
|
279
279
|
```
|
|
280
280
|
|
|
281
281
|
- **`'npx' is not recognized...`** — Node.js isn't installed. Follow "No Node.js?" in Step 2, then run the command again.
|
|
@@ -305,7 +305,7 @@ Start it again after a full quit and it picks the tools up. If they still aren't
|
|
|
305
305
|
1. Run this in a terminal (it removes the entries registered in your AI apps).
|
|
306
306
|
|
|
307
307
|
```
|
|
308
|
-
npx -y @modootoday/datalab-extension-mcp@1.
|
|
308
|
+
npx -y @modootoday/datalab-extension-mcp@1.12.0 uninstall
|
|
309
309
|
```
|
|
310
310
|
|
|
311
311
|
2. Turn **MCP 연결** off in the extension settings. The panel is the bridge, so with it off a leftover config line can look nothing up.
|
package/README.md
CHANGED
|
@@ -52,13 +52,13 @@ Claude 같은 AI 앱을 데이터랩툴즈에 연결해 주는 작은 무료 프
|
|
|
52
52
|
명령 한 줄이면 컴퓨터에 있는 AI 앱을 **모두 자동으로** 찾아 연결해 줘요. 앱마다 따로 할 일은 없어요.
|
|
53
53
|
|
|
54
54
|
1. **터미널을 열어요** — Windows는 검색창에 `cmd` → "명령 프롬프트", Mac은 `⌘+스페이스`로 `터미널`, Linux는 터미널 앱(보통 `Ctrl+Alt+T`)이에요.
|
|
55
|
-
2. **아래 명령을 붙여넣고 Enter를 눌러요.**
|
|
55
|
+
2. **아래 명령을 붙여넣고 Enter를 눌러요.** 도우미는 이 버전의 연결 프로그램을 이 컴퓨터에 설치(`npm install -g`)하고, AI 앱이 그 설치본을 바로 실행하도록 등록해요. 그래서 AI 앱이 시작할 때 연결 프로그램을 다시 내려받지 않아요. 연결이 열린 뒤 정본 릴리스를 확인해 새 버전이 있으면 설치해 두고, 다음 시작부터 그 버전을 써요. 진단 환경에서는 `--no-self-update`로 이 업데이트를 끌 수 있어요.
|
|
56
56
|
|
|
57
57
|
```
|
|
58
|
-
npx -y @modootoday/datalab-extension-mcp@1.
|
|
58
|
+
npx -y @modootoday/datalab-extension-mcp@1.12.0 install
|
|
59
59
|
```
|
|
60
60
|
|
|
61
|
-
영어 글자가 여러 줄 올라오는 건 정상이에요. 이 명령은 연결 프로그램을
|
|
61
|
+
영어 글자가 여러 줄 올라오는 건 정상이에요. 이 명령은 연결 프로그램을 설치하고 AI 앱 설정에 우리 항목만 더할 뿐, 다른 건 건드리지 않아요. npm 전역 설치 권한이 없으면 예전처럼 AI 앱이 시작할 때마다 내려받아 실행하도록 연결해요(시작이 조금 느려요).
|
|
62
62
|
|
|
63
63
|
도우미는 네 대목으로 진행돼요 — `[1/4] 연결 키 확인`, `[2/4] 연결할 AI 프로그램 찾기`, `[3/4] 연결하는 중`, `[4/4] 결과`.
|
|
64
64
|
|
|
@@ -137,10 +137,10 @@ Claude 같은 AI 앱을 데이터랩툴즈에 연결해 주는 작은 무료 프
|
|
|
137
137
|
도움말을 번호로 여러 개 고를 수 있어요. Enter를 누르면 추천 구성만 설치됩니다.
|
|
138
138
|
|
|
139
139
|
```
|
|
140
|
-
npx -y @modootoday/datalab-extension-mcp@1.
|
|
141
|
-
npx -y @modootoday/datalab-extension-mcp@1.
|
|
142
|
-
npx -y @modootoday/datalab-extension-mcp@1.
|
|
143
|
-
npx -y @modootoday/datalab-extension-mcp@1.
|
|
140
|
+
npx -y @modootoday/datalab-extension-mcp@1.12.0 skills list
|
|
141
|
+
npx -y @modootoday/datalab-extension-mcp@1.12.0 skills status
|
|
142
|
+
npx -y @modootoday/datalab-extension-mcp@1.12.0 skills attach <이름>
|
|
143
|
+
npx -y @modootoday/datalab-extension-mcp@1.12.0 skills detach <이름>
|
|
144
144
|
```
|
|
145
145
|
|
|
146
146
|
- `list` 는 이 버전에 들어 있는 전부를 이름과 설명으로 보여 줘요.
|
|
@@ -214,7 +214,7 @@ MCP 를 켜 두었지만 **네이버 페이지가 한 곳도 열려 있지 않
|
|
|
214
214
|
|
|
215
215
|
정상이에요. **일부러 그렇게 보냅니다.**
|
|
216
216
|
|
|
217
|
-
전체 도구는
|
|
217
|
+
전체 도구는 218개인데, 그걸 전부 목록으로 보내면 AI 앱마다 정해 둔 상한에 걸려요.
|
|
218
218
|
어떤 앱은 넘치는 만큼 조용히 잘라내고, 어떤 앱은 아예 연결을 거부해요. 그래서 자주 쓰는
|
|
219
219
|
탐색 도구만 목록에 올리고, 나머지는 **AI가 요청 의도를 찾아 답으로 건네받습니다.**
|
|
220
220
|
|
|
@@ -242,7 +242,7 @@ AI가 "그런 기능은 없다" 고 답하면, **"숨은 도구를 찾아보고
|
|
|
242
242
|
- **연결이 사라졌을 때** — 처음 실행했던 그 명령을 한 번 더 실행하면 안전하게 다시 등록돼요. (일부 AI 앱이 설정 파일을 정리하며 연결을 지우기도 해요.)
|
|
243
243
|
|
|
244
244
|
```
|
|
245
|
-
npx -y @modootoday/datalab-extension-mcp@1.
|
|
245
|
+
npx -y @modootoday/datalab-extension-mcp@1.12.0 install
|
|
246
246
|
```
|
|
247
247
|
|
|
248
248
|
- **`'npx'을(는) 내부 또는 외부 명령...`** — Node.js가 없는 거예요. 위 2단계의 "Node.js가 없다면"을 따라 설치한 뒤 다시 실행해요.
|
|
@@ -272,7 +272,7 @@ AI가 "그런 기능은 없다" 고 답하면, **"숨은 도구를 찾아보고
|
|
|
272
272
|
1. 터미널에서 아래 명령을 실행해요(AI 앱에 등록된 설정을 지워 줘요).
|
|
273
273
|
|
|
274
274
|
```
|
|
275
|
-
npx -y @modootoday/datalab-extension-mcp@1.
|
|
275
|
+
npx -y @modootoday/datalab-extension-mcp@1.12.0 uninstall
|
|
276
276
|
```
|
|
277
277
|
|
|
278
278
|
2. 확장 설정에서 **MCP 연결을 꺼요.** 패널이 브릿지라, 꺼 두면 어딘가 설정 줄이 남아 있어도 AI 앱이 아무것도 조회할 수 없어요.
|
|
@@ -2,7 +2,7 @@ import {
|
|
|
2
2
|
__export
|
|
3
3
|
} from "./chunk-MLKGABMK.js";
|
|
4
4
|
|
|
5
|
-
// ../mcp-server/dist/chunk-
|
|
5
|
+
// ../mcp-server/dist/chunk-2CASJT66.js
|
|
6
6
|
import { createHash } from "crypto";
|
|
7
7
|
import { createHash as createHash2, randomUUID } from "crypto";
|
|
8
8
|
import { mkdir, readFile, readdir, rm, writeFile } from "fs/promises";
|
|
@@ -20076,6 +20076,7 @@ var TOOL_TIERS = Object.freeze({
|
|
|
20076
20076
|
editor_read_structure: "read",
|
|
20077
20077
|
editor_read_document: "read",
|
|
20078
20078
|
editor_operation_status: "read",
|
|
20079
|
+
editor_list_saved_drafts: "read",
|
|
20079
20080
|
// ── Post editor: writes ─────────────────────────────────────────
|
|
20080
20081
|
//
|
|
20081
20082
|
// Every injection is bracketed by a vendor autosave, plus a separate copy
|
|
@@ -20085,6 +20086,14 @@ var TOOL_TIERS = Object.freeze({
|
|
|
20085
20086
|
// Only whole-body replacement is destructive: the others append, so the
|
|
20086
20087
|
// autosave point still holds, while replacing the body overwrites it.
|
|
20087
20088
|
editor_insert_draft: "write",
|
|
20089
|
+
// Saves to the vendor's temp list; the document itself is untouched.
|
|
20090
|
+
editor_save_draft: "write",
|
|
20091
|
+
// Refuses while changes since the last confirmed save would be lost.
|
|
20092
|
+
editor_new_post: "write",
|
|
20093
|
+
// Same protection: refuses while unsaved changes would be dropped.
|
|
20094
|
+
editor_open_saved_draft: "write",
|
|
20095
|
+
// Restyles existing text; the words stay as they are.
|
|
20096
|
+
editor_apply_styles: "write",
|
|
20088
20097
|
// `write`, and it stays that way because it REFUSES an occupied body rather
|
|
20089
20098
|
// than overwriting it. A replace fallback would make it destructive while its
|
|
20090
20099
|
// confirm still reads as an append, so that fallback is a review-block.
|
|
@@ -22805,7 +22814,6 @@ function killPortOwner(port, platform = process.platform) {
|
|
|
22805
22814
|
}
|
|
22806
22815
|
|
|
22807
22816
|
// src/adapter.ts
|
|
22808
|
-
import { spawnSync as spawnSync2 } from "child_process";
|
|
22809
22817
|
import { randomUUID as randomUUID2 } from "crypto";
|
|
22810
22818
|
import { Server } from "@modelcontextprotocol/sdk/server/index.js";
|
|
22811
22819
|
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
|
|
@@ -42908,6 +42916,7 @@ var TOOL_TIERS2 = Object.freeze({
|
|
|
42908
42916
|
editor_read_structure: "read",
|
|
42909
42917
|
editor_read_document: "read",
|
|
42910
42918
|
editor_operation_status: "read",
|
|
42919
|
+
editor_list_saved_drafts: "read",
|
|
42911
42920
|
// ── Post editor: writes ─────────────────────────────────────────
|
|
42912
42921
|
//
|
|
42913
42922
|
// Every injection is bracketed by a vendor autosave, plus a separate copy
|
|
@@ -42917,6 +42926,14 @@ var TOOL_TIERS2 = Object.freeze({
|
|
|
42917
42926
|
// Only whole-body replacement is destructive: the others append, so the
|
|
42918
42927
|
// autosave point still holds, while replacing the body overwrites it.
|
|
42919
42928
|
editor_insert_draft: "write",
|
|
42929
|
+
// Saves to the vendor's temp list; the document itself is untouched.
|
|
42930
|
+
editor_save_draft: "write",
|
|
42931
|
+
// Refuses while changes since the last confirmed save would be lost.
|
|
42932
|
+
editor_new_post: "write",
|
|
42933
|
+
// Same protection: refuses while unsaved changes would be dropped.
|
|
42934
|
+
editor_open_saved_draft: "write",
|
|
42935
|
+
// Restyles existing text; the words stay as they are.
|
|
42936
|
+
editor_apply_styles: "write",
|
|
42920
42937
|
// `write`, and it stays that way because it REFUSES an occupied body rather
|
|
42921
42938
|
// than overwriting it. A replace fallback would make it destructive while its
|
|
42922
42939
|
// confirm still reads as an append, so that fallback is a review-block.
|
|
@@ -43488,6 +43505,7 @@ function createAdapterServer(deps = {}) {
|
|
|
43488
43505
|
}
|
|
43489
43506
|
});
|
|
43490
43507
|
async function handleToolList() {
|
|
43508
|
+
await deps.ready;
|
|
43491
43509
|
let resp;
|
|
43492
43510
|
try {
|
|
43493
43511
|
resp = await postMcp(fetchImpl, mcpUrl, "tools/list");
|
|
@@ -43527,6 +43545,7 @@ function createAdapterServer(deps = {}) {
|
|
|
43527
43545
|
});
|
|
43528
43546
|
async function handleToolCall(request) {
|
|
43529
43547
|
const { name, arguments: args } = request.params;
|
|
43548
|
+
await deps.ready;
|
|
43530
43549
|
let resp;
|
|
43531
43550
|
try {
|
|
43532
43551
|
resp = await postMcp(fetchImpl, mcpUrl, "tools/call", {
|
|
@@ -43652,26 +43671,68 @@ async function pushToolChanges(deps) {
|
|
|
43652
43671
|
}
|
|
43653
43672
|
}
|
|
43654
43673
|
var SESSION_EXIT_GRACE_MS = 200;
|
|
43655
|
-
|
|
43656
|
-
if (!
|
|
43674
|
+
function launchKindOf(entry) {
|
|
43675
|
+
if (!entry) return "other";
|
|
43676
|
+
const path = entry.replace(/\\/g, "/");
|
|
43677
|
+
if (path.includes("/_npx/")) return "npx";
|
|
43678
|
+
if (path.endsWith(`/node_modules/${PACKAGE_NAME}/dist/cli.js`)) {
|
|
43679
|
+
return "global";
|
|
43680
|
+
}
|
|
43681
|
+
return "other";
|
|
43682
|
+
}
|
|
43683
|
+
async function updateInstalledCopy(selfVersion, log, deps = {}) {
|
|
43684
|
+
const launch = deps.launch ?? launchKindOf(process.argv[1]);
|
|
43685
|
+
if (!selfVersion || launch === "other") return "none";
|
|
43657
43686
|
const target = await (deps.resolve ?? canonicalVersion)();
|
|
43658
|
-
|
|
43659
|
-
|
|
43660
|
-
|
|
43661
|
-
|
|
43662
|
-
)
|
|
43663
|
-
|
|
43664
|
-
|
|
43665
|
-
|
|
43666
|
-
|
|
43687
|
+
const newer = target !== null && isOlderVersion(selfVersion, target) ? target : null;
|
|
43688
|
+
if (launch === "global" && newer === null) return "none";
|
|
43689
|
+
const version3 = newer ?? selfVersion;
|
|
43690
|
+
const install = deps.install ?? defaultInstall;
|
|
43691
|
+
if (!await install(version3)) {
|
|
43692
|
+
log(`could not install connector ${version3}; this build keeps serving`);
|
|
43693
|
+
return "failed";
|
|
43694
|
+
}
|
|
43695
|
+
if (launch === "global") {
|
|
43696
|
+
log(`connector ${version3} is installed; the next start uses it`);
|
|
43697
|
+
return "installed";
|
|
43698
|
+
}
|
|
43699
|
+
await (deps.relink ?? defaultRelink)(version3);
|
|
43700
|
+
return "migrated";
|
|
43701
|
+
}
|
|
43702
|
+
async function quietInstallerIo() {
|
|
43703
|
+
const installer = await import("./dist-H4FFG2Z2.js");
|
|
43704
|
+
const io = installer.createNodeIo();
|
|
43705
|
+
io.out = (line) => defaultLog(line);
|
|
43706
|
+
return { installer, io };
|
|
43707
|
+
}
|
|
43708
|
+
async function defaultInstall(version3) {
|
|
43709
|
+
const { installer, io } = await quietInstallerIo();
|
|
43710
|
+
const present = await installer.resolveGlobalLaunch(io, version3);
|
|
43711
|
+
if (present.ok) return true;
|
|
43712
|
+
const outcome = await installer.installGlobally(io, version3, {
|
|
43713
|
+
inheritStdio: false
|
|
43714
|
+
});
|
|
43715
|
+
return outcome.ok;
|
|
43716
|
+
}
|
|
43717
|
+
async function defaultRelink(version3) {
|
|
43718
|
+
const { installer, io } = await quietInstallerIo();
|
|
43719
|
+
const resolved = await installer.resolveGlobalLaunch(io, version3);
|
|
43720
|
+
if (!resolved.ok) return;
|
|
43721
|
+
const env = process.env;
|
|
43722
|
+
const opts = {
|
|
43723
|
+
version: version3,
|
|
43724
|
+
token: env["DATALAB_MCP_TOKEN"]?.trim() ?? "",
|
|
43725
|
+
extensionId: env["DATALAB_MCP_EXTENSION_ID"]?.trim() ?? "",
|
|
43726
|
+
port: env["DATALAB_MCP_PORT"]?.trim() || void 0
|
|
43727
|
+
};
|
|
43728
|
+
if (installer.validateInstallOptions(opts) !== null) return;
|
|
43729
|
+
const results = await installer.relinkInstalledHosts(io, {
|
|
43730
|
+
...opts,
|
|
43731
|
+
launch: resolved.launch
|
|
43667
43732
|
});
|
|
43668
|
-
|
|
43669
|
-
|
|
43670
|
-
`could not start ${target} (${res.error.message}); continuing as ${selfVersion}`
|
|
43671
|
-
);
|
|
43672
|
-
return false;
|
|
43733
|
+
for (const r of results) {
|
|
43734
|
+
defaultLog(`relink ${r.hostId}: ${r.status}`);
|
|
43673
43735
|
}
|
|
43674
|
-
process.exit(res.status ?? 0);
|
|
43675
43736
|
}
|
|
43676
43737
|
function countRequests(flight, passthrough) {
|
|
43677
43738
|
return (delta) => {
|
|
@@ -43680,35 +43741,43 @@ function countRequests(flight, passthrough) {
|
|
|
43680
43741
|
};
|
|
43681
43742
|
}
|
|
43682
43743
|
async function runAdapter(deps = {}) {
|
|
43683
|
-
if (deps.selfUpdate !== false) {
|
|
43684
|
-
await selfUpdateAndRestart(deps.version, deps.log ?? (() => {
|
|
43685
|
-
}), {
|
|
43686
|
-
resolve: deps.canonical,
|
|
43687
|
-
spawn: deps.spawnImpl
|
|
43688
|
-
});
|
|
43689
|
-
}
|
|
43690
43744
|
const ensure = deps.ensure ?? ensureDaemonRunning;
|
|
43691
|
-
|
|
43745
|
+
const log = deps.log ?? defaultLog;
|
|
43746
|
+
const ready = ensure({
|
|
43692
43747
|
host: deps.host,
|
|
43693
43748
|
port: deps.port,
|
|
43694
43749
|
log: deps.log,
|
|
43695
43750
|
selfVersion: deps.version
|
|
43751
|
+
}).catch((err) => {
|
|
43752
|
+
log(`could not start the connector service: ${describeError(err)}`);
|
|
43696
43753
|
});
|
|
43697
43754
|
const flight = { count: 0 };
|
|
43698
43755
|
const watchMs = deps.watchIntervalMs ?? DEFAULT_WATCH_MS;
|
|
43699
43756
|
const server = createAdapterServer({
|
|
43700
43757
|
...deps,
|
|
43758
|
+
ready,
|
|
43701
43759
|
onActivity: countRequests(flight, deps.onActivity)
|
|
43702
43760
|
});
|
|
43703
|
-
|
|
43704
|
-
|
|
43705
|
-
|
|
43706
|
-
|
|
43707
|
-
|
|
43708
|
-
|
|
43761
|
+
let updating = false;
|
|
43762
|
+
let watch = null;
|
|
43763
|
+
const checkForUpdate = () => {
|
|
43764
|
+
if (updating || flight.count > 0) return;
|
|
43765
|
+
updating = true;
|
|
43766
|
+
const run = deps.update ?? (() => updateInstalledCopy(deps.version, deps.log ?? defaultLog, {
|
|
43767
|
+
resolve: deps.canonical
|
|
43768
|
+
}));
|
|
43769
|
+
void run().then((outcome) => {
|
|
43770
|
+
if (outcome !== "none" && watch) clearInterval(watch);
|
|
43771
|
+
}).catch((err) => {
|
|
43772
|
+
log(`update check failed: ${describeError(err)}`);
|
|
43773
|
+
}).finally(() => {
|
|
43774
|
+
updating = false;
|
|
43709
43775
|
});
|
|
43710
|
-
}
|
|
43711
|
-
|
|
43776
|
+
};
|
|
43777
|
+
if (deps.selfUpdate !== false) {
|
|
43778
|
+
watch = setInterval(checkForUpdate, watchMs);
|
|
43779
|
+
watch.unref?.();
|
|
43780
|
+
}
|
|
43712
43781
|
let transport;
|
|
43713
43782
|
if (deps.transport) {
|
|
43714
43783
|
transport = deps.transport;
|
|
@@ -43716,6 +43785,7 @@ async function runAdapter(deps = {}) {
|
|
|
43716
43785
|
transport = new StdioServerTransport();
|
|
43717
43786
|
}
|
|
43718
43787
|
await server.connect(transport);
|
|
43788
|
+
if (deps.selfUpdate !== false) checkForUpdate();
|
|
43719
43789
|
const host = deps.host ?? DEFAULT_HOST;
|
|
43720
43790
|
const port = deps.port ?? DEFAULT_PORT;
|
|
43721
43791
|
const controller = new AbortController();
|
|
@@ -43736,14 +43806,16 @@ async function runAdapter(deps = {}) {
|
|
|
43736
43806
|
stdin.once("end", endSession);
|
|
43737
43807
|
stdin.once("close", endSession);
|
|
43738
43808
|
}
|
|
43739
|
-
void
|
|
43740
|
-
|
|
43741
|
-
|
|
43742
|
-
|
|
43743
|
-
|
|
43744
|
-
|
|
43745
|
-
|
|
43746
|
-
|
|
43809
|
+
void ready.then(
|
|
43810
|
+
() => pushToolChanges({
|
|
43811
|
+
mcpUrl: `http://${host}:${port}/mcp`,
|
|
43812
|
+
notifyHost: () => server.notification({ method: "notifications/tools/list_changed" }).catch(() => {
|
|
43813
|
+
}),
|
|
43814
|
+
subscribe: deps.subscribe,
|
|
43815
|
+
log: deps.log,
|
|
43816
|
+
signal: controller.signal
|
|
43817
|
+
})
|
|
43818
|
+
);
|
|
43747
43819
|
}
|
|
43748
43820
|
async function dispatchCli(argv, handlers) {
|
|
43749
43821
|
const sub = argv[2];
|
|
@@ -43767,6 +43839,7 @@ async function dispatchCli(argv, handlers) {
|
|
|
43767
43839
|
}
|
|
43768
43840
|
|
|
43769
43841
|
export {
|
|
43842
|
+
resolveConfig,
|
|
43770
43843
|
runDaemon,
|
|
43771
43844
|
ensureDaemonRunning,
|
|
43772
43845
|
createAdapterServer,
|
package/dist/cli.js
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import {
|
|
3
3
|
dispatchCli,
|
|
4
|
+
resolveConfig,
|
|
4
5
|
runAdapter,
|
|
5
6
|
runDaemon
|
|
6
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-OOT6JOYE.js";
|
|
7
8
|
import "./chunk-MLKGABMK.js";
|
|
8
9
|
|
|
9
10
|
// src/cli.ts
|
|
@@ -15,7 +16,7 @@ function log(message) {
|
|
|
15
16
|
`);
|
|
16
17
|
}
|
|
17
18
|
async function runInstaller(sub, argv) {
|
|
18
|
-
const { createNodeIo, runInstall, runUninstall } = await import("./dist-
|
|
19
|
+
const { createNodeIo, runInstall, runUninstall } = await import("./dist-H4FFG2Z2.js");
|
|
19
20
|
const opts = { version: VERSION };
|
|
20
21
|
for (let i = 0; i < argv.length; i += 1) {
|
|
21
22
|
const flag = argv[i];
|
|
@@ -54,13 +55,18 @@ async function main() {
|
|
|
54
55
|
serve: () => {
|
|
55
56
|
runDaemon(process.env);
|
|
56
57
|
},
|
|
57
|
-
adapter: () =>
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
58
|
+
adapter: () => {
|
|
59
|
+
const env = resolveConfig(process.env);
|
|
60
|
+
return runAdapter({
|
|
61
|
+
name: NAME,
|
|
62
|
+
version: VERSION,
|
|
63
|
+
host: env.ok ? env.config.host : void 0,
|
|
64
|
+
port: env.ok ? env.config.port : void 0,
|
|
65
|
+
// The host config pins an exact install, so without this a paired user
|
|
66
|
+
// never receives a release. `--no-self-update` keeps this build.
|
|
67
|
+
selfUpdate: !process.argv.slice(2).includes("--no-self-update")
|
|
68
|
+
});
|
|
69
|
+
},
|
|
64
70
|
// Loaded lazily, like the installer: an MCP host spawning the adapter must
|
|
65
71
|
// not pay to resolve a command only an operator types.
|
|
66
72
|
skills: async (argv) => {
|
|
@@ -72,7 +78,7 @@ async function main() {
|
|
|
72
78
|
attachSkill,
|
|
73
79
|
detachSkill,
|
|
74
80
|
skillsPayloadRoot
|
|
75
|
-
} = await import("./dist-
|
|
81
|
+
} = await import("./dist-H4FFG2Z2.js");
|
|
76
82
|
const io = createNodeIo();
|
|
77
83
|
const root = skillsPayloadRoot();
|
|
78
84
|
const code = await runSkills(argv, {
|
|
@@ -35,6 +35,12 @@ var DEFAULT_EXTENSION_ID = "ldoknfkedngbdfgdkeicojmhnojgpdcb";
|
|
|
35
35
|
function packageSpec(version) {
|
|
36
36
|
return `${SERVER_PACKAGE}@${version}`;
|
|
37
37
|
}
|
|
38
|
+
function launchArgv(opts) {
|
|
39
|
+
if (opts.launch !== void 0) {
|
|
40
|
+
return [opts.launch.node, opts.launch.cli];
|
|
41
|
+
}
|
|
42
|
+
return ["npx", "-y", packageSpec(opts.version)];
|
|
43
|
+
}
|
|
38
44
|
function isCustomPort(port) {
|
|
39
45
|
if (port === void 0 || port === "") {
|
|
40
46
|
return false;
|
|
@@ -69,6 +75,13 @@ function buildUrlEntry(opts) {
|
|
|
69
75
|
return { url: daemonMcpUrl(opts) };
|
|
70
76
|
}
|
|
71
77
|
function buildFileEntry(opts, platform) {
|
|
78
|
+
if (opts.launch !== void 0) {
|
|
79
|
+
return {
|
|
80
|
+
command: opts.launch.node,
|
|
81
|
+
args: [opts.launch.cli],
|
|
82
|
+
env: buildEnv(opts)
|
|
83
|
+
};
|
|
84
|
+
}
|
|
72
85
|
const spec = packageSpec(opts.version);
|
|
73
86
|
if (platform === "win32") {
|
|
74
87
|
return {
|
|
@@ -133,11 +146,14 @@ var claudeCliHost = {
|
|
|
133
146
|
for (const pair of envPairs(opts)) {
|
|
134
147
|
args.push("--env", pair);
|
|
135
148
|
}
|
|
136
|
-
args.push("--",
|
|
149
|
+
args.push("--", ...launchArgv(opts));
|
|
137
150
|
return args;
|
|
138
151
|
},
|
|
139
152
|
buildRemoveArgs() {
|
|
140
153
|
return ["mcp", "remove", SERVER_NAME, "--scope", "user"];
|
|
154
|
+
},
|
|
155
|
+
buildGetArgs() {
|
|
156
|
+
return ["mcp", "get", SERVER_NAME];
|
|
141
157
|
}
|
|
142
158
|
};
|
|
143
159
|
var claudeInstallable = {
|
|
@@ -159,10 +175,11 @@ function jsonSnippet(topKey, opts, platform) {
|
|
|
159
175
|
return JSON.stringify({ [topKey]: { [SERVER_NAME]: entry } }, null, 2);
|
|
160
176
|
}
|
|
161
177
|
function tomlSnippet(opts) {
|
|
178
|
+
const launch = opts.launch;
|
|
179
|
+
const head = launch === void 0 ? [`command = "npx"`, `args = ["-y", "${packageSpec(opts.version)}"]`] : [`command = '${launch.node}'`, `args = ['${launch.cli}']`];
|
|
162
180
|
const lines = [
|
|
163
181
|
`[mcp_servers.${SERVER_NAME}]`,
|
|
164
|
-
|
|
165
|
-
`args = ["-y", "${packageSpec(opts.version)}"]`,
|
|
182
|
+
...head,
|
|
166
183
|
"",
|
|
167
184
|
`[mcp_servers.${SERVER_NAME}.env]`
|
|
168
185
|
];
|
|
@@ -336,11 +353,14 @@ var codexCliHost = {
|
|
|
336
353
|
for (const pair of envPairs(opts)) {
|
|
337
354
|
args.push("--env", pair);
|
|
338
355
|
}
|
|
339
|
-
args.push("--",
|
|
356
|
+
args.push("--", ...launchArgv(opts));
|
|
340
357
|
return args;
|
|
341
358
|
},
|
|
342
359
|
buildRemoveArgs() {
|
|
343
360
|
return ["mcp", "remove", SERVER_NAME];
|
|
361
|
+
},
|
|
362
|
+
buildGetArgs() {
|
|
363
|
+
return ["mcp", "get", SERVER_NAME];
|
|
344
364
|
}
|
|
345
365
|
};
|
|
346
366
|
var codexInstallable = {
|
|
@@ -455,7 +475,7 @@ var geminiCliHost = {
|
|
|
455
475
|
for (const pair of envPairs(opts)) {
|
|
456
476
|
args.push("-e", pair);
|
|
457
477
|
}
|
|
458
|
-
args.push(SERVER_NAME,
|
|
478
|
+
args.push(SERVER_NAME, ...launchArgv(opts));
|
|
459
479
|
return args;
|
|
460
480
|
},
|
|
461
481
|
buildRemoveArgs() {
|
|
@@ -561,7 +581,7 @@ function opencodeSnippet(opts) {
|
|
|
561
581
|
mcp: {
|
|
562
582
|
[SERVER_NAME]: {
|
|
563
583
|
type: "local",
|
|
564
|
-
command:
|
|
584
|
+
command: launchArgv(opts),
|
|
565
585
|
enabled: true,
|
|
566
586
|
environment: buildEnv(opts)
|
|
567
587
|
}
|
|
@@ -1193,6 +1213,13 @@ var UNINSTALL_DONE = "\uC815\uB9AC\uAC00 \uB05D\uB0AC\uC5B4\uC694.";
|
|
|
1193
1213
|
var UNINSTALL_TOKEN_REMINDER = "\uC774 \uBE0C\uB77C\uC6B0\uC800\uC758 \uB85C\uCEEC \uC5F0\uACB0 \uC815\uBCF4\uB3C4 \uC9C0\uC6B0\uB824\uBA74 \uB370\uC774\uD130\uB7A9\uD234\uC988 \uD328\uB110\uC5D0\uC11C '\uC774 \uBE0C\uB77C\uC6B0\uC800 \uC5F0\uACB0 \uB044\uAE30'\uB97C \uB20C\uB7EC \uC8FC\uC138\uC694. \uC774 \uCEF4\uD4E8\uD130\uC758 \uB4F1\uB85D\uC740 \uB4F1\uB85D\uB41C \uBE0C\uB77C\uC6B0\uC800 \uBAA9\uB85D\uC5D0\uC11C \uBCC4\uB3C4\uB85C \uB0B4\uB9B4 \uC218 \uC788\uC5B4\uC694.";
|
|
1194
1214
|
var PERMISSION_DENIED_HINT = "\uD30C\uC77C \uAD8C\uD55C \uB54C\uBB38\uC5D0 \uC124\uC815\uC744 \uC4F8 \uC218 \uC5C6\uC5C8\uC5B4\uC694. \uD30C\uC77C \uAD8C\uD55C\uC744 \uD655\uC778\uD55C \uB4A4 \uAC19\uC740 \uBA85\uB839\uC5B4\uB97C \uB2E4\uC2DC \uC2E4\uD589\uD574 \uC8FC\uC138\uC694.";
|
|
1195
1215
|
var NO_HOSTS_DETECTED = "\uC5F0\uACB0\uD560 \uC218 \uC788\uB294 AI \uD504\uB85C\uADF8\uB7A8\uC744 \uCC3E\uC9C0 \uBABB\uD588\uC5B4\uC694.";
|
|
1216
|
+
var FALLBACK_TAIL = "\uADF8\uB798\uC11C AI \uC571\uC774 \uC2DC\uC791\uD560 \uB54C\uB9C8\uB2E4 \uB0B4\uB824\uBC1B\uC544 \uC2E4\uD589\uD558\uB3C4\uB85D \uC5F0\uACB0\uD574\uC694. \uC5F0\uACB0\uC740 \uB418\uC9C0\uB9CC \uC2DC\uC791\uC774 10\uCD08\uCBE4 \uB2A6\uC5B4\uC694.";
|
|
1217
|
+
var GLOBAL_INSTALL_FALLBACK = {
|
|
1218
|
+
unsupported: `\uC774 \uC2E4\uD589 \uD658\uACBD\uC5D0\uC11C\uB294 \uC5F0\uACB0 \uD504\uB85C\uADF8\uB7A8\uC744 \uC124\uCE58\uD560 \uC218 \uC5C6\uC5B4\uC694. ${FALLBACK_TAIL}`,
|
|
1219
|
+
"install-failed": `\uC5F0\uACB0 \uD504\uB85C\uADF8\uB7A8\uC744 \uC124\uCE58\uD558\uC9C0 \uBABB\uD588\uC5B4\uC694. npm \uC804\uC5ED \uC124\uCE58 \uAD8C\uD55C\uC774 \uC5C6\uC744 \uB54C \uC774\uB807\uAC8C \uB3FC\uC694. ${FALLBACK_TAIL}`,
|
|
1220
|
+
"not-found": `\uC124\uCE58\uD55C \uC5F0\uACB0 \uD504\uB85C\uADF8\uB7A8\uC744 \uCC3E\uC9C0 \uBABB\uD588\uC5B4\uC694. ${FALLBACK_TAIL}`,
|
|
1221
|
+
path: `\uC124\uCE58 \uACBD\uB85C\uC5D0 \uC4F8 \uC218 \uC5C6\uB294 \uAE00\uC790\uAC00 \uC788\uC5B4\uC694. ${FALLBACK_TAIL}`
|
|
1222
|
+
};
|
|
1196
1223
|
var SUPPORTED_APPS_HEADER = "\uC9C0\uC6D0\uD558\uB294 \uD504\uB85C\uADF8\uB7A8\uACFC \uB2E4\uC6B4\uB85C\uB4DC \uC8FC\uC18C\uC608\uC694:";
|
|
1197
1224
|
var AFTER_INSTALL_RETRY = "\uD504\uB85C\uADF8\uB7A8\uC744 \uC124\uCE58\uD55C \uB4A4 \uAC19\uC740 \uBA85\uB839\uC5B4\uB97C \uB2E4\uC2DC \uC2E4\uD589\uD574 \uC8FC\uC138\uC694.";
|
|
1198
1225
|
var ALREADY_INSTALLED_HINT = "\uC774\uBBF8 \uC124\uCE58\uD588\uB294\uB370 \uBAA9\uB85D\uC5D0 \uC5C6\uB2E4\uBA74, \uC124\uC815 \uD30C\uC77C\uC774 \uC544\uC9C1 \uB9CC\uB4E4\uC5B4\uC9C0\uC9C0 \uC54A\uC558\uC744 \uC218 \uC788\uC5B4\uC694. \uC124\uC815 \uD30C\uC77C\uC740 \uD504\uB85C\uADF8\uB7A8\uC744 \uC124\uCE58\uD560 \uB54C\uAC00 \uC544\uB2C8\uB77C \uCC98\uC74C \uC4F8 \uB54C \uB9CC\uB4E4\uC5B4\uC838\uC694:\n - ChatGPT \uB370\uC2A4\uD06C\uD1B1: \uC124\uC815 \u2192 MCP \uC11C\uBC84 \u2192 \uC11C\uBC84 \uCD94\uAC00\uB97C \uD55C \uBC88 \uC2E4\uD589\n - VS Code: \uBA85\uB839 \uD314\uB808\uD2B8(Ctrl+Shift+P) \u2192 'MCP: Open User Configuration' \uC2E4\uD589\n\uADF8 \uB4A4 \uAC19\uC740 \uBA85\uB839\uC5B4\uB97C \uB2E4\uC2DC \uC2E4\uD589\uD558\uBA74 \uCC3E\uC744 \uC218 \uC788\uC5B4\uC694.";
|
|
@@ -1225,6 +1252,10 @@ var TOKEN_RE = /^[0-9a-f]{32,128}$/i;
|
|
|
1225
1252
|
var EXTENSION_ID_RE = /^[a-p]{32}$/;
|
|
1226
1253
|
var PORT_RE = /^\d{2,5}$/;
|
|
1227
1254
|
var VERSION_RE = /^\d+\.\d+\.\d+$/;
|
|
1255
|
+
var LAUNCH_PATH_RE = /^(?:\/|[A-Za-z]:[\\/])[\p{L}\p{N} ._\-()\\/:@+~]*$/u;
|
|
1256
|
+
function isLaunchPath(path) {
|
|
1257
|
+
return path.length <= 400 && LAUNCH_PATH_RE.test(path);
|
|
1258
|
+
}
|
|
1228
1259
|
var RETRY_HINT = "\uD328\uB110\uC5D0\uC11C \uBA85\uB839\uC5B4\uB97C \uB2E4\uC2DC \uBCF5\uC0AC\uD574\uC11C \uC2E4\uD589\uD574 \uC8FC\uC138\uC694.";
|
|
1229
1260
|
var INVALID_TOKEN_MESSAGE = `\uC5F0\uACB0 \uD1A0\uD070 \uD615\uC2DD\uC774 \uC62C\uBC14\uB974\uC9C0 \uC54A\uC544\uC694. ${RETRY_HINT}`;
|
|
1230
1261
|
var INVALID_EXTENSION_ID_MESSAGE = `\uD655\uC7A5 \uD504\uB85C\uADF8\uB7A8 ID \uD615\uC2DD\uC774 \uC62C\uBC14\uB974\uC9C0 \uC54A\uC544\uC694. ${RETRY_HINT}`;
|
|
@@ -1391,6 +1422,70 @@ async function reclaimPort(io, token, deps = {}) {
|
|
|
1391
1422
|
if (!ended) return { kind: "failed" };
|
|
1392
1423
|
return await gone() ? { kind: "forced" } : { kind: "failed" };
|
|
1393
1424
|
}
|
|
1425
|
+
function globalPackageDir(io, root) {
|
|
1426
|
+
const [scope, name] = SERVER_PACKAGE.split("/");
|
|
1427
|
+
return joinPath(io, root, scope, name);
|
|
1428
|
+
}
|
|
1429
|
+
async function resolveGlobalLaunch(io, version) {
|
|
1430
|
+
if (io.execPath === void 0 || io.npmRootGlobal === void 0) {
|
|
1431
|
+
return { ok: false, reason: "unsupported" };
|
|
1432
|
+
}
|
|
1433
|
+
const root = await io.npmRootGlobal();
|
|
1434
|
+
if (root === "") return { ok: false, reason: "not-found" };
|
|
1435
|
+
const dir = globalPackageDir(io, root);
|
|
1436
|
+
let installed;
|
|
1437
|
+
try {
|
|
1438
|
+
installed = JSON.parse(
|
|
1439
|
+
await io.readFile(joinPath(io, dir, "package.json"))
|
|
1440
|
+
);
|
|
1441
|
+
} catch {
|
|
1442
|
+
return { ok: false, reason: "not-found" };
|
|
1443
|
+
}
|
|
1444
|
+
if (installed?.version !== version) {
|
|
1445
|
+
return { ok: false, reason: "not-found" };
|
|
1446
|
+
}
|
|
1447
|
+
const cli = joinPath(io, dir, "dist", "cli.js");
|
|
1448
|
+
if (!await io.exists(cli)) return { ok: false, reason: "not-found" };
|
|
1449
|
+
if (!isLaunchPath(io.execPath) || !isLaunchPath(cli)) {
|
|
1450
|
+
return { ok: false, reason: "path" };
|
|
1451
|
+
}
|
|
1452
|
+
return { ok: true, launch: { node: io.execPath, cli } };
|
|
1453
|
+
}
|
|
1454
|
+
async function installGlobally(io, version, opts) {
|
|
1455
|
+
if (!VERSION_RE.test(version)) return { ok: false, reason: "install-failed" };
|
|
1456
|
+
if (io.execPath === void 0 || io.npmRootGlobal === void 0) {
|
|
1457
|
+
return { ok: false, reason: "unsupported" };
|
|
1458
|
+
}
|
|
1459
|
+
let code = -1;
|
|
1460
|
+
try {
|
|
1461
|
+
const result = await io.spawn(
|
|
1462
|
+
"npm",
|
|
1463
|
+
["install", "-g", packageSpec(version)],
|
|
1464
|
+
{ shell: io.platform === "win32", inheritStdio: opts.inheritStdio }
|
|
1465
|
+
);
|
|
1466
|
+
code = result.code;
|
|
1467
|
+
} catch {
|
|
1468
|
+
code = -1;
|
|
1469
|
+
}
|
|
1470
|
+
if (code !== 0) return { ok: false, reason: "install-failed" };
|
|
1471
|
+
return resolveGlobalLaunch(io, version);
|
|
1472
|
+
}
|
|
1473
|
+
async function uninstallGlobally(io) {
|
|
1474
|
+
if (io.npmRootGlobal === void 0) return false;
|
|
1475
|
+
const root = await io.npmRootGlobal();
|
|
1476
|
+
if (root === "" || !await io.exists(globalPackageDir(io, root))) {
|
|
1477
|
+
return false;
|
|
1478
|
+
}
|
|
1479
|
+
try {
|
|
1480
|
+
const result = await io.spawn("npm", ["uninstall", "-g", SERVER_PACKAGE], {
|
|
1481
|
+
shell: io.platform === "win32",
|
|
1482
|
+
inheritStdio: true
|
|
1483
|
+
});
|
|
1484
|
+
return result.code === 0;
|
|
1485
|
+
} catch {
|
|
1486
|
+
return false;
|
|
1487
|
+
}
|
|
1488
|
+
}
|
|
1394
1489
|
var BACKUP_KEEP = 3;
|
|
1395
1490
|
function formatBackupTimestamp(date) {
|
|
1396
1491
|
const pad = (n) => String(n).padStart(2, "0");
|
|
@@ -2233,6 +2328,22 @@ async function runInstall(opts, io) {
|
|
|
2233
2328
|
}
|
|
2234
2329
|
}
|
|
2235
2330
|
printStep((line) => io.out(line), 4, 5, "\uC5F0\uACB0\uD558\uB294 \uC911");
|
|
2331
|
+
printBody(
|
|
2332
|
+
(line) => io.out(line),
|
|
2333
|
+
"\uC5F0\uACB0 \uD504\uB85C\uADF8\uB7A8\uC744 \uC774 \uCEF4\uD4E8\uD130\uC5D0 \uC124\uCE58\uD558\uB294 \uC911\uC774\uC5D0\uC694\u2026"
|
|
2334
|
+
);
|
|
2335
|
+
const installed = await installGlobally(io, entryOpts.version, {
|
|
2336
|
+
inheritStdio: true
|
|
2337
|
+
});
|
|
2338
|
+
if (installed.ok) {
|
|
2339
|
+
entryOpts.launch = installed.launch;
|
|
2340
|
+
printBody((line) => io.out(line), "\uC124\uCE58\uD588\uC5B4\uC694. AI \uC571\uC774 \uBC14\uB85C \uC2E4\uD589\uD574\uC694.");
|
|
2341
|
+
} else {
|
|
2342
|
+
printBody(
|
|
2343
|
+
(line) => io.out(line),
|
|
2344
|
+
GLOBAL_INSTALL_FALLBACK[installed.reason]
|
|
2345
|
+
);
|
|
2346
|
+
}
|
|
2236
2347
|
const results = [];
|
|
2237
2348
|
for (const d of detected) {
|
|
2238
2349
|
try {
|
|
@@ -2391,6 +2502,9 @@ async function runUninstall(opts, io) {
|
|
|
2391
2502
|
for (const result of results) {
|
|
2392
2503
|
printResult(io, result);
|
|
2393
2504
|
}
|
|
2505
|
+
if (await uninstallGlobally(io)) {
|
|
2506
|
+
io.out(" \uC774 \uCEF4\uD4E8\uD130\uC5D0 \uC124\uCE58\uD55C \uC5F0\uACB0 \uD504\uB85C\uADF8\uB7A8\uB3C4 \uC9C0\uC6E0\uC5B4\uC694.");
|
|
2507
|
+
}
|
|
2394
2508
|
io.out("");
|
|
2395
2509
|
io.out(UNINSTALL_DONE);
|
|
2396
2510
|
io.out(UNINSTALL_TOKEN_REMINDER);
|
|
@@ -2400,6 +2514,93 @@ async function runUninstall(opts, io) {
|
|
|
2400
2514
|
}
|
|
2401
2515
|
return 0;
|
|
2402
2516
|
}
|
|
2517
|
+
var RUNNER = /\bnpx(?:\.cmd)?\b/;
|
|
2518
|
+
function runsThroughRunner(entry) {
|
|
2519
|
+
if (!entry || typeof entry !== "object") return false;
|
|
2520
|
+
const { command, args } = entry;
|
|
2521
|
+
const argv = [command, ...Array.isArray(args) ? args : []];
|
|
2522
|
+
return argv.some((part) => typeof part === "string" && RUNNER.test(part));
|
|
2523
|
+
}
|
|
2524
|
+
async function readJson(io, path) {
|
|
2525
|
+
try {
|
|
2526
|
+
return JSON.parse(await io.readFile(path));
|
|
2527
|
+
} catch {
|
|
2528
|
+
return null;
|
|
2529
|
+
}
|
|
2530
|
+
}
|
|
2531
|
+
function ourTomlTable(raw) {
|
|
2532
|
+
const start = raw.indexOf(`[mcp_servers.${SERVER_NAME}]`);
|
|
2533
|
+
if (start === -1) return null;
|
|
2534
|
+
const rest = raw.slice(start + 1);
|
|
2535
|
+
const next = rest.search(/^\[(?!mcp_servers\.datalab[.\]])/m);
|
|
2536
|
+
return next === -1 ? rest : rest.slice(0, next);
|
|
2537
|
+
}
|
|
2538
|
+
async function relinkInstalledHosts(io, opts) {
|
|
2539
|
+
if (opts.launch === void 0) return [];
|
|
2540
|
+
const results = [];
|
|
2541
|
+
const shell = io.platform === "win32";
|
|
2542
|
+
for (const d of await detectHosts(io)) {
|
|
2543
|
+
try {
|
|
2544
|
+
if (d.tier === 1 && d.cli?.buildGetArgs !== void 0) {
|
|
2545
|
+
const got = await io.spawn(d.cli.bin, d.cli.buildGetArgs(), { shell });
|
|
2546
|
+
if (got.code !== 0) continue;
|
|
2547
|
+
await io.spawn(d.cli.bin, d.cli.buildRemoveArgs(), { shell });
|
|
2548
|
+
const added = await io.spawn(d.cli.bin, d.cli.buildAddArgs(opts), {
|
|
2549
|
+
shell
|
|
2550
|
+
});
|
|
2551
|
+
results.push({
|
|
2552
|
+
hostId: d.id,
|
|
2553
|
+
displayName: d.displayName,
|
|
2554
|
+
tier: 1,
|
|
2555
|
+
status: added.code === 0 ? "success" : "failed",
|
|
2556
|
+
message: added.code === 0 ? "relinked" : `exit ${added.code}`
|
|
2557
|
+
});
|
|
2558
|
+
} else if (d.tier === 2 && d.file?.entryKind === "stdio" && d.configPath) {
|
|
2559
|
+
const doc = await readJson(io, d.configPath);
|
|
2560
|
+
if (!runsThroughRunner(doc?.mcpServers?.[SERVER_NAME])) continue;
|
|
2561
|
+
const outcome = await upsertServerKey(
|
|
2562
|
+
io,
|
|
2563
|
+
d.configPath,
|
|
2564
|
+
buildEntryForHost(d.file, opts, io.platform)
|
|
2565
|
+
);
|
|
2566
|
+
results.push({
|
|
2567
|
+
hostId: d.id,
|
|
2568
|
+
displayName: d.displayName,
|
|
2569
|
+
tier: 2,
|
|
2570
|
+
status: outcome.ok ? "success" : "failed",
|
|
2571
|
+
message: outcome.ok ? "relinked" : outcome.reason ?? "failed"
|
|
2572
|
+
});
|
|
2573
|
+
} else if (d.tier === 3 && d.snippet?.tomlServerName !== void 0) {
|
|
2574
|
+
const path = d.snippet.detectedPath(io);
|
|
2575
|
+
if (path === null || !await io.exists(path)) continue;
|
|
2576
|
+
const table = ourTomlTable(await io.readFile(path));
|
|
2577
|
+
if (table === null || !RUNNER.test(table)) continue;
|
|
2578
|
+
const outcome = await upsertTomlServer(
|
|
2579
|
+
io,
|
|
2580
|
+
path,
|
|
2581
|
+
d.snippet.buildSnippet(opts, io.platform),
|
|
2582
|
+
d.snippet.tomlServerName
|
|
2583
|
+
);
|
|
2584
|
+
results.push({
|
|
2585
|
+
hostId: d.id,
|
|
2586
|
+
displayName: d.displayName,
|
|
2587
|
+
tier: 3,
|
|
2588
|
+
status: outcome.ok ? "success" : "failed",
|
|
2589
|
+
message: outcome.ok ? "relinked" : outcome.reason ?? "failed"
|
|
2590
|
+
});
|
|
2591
|
+
}
|
|
2592
|
+
} catch {
|
|
2593
|
+
results.push({
|
|
2594
|
+
hostId: d.id,
|
|
2595
|
+
displayName: d.displayName,
|
|
2596
|
+
tier: d.tier,
|
|
2597
|
+
status: "failed",
|
|
2598
|
+
message: "error"
|
|
2599
|
+
});
|
|
2600
|
+
}
|
|
2601
|
+
}
|
|
2602
|
+
return results;
|
|
2603
|
+
}
|
|
2403
2604
|
function descriptionOf2(skillMd) {
|
|
2404
2605
|
const fm = /^---\n([\s\S]*?)\n---/.exec(skillMd);
|
|
2405
2606
|
const line = /^description:\s*(.*)$/m.exec(fm?.[1] ?? "");
|
|
@@ -2482,9 +2683,26 @@ async function detachSkill(io, payloadRoot, slug) {
|
|
|
2482
2683
|
}
|
|
2483
2684
|
return { kind: "moved", outcomes };
|
|
2484
2685
|
}
|
|
2686
|
+
function quoteForCmd(arg) {
|
|
2687
|
+
return /[ ()]/.test(arg) ? `"${arg}"` : arg;
|
|
2688
|
+
}
|
|
2485
2689
|
function createNodeIo() {
|
|
2486
2690
|
return {
|
|
2487
2691
|
platform: process.platform,
|
|
2692
|
+
execPath: process.execPath,
|
|
2693
|
+
npmRootGlobal() {
|
|
2694
|
+
return new Promise((resolve) => {
|
|
2695
|
+
const [command, args] = process.platform === "win32" ? ["cmd.exe", ["/d", "/s", "/c", "npm root -g"]] : ["npm", ["root", "-g"]];
|
|
2696
|
+
execFile(
|
|
2697
|
+
command,
|
|
2698
|
+
args,
|
|
2699
|
+
{ windowsHide: true, timeout: 2e4 },
|
|
2700
|
+
(err, stdout) => {
|
|
2701
|
+
resolve(err ? "" : String(stdout ?? "").trim());
|
|
2702
|
+
}
|
|
2703
|
+
);
|
|
2704
|
+
});
|
|
2705
|
+
},
|
|
2488
2706
|
fetch: globalThis.fetch,
|
|
2489
2707
|
homedir() {
|
|
2490
2708
|
return homedir();
|
|
@@ -2526,7 +2744,7 @@ function createNodeIo() {
|
|
|
2526
2744
|
async spawn(command, args, opts) {
|
|
2527
2745
|
return new Promise((resolve) => {
|
|
2528
2746
|
const useShell = opts.shell === true;
|
|
2529
|
-
const spawnCommand = useShell ? [command, ...args].join(" ") : command;
|
|
2747
|
+
const spawnCommand = useShell ? [command, ...args].map(quoteForCmd).join(" ") : command;
|
|
2530
2748
|
const spawnArgs = useShell ? [] : args;
|
|
2531
2749
|
const child = nodeSpawn(spawnCommand, spawnArgs, {
|
|
2532
2750
|
shell: opts.shell,
|
|
@@ -2637,15 +2855,19 @@ export {
|
|
|
2637
2855
|
detachSkill,
|
|
2638
2856
|
detectHosts,
|
|
2639
2857
|
formatBackupTimestamp,
|
|
2858
|
+
installGlobally,
|
|
2640
2859
|
installQuestion,
|
|
2641
2860
|
listSkills,
|
|
2642
2861
|
packageSpec,
|
|
2643
2862
|
printBanner,
|
|
2863
|
+
relinkInstalledHosts,
|
|
2644
2864
|
removeServerKey,
|
|
2865
|
+
resolveGlobalLaunch,
|
|
2645
2866
|
runInstall,
|
|
2646
2867
|
runUninstall,
|
|
2647
2868
|
skillStatus,
|
|
2648
2869
|
skillsPayloadRoot,
|
|
2870
|
+
uninstallGlobally,
|
|
2649
2871
|
uninstallQuestion,
|
|
2650
2872
|
upsertServerKey,
|
|
2651
2873
|
validateInstallOptions,
|
package/dist/index.d.ts
CHANGED
|
@@ -1,17 +1,6 @@
|
|
|
1
|
-
import { spawnSync } from 'node:child_process';
|
|
2
1
|
import { Server } from '@modelcontextprotocol/sdk/server/index.js';
|
|
3
2
|
import { Transport } from '@modelcontextprotocol/sdk/shared/transport.js';
|
|
4
3
|
|
|
5
|
-
/**
|
|
6
|
-
* The thin stdio adapter — a stdio-to-daemon proxy that owns nothing.
|
|
7
|
-
*
|
|
8
|
-
* An MCP host spawns this bin; it speaks MCP over stdio and forwards its two
|
|
9
|
-
* methods to the background daemon over loopback HTTP. It binds no port and
|
|
10
|
-
* holds no bridge, so many adapters (one per host) share one daemon. Every
|
|
11
|
-
* edge — readiness probe, child spawn, HTTP fetch — is injectable, which is
|
|
12
|
-
* what makes the proxy testable without a real socket or daemon.
|
|
13
|
-
*/
|
|
14
|
-
|
|
15
4
|
/**
|
|
16
5
|
* The version the operator currently publishes as canonical.
|
|
17
6
|
*
|
|
@@ -104,6 +93,8 @@ interface AdapterServerDeps {
|
|
|
104
93
|
* tests; defaults to `ensureDaemonRunning`.
|
|
105
94
|
*/
|
|
106
95
|
revive?: (deps: EnsureRunningDeps) => Promise<void>;
|
|
96
|
+
/** Settles once the start-up daemon check is done; calls wait on it, the handshake does not. */
|
|
97
|
+
ready?: Promise<void>;
|
|
107
98
|
}
|
|
108
99
|
/**
|
|
109
100
|
* Build the low-level MCP Server whose two handlers proxy to the daemon. The
|
|
@@ -122,8 +113,8 @@ interface RunAdapterDeps extends AdapterServerDeps {
|
|
|
122
113
|
watchIntervalMs?: number;
|
|
123
114
|
/** Injected in tests; defaults to asking the gateway. */
|
|
124
115
|
canonical?: typeof canonicalVersion;
|
|
125
|
-
/** Injected in tests; defaults to
|
|
126
|
-
|
|
116
|
+
/** Injected in tests; defaults to {@link updateInstalledCopy}. */
|
|
117
|
+
update?: () => Promise<UpdateOutcome>;
|
|
127
118
|
/** Injected in tests; defaults to `ensureDaemonRunning`. */
|
|
128
119
|
ensure?: (deps: EnsureRunningDeps) => Promise<void>;
|
|
129
120
|
/** Injected in tests; defaults to a real stdio transport. */
|
|
@@ -137,6 +128,7 @@ interface RunAdapterDeps extends AdapterServerDeps {
|
|
|
137
128
|
/** Injected in tests; defaults to process.exit. */
|
|
138
129
|
exit?: (code: number) => void;
|
|
139
130
|
}
|
|
131
|
+
type UpdateOutcome = "none" | "installed" | "migrated" | "failed";
|
|
140
132
|
declare function runAdapter(deps?: RunAdapterDeps): Promise<void>;
|
|
141
133
|
interface CliHandlers {
|
|
142
134
|
install: (sub: "install" | "uninstall", argv: readonly string[]) => Promise<void>;
|
package/dist/index.js
CHANGED