@modootoday/datalab-extension-mcp 1.18.1 → 1.18.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.en.md +85 -62
- package/README.md +75 -53
- package/dist/{chunk-3MDAJLDK.js → chunk-ISCO5PYC.js} +118 -27
- package/dist/cli.js +2 -2
- package/dist/{dist-JMZ4GVJ4.js → dist-43NMRYEU.js} +184 -121
- package/dist/index.d.ts +2 -2
- package/dist/index.js +1 -1
- package/package.json +1 -1
package/README.en.md
CHANGED
|
@@ -22,16 +22,15 @@ Set this up once per computer.
|
|
|
22
22
|
|
|
23
23
|
> A work computer may block installs by policy. Check with your IT team first to avoid wasting time.
|
|
24
24
|
|
|
25
|
-
##
|
|
25
|
+
## Three steps
|
|
26
26
|
|
|
27
|
-
|
|
28
|
-
| ----------------- | --------------------------------------------- | ------------------ |
|
|
29
|
-
| **1. Turn it on** | Flip a switch and copy the **connection key** | Extension settings |
|
|
30
|
-
| **2. Install** | Run one command and paste the key | Terminal |
|
|
31
|
-
| **3. Connect** | Open the side panel | Extension |
|
|
32
|
-
| **4. Verify** | Ask a test question in your AI app | Your AI app |
|
|
27
|
+
No connection key is needed. The first time an app connects, you allow it once in the side panel.
|
|
33
28
|
|
|
34
|
-
|
|
29
|
+
| Step | What | Where |
|
|
30
|
+
| ----------------- | -------------------------------------------------------- | ------------------ |
|
|
31
|
+
| **1. Turn it on** | Flip a switch and copy the install command | Extension settings |
|
|
32
|
+
| **2. Install** | Run the command, or hand the install to your AI app | Terminal |
|
|
33
|
+
| **3. Allow** | Restart the AI app and press **[허용하기]** in the panel | Extension |
|
|
35
34
|
|
|
36
35
|
Feel free to read [Safety](#safety) first if you'd like reassurance before starting.
|
|
37
36
|
|
|
@@ -45,53 +44,50 @@ Feel free to read [Safety](#safety) first if you'd like reassurance before start
|
|
|
45
44
|
>
|
|
46
45
|
> _(When a connected AI app asks, your Naver data is sent to that app and its AI provider's servers.)_
|
|
47
46
|
|
|
48
|
-
4.
|
|
47
|
+
4. In the guide that opens, press **[명령 복사하기]** (copy the command). It is the same command as in Step 2.
|
|
49
48
|
|
|
50
|
-
|
|
51
|
-
>
|
|
52
|
-
> _(This value is a password for this computer only. Don't send it to anyone.)_
|
|
49
|
+
## Step 2 — Install
|
|
53
50
|
|
|
54
|
-
|
|
51
|
+
There are two ways. Pick one.
|
|
55
52
|
|
|
56
|
-
|
|
53
|
+
### Install with the command
|
|
57
54
|
|
|
58
55
|
One command finds **every** AI app on your computer and connects them automatically. Nothing to do per app.
|
|
59
56
|
|
|
60
57
|
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.**
|
|
58
|
+
2. **Paste this command and press Enter.**
|
|
62
59
|
|
|
63
60
|
```
|
|
64
|
-
npx -y @modootoday/datalab-extension-mcp@1.18.
|
|
61
|
+
npx -y @modootoday/datalab-extension-mcp@1.18.2 install
|
|
65
62
|
```
|
|
66
63
|
|
|
67
|
-
Lines of English scrolling by is normal.
|
|
68
|
-
|
|
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
|
-
|
|
71
|
-
3. **Paste the connection key.** The helper asks:
|
|
72
|
-
|
|
73
|
-
> "복사한 연결 키를 붙여넣어 주세요:"
|
|
74
|
-
>
|
|
75
|
-
> _(Paste the connection key you copied here:)_
|
|
64
|
+
The helper installs this version of the connector on your computer (`npm install -g`) and registers that installed copy with your AI apps. Lines of English scrolling by is normal. It adds only our entry to your AI apps' settings and 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).
|
|
76
65
|
|
|
77
|
-
|
|
66
|
+
The helper runs in three chapters — `1/3` find AI programs, `2/3` connect, `3/3` finish.
|
|
78
67
|
|
|
79
|
-
|
|
68
|
+
3. **Confirm.** It asks exactly one question:
|
|
80
69
|
|
|
81
|
-
> "
|
|
70
|
+
> "연결할까요?" (엔터 = 예 / n = 아니오)
|
|
82
71
|
>
|
|
83
|
-
> _(Connect
|
|
72
|
+
> _(Connect? Enter = yes / n = no)_
|
|
84
73
|
|
|
85
74
|
Press Enter. Per-app results follow, then a count: `N개 프로그램에 연결했어요.` If it found 0 apps, install an AI app first and run the same command again.
|
|
86
75
|
|
|
87
|
-
|
|
76
|
+
### Hand the install to your AI app
|
|
88
77
|
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
78
|
+
If you'd rather not use a terminal yourself, paste this into an AI app that can run commands (Claude Code, Codex, Gemini CLI and the like). It is in Korean on purpose; the app follows it either way.
|
|
79
|
+
|
|
80
|
+
```
|
|
81
|
+
데이터랩툴즈 연결 프로그램을 설치하고 이 앱에 등록해 줘.
|
|
82
|
+
1. node --version 으로 Node.js 22 이상인지 확인해. 없거나 낮으면 설치 방법만 알려 주고 멈춰.
|
|
83
|
+
2. npm install -g @modootoday/datalab-extension-mcp@1.18.2 을 실행해.
|
|
84
|
+
3. 이 앱의 MCP 설정에 datalab-extension-mcp 라는 이름으로 서버를 추가해.
|
|
85
|
+
명령은 전역 설치된 datalab-extension-mcp 이고, Windows 에서는 cmd /c datalab-extension-mcp 야.
|
|
86
|
+
npx 는 쓰지 말고, 키나 환경 변수는 넣지 마.
|
|
87
|
+
4. 끝나면 이 앱을 완전히 종료했다가 다시 켜라고 알려 줘.
|
|
88
|
+
```
|
|
93
89
|
|
|
94
|
-
|
|
90
|
+
_(Install the DataLab Tools connector and register it with this app: check Node.js 22 or later and stop with install advice if missing; run the pinned global install; add a server named datalab-extension-mcp that runs the global bin, through cmd /c on Windows, never npx, with no key or environment variables; then ask me to fully restart the app.)_
|
|
95
91
|
|
|
96
92
|
<details>
|
|
97
93
|
<summary><strong>No Node.js? — install it in one go</strong></summary>
|
|
@@ -110,32 +106,42 @@ If the command errors with `'npx' is not recognized`, Node.js isn't installed. O
|
|
|
110
106
|
curl -fsSL https://app.datalab.tools/install/mcp.sh | sh
|
|
111
107
|
```
|
|
112
108
|
|
|
113
|
-
|
|
109
|
+
If you have no AI app yet, you can also pick one to install right there (choosing is optional).
|
|
114
110
|
|
|
115
111
|
> Want to see what it does before running it? Open that URL in a browser — it serves the script itself, in plain text.
|
|
116
112
|
|
|
117
113
|
</details>
|
|
118
114
|
|
|
115
|
+
<details>
|
|
116
|
+
<summary><strong>Install as an AI app plugin</strong></summary>
|
|
117
|
+
|
|
118
|
+
This repository also installs as a plugin. The app runs the connector at this version, with no key.
|
|
119
|
+
|
|
120
|
+
- **Claude Code**: `claude plugin marketplace add modootoday/datalab-extension-mcp`, then `claude plugin install datalab-extension-mcp@modootoday`
|
|
121
|
+
- **GitHub Copilot CLI**: `copilot plugin install modootoday/datalab-extension-mcp`
|
|
122
|
+
- **Gemini CLI**: `gemini extensions install https://github.com/modootoday/datalab-extension-mcp`
|
|
123
|
+
- **Antigravity**: `agy plugin install https://github.com/modootoday/datalab-extension-mcp`
|
|
124
|
+
- **VS Code**: run "Chat: Install Plugin from Source" from the Command Palette and enter this repository's URL.
|
|
125
|
+
|
|
126
|
+
</details>
|
|
127
|
+
|
|
119
128
|
Apps it **connects automatically**: Claude Desktop, Claude Code, ChatGPT desktop, Codex CLI, Gemini CLI, Cursor, Windsurf, Amazon Q Developer, JetBrains Junie, Kiro.
|
|
120
129
|
Apps it **only prints instructions for** (follow the on-screen guide): VS Code, Zed, Cline, Roo Code, LM Studio, Warp.
|
|
121
130
|
|
|
122
|
-
## Step 3 —
|
|
131
|
+
## Step 3 — Allow
|
|
123
132
|
|
|
124
|
-
|
|
125
|
-
|
|
133
|
+
1. **Fully quit your AI app and start it again.** Just closing the window can leave it running in the background (Windows: tray icon → quit; Mac: `⌘+Q`; Linux: Quit from the app menu).
|
|
134
|
+
2. **With the side panel open**, use DataLab Tools in the AI app for the first time. The panel asks:
|
|
126
135
|
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
another browser on this computer). See [Putting another browser on this
|
|
131
|
-
computer](#putting-another-browser-on-this-computer).
|
|
136
|
+
> "'앱 이름' 앱이 연결을 요청했어요"
|
|
137
|
+
>
|
|
138
|
+
> _('App name' asked to connect)_
|
|
132
139
|
|
|
133
|
-
|
|
140
|
+
Press **[허용하기]** (allow) and you're done. If you didn't start this yourself, press **[거절하기]** (decline). A request can be allowed for 10 minutes.
|
|
134
141
|
|
|
135
|
-
|
|
142
|
+
3. If the card at the top of the side panel is **green** and reads "연결됨" (connected), you're set. Ask something like "How did my blog do last week?" in your AI app; if real numbers come back, everything's done. If it isn't green, go to [Troubleshooting](#troubleshooting).
|
|
136
143
|
|
|
137
|
-
|
|
138
|
-
- Ask something like "How did my blog do last week?" in your AI app; if real numbers come back, everything's done.
|
|
144
|
+
The connection itself lives only while the side panel is open.
|
|
139
145
|
|
|
140
146
|
## Good to know
|
|
141
147
|
|
|
@@ -157,10 +163,10 @@ copied to your machine; the AI app fetches them from the catalog when it needs t
|
|
|
157
163
|
|
|
158
164
|
## Putting another browser on this computer
|
|
159
165
|
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
166
|
+
The first browser to press **[허용하기]** is the one this computer's connector
|
|
167
|
+
pairs with. To use another browser on this computer too, copy the **connection key**
|
|
168
|
+
from the connected browser (extension settings → **다른 AI 앱에 연결 (MCP)**) and
|
|
169
|
+
paste it on the same screen in the other browser. No registration codes, no
|
|
164
170
|
issuing, no roster.
|
|
165
171
|
|
|
166
172
|
This is one computer only — the connector listens on 127.0.0.1, so no other
|
|
@@ -216,6 +222,22 @@ presenting that same old key.
|
|
|
216
222
|
|
|
217
223
|
Item 3 is what brings the connector back with the key stored in the AI app.
|
|
218
224
|
|
|
225
|
+
### "이 컴퓨터의 연결 프로그램은 다른 브라우저와 연결돼 있어요. 그 브라우저 설정에서 연결 키를 복사해 이 브라우저 설정에 붙여넣어 주세요."
|
|
226
|
+
|
|
227
|
+
_(This computer's connector is paired with another browser. Copy the connection key from that browser's settings into this browser's settings.)_
|
|
228
|
+
|
|
229
|
+
Another browser on this computer pressed **[허용하기]** first. Put that browser's
|
|
230
|
+
connection key into this one and both work ([Putting another browser on this
|
|
231
|
+
computer](#putting-another-browser-on-this-computer)). If you never connected one,
|
|
232
|
+
someone else may have; disconnect with the command the panel shows and try again.
|
|
233
|
+
|
|
234
|
+
### "연결 대기 시간이 지났어요. AI 앱을 완전히 껐다 켠 뒤 10분 안에 사이드 패널을 열어 주세요."
|
|
235
|
+
|
|
236
|
+
_(The wait ran out. Fully restart the AI app, then open the side panel within 10 minutes.)_
|
|
237
|
+
|
|
238
|
+
A connection request can be allowed for 10 minutes only. Fully quit and restart the
|
|
239
|
+
AI app, open the side panel and press **[허용하기]**.
|
|
240
|
+
|
|
219
241
|
### "연결 통로(포트)를 다른 프로그램이 쓰고 있어요."
|
|
220
242
|
|
|
221
243
|
_(Another program is using the connection path (port).)_
|
|
@@ -263,7 +285,7 @@ Start it again after a full quit and it picks the tools up. If they still aren't
|
|
|
263
285
|
- **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.)
|
|
264
286
|
|
|
265
287
|
```
|
|
266
|
-
npx -y @modootoday/datalab-extension-mcp@1.18.
|
|
288
|
+
npx -y @modootoday/datalab-extension-mcp@1.18.2 install
|
|
267
289
|
```
|
|
268
290
|
|
|
269
291
|
- **`'npx' is not recognized...`** — Node.js isn't installed. Follow "No Node.js?" in Step 2, then run the command again.
|
|
@@ -283,9 +305,10 @@ Start it again after a full quit and it picks the tools up. If they still aren't
|
|
|
283
305
|
- **Lookups just work; editing is asked for, every time.** Looking data up is immediate. Changing your **Naver draft** or a photo/video editor — setting the title, inserting text, undo, replacing the whole body, inserting a photo, closing an editor window, deleting anything — is confirmed in the side panel before it runs. So is anything that costs money. **There is no setting that approves these in advance.** Publishing and ad spend are opened by nothing at all.
|
|
284
306
|
- **It never publishes.** Posting or making a draft public is not connected — edits stay in the draft window, and publishing is yours to do.
|
|
285
307
|
- **The connector stores no logins, passwords, or cookies.** It never contacts Naver directly. Every lookup happens inside your own logged-in browser.
|
|
286
|
-
- **It works only inside your computer.** Nothing outside can connect,
|
|
308
|
+
- **It works only inside your computer.** Nothing outside can connect, only a browser you allowed attaches, and every session is checked against the connection key and the extension identity.
|
|
287
309
|
- **How data moves** — "연결된 AI 앱이 요청하면 네이버 데이터가 해당 앱과 그 AI 제공사 서버로 전달돼요." When the AI app asks, the result goes to that AI provider (e.g. Anthropic) — exactly what you agreed to when turning this on. Retention and training are governed by each provider's policy, so check the privacy policy of the AI app you use.
|
|
288
310
|
- **The saved command names an exact bootstrap version.** At startup and while idle, the connector checks the canonical release and promotes itself to the current secure, compatible version. Diagnostic environments can opt out with `--no-self-update`.
|
|
311
|
+
- **You can check the package was built from the public repository.** Run `npm audit signatures`, or `npm view @modootoday/datalab-extension-mcp@1.18.2 dist.attestations` to see its build provenance. If you install through another npm registry, such as a company mirror, this checks what that registry served.
|
|
289
312
|
- **The full source is open.** That said, it can't stop malware already running under your own account — this connector's locks control remote and cross-origin access, not an already-compromised host.
|
|
290
313
|
|
|
291
314
|
## Removing it
|
|
@@ -293,7 +316,7 @@ Start it again after a full quit and it picks the tools up. If they still aren't
|
|
|
293
316
|
1. Run this in a terminal (it removes the `datalab-extension-mcp` entries registered in your AI apps, and any `datalab` entry an earlier version registered).
|
|
294
317
|
|
|
295
318
|
```
|
|
296
|
-
npx -y @modootoday/datalab-extension-mcp@1.18.
|
|
319
|
+
npx -y @modootoday/datalab-extension-mcp@1.18.2 uninstall
|
|
297
320
|
```
|
|
298
321
|
|
|
299
322
|
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.
|
|
@@ -309,7 +332,7 @@ Deleting the extension also renders any leftover connector inert. A leftover lin
|
|
|
309
332
|
- **Does the ChatGPT website work?** No. Only the installed desktop app connects.
|
|
310
333
|
- **Do I keep it always on?** No. It connects only while the panel is open.
|
|
311
334
|
- **What data does it read?** Blog stats, keywords, ads — what DataLab Tools shows. Scoped to the Naver account you're logged into in Chrome.
|
|
312
|
-
- **Other computers?** Yes, but set it up
|
|
335
|
+
- **Other computers?** Yes, but set it up and allow it once per computer.
|
|
313
336
|
|
|
314
337
|
</details>
|
|
315
338
|
|
|
@@ -323,12 +346,12 @@ Deleting the extension also renders any leftover connector inert. A leftover lin
|
|
|
323
346
|
|
|
324
347
|
**Environment variables**
|
|
325
348
|
|
|
326
|
-
| Variable | Required | Default | Description
|
|
327
|
-
| -------------------------- | -------- | ----------- |
|
|
328
|
-
| `DATALAB_MCP_TOKEN` |
|
|
329
|
-
| `DATALAB_MCP_EXTENSION_ID` |
|
|
330
|
-
| `DATALAB_MCP_PORT` | optional | `8765` | Listen port.
|
|
331
|
-
| `DATALAB_MCP_HOST` | optional | `127.0.0.1` | Bind address. Non-loopback values are rejected.
|
|
349
|
+
| Variable | Required | Default | Description |
|
|
350
|
+
| -------------------------- | -------- | ----------- | -------------------------------------------------------------- |
|
|
351
|
+
| `DATALAB_MCP_TOKEN` | optional | — | A fixed token. Without one the connector pairs with the panel. |
|
|
352
|
+
| `DATALAB_MCP_EXTENSION_ID` | optional | store build | The extension ID allowed to connect. |
|
|
353
|
+
| `DATALAB_MCP_PORT` | optional | `8765` | Listen port. |
|
|
354
|
+
| `DATALAB_MCP_HOST` | optional | `127.0.0.1` | Bind address. Non-loopback values are rejected. |
|
|
332
355
|
|
|
333
356
|
**Rate limit** — `300` calls of burst per connector, refilling at `50` per second. Browsers connected to the same connector **share that budget**. It damps runaway loops rather than enforcing billing, so ordinary use never reaches it.
|
|
334
357
|
|
package/README.md
CHANGED
|
@@ -20,16 +20,15 @@ Claude 같은 AI 앱을 데이터랩툴즈에 연결해 주는 작은 무료 프
|
|
|
20
20
|
|
|
21
21
|
> 회사 컴퓨터는 보안 정책 때문에 설치가 막혀 있을 수 있어요. 시작 전에 회사 IT 담당자와 먼저 상의하면 시간을 아낄 수 있어요.
|
|
22
22
|
|
|
23
|
-
##
|
|
23
|
+
## 세 단계예요
|
|
24
24
|
|
|
25
|
-
|
|
26
|
-
| ----------- | ------------------------------------- | --------- |
|
|
27
|
-
| **1. 켜기** | 스위치를 켜고 **연결 키**를 복사해요 | 확장 설정 |
|
|
28
|
-
| **2. 설치** | 명령 한 줄을 실행하고 키를 붙여넣어요 | 터미널 |
|
|
29
|
-
| **3. 연결** | 사이드 패널을 열어요 | 확장 |
|
|
30
|
-
| **4. 확인** | AI 앱에서 시험 질문을 해 봐요 | AI 앱 |
|
|
25
|
+
연결 키는 필요 없어요. 처음 연결할 때 사이드 패널에서 한 번 허용하면 돼요.
|
|
31
26
|
|
|
32
|
-
|
|
27
|
+
| 단계 | 하는 일 | 어디서 |
|
|
28
|
+
| ----------- | ---------------------------------------------- | --------- |
|
|
29
|
+
| **1. 켜기** | 스위치를 켜고 설치 명령을 복사해요 | 확장 설정 |
|
|
30
|
+
| **2. 설치** | 명령을 붙여넣어 실행하거나, AI 앱에 맡겨요 | 터미널 |
|
|
31
|
+
| **3. 허용** | AI 앱을 다시 켜고 패널에서 **[허용하기]** 해요 | 확장 |
|
|
33
32
|
|
|
34
33
|
시작 전에 안심하고 싶다면 아래 [안전](#안전)을 먼저 읽으셔도 좋아요.
|
|
35
34
|
|
|
@@ -41,45 +40,46 @@ Claude 같은 AI 앱을 데이터랩툴즈에 연결해 주는 작은 무료 프
|
|
|
41
40
|
|
|
42
41
|
> "연결된 AI 앱이 요청하면 네이버 데이터가 해당 앱과 그 AI 제공사 서버로 전달돼요."
|
|
43
42
|
|
|
44
|
-
4.
|
|
43
|
+
4. 펼쳐진 안내에서 **[명령 복사하기]** 를 눌러요. 아래 2단계의 명령과 같아요.
|
|
45
44
|
|
|
46
|
-
|
|
45
|
+
## 2단계 — 설치
|
|
47
46
|
|
|
48
|
-
|
|
47
|
+
방법은 둘이에요. 편한 쪽 하나만 하면 돼요.
|
|
49
48
|
|
|
50
|
-
|
|
49
|
+
### 명령으로 설치하기
|
|
51
50
|
|
|
52
51
|
명령 한 줄이면 컴퓨터에 있는 AI 앱을 **모두 자동으로** 찾아 연결해 줘요. 앱마다 따로 할 일은 없어요.
|
|
53
52
|
|
|
54
53
|
1. **터미널을 열어요** — Windows는 검색창에 `cmd` → "명령 프롬프트", Mac은 `⌘+스페이스`로 `터미널`, Linux는 터미널 앱(보통 `Ctrl+Alt+T`)이에요.
|
|
55
|
-
2. **아래 명령을 붙여넣고 Enter를 눌러요.**
|
|
54
|
+
2. **아래 명령을 붙여넣고 Enter를 눌러요.**
|
|
56
55
|
|
|
57
56
|
```
|
|
58
|
-
npx -y @modootoday/datalab-extension-mcp@1.18.
|
|
57
|
+
npx -y @modootoday/datalab-extension-mcp@1.18.2 install
|
|
59
58
|
```
|
|
60
59
|
|
|
61
|
-
영어 글자가 여러 줄 올라오는 건 정상이에요.
|
|
62
|
-
|
|
63
|
-
도우미는 네 대목으로 진행돼요 — `[1/4] 연결 키 확인`, `[2/4] 연결할 AI 프로그램 찾기`, `[3/4] 연결하는 중`, `[4/4] 결과`.
|
|
64
|
-
|
|
65
|
-
3. **연결 키를 붙여넣어요.** 도우미가 이렇게 물어봐요.
|
|
66
|
-
|
|
67
|
-
> "복사한 연결 키를 붙여넣어 주세요:"
|
|
60
|
+
도우미는 이 버전의 연결 프로그램을 이 컴퓨터에 설치(`npm install -g`)하고, AI 앱이 그 설치본을 바로 실행하도록 등록해요. 영어 글자가 여러 줄 올라오는 건 정상이에요. AI 앱 설정에는 우리 항목만 더하고, 다른 건 건드리지 않아요. npm 전역 설치 권한이 없으면 AI 앱이 시작할 때마다 내려받아 실행하도록 연결해요(시작이 조금 느려요).
|
|
68
61
|
|
|
69
|
-
|
|
62
|
+
도우미는 세 대목으로 진행돼요 — `1/3 AI 프로그램 찾기`, `2/3 연결하기`, `3/3 마무리`.
|
|
70
63
|
|
|
71
|
-
|
|
64
|
+
3. **연결할지 확인해요.** 딱 하나만 물어봐요.
|
|
72
65
|
|
|
73
|
-
> "
|
|
66
|
+
> "연결할까요?" (엔터 = 예 / n = 아니오)
|
|
74
67
|
|
|
75
68
|
엔터를 누르면 앱별 결과와 함께 `N개 프로그램에 연결했어요.` 가 나와요. 찾은 앱이 0개면 AI 앱을 먼저 설치한 뒤 같은 명령을 다시 실행하면 돼요.
|
|
76
69
|
|
|
77
|
-
|
|
70
|
+
### AI 앱에 설치 맡기기
|
|
78
71
|
|
|
79
|
-
|
|
80
|
-
> (Windows: 작업 표시줄 트레이 아이콘에서 종료)
|
|
72
|
+
터미널을 직접 쓰고 싶지 않다면, 쓰고 있는 AI 앱(Claude Code, Codex, Gemini CLI 처럼 명령을 실행할 수 있는 앱)에 아래 내용을 그대로 붙여넣어요.
|
|
81
73
|
|
|
82
|
-
|
|
74
|
+
```
|
|
75
|
+
데이터랩툴즈 연결 프로그램을 설치하고 이 앱에 등록해 줘.
|
|
76
|
+
1. node --version 으로 Node.js 22 이상인지 확인해. 없거나 낮으면 설치 방법만 알려 주고 멈춰.
|
|
77
|
+
2. npm install -g @modootoday/datalab-extension-mcp@1.18.2 을 실행해.
|
|
78
|
+
3. 이 앱의 MCP 설정에 datalab-extension-mcp 라는 이름으로 서버를 추가해.
|
|
79
|
+
명령은 전역 설치된 datalab-extension-mcp 이고, Windows 에서는 cmd /c datalab-extension-mcp 야.
|
|
80
|
+
npx 는 쓰지 말고, 키나 환경 변수는 넣지 마.
|
|
81
|
+
4. 끝나면 이 앱을 완전히 종료했다가 다시 켜라고 알려 줘.
|
|
82
|
+
```
|
|
83
83
|
|
|
84
84
|
<details>
|
|
85
85
|
<summary><strong>Node.js가 없다면 — 한 줄로 한 번에 설치</strong></summary>
|
|
@@ -98,30 +98,40 @@ Claude 같은 AI 앱을 데이터랩툴즈에 연결해 주는 작은 무료 프
|
|
|
98
98
|
curl -fsSL https://app.datalab.tools/install/mcp.sh | sh
|
|
99
99
|
```
|
|
100
100
|
|
|
101
|
-
|
|
101
|
+
아직 AI 앱이 하나도 없으면, 원하는 AI 프로그램을 그 자리에서 골라 설치할 수도 있어요(고르는 건 자유예요).
|
|
102
102
|
|
|
103
103
|
> 실행 전에 내용을 확인하고 싶으면 위 주소를 브라우저에 그대로 열어 보세요 — 받아서 실행할 스크립트 원문이 그대로 보여요.
|
|
104
104
|
|
|
105
105
|
</details>
|
|
106
106
|
|
|
107
|
+
<details>
|
|
108
|
+
<summary><strong>AI 앱의 플러그인으로 설치하기</strong></summary>
|
|
109
|
+
|
|
110
|
+
이 저장소는 플러그인으로도 설치돼요. 앱이 연결 프로그램을 이 버전으로 실행하고, 키는 필요 없어요.
|
|
111
|
+
|
|
112
|
+
- **Claude Code**: `claude plugin marketplace add modootoday/datalab-extension-mcp` 다음에 `claude plugin install datalab-extension-mcp@modootoday`
|
|
113
|
+
- **GitHub Copilot CLI**: `copilot plugin install modootoday/datalab-extension-mcp`
|
|
114
|
+
- **Gemini CLI**: `gemini extensions install https://github.com/modootoday/datalab-extension-mcp`
|
|
115
|
+
- **Antigravity**: `agy plugin install https://github.com/modootoday/datalab-extension-mcp`
|
|
116
|
+
- **VS Code**: 명령 팔레트의 "Chat: Install Plugin from Source" 에 이 저장소 주소를 넣어요.
|
|
117
|
+
|
|
118
|
+
</details>
|
|
119
|
+
|
|
107
120
|
**자동으로 연결되는 앱**: Claude Desktop, Claude Code, ChatGPT 데스크톱, Codex CLI, Gemini CLI, Cursor, Windsurf, Amazon Q Developer, JetBrains Junie, Kiro.
|
|
108
121
|
**안내문만 보여 주는 앱**(화면 안내를 따라 하면 돼요): VS Code, Zed, Cline, Roo Code, LM Studio, Warp.
|
|
109
122
|
|
|
110
|
-
## 3단계 —
|
|
123
|
+
## 3단계 — 허용
|
|
111
124
|
|
|
112
|
-
|
|
113
|
-
|
|
125
|
+
1. **AI 앱을 완전히 종료했다가 다시 켜요.** 창만 닫으면 뒤에서 계속 돌 수 있어요 — Windows는 트레이 아이콘에서 종료, Mac은 `⌘+Q`, Linux는 앱 메뉴의 Quit.
|
|
126
|
+
2. **사이드 패널을 열어 둔 채** AI 앱에서 데이터랩툴즈를 처음 쓰면, 패널이 이렇게 물어요.
|
|
114
127
|
|
|
115
|
-
|
|
116
|
-
이 브라우저 1번 아래의 **[이 컴퓨터의 다른 브라우저에서 이미 설치했어요]** 에 넣으세요
|
|
117
|
-
(아래 [이 컴퓨터에 브라우저 하나 더 올리기](#이-컴퓨터에-브라우저-하나-더-올리기)).
|
|
128
|
+
> "'앱 이름' 앱이 연결을 요청했어요"
|
|
118
129
|
|
|
119
|
-
|
|
130
|
+
**[허용하기]** 를 누르면 끝이에요. 직접 연결을 시작한 게 아니라면 **[거절하기]** 를 눌러요. 요청은 10분 안에 허용해야 해요.
|
|
120
131
|
|
|
121
|
-
|
|
132
|
+
3. 사이드 패널 위쪽 카드가 **초록색**이고 "연결됨"이 보이면 된 거예요. AI 앱에서 "지난주 내 블로그 어땠어?" 처럼 물어보고 실제 수치가 나오면 전부 끝이에요. 초록색이 아니면 [문제해결](#문제해결)로 가세요.
|
|
122
133
|
|
|
123
|
-
|
|
124
|
-
- AI 앱에서 "지난주 내 블로그 어땠어?" 처럼 물어보고 실제 수치가 나오면 전부 끝이에요.
|
|
134
|
+
실제 연결은 사이드 패널을 열어 둔 동안 이루어져요.
|
|
125
135
|
|
|
126
136
|
## 알아 두면 좋은 것
|
|
127
137
|
|
|
@@ -144,10 +154,10 @@ Claude 같은 AI 앱을 데이터랩툴즈에 연결해 주는 작은 무료 프
|
|
|
144
154
|
|
|
145
155
|
## 이 컴퓨터에 브라우저 하나 더 올리기
|
|
146
156
|
|
|
147
|
-
|
|
148
|
-
확장 설정 → **다른 AI 앱에 연결 (MCP)**
|
|
149
|
-
|
|
150
|
-
|
|
157
|
+
처음 **[허용하기]** 를 누른 브라우저가 이 컴퓨터의 연결 프로그램과 연결돼요. 이 컴퓨터의
|
|
158
|
+
다른 브라우저도 쓰려면, 이미 연결된 브라우저의 확장 설정 → **다른 AI 앱에 연결 (MCP)** 에서
|
|
159
|
+
**연결 키** 를 복사해 올릴 브라우저의 같은 화면에 붙여넣으시면 됩니다. 등록 코드도, 발급도,
|
|
160
|
+
목록도 없어요.
|
|
151
161
|
|
|
152
162
|
**한 컴퓨터 안에서만** 됩니다 — 연결 프로그램은 127.0.0.1 에서만 듣기 때문에 다른
|
|
153
163
|
컴퓨터는 닿지 못하고, 키는 남에게 보낼 것이 아니에요.
|
|
@@ -191,6 +201,17 @@ MCP 를 켜 두었지만 **이 화면이 확장의 사이드패널 밖에서 열
|
|
|
191
201
|
|
|
192
202
|
3번까지 해야 연결 프로그램이 AI 앱 설정에 저장된 연결 키로 다시 떠요.
|
|
193
203
|
|
|
204
|
+
### "이 컴퓨터의 연결 프로그램은 다른 브라우저와 연결돼 있어요. 그 브라우저 설정에서 연결 키를 복사해 이 브라우저 설정에 붙여넣어 주세요."
|
|
205
|
+
|
|
206
|
+
이 컴퓨터에서 다른 브라우저가 먼저 **[허용하기]** 를 눌렀어요. 그 브라우저의 연결 키를 이
|
|
207
|
+
브라우저에 넣으면 둘 다 쓸 수 있어요([이 컴퓨터에 브라우저 하나 더 올리기](#이-컴퓨터에-브라우저-하나-더-올리기)).
|
|
208
|
+
직접 연결한 적이 없다면 다른 사용자가 먼저 연결했을 수 있어요. 패널이 보여 주는 명령으로 연결을 끊은 뒤 다시 시도해 주세요.
|
|
209
|
+
|
|
210
|
+
### "연결 대기 시간이 지났어요. AI 앱을 완전히 껐다 켠 뒤 10분 안에 사이드 패널을 열어 주세요."
|
|
211
|
+
|
|
212
|
+
연결 요청은 10분 동안만 허용할 수 있어요. AI 앱을 완전히 종료했다가 다시 켜고, 사이드 패널을
|
|
213
|
+
열어 **[허용하기]** 를 눌러 주세요.
|
|
214
|
+
|
|
194
215
|
### "연결 통로(포트)를 다른 프로그램이 쓰고 있어요."
|
|
195
216
|
|
|
196
217
|
카드의 **[업데이트 명령어 복사]** 버튼을 눌러 터미널에 붙여넣어 실행하면 연결 프로그램이 새 설정으로 다시 연결돼요.
|
|
@@ -231,7 +252,7 @@ AI가 "그런 기능은 없다" 고 답하면, **"숨은 도구를 찾아보고
|
|
|
231
252
|
- **연결이 사라졌을 때** — 처음 실행했던 그 명령을 한 번 더 실행하면 안전하게 다시 등록돼요. (일부 AI 앱이 설정 파일을 정리하며 연결을 지우기도 해요.)
|
|
232
253
|
|
|
233
254
|
```
|
|
234
|
-
npx -y @modootoday/datalab-extension-mcp@1.18.
|
|
255
|
+
npx -y @modootoday/datalab-extension-mcp@1.18.2 install
|
|
235
256
|
```
|
|
236
257
|
|
|
237
258
|
- **`'npx'을(는) 내부 또는 외부 명령...`** — Node.js가 없는 거예요. 위 2단계의 "Node.js가 없다면"을 따라 설치한 뒤 다시 실행해요.
|
|
@@ -251,9 +272,10 @@ AI가 "그런 기능은 없다" 고 답하면, **"숨은 도구를 찾아보고
|
|
|
251
272
|
- **조회는 그냥 되고, 고치는 건 그때그때 허락받아요.** 데이터 조회는 바로 돼요. **네이버 글쓰기 창**과 사진·영상 편집기의 내용을 고치는 것 — 제목·본문 넣기, 되돌리기, 본문을 통째로 바꾸기, 사진 넣기, 편집기 창 닫기, 지우기 — 은 실행 전에 **할 때마다** 사이드패널에서 물어봐요. 요금이 드는 기능도 같습니다. **미리 켜 두는 설정은 없어요.** 글 발행과 광고비 집행은 어떤 경우에도 열리지 않아요.
|
|
252
273
|
- **발행은 하지 않아요.** 글을 올리거나 공개하는 기능은 연결되지 않습니다 — 고친 내용은 글쓰기 창에 남고, 올릴지는 사용자가 직접 정해요.
|
|
253
274
|
- **아이디·비밀번호·쿠키를 저장하지 않아요.** 네이버에 직접 접속하지도 않아요. 모든 조회는 내가 로그인해 둔 내 브라우저 안에서 일어나요.
|
|
254
|
-
- **내 컴퓨터 안에서만 동작해요.** 밖에서는 접속할 수 없고, 연결 키와 확장 확인이라는 이중 잠금이 걸려 있어요.
|
|
275
|
+
- **내 컴퓨터 안에서만 동작해요.** 밖에서는 접속할 수 없고, 내가 허용한 브라우저만 붙어요. 연결 키와 확장 확인이라는 이중 잠금이 걸려 있어요.
|
|
255
276
|
- **데이터가 나가는 방식** — "연결된 AI 앱이 요청하면 네이버 데이터가 해당 앱과 그 AI 제공사 서버로 전달돼요." 이게 AI가 답하는 방식이라 처음 켤 때 미리 동의를 받아요. 전달된 데이터를 얼마나 보관·학습하는지는 각 AI 제공사 정책을 따르니, 쓰시는 AI 앱의 개인정보 정책을 확인해 주세요.
|
|
256
277
|
- **설정에는 정확한 버전이 기록되고, 실행 시 안전한 최신 버전을 확인해요.** 연결 프로그램은 시작할 때와 유휴 상태에서 정본 버전을 확인해 최신 보안·호환 버전으로 승격합니다. 특정 버전을 유지해야 하는 진단 환경은 `--no-self-update`를 사용할 수 있어요.
|
|
278
|
+
- **받은 패키지가 공개 저장소에서 빌드된 것인지 확인할 수 있어요.** `npm audit signatures` 를 실행하거나 `npm view @modootoday/datalab-extension-mcp@1.18.2 dist.attestations` 로 빌드 출처를 볼 수 있어요. 회사 미러 같은 다른 npm 레지스트리를 쓰고 있다면 그 레지스트리가 내려준 것을 확인하는 거예요.
|
|
257
279
|
- **소스가 전부 공개된 오픈소스예요.** 다만 이미 같은 권한으로 실행 중인 악성코드까지 막아 주지는 못해요 — 이 연결 프로그램의 잠금은 원격·타 출처 접근을 막는 장치예요.
|
|
258
280
|
|
|
259
281
|
## 해지
|
|
@@ -261,7 +283,7 @@ AI가 "그런 기능은 없다" 고 답하면, **"숨은 도구를 찾아보고
|
|
|
261
283
|
1. 터미널에서 아래 명령을 실행해요(AI 앱에 `datalab-extension-mcp` 이름으로 등록된 설정을 지워 줘요. 예전 버전이 `datalab` 이름으로 등록한 설정도 함께 지워요).
|
|
262
284
|
|
|
263
285
|
```
|
|
264
|
-
npx -y @modootoday/datalab-extension-mcp@1.18.
|
|
286
|
+
npx -y @modootoday/datalab-extension-mcp@1.18.2 uninstall
|
|
265
287
|
```
|
|
266
288
|
|
|
267
289
|
2. 확장 설정에서 **MCP 연결을 꺼요.** 패널이 브릿지라, 꺼 두면 어딘가 설정 줄이 남아 있어도 AI 앱이 아무것도 조회할 수 없어요.
|
|
@@ -277,7 +299,7 @@ AI가 "그런 기능은 없다" 고 답하면, **"숨은 도구를 찾아보고
|
|
|
277
299
|
- **ChatGPT 웹사이트에서도 되나요?** 아니요. 컴퓨터에 설치한 데스크톱 앱만 연결돼요.
|
|
278
300
|
- **항상 켜 둬야 하나요?** 아니요. 패널이 열려 있을 때만 연결돼요.
|
|
279
301
|
- **어떤 데이터를 읽나요?** 블로그 통계·키워드·광고 등 데이터랩툴즈가 보여 주는 것들이에요. 기준은 지금 Chrome에 로그인해 둔 네이버 계정이에요.
|
|
280
|
-
- **다른 컴퓨터에서도 되나요?** 네. 컴퓨터마다 한 번씩
|
|
302
|
+
- **다른 컴퓨터에서도 되나요?** 네. 컴퓨터마다 한 번씩 설치하고 한 번씩 허용해요.
|
|
281
303
|
|
|
282
304
|
</details>
|
|
283
305
|
|
|
@@ -291,12 +313,12 @@ AI가 "그런 기능은 없다" 고 답하면, **"숨은 도구를 찾아보고
|
|
|
291
313
|
|
|
292
314
|
**환경 변수**
|
|
293
315
|
|
|
294
|
-
| 변수 | 필수 | 기본값 | 설명
|
|
295
|
-
| -------------------------- | ---- | ----------- |
|
|
296
|
-
| `DATALAB_MCP_TOKEN` |
|
|
297
|
-
| `DATALAB_MCP_EXTENSION_ID` |
|
|
298
|
-
| `DATALAB_MCP_PORT` | 선택 | `8765` | 수신 포트.
|
|
299
|
-
| `DATALAB_MCP_HOST` | 선택 | `127.0.0.1` | 바인드 주소. loopback 외 값은 거부.
|
|
316
|
+
| 변수 | 필수 | 기본값 | 설명 |
|
|
317
|
+
| -------------------------- | ---- | ----------- | ------------------------------------ |
|
|
318
|
+
| `DATALAB_MCP_TOKEN` | 선택 | — | 고정 토큰. 없으면 패널과 페어링해요. |
|
|
319
|
+
| `DATALAB_MCP_EXTENSION_ID` | 선택 | 스토어 확장 | 연결을 허용할 확장 ID. |
|
|
320
|
+
| `DATALAB_MCP_PORT` | 선택 | `8765` | 수신 포트. |
|
|
321
|
+
| `DATALAB_MCP_HOST` | 선택 | `127.0.0.1` | 바인드 주소. loopback 외 값은 거부. |
|
|
300
322
|
|
|
301
323
|
**호출 한도** — 연결 프로그램 하나가 `300`회까지 몰아 부를 수 있고 초당 `50`회씩 다시 찹니다. 브라우저를 여러 대 연결했다면 그 예산을 **함께 씁니다**. 요금 제한이 아니라 폭주 루프 완충용이라 평범한 사용에서는 닿지 않습니다.
|
|
302
324
|
|
|
@@ -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-MX35GA3V.js
|
|
6
6
|
import {
|
|
7
7
|
appendFileSync,
|
|
8
8
|
mkdirSync,
|
|
@@ -19680,7 +19680,11 @@ var HelloNackReasonSchema = external_exports.enum([
|
|
|
19680
19680
|
/** Root authority cannot open a browser session. */
|
|
19681
19681
|
"browser_registration_required",
|
|
19682
19682
|
/** This panel predates mandatory browser routing and file permits. */
|
|
19683
|
-
"browser_capability_required"
|
|
19683
|
+
"browser_capability_required",
|
|
19684
|
+
/** The connector is paired with another browser's key; only that key is accepted. */
|
|
19685
|
+
"paired_elsewhere",
|
|
19686
|
+
/** Nothing is paired and the pairing window has ended; a restart reopens it. */
|
|
19687
|
+
"window_closed"
|
|
19684
19688
|
]);
|
|
19685
19689
|
var BrowserRoutingSchema = external_exports.object({
|
|
19686
19690
|
targetBrowserId: external_exports.string(),
|
|
@@ -20833,6 +20837,7 @@ function deletePairingRecord(home = homedir2()) {
|
|
|
20833
20837
|
var CLAIM_WINDOW_MS = 10 * 60 * 1e3;
|
|
20834
20838
|
function fixedRoot(token) {
|
|
20835
20839
|
return {
|
|
20840
|
+
source: "environment",
|
|
20836
20841
|
current: () => token,
|
|
20837
20842
|
claim: () => "already_paired",
|
|
20838
20843
|
windowEndsAt: () => null,
|
|
@@ -20845,6 +20850,7 @@ function pairingRoot(options = {}) {
|
|
|
20845
20850
|
const startedAt = now();
|
|
20846
20851
|
let token = readPairingRecord(options.home)?.token ?? null;
|
|
20847
20852
|
return {
|
|
20853
|
+
source: "side_panel",
|
|
20848
20854
|
current: () => token,
|
|
20849
20855
|
windowEndsAt: () => token === null ? startedAt + windowMs : null,
|
|
20850
20856
|
acceptsClaim: () => token === null && now() - startedAt <= windowMs,
|
|
@@ -21025,6 +21031,23 @@ function createPairingDesk(options) {
|
|
|
21025
21031
|
}
|
|
21026
21032
|
};
|
|
21027
21033
|
}
|
|
21034
|
+
var PAIRED_ELSEWHERE = "This connector is paired with another browser. Copy the connection key from that browser's settings into this browser's settings.";
|
|
21035
|
+
var WINDOW_CLOSED = "The pairing window has ended. Restart your AI app, then open the side panel within 10 minutes.";
|
|
21036
|
+
function nack(reason, message) {
|
|
21037
|
+
return { t: "hello_nack", reason, supported: [], message };
|
|
21038
|
+
}
|
|
21039
|
+
function pairingRefusal(root, presented, browserId) {
|
|
21040
|
+
if (browserId === void 0 || browserId.length === 0) return null;
|
|
21041
|
+
const held = root.current();
|
|
21042
|
+
if (held === null) {
|
|
21043
|
+
if (root.acceptsClaim()) return null;
|
|
21044
|
+
return nack("window_closed", WINDOW_CLOSED);
|
|
21045
|
+
}
|
|
21046
|
+
if (root.source !== "side_panel") return null;
|
|
21047
|
+
if (presented.length < MIN_TOKEN_LENGTH) return null;
|
|
21048
|
+
if (checkToken(presented, held).ok) return null;
|
|
21049
|
+
return nack("paired_elsewhere", PAIRED_ELSEWHERE);
|
|
21050
|
+
}
|
|
21028
21051
|
function randomPrefix() {
|
|
21029
21052
|
return Math.floor(Math.random() * 16777215).toString(36).padStart(4, "0");
|
|
21030
21053
|
}
|
|
@@ -21560,6 +21583,15 @@ var Bridge = class {
|
|
|
21560
21583
|
};
|
|
21561
21584
|
}
|
|
21562
21585
|
const rootToken = this.#rootFor(parsed.data.token, parsed.data.browserId);
|
|
21586
|
+
const explained = pairingRefusal(
|
|
21587
|
+
this.#root,
|
|
21588
|
+
parsed.data.token,
|
|
21589
|
+
parsed.data.browserId
|
|
21590
|
+
);
|
|
21591
|
+
if (explained !== null) {
|
|
21592
|
+
this.#deps.log?.(`refused a browser handshake: ${explained.reason}`);
|
|
21593
|
+
return explained;
|
|
21594
|
+
}
|
|
21563
21595
|
if (rootToken === null) {
|
|
21564
21596
|
return {
|
|
21565
21597
|
t: "hello_nack",
|
|
@@ -23312,7 +23344,9 @@ function createHttpBridge(opts) {
|
|
|
23312
23344
|
json2(res, 200, {
|
|
23313
23345
|
name: MCP_SERVER_HEALTH_NAME,
|
|
23314
23346
|
version: opts.identity.version,
|
|
23315
|
-
schema: MCP_SERVER_HEALTH_SCHEMA
|
|
23347
|
+
schema: MCP_SERVER_HEALTH_SCHEMA,
|
|
23348
|
+
// Lets a local installer tie this answer to the process it may end.
|
|
23349
|
+
pid: process.pid
|
|
23316
23350
|
});
|
|
23317
23351
|
return;
|
|
23318
23352
|
}
|
|
@@ -23865,31 +23899,54 @@ function parseNetstatListeners(output3, port) {
|
|
|
23865
23899
|
const cols = line.trim().split(/\s+/);
|
|
23866
23900
|
if (cols.length < 5 || cols[0]?.toUpperCase() !== "TCP") continue;
|
|
23867
23901
|
if (cols[3]?.toUpperCase() !== "LISTENING") continue;
|
|
23868
|
-
|
|
23869
|
-
if (local.slice(local.lastIndexOf(":") + 1) !== String(port)) continue;
|
|
23902
|
+
if (cols[1] !== `127.0.0.1:${String(port)}`) continue;
|
|
23870
23903
|
const pid = Number(cols[4]);
|
|
23871
23904
|
if (Number.isInteger(pid) && pid > 0) pids.add(pid);
|
|
23872
23905
|
}
|
|
23873
23906
|
return [...pids];
|
|
23874
23907
|
}
|
|
23875
|
-
function
|
|
23876
|
-
|
|
23908
|
+
function parseLsofListeners(output3, port) {
|
|
23909
|
+
const pids = /* @__PURE__ */ new Set();
|
|
23910
|
+
let pid = 0;
|
|
23911
|
+
for (const line of output3.split(/\r?\n/)) {
|
|
23912
|
+
if (line.startsWith("p")) {
|
|
23913
|
+
pid = Number(line.slice(1));
|
|
23914
|
+
continue;
|
|
23915
|
+
}
|
|
23916
|
+
if (!line.startsWith("n")) continue;
|
|
23917
|
+
if (line.slice(1) !== `127.0.0.1:${String(port)}`) continue;
|
|
23918
|
+
if (Number.isInteger(pid) && pid > 0) pids.add(pid);
|
|
23919
|
+
}
|
|
23920
|
+
return [...pids];
|
|
23877
23921
|
}
|
|
23878
23922
|
function listenerQuery(platform, port) {
|
|
23879
23923
|
if (platform === "win32") {
|
|
23880
23924
|
return { command: "netstat", args: ["-ano", "-p", "TCP"] };
|
|
23881
23925
|
}
|
|
23882
23926
|
if (platform === "darwin" || platform === "linux") {
|
|
23883
|
-
return {
|
|
23927
|
+
return {
|
|
23928
|
+
command: "lsof",
|
|
23929
|
+
args: ["-nP", `-iTCP:${String(port)}`, "-sTCP:LISTEN", "-Fpn"]
|
|
23930
|
+
};
|
|
23884
23931
|
}
|
|
23885
23932
|
return null;
|
|
23886
23933
|
}
|
|
23887
|
-
function
|
|
23888
|
-
|
|
23889
|
-
|
|
23890
|
-
|
|
23891
|
-
|
|
23892
|
-
|
|
23934
|
+
function identityQuery(platform, pid) {
|
|
23935
|
+
if (platform === "darwin" || platform === "linux") {
|
|
23936
|
+
return { command: "ps", args: ["-o", "uid=,command=", "-p", String(pid)] };
|
|
23937
|
+
}
|
|
23938
|
+
return null;
|
|
23939
|
+
}
|
|
23940
|
+
function isOwnConnector(output3, uid) {
|
|
23941
|
+
const match = /^\s*(\d+)\s+(.+)$/.exec(output3.trim());
|
|
23942
|
+
if (match === null) return false;
|
|
23943
|
+
if (Number(match[1]) !== uid) return false;
|
|
23944
|
+
return (match[2] ?? "").includes("datalab-extension-mcp");
|
|
23945
|
+
}
|
|
23946
|
+
function soleListener(pids, selfPid) {
|
|
23947
|
+
const others = pids.filter((pid) => pid !== selfPid);
|
|
23948
|
+
if (others.length !== 1) return null;
|
|
23949
|
+
return others[0] ?? null;
|
|
23893
23950
|
}
|
|
23894
23951
|
function runQuiet(command, args) {
|
|
23895
23952
|
const res = spawnSync2(command, args, {
|
|
@@ -23899,17 +23956,35 @@ function runQuiet(command, args) {
|
|
|
23899
23956
|
});
|
|
23900
23957
|
return typeof res.stdout === "string" ? res.stdout : "";
|
|
23901
23958
|
}
|
|
23902
|
-
function
|
|
23959
|
+
function ownListener(platform, port, reportedPid, run, selfPid, uid) {
|
|
23960
|
+
if (reportedPid === null || uid === void 0) return null;
|
|
23961
|
+
const query = listenerQuery(platform, port);
|
|
23962
|
+
if (query === null) return null;
|
|
23963
|
+
const listing = run(query.command, query.args);
|
|
23964
|
+
const pids = platform === "win32" ? parseNetstatListeners(listing, port) : parseLsofListeners(listing, port);
|
|
23965
|
+
const pid = soleListener(pids, selfPid);
|
|
23966
|
+
if (pid === null || pid !== reportedPid) return null;
|
|
23967
|
+
const identity = identityQuery(platform, pid);
|
|
23968
|
+
if (identity === null) return null;
|
|
23969
|
+
return isOwnConnector(run(identity.command, identity.args), uid) ? pid : null;
|
|
23970
|
+
}
|
|
23971
|
+
function killPortOwner(port, reportedPid, platform = process.platform) {
|
|
23903
23972
|
if (process.env["VITEST"] !== void 0) return false;
|
|
23904
|
-
|
|
23905
|
-
|
|
23906
|
-
|
|
23907
|
-
|
|
23908
|
-
|
|
23909
|
-
|
|
23910
|
-
|
|
23973
|
+
const pid = ownListener(
|
|
23974
|
+
platform,
|
|
23975
|
+
port,
|
|
23976
|
+
reportedPid,
|
|
23977
|
+
runQuiet,
|
|
23978
|
+
process.pid,
|
|
23979
|
+
process.getuid?.()
|
|
23980
|
+
);
|
|
23981
|
+
if (pid === null) return false;
|
|
23982
|
+
try {
|
|
23983
|
+
process.kill(pid, "SIGKILL");
|
|
23984
|
+
return true;
|
|
23985
|
+
} catch {
|
|
23986
|
+
return false;
|
|
23911
23987
|
}
|
|
23912
|
-
return signalled;
|
|
23913
23988
|
}
|
|
23914
23989
|
|
|
23915
23990
|
// src/adapter.ts
|
|
@@ -43724,7 +43799,11 @@ var HelloNackReasonSchema2 = external_exports2.enum([
|
|
|
43724
43799
|
/** Root authority cannot open a browser session. */
|
|
43725
43800
|
"browser_registration_required",
|
|
43726
43801
|
/** This panel predates mandatory browser routing and file permits. */
|
|
43727
|
-
"browser_capability_required"
|
|
43802
|
+
"browser_capability_required",
|
|
43803
|
+
/** The connector is paired with another browser's key; only that key is accepted. */
|
|
43804
|
+
"paired_elsewhere",
|
|
43805
|
+
/** Nothing is paired and the pairing window has ended; a restart reopens it. */
|
|
43806
|
+
"window_closed"
|
|
43728
43807
|
]);
|
|
43729
43808
|
var BrowserRoutingSchema2 = external_exports2.object({
|
|
43730
43809
|
targetBrowserId: external_exports2.string(),
|
|
@@ -44652,6 +44731,18 @@ async function defaultReadVersion(base) {
|
|
|
44652
44731
|
return null;
|
|
44653
44732
|
}
|
|
44654
44733
|
}
|
|
44734
|
+
async function defaultReadPid(base) {
|
|
44735
|
+
try {
|
|
44736
|
+
const res = await globalThis.fetch(
|
|
44737
|
+
`${base}/bridge/health`
|
|
44738
|
+
);
|
|
44739
|
+
const body = await res.json();
|
|
44740
|
+
if (!isOurConnector(body)) return null;
|
|
44741
|
+
return typeof body.pid === "number" && Number.isInteger(body.pid) ? body.pid : null;
|
|
44742
|
+
} catch {
|
|
44743
|
+
return null;
|
|
44744
|
+
}
|
|
44745
|
+
}
|
|
44655
44746
|
async function defaultShutdown(base, token) {
|
|
44656
44747
|
try {
|
|
44657
44748
|
const res = await globalThis.fetch(
|
|
@@ -44699,13 +44790,13 @@ async function ensureDaemonRunning(deps = {}) {
|
|
|
44699
44790
|
const shutdown = deps.shutdown ?? defaultShutdown;
|
|
44700
44791
|
const checkAuthority = deps.checkAuthority ?? defaultCheckAuthority;
|
|
44701
44792
|
const readTakeover = deps.readTakeover ?? (() => readTakeoverSecret());
|
|
44702
|
-
const killOwner = deps.killOwner ?? ((p) => killPortOwner(p));
|
|
44793
|
+
const killOwner = deps.killOwner ?? (async (p) => killPortOwner(p, await defaultReadPid(base)));
|
|
44703
44794
|
const shutdownWithTakeover = async () => {
|
|
44704
44795
|
const secret = readTakeover();
|
|
44705
44796
|
return secret !== null && await shutdown(base, secret);
|
|
44706
44797
|
};
|
|
44707
44798
|
const seizePort = async () => {
|
|
44708
|
-
if (!killOwner(port)) return false;
|
|
44799
|
+
if (!await killOwner(port)) return false;
|
|
44709
44800
|
log(`ending the connector that holds port ${String(port)}`);
|
|
44710
44801
|
await waitForPortRelease();
|
|
44711
44802
|
await spawnAndWait();
|
|
@@ -45028,7 +45119,7 @@ async function updateInstalledCopy(selfVersion, log, deps = {}) {
|
|
|
45028
45119
|
return "migrated";
|
|
45029
45120
|
}
|
|
45030
45121
|
async function quietInstallerIo() {
|
|
45031
|
-
const installer = await import("./dist-
|
|
45122
|
+
const installer = await import("./dist-43NMRYEU.js");
|
|
45032
45123
|
const io = installer.createNodeIo();
|
|
45033
45124
|
io.out = (line) => defaultLog(line);
|
|
45034
45125
|
return { installer, io };
|
package/dist/cli.js
CHANGED
|
@@ -10,7 +10,7 @@ import {
|
|
|
10
10
|
runAdapter,
|
|
11
11
|
runDaemon,
|
|
12
12
|
tryConnect
|
|
13
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-ISCO5PYC.js";
|
|
14
14
|
import "./chunk-MLKGABMK.js";
|
|
15
15
|
|
|
16
16
|
// src/cli.ts
|
|
@@ -49,7 +49,7 @@ function log(message) {
|
|
|
49
49
|
`);
|
|
50
50
|
}
|
|
51
51
|
async function runInstaller(sub, argv) {
|
|
52
|
-
const { createNodeIo, runInstall, runUninstall } = await import("./dist-
|
|
52
|
+
const { createNodeIo, runInstall, runUninstall } = await import("./dist-43NMRYEU.js");
|
|
53
53
|
const opts = { version: VERSION };
|
|
54
54
|
for (let i = 0; i < argv.length; i += 1) {
|
|
55
55
|
const flag = argv[i];
|
|
@@ -26,24 +26,20 @@ function isCustomPort(port) {
|
|
|
26
26
|
return port !== DEFAULT_PORT;
|
|
27
27
|
}
|
|
28
28
|
function buildEnv(opts) {
|
|
29
|
-
const env = {
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
}
|
|
29
|
+
const env = {};
|
|
30
|
+
if (opts.token !== void 0) {
|
|
31
|
+
env["DATALAB_MCP_TOKEN"] = opts.token;
|
|
32
|
+
}
|
|
33
|
+
env["DATALAB_MCP_EXTENSION_ID"] = opts.extensionId;
|
|
33
34
|
if (isCustomPort(opts.port)) {
|
|
34
35
|
env["DATALAB_MCP_PORT"] = opts.port;
|
|
35
36
|
}
|
|
36
37
|
return env;
|
|
37
38
|
}
|
|
38
39
|
function envPairs(opts) {
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
];
|
|
43
|
-
if (isCustomPort(opts.port)) {
|
|
44
|
-
pairs.push(`DATALAB_MCP_PORT=${opts.port}`);
|
|
45
|
-
}
|
|
46
|
-
return pairs;
|
|
40
|
+
return Object.entries(buildEnv(opts)).map(
|
|
41
|
+
([key, value]) => `${key}=${value}`
|
|
42
|
+
);
|
|
47
43
|
}
|
|
48
44
|
function daemonMcpUrl(opts) {
|
|
49
45
|
const port = isCustomPort(opts.port) ? opts.port : DEFAULT_PORT;
|
|
@@ -1012,7 +1008,7 @@ function validateInstallOptions(opts) {
|
|
|
1012
1008
|
if (typeof opts.version !== "string" || !VERSION_RE.test(opts.version)) {
|
|
1013
1009
|
return INVALID_VERSION_MESSAGE;
|
|
1014
1010
|
}
|
|
1015
|
-
if (
|
|
1011
|
+
if (opts.token !== void 0 && !TOKEN_RE.test(opts.token)) {
|
|
1016
1012
|
return INVALID_TOKEN_MESSAGE;
|
|
1017
1013
|
}
|
|
1018
1014
|
if (typeof opts.extensionId !== "string" || !EXTENSION_ID_RE.test(opts.extensionId)) {
|
|
@@ -1108,44 +1104,83 @@ function parseNetstatListeners(output, port) {
|
|
|
1108
1104
|
const cols = line.trim().split(/\s+/);
|
|
1109
1105
|
if (cols.length < 5 || cols[0]?.toUpperCase() !== "TCP") continue;
|
|
1110
1106
|
if (cols[3]?.toUpperCase() !== "LISTENING") continue;
|
|
1111
|
-
|
|
1112
|
-
if (local.slice(local.lastIndexOf(":") + 1) !== String(port)) continue;
|
|
1107
|
+
if (cols[1] !== `127.0.0.1:${String(port)}`) continue;
|
|
1113
1108
|
const pid = Number(cols[4]);
|
|
1114
1109
|
if (Number.isInteger(pid) && pid > 0) pids.add(pid);
|
|
1115
1110
|
}
|
|
1116
1111
|
return [...pids];
|
|
1117
1112
|
}
|
|
1118
|
-
function
|
|
1119
|
-
|
|
1113
|
+
function parseLsofListeners(output, port) {
|
|
1114
|
+
const pids = /* @__PURE__ */ new Set();
|
|
1115
|
+
let pid = 0;
|
|
1116
|
+
for (const line of output.split(/\r?\n/)) {
|
|
1117
|
+
if (line.startsWith("p")) {
|
|
1118
|
+
pid = Number(line.slice(1));
|
|
1119
|
+
continue;
|
|
1120
|
+
}
|
|
1121
|
+
if (!line.startsWith("n")) continue;
|
|
1122
|
+
if (line.slice(1) !== `127.0.0.1:${String(port)}`) continue;
|
|
1123
|
+
if (Number.isInteger(pid) && pid > 0) pids.add(pid);
|
|
1124
|
+
}
|
|
1125
|
+
return [...pids];
|
|
1120
1126
|
}
|
|
1121
1127
|
function listenerQuery(platform, port) {
|
|
1122
1128
|
if (platform === "win32") {
|
|
1123
1129
|
return { command: "netstat", args: ["-ano", "-p", "TCP"] };
|
|
1124
1130
|
}
|
|
1125
1131
|
if (platform === "darwin" || platform === "linux") {
|
|
1126
|
-
return {
|
|
1132
|
+
return {
|
|
1133
|
+
command: "lsof",
|
|
1134
|
+
args: ["-nP", `-iTCP:${String(port)}`, "-sTCP:LISTEN", "-Fpn"]
|
|
1135
|
+
};
|
|
1136
|
+
}
|
|
1137
|
+
return null;
|
|
1138
|
+
}
|
|
1139
|
+
function identityQuery(platform, pid) {
|
|
1140
|
+
if (platform === "darwin" || platform === "linux") {
|
|
1141
|
+
return { command: "ps", args: ["-o", "uid=,command=", "-p", String(pid)] };
|
|
1127
1142
|
}
|
|
1128
1143
|
return null;
|
|
1129
1144
|
}
|
|
1130
|
-
|
|
1145
|
+
function isOwnConnector(output, uid) {
|
|
1146
|
+
const match = /^\s*(\d+)\s+(.+)$/.exec(output.trim());
|
|
1147
|
+
if (match === null) return false;
|
|
1148
|
+
if (Number(match[1]) !== uid) return false;
|
|
1149
|
+
return (match[2] ?? "").includes("datalab-extension-mcp");
|
|
1150
|
+
}
|
|
1151
|
+
function soleListener(pids, selfPid) {
|
|
1152
|
+
const others = pids.filter((pid) => pid !== selfPid);
|
|
1153
|
+
if (others.length !== 1) return null;
|
|
1154
|
+
return others[0] ?? null;
|
|
1155
|
+
}
|
|
1156
|
+
async function ownListener(platform, port, reportedPid, deps) {
|
|
1157
|
+
if (reportedPid === null || deps.uid === void 0) return null;
|
|
1131
1158
|
const query = listenerQuery(platform, port);
|
|
1132
|
-
if (query === null) return
|
|
1133
|
-
const
|
|
1134
|
-
const pids = platform === "win32" ? parseNetstatListeners(
|
|
1135
|
-
|
|
1136
|
-
|
|
1137
|
-
|
|
1138
|
-
|
|
1139
|
-
|
|
1140
|
-
|
|
1141
|
-
|
|
1142
|
-
|
|
1159
|
+
if (query === null) return null;
|
|
1160
|
+
const listing = await deps.capture(query.command, query.args);
|
|
1161
|
+
const pids = platform === "win32" ? parseNetstatListeners(listing, port) : parseLsofListeners(listing, port);
|
|
1162
|
+
const pid = soleListener(pids, deps.selfPid);
|
|
1163
|
+
if (pid === null || pid !== reportedPid) return null;
|
|
1164
|
+
const identity = identityQuery(platform, pid);
|
|
1165
|
+
if (identity === null) return null;
|
|
1166
|
+
const owner = await deps.capture(identity.command, identity.args);
|
|
1167
|
+
return isOwnConnector(owner, deps.uid) ? pid : null;
|
|
1168
|
+
}
|
|
1169
|
+
async function endPortListener(platform, port, reportedPid, deps) {
|
|
1170
|
+
const pid = await ownListener(platform, port, reportedPid, deps);
|
|
1171
|
+
if (pid === null) return false;
|
|
1172
|
+
try {
|
|
1173
|
+
deps.killPid(pid);
|
|
1174
|
+
return true;
|
|
1175
|
+
} catch {
|
|
1176
|
+
return false;
|
|
1143
1177
|
}
|
|
1144
|
-
return signalled;
|
|
1145
1178
|
}
|
|
1146
1179
|
var DEFAULT_PORT2 = 8765;
|
|
1147
1180
|
var HOST = "127.0.0.1";
|
|
1148
1181
|
var CONNECTOR_NAME = "datalab-extension-mcp-server";
|
|
1182
|
+
var STATE_DIR = ".datalab-mcp";
|
|
1183
|
+
var TAKEOVER_FILE = "takeover";
|
|
1149
1184
|
var PROBE_TIMEOUT_MS = 2e3;
|
|
1150
1185
|
var RELEASE_ATTEMPTS = 20;
|
|
1151
1186
|
var RELEASE_INTERVAL_MS = 150;
|
|
@@ -1188,18 +1223,21 @@ async function post(fetchImpl, target, body) {
|
|
|
1188
1223
|
}
|
|
1189
1224
|
async function probePort(fetchImpl, port) {
|
|
1190
1225
|
const res = await get(fetchImpl, url(port, "/bridge/health"));
|
|
1191
|
-
if (res === null) return { state: "free", version: null };
|
|
1192
|
-
if (!res.ok) return { state: "foreign", version: null };
|
|
1226
|
+
if (res === null) return { state: "free", version: null, pid: null };
|
|
1227
|
+
if (!res.ok) return { state: "foreign", version: null, pid: null };
|
|
1193
1228
|
try {
|
|
1194
1229
|
const body = await res.json();
|
|
1195
|
-
if (body.name !== CONNECTOR_NAME)
|
|
1196
|
-
return { state: "foreign", version: null };
|
|
1230
|
+
if (body.name !== CONNECTOR_NAME) {
|
|
1231
|
+
return { state: "foreign", version: null, pid: null };
|
|
1232
|
+
}
|
|
1233
|
+
const pid = typeof body.pid === "number" && Number.isInteger(body.pid) ? body.pid : null;
|
|
1197
1234
|
return {
|
|
1198
1235
|
state: "ours",
|
|
1199
|
-
version: typeof body.version === "string" ? body.version : null
|
|
1236
|
+
version: typeof body.version === "string" ? body.version : null,
|
|
1237
|
+
pid
|
|
1200
1238
|
};
|
|
1201
1239
|
} catch {
|
|
1202
|
-
return { state: "foreign", version: null };
|
|
1240
|
+
return { state: "foreign", version: null, pid: null };
|
|
1203
1241
|
}
|
|
1204
1242
|
}
|
|
1205
1243
|
async function reclaimPort(io, token, deps = {}) {
|
|
@@ -1210,33 +1248,81 @@ async function reclaimPort(io, token, deps = {}) {
|
|
|
1210
1248
|
const probe = await probePort(fetchImpl, port);
|
|
1211
1249
|
if (probe.state === "free") return { kind: "not-needed" };
|
|
1212
1250
|
if (probe.state === "foreign") return { kind: "foreign" };
|
|
1251
|
+
const older = olderThan(probe.version, deps.version);
|
|
1252
|
+
if (token === void 0) {
|
|
1253
|
+
if (!older) return { kind: "not-needed" };
|
|
1254
|
+
return retireWithoutToken(io, port, probe.pid, fetchImpl, sleep);
|
|
1255
|
+
}
|
|
1213
1256
|
const authorised = await post(fetchImpl, url(port, "/mcp/authority"), {
|
|
1214
1257
|
token
|
|
1215
1258
|
});
|
|
1216
|
-
if (authorised?.status === 204 && !
|
|
1259
|
+
if (authorised?.status === 204 && !older) {
|
|
1217
1260
|
return { kind: "not-needed" };
|
|
1218
1261
|
}
|
|
1219
1262
|
const stood = await post(fetchImpl, url(port, "/mcp/shutdown"), { token });
|
|
1220
|
-
|
|
1221
|
-
|
|
1222
|
-
|
|
1223
|
-
|
|
1263
|
+
if (stood?.status === 200 && await released(fetchImpl, port, sleep)) {
|
|
1264
|
+
return { kind: "retired" };
|
|
1265
|
+
}
|
|
1266
|
+
return endListener(io, port, probe.pid, fetchImpl, sleep);
|
|
1267
|
+
}
|
|
1268
|
+
async function retireWithoutToken(io, port, reportedPid, fetchImpl, sleep) {
|
|
1269
|
+
const pid = await ownListener(
|
|
1270
|
+
io.platform,
|
|
1271
|
+
port,
|
|
1272
|
+
reportedPid,
|
|
1273
|
+
listenerDeps(io)
|
|
1274
|
+
);
|
|
1275
|
+
if (pid === null) return { kind: "failed" };
|
|
1276
|
+
const secret = await readTakeover(io);
|
|
1277
|
+
if (secret !== null) {
|
|
1278
|
+
const stood = await post(fetchImpl, url(port, "/mcp/shutdown"), {
|
|
1279
|
+
token: secret
|
|
1280
|
+
});
|
|
1281
|
+
if (stood?.status === 200 && await released(fetchImpl, port, sleep)) {
|
|
1282
|
+
return { kind: "retired" };
|
|
1224
1283
|
}
|
|
1225
|
-
|
|
1226
|
-
|
|
1227
|
-
|
|
1228
|
-
|
|
1284
|
+
}
|
|
1285
|
+
return endListener(io, port, reportedPid, fetchImpl, sleep);
|
|
1286
|
+
}
|
|
1287
|
+
async function readTakeover(io) {
|
|
1288
|
+
try {
|
|
1289
|
+
const raw = await io.readFile(
|
|
1290
|
+
joinPath(io, io.homedir(), STATE_DIR, TAKEOVER_FILE)
|
|
1291
|
+
);
|
|
1292
|
+
const secret = raw.trim();
|
|
1293
|
+
return secret === "" ? null : secret;
|
|
1294
|
+
} catch {
|
|
1295
|
+
return null;
|
|
1296
|
+
}
|
|
1297
|
+
}
|
|
1298
|
+
function listenerDeps(io) {
|
|
1299
|
+
return {
|
|
1229
1300
|
capture: io.capture,
|
|
1230
1301
|
killPid: io.killPid,
|
|
1231
|
-
selfPid: process.pid
|
|
1232
|
-
|
|
1302
|
+
selfPid: process.pid,
|
|
1303
|
+
uid: io.uid
|
|
1304
|
+
};
|
|
1305
|
+
}
|
|
1306
|
+
async function released(fetchImpl, port, sleep) {
|
|
1307
|
+
for (let i = 0; i < RELEASE_ATTEMPTS; i += 1) {
|
|
1308
|
+
await sleep(RELEASE_INTERVAL_MS);
|
|
1309
|
+
if ((await probePort(fetchImpl, port)).state === "free") return true;
|
|
1310
|
+
}
|
|
1311
|
+
return false;
|
|
1312
|
+
}
|
|
1313
|
+
async function endListener(io, port, reportedPid, fetchImpl, sleep) {
|
|
1314
|
+
const ended = await endPortListener(
|
|
1315
|
+
io.platform,
|
|
1316
|
+
port,
|
|
1317
|
+
reportedPid,
|
|
1318
|
+
listenerDeps(io)
|
|
1319
|
+
);
|
|
1233
1320
|
if (!ended) return { kind: "failed" };
|
|
1234
|
-
return await
|
|
1321
|
+
return await released(fetchImpl, port, sleep) ? { kind: "forced" } : { kind: "failed" };
|
|
1235
1322
|
}
|
|
1236
1323
|
var INSTALL_TITLE = "\uB370\uC774\uD130\uB7A9\uD234\uC988 \uC5F0\uACB0 \uB3C4\uC6B0\uBBF8";
|
|
1237
1324
|
var UNINSTALL_TITLE = "\uB370\uC774\uD130\uB7A9\uD234\uC988 \uC5F0\uACB0 \uC815\uB9AC";
|
|
1238
1325
|
var INSTALL_STEPS = {
|
|
1239
|
-
key: "\uC5F0\uACB0 \uD0A4",
|
|
1240
1326
|
find: "AI \uD504\uB85C\uADF8\uB7A8 \uCC3E\uAE30",
|
|
1241
1327
|
connect: "\uC5F0\uACB0\uD558\uAE30",
|
|
1242
1328
|
finish: "\uB9C8\uBB34\uB9AC"
|
|
@@ -1249,22 +1335,6 @@ var SURFACE_NOTE = {
|
|
|
1249
1335
|
extension: "\uB0B4 \uBE0C\uB77C\uC6B0\uC800\uC758 \uB124\uC774\uBC84 \uB370\uC774\uD130",
|
|
1250
1336
|
catalog: "\uB9C8\uCF00\uD305\xB7\uAE30\uD68D\xB7\uBC95\uBB34 \uC5C5\uBB34 \uC694\uB839"
|
|
1251
1337
|
};
|
|
1252
|
-
var TOKEN_PROMPT_GUIDE = [
|
|
1253
|
-
"\uD06C\uB86C \uD655\uC7A5 \uC124\uC815 \u203A \uB2E4\uB978 AI \uC571\uC5D0 \uC5F0\uACB0 (MCP)",
|
|
1254
|
-
"\u203A 1\uBC88 [\uC5F0\uACB0 \uD0A4]\uB97C \uBCF5\uC0AC\uD574 \uBD99\uC5EC\uB123\uC5B4 \uC8FC\uC138\uC694."
|
|
1255
|
-
];
|
|
1256
|
-
var TOKEN_PROMPT_QUESTION = " \uC5F0\uACB0 \uD0A4:";
|
|
1257
|
-
var TOKEN_PROMPT_RETRY = "\uC5F0\uACB0 \uD0A4 \uD615\uC2DD\uC774 \uB9DE\uC9C0 \uC54A\uC544\uC694. \uB2E4\uC2DC \uBCF5\uC0AC\uD574 \uBD99\uC5EC\uB123\uC5B4 \uC8FC\uC138\uC694.";
|
|
1258
|
-
var TOKEN_CONFIRMED = "\uC5F0\uACB0 \uD0A4\uB97C \uD655\uC778\uD588\uC5B4\uC694.";
|
|
1259
|
-
var TOKEN_REQUIRED = "\uC5F0\uACB0 \uD0A4\uAC00 \uD544\uC694\uD574\uC694.";
|
|
1260
|
-
var TOKEN_REQUIRED_CARD = {
|
|
1261
|
-
title: "\uC774\uB807\uAC8C \uD574 \uC8FC\uC138\uC694",
|
|
1262
|
-
lines: [
|
|
1263
|
-
"\uD06C\uB86C \uD655\uC7A5 \uC124\uC815 \u203A \uB2E4\uB978 AI \uC571\uC5D0 \uC5F0\uACB0 (MCP)",
|
|
1264
|
-
"\u203A 2\uBC88 \uBA85\uB839\uC758 [\uBCF5\uC0AC]\uB97C \uB20C\uB7EC, \uBCF5\uC0AC\uB41C \uBA85\uB839\uC744 \uADF8\uB300\uB85C",
|
|
1265
|
-
" \uBD99\uC5EC\uB123\uC5B4 \uC2E4\uD589\uD574 \uC8FC\uC138\uC694."
|
|
1266
|
-
]
|
|
1267
|
-
};
|
|
1268
1338
|
function foundPrograms(count) {
|
|
1269
1339
|
return `${String(count)}\uAC1C\uB97C \uCC3E\uC558\uC5B4\uC694.`;
|
|
1270
1340
|
}
|
|
@@ -1333,8 +1403,9 @@ var RECLAIM = {
|
|
|
1333
1403
|
"\uADF8 \uD504\uB85C\uADF8\uB7A8\uC744 \uB044\uACE0 \uB2E4\uC2DC \uC2E4\uD589\uD574 \uC8FC\uC138\uC694."
|
|
1334
1404
|
],
|
|
1335
1405
|
failed: [
|
|
1336
|
-
"\uC608\uC804 \uC5F0\uACB0 \uD504\uB85C\uADF8\uB7A8\
|
|
1337
|
-
"AI \
|
|
1406
|
+
"\uC124\uCE58\uB294 \uB05D\uB0AC\uC5B4\uC694. \uC608\uC804 \uC5F0\uACB0 \uD504\uB85C\uADF8\uB7A8\uC774 \uC544\uC9C1 \uD3EC\uD2B8 8765\uB97C \uC4F0\uACE0 \uC788\uC5B4\uC694.",
|
|
1407
|
+
"AI \uC571\uC744 \uBAA8\uB450 \uC885\uB8CC\uD558\uACE0 5\uBD84\uCBE4 \uAE30\uB2E4\uB9B0 \uB4A4 \uB2E4\uC2DC \uCF1C\uBA74 \uC0C8 \uBC84\uC804\uC73C\uB85C \uC5F0\uACB0\uB3FC\uC694.",
|
|
1408
|
+
"\uADF8\uB798\uB3C4 \uC5F0\uACB0\uB418\uC9C0 \uC54A\uC73C\uBA74 \uC124\uCE58 \uBA85\uB839\uC744 \uD55C \uBC88 \uB354 \uC2E4\uD589\uD574 \uC8FC\uC138\uC694."
|
|
1338
1409
|
]
|
|
1339
1410
|
};
|
|
1340
1411
|
var DETAIL = {
|
|
@@ -1363,6 +1434,10 @@ var RESTART_LINES = [
|
|
|
1363
1434
|
"AI \uD504\uB85C\uADF8\uB7A8\uC744 \uC644\uC804\uD788 \uC885\uB8CC\uD588\uB2E4\uAC00 \uB2E4\uC2DC \uC2E4\uD589\uD574 \uC8FC\uC138\uC694.",
|
|
1364
1435
|
" Windows \uB294 \uC791\uC5C5 \uD45C\uC2DC\uC904 \uD2B8\uB808\uC774 \uC544\uC774\uCF58\uC5D0\uC11C \uC885\uB8CC\uD574\uC694."
|
|
1365
1436
|
];
|
|
1437
|
+
var PAIRING_LINES = [
|
|
1438
|
+
"AI \uD504\uB85C\uADF8\uB7A8\uC5D0\uC11C \uB370\uC774\uD130\uB7A9\uD234\uC988\uB97C \uCC98\uC74C \uC4F0\uBA74 \uD06C\uB86C \uD655\uC7A5 \uCC3D\uC774",
|
|
1439
|
+
" \uC5F0\uACB0\uC744 \uD5C8\uC6A9\uD560\uC9C0 \uBB3C\uC5B4\uC694. [\uD5C8\uC6A9\uD558\uAE30]\uB97C \uB20C\uB7EC \uC8FC\uC138\uC694."
|
|
1440
|
+
];
|
|
1366
1441
|
var CATALOG_LOGIN_LINES = [
|
|
1367
1442
|
"\uC2A4\uD0AC \uCE74\uD0C8\uB85C\uADF8\uB97C \uCC98\uC74C \uC4F8 \uB54C modoo.today \uB85C\uADF8\uC778 \uCC3D\uC774",
|
|
1368
1443
|
" \uC5F4\uB824\uC694. \uD55C \uBC88 \uB85C\uADF8\uC778\uD558\uBA74 \uADF8\uB2E4\uC74C\uBD80\uD130\uB294 \uC790\uB3D9\uC774\uC5D0\uC694."
|
|
@@ -1593,22 +1668,22 @@ async function removeCatalog(io, host) {
|
|
|
1593
1668
|
}
|
|
1594
1669
|
return { row: { status: "\uC644\uB8CC", label: UNINSTALL_ROW.catalog } };
|
|
1595
1670
|
}
|
|
1596
|
-
|
|
1597
|
-
|
|
1598
|
-
|
|
1599
|
-
|
|
1600
|
-
|
|
1601
|
-
|
|
1602
|
-
}
|
|
1603
|
-
|
|
1604
|
-
|
|
1605
|
-
const
|
|
1606
|
-
|
|
1607
|
-
|
|
1608
|
-
|
|
1609
|
-
|
|
1610
|
-
|
|
1611
|
-
return {
|
|
1671
|
+
function resolveEntryOptions(opts) {
|
|
1672
|
+
const token = opts.token === "" ? void 0 : opts.token;
|
|
1673
|
+
const resolved = {
|
|
1674
|
+
...opts,
|
|
1675
|
+
token,
|
|
1676
|
+
extensionId: opts.extensionId ?? DEFAULT_EXTENSION_ID
|
|
1677
|
+
};
|
|
1678
|
+
const refusal = validateInstallOptions(resolved);
|
|
1679
|
+
if (refusal !== null) return { ok: false, refusal };
|
|
1680
|
+
const entry = {
|
|
1681
|
+
version: resolved.version,
|
|
1682
|
+
extensionId: resolved.extensionId
|
|
1683
|
+
};
|
|
1684
|
+
if (token !== void 0) entry.token = token;
|
|
1685
|
+
if (resolved.port !== void 0) entry.port = resolved.port;
|
|
1686
|
+
return { ok: true, entry };
|
|
1612
1687
|
}
|
|
1613
1688
|
var BACKUP_KEEP = 3;
|
|
1614
1689
|
function formatBackupTimestamp(date) {
|
|
@@ -2383,14 +2458,17 @@ function tally(reports) {
|
|
|
2383
2458
|
}
|
|
2384
2459
|
return { connected, manual, failed: failed2 };
|
|
2385
2460
|
}
|
|
2386
|
-
var STEPS =
|
|
2461
|
+
var STEPS = 3;
|
|
2387
2462
|
async function runInstall(opts, io) {
|
|
2388
2463
|
const ui = createUi((line) => io.out(line), terminalCaps(io));
|
|
2389
2464
|
ui.banner(INSTALL_TITLE, `v${opts.version}`);
|
|
2390
|
-
|
|
2391
|
-
|
|
2392
|
-
|
|
2393
|
-
|
|
2465
|
+
const resolved = resolveEntryOptions(opts);
|
|
2466
|
+
if (!resolved.ok) {
|
|
2467
|
+
ui.notice("\uC2E4\uD328", [resolved.refusal]);
|
|
2468
|
+
return 1;
|
|
2469
|
+
}
|
|
2470
|
+
const entryOpts = resolved.entry;
|
|
2471
|
+
ui.step(1, STEPS, INSTALL_STEPS.find);
|
|
2394
2472
|
const found = await findPrograms(opts, io, ui);
|
|
2395
2473
|
if (typeof found === "number") return found;
|
|
2396
2474
|
const withCatalog = opts.skills !== false;
|
|
@@ -2400,27 +2478,11 @@ async function runInstall(opts, io) {
|
|
|
2400
2478
|
ui.text(NOTHING_CHANGED);
|
|
2401
2479
|
return 0;
|
|
2402
2480
|
}
|
|
2403
|
-
ui.step(
|
|
2481
|
+
ui.step(2, STEPS, INSTALL_STEPS.connect);
|
|
2404
2482
|
const reports = await connect(opts, io, ui, found, entryOpts, withCatalog);
|
|
2405
2483
|
printHostReports(ui, reports);
|
|
2406
|
-
ui.step(
|
|
2407
|
-
return finish(ui, reports);
|
|
2408
|
-
}
|
|
2409
|
-
async function confirmKey(opts, io, ui) {
|
|
2410
|
-
const resolved = await resolveCredentials(opts, io, ui);
|
|
2411
|
-
if (resolved === null) return null;
|
|
2412
|
-
const refusal = validateInstallOptions(resolved);
|
|
2413
|
-
if (refusal !== null) {
|
|
2414
|
-
ui.notice("\uC2E4\uD328", [refusal]);
|
|
2415
|
-
return null;
|
|
2416
|
-
}
|
|
2417
|
-
ui.notice("\uC644\uB8CC", [TOKEN_CONFIRMED]);
|
|
2418
|
-
return {
|
|
2419
|
-
version: resolved.version,
|
|
2420
|
-
token: resolved.token,
|
|
2421
|
-
extensionId: resolved.extensionId,
|
|
2422
|
-
...resolved.port === void 0 ? {} : { port: resolved.port }
|
|
2423
|
-
};
|
|
2484
|
+
ui.step(3, STEPS, INSTALL_STEPS.finish);
|
|
2485
|
+
return finish(ui, reports, entryOpts.token === void 0);
|
|
2424
2486
|
}
|
|
2425
2487
|
async function findPrograms(opts, io, ui) {
|
|
2426
2488
|
const detected = filterByRequestedHosts(await detectHosts(io), opts.hosts);
|
|
@@ -2509,7 +2571,8 @@ var RECLAIM_NOTICE = {
|
|
|
2509
2571
|
retired: { status: "\uC815\uB9AC", lines: RECLAIM.retired },
|
|
2510
2572
|
forced: { status: "\uC815\uB9AC", lines: RECLAIM.retired },
|
|
2511
2573
|
foreign: { status: "\uC548\uB0B4", lines: RECLAIM.foreign },
|
|
2512
|
-
|
|
2574
|
+
// The entries are written either way; only the moment the new version runs waits.
|
|
2575
|
+
failed: { status: "\uC548\uB0B4", lines: RECLAIM.failed }
|
|
2513
2576
|
};
|
|
2514
2577
|
function printSummary(ui, counts) {
|
|
2515
2578
|
if (counts.failed > 0) {
|
|
@@ -2522,7 +2585,7 @@ function printSummary(ui, counts) {
|
|
|
2522
2585
|
}
|
|
2523
2586
|
ui.summary("ok", summaryAllConnected(counts.connected));
|
|
2524
2587
|
}
|
|
2525
|
-
function finish(ui, reports) {
|
|
2588
|
+
function finish(ui, reports, pairs) {
|
|
2526
2589
|
const counts = tally(reports);
|
|
2527
2590
|
printSummary(ui, counts);
|
|
2528
2591
|
if (counts.connected > 0) {
|
|
@@ -2531,18 +2594,20 @@ function finish(ui, reports) {
|
|
|
2531
2594
|
(row) => row.label === SURFACE.catalog && row.status === "\uC644\uB8CC"
|
|
2532
2595
|
)
|
|
2533
2596
|
);
|
|
2534
|
-
const
|
|
2535
|
-
if (
|
|
2536
|
-
|
|
2537
|
-
|
|
2538
|
-
...CATALOG_LOGIN_LINES.slice(1)
|
|
2539
|
-
);
|
|
2540
|
-
}
|
|
2541
|
-
ui.card("attention", MUST_DO_TITLE, lines);
|
|
2597
|
+
const groups = [RESTART_LINES];
|
|
2598
|
+
if (pairs) groups.push(PAIRING_LINES);
|
|
2599
|
+
if (catalogConnected) groups.push(CATALOG_LOGIN_LINES);
|
|
2600
|
+
ui.card("attention", MUST_DO_TITLE, numbered(groups));
|
|
2542
2601
|
}
|
|
2543
2602
|
printCards(ui, reports);
|
|
2544
2603
|
return counts.failed > 0 ? 1 : 0;
|
|
2545
2604
|
}
|
|
2605
|
+
function numbered(groups) {
|
|
2606
|
+
return groups.flatMap((group, index) => [
|
|
2607
|
+
`${String(index + 1)}. ${group[0] ?? ""}`,
|
|
2608
|
+
...group.slice(1)
|
|
2609
|
+
]);
|
|
2610
|
+
}
|
|
2546
2611
|
async function runUninstall(opts, io) {
|
|
2547
2612
|
const ui = createUi((line) => io.out(line), terminalCaps(io));
|
|
2548
2613
|
ui.banner(UNINSTALL_TITLE, `v${opts.version}`);
|
|
@@ -2802,6 +2867,7 @@ function createNodeIo() {
|
|
|
2802
2867
|
killPid(pid) {
|
|
2803
2868
|
process.kill(pid, "SIGKILL");
|
|
2804
2869
|
},
|
|
2870
|
+
uid: process.getuid?.(),
|
|
2805
2871
|
async ask(question) {
|
|
2806
2872
|
const rl = createInterface({
|
|
2807
2873
|
input: process.stdin,
|
|
@@ -2869,10 +2935,7 @@ export {
|
|
|
2869
2935
|
SERVER_PACKAGE,
|
|
2870
2936
|
SNIPPET_HOSTS,
|
|
2871
2937
|
SUPPORTED_APPS,
|
|
2872
|
-
TOKEN_PROMPT_GUIDE,
|
|
2873
|
-
TOKEN_PROMPT_QUESTION,
|
|
2874
2938
|
TOKEN_RE,
|
|
2875
|
-
TOKEN_REQUIRED,
|
|
2876
2939
|
UNINSTALL_DONE,
|
|
2877
2940
|
UNINSTALL_QUESTION,
|
|
2878
2941
|
VERSION_RE,
|
package/dist/index.d.ts
CHANGED
|
@@ -46,9 +46,9 @@ interface EnsureRunningDeps {
|
|
|
46
46
|
readTakeover?: () => string | null;
|
|
47
47
|
/**
|
|
48
48
|
* Ends the process holding the port. Injected in tests; defaults to the real
|
|
49
|
-
* one
|
|
49
|
+
* one, which ends only a listener proven to be our connector.
|
|
50
50
|
*/
|
|
51
|
-
killOwner?: (port: number) => boolean
|
|
51
|
+
killOwner?: (port: number) => boolean | Promise<boolean>;
|
|
52
52
|
/**
|
|
53
53
|
* This adapter's own version. When set, a running daemon older than this is
|
|
54
54
|
* replaced; one at this version or newer is left alone, so an older adapter
|
package/dist/index.js
CHANGED