deepline 0.3.540 → 0.3.542

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.
Files changed (143) hide show
  1. package/dist/bundling-sources/sdk/src/release.ts +1 -1
  2. package/dist/bundling-sources/sdk/src/types.ts +7 -1
  3. package/dist/cli/auth-2PH6RSKL.js +43 -0
  4. package/dist/cli/{auth-32TURPHH.mjs → auth-IGBGOB4E.mjs} +5 -5
  5. package/dist/cli/{billing-6433M4BX.js → billing-IB2TWE74.js} +92 -92
  6. package/dist/cli/{billing-NSH3NOHV.mjs → billing-N37W2I62.mjs} +8 -8
  7. package/dist/cli/{chunk-XYM3SQZN.mjs → chunk-2VRKBHMD.mjs} +1 -1
  8. package/dist/cli/{chunk-FR3AII3W.mjs → chunk-2ZGSHVZE.mjs} +2 -2
  9. package/dist/cli/{chunk-SINNEITW.mjs → chunk-3LEUSRV3.mjs} +4 -4
  10. package/dist/cli/{chunk-M4DB6BBP.js → chunk-3XXXMSSP.js} +44 -44
  11. package/dist/cli/{chunk-KN6ELDPL.mjs → chunk-46V7QSJE.mjs} +2 -2
  12. package/dist/cli/{chunk-XIIQNSWA.js → chunk-4I47NCRI.js} +8 -8
  13. package/dist/cli/{chunk-B6UZUQ2O.mjs → chunk-5APOJWJF.mjs} +1 -1
  14. package/dist/cli/{chunk-MLDLN6WG.js → chunk-5CAVURVS.js} +53 -53
  15. package/dist/cli/{chunk-UJYX4VLX.js → chunk-6SLEHAXX.js} +5 -5
  16. package/dist/cli/{chunk-IYQZVEV4.mjs → chunk-6WQDHEVF.mjs} +5 -5
  17. package/dist/cli/{chunk-S3ULSGFH.mjs → chunk-ACVTMAW4.mjs} +2 -2
  18. package/dist/cli/{chunk-WHYNYL3M.js → chunk-AKY7KZRJ.js} +6 -6
  19. package/dist/cli/{chunk-N6DMKVKO.js → chunk-AUFE624T.js} +10 -10
  20. package/dist/cli/{chunk-AOYW62XO.js → chunk-AWLPERL3.js} +3 -3
  21. package/dist/cli/{chunk-Y6647AIY.mjs → chunk-B5NP3SHX.mjs} +2 -2
  22. package/dist/cli/{chunk-J3TAEPFA.js → chunk-CFZCRM6R.js} +26 -26
  23. package/dist/cli/{chunk-XL3CEPZA.js → chunk-D44DP4KJ.js} +9 -9
  24. package/dist/cli/{chunk-TNUM4DFA.js → chunk-D7GWEBMF.js} +7 -7
  25. package/dist/cli/{chunk-AB6DFHGL.mjs → chunk-DADH3WPE.mjs} +2 -2
  26. package/dist/cli/{chunk-ZTJQKHLM.js → chunk-DMXLZ57N.js} +2 -2
  27. package/dist/cli/{chunk-BGBRA2S6.js → chunk-DNGACHFX.js} +22 -22
  28. package/dist/cli/{chunk-VAOGM5VS.js → chunk-E7B73LGT.js} +19 -19
  29. package/dist/cli/{chunk-SXVYFOBG.mjs → chunk-EGOCGWCI.mjs} +3 -3
  30. package/dist/cli/{chunk-AJVK4XC5.js → chunk-EHLCWGWN.js} +4 -4
  31. package/dist/cli/{chunk-SGMDRYAD.mjs → chunk-FFDZT255.mjs} +1 -1
  32. package/dist/cli/{chunk-BNNGM2E5.js → chunk-FGGPCAGC.js} +15 -15
  33. package/dist/cli/{chunk-MH22LQKZ.mjs → chunk-FX4OWXKK.mjs} +2 -2
  34. package/dist/cli/{chunk-WDHHQEWQ.js → chunk-GM73TZ2W.js} +41 -41
  35. package/dist/cli/{chunk-LXLCQP4A.js → chunk-HAITCPCG.js} +16 -16
  36. package/dist/cli/{chunk-JPU5YLQG.mjs → chunk-I5EAIFGO.mjs} +1 -1
  37. package/dist/cli/{chunk-2U4VACUA.js → chunk-JPT6VE54.js} +2 -2
  38. package/dist/cli/{chunk-HKWJD45V.js → chunk-LFMQVSEI.js} +5 -5
  39. package/dist/cli/{chunk-EXAXDEIF.js → chunk-NDNEARE3.js} +13 -13
  40. package/dist/cli/{chunk-WCM64BRH.mjs → chunk-NLZHLEHD.mjs} +5 -5
  41. package/dist/cli/{chunk-PJOMRUFP.mjs → chunk-ORA5TMML.mjs} +5 -5
  42. package/dist/cli/{chunk-BD3VAPB4.mjs → chunk-P4MDTBAA.mjs} +1 -1
  43. package/dist/cli/{chunk-ZJFU2COM.mjs → chunk-PLIKPGOO.mjs} +5 -5
  44. package/dist/cli/{chunk-H6IA6XRE.js → chunk-Q7WDXLYO.js} +2 -2
  45. package/dist/cli/{chunk-Z2OYTXLK.mjs → chunk-QONO7FRF.mjs} +1 -1
  46. package/dist/cli/{chunk-DV3ESQ4X.js → chunk-QXNOSCYL.js} +1 -1
  47. package/dist/cli/{chunk-BZVVSUE2.mjs → chunk-SCLP5H4P.mjs} +1 -1
  48. package/dist/cli/{chunk-TZVW5JH3.mjs → chunk-SWO5QOXB.mjs} +1 -1
  49. package/dist/cli/{chunk-37VFUQMU.mjs → chunk-TT4JUUC3.mjs} +2 -2
  50. package/dist/cli/{chunk-LPMI4CYW.js → chunk-TTBHOMAA.js} +107 -107
  51. package/dist/cli/{chunk-MVIVF4BW.js → chunk-VHJUH3TB.js} +3 -3
  52. package/dist/cli/{chunk-KFAJYK2N.mjs → chunk-WACIN4PR.mjs} +3 -3
  53. package/dist/cli/{chunk-3GVIVIER.js → chunk-WL2GUGNZ.js} +5 -5
  54. package/dist/cli/{chunk-JGFGWWOF.mjs → chunk-YK7NNZD4.mjs} +10 -10
  55. package/dist/cli/{chunk-DWE2VE5I.mjs → chunk-Z5YRKX7K.mjs} +1 -1
  56. package/dist/cli/{chunk-HLHDCFKL.mjs → chunk-ZVNYBQ77.mjs} +4 -4
  57. package/dist/cli/concurrent-runs-help-BNIDBKML.js +21 -0
  58. package/dist/cli/{concurrent-runs-help-DU5STFGB.mjs → concurrent-runs-help-DIBGMEIN.mjs} +6 -6
  59. package/dist/cli/{csv-OJCMBODT.mjs → csv-CAVA3EMS.mjs} +4 -4
  60. package/dist/cli/{csv-FBNS6SM3.js → csv-XZAM7EYZ.js} +13 -13
  61. package/dist/cli/{db-43RQRF64.mjs → db-HD332QI7.mjs} +6 -6
  62. package/dist/cli/{db-XRGJJ2KA.js → db-PPGEOBNG.js} +27 -27
  63. package/dist/cli/describe-5TFFB2PM.js +49 -0
  64. package/dist/cli/{describe-I42Y3PWR.mjs → describe-THQU7N47.mjs} +17 -17
  65. package/dist/cli/describe-core.d.mts +2 -2
  66. package/dist/cli/describe-core.d.ts +2 -2
  67. package/dist/cli/{executions-LH46O4PG.js → executions-4ZKBL7IC.js} +8 -8
  68. package/dist/cli/{executions-QXGVQHQF.mjs → executions-AFEOLB4A.mjs} +6 -6
  69. package/dist/cli/{feedback-ELFINGTM.mjs → feedback-J2YPLKMF.mjs} +6 -6
  70. package/dist/cli/{feedback-ERYIV6MT.js → feedback-M6Y33JKT.js} +14 -14
  71. package/dist/cli/{git-V2XWB6LN.mjs → git-632RYEF6.mjs} +5 -5
  72. package/dist/cli/git-AQLQYWRI.js +25 -0
  73. package/dist/cli/index.js +144 -140
  74. package/dist/cli/index.mjs +46 -42
  75. package/dist/cli/{legacy-noops-Y3OKNVWH.js → legacy-noops-4Y62TKPC.js} +9 -9
  76. package/dist/cli/{legacy-noops-ULL2EA37.mjs → legacy-noops-KWZMXYAU.mjs} +6 -6
  77. package/dist/cli/mcp-35QA6YG7.js +352 -0
  78. package/dist/cli/mcp-PESLHAAC.mjs +352 -0
  79. package/dist/cli/{monitors-DNQXCRJZ.js → monitors-4DTUZLAI.js} +100 -100
  80. package/dist/cli/{monitors-L34NROM3.mjs → monitors-YVBKBJBU.mjs} +7 -7
  81. package/dist/cli/{org-L3HTEEXL.mjs → org-DJNKMFCZ.mjs} +82 -6
  82. package/dist/cli/{org-JETA62CO.js → org-FWCBZMER.js} +162 -86
  83. package/dist/cli/{play-GTGJRNWI.js → play-FZ45M4KD.js} +317 -317
  84. package/dist/cli/{play-JHGLSSJP.mjs → play-PHVQEEEZ.mjs} +17 -17
  85. package/dist/cli/{providers-IQVHZJ27.mjs → providers-46E67QG7.mjs} +6 -6
  86. package/dist/cli/{providers-7VH7PH2Q.js → providers-QJU6FMDD.js} +9 -9
  87. package/dist/cli/{quickstart-ZDBC45PM.mjs → quickstart-6HMJJ4RR.mjs} +4 -4
  88. package/dist/cli/{quickstart-M25JNU3O.js → quickstart-HOL7H5FS.js} +6 -6
  89. package/dist/cli/{run-NEEWZBTX.mjs → run-2W2TJ6QA.mjs} +22 -22
  90. package/dist/cli/{run-MPZGX3YD.js → run-WKSIRXEC.js} +42 -42
  91. package/dist/cli/{search-YXAFB4QQ.mjs → search-Y2CFLSYB.mjs} +7 -7
  92. package/dist/cli/search-YLJFCJTK.js +32 -0
  93. package/dist/cli/{search-output-4PH5HSJC.js → search-output-2IK6ZZDY.js} +6 -6
  94. package/dist/cli/{search-output-67BBIXIZ.mjs → search-output-FCZ35PHF.mjs} +4 -4
  95. package/dist/cli/{secrets-HLUBDN3H.js → secrets-JVJIHGU4.js} +15 -15
  96. package/dist/cli/{secrets-445FER3C.mjs → secrets-PNPNUZLX.mjs} +6 -6
  97. package/dist/cli/{sessions-CCKXJNWT.mjs → sessions-GY5VVQGO.mjs} +6 -6
  98. package/dist/cli/sessions-TZ33UCPS.js +22 -0
  99. package/dist/cli/{settings-WXJIQS5J.js → settings-5WHMFRNQ.js} +85 -85
  100. package/dist/cli/{settings-3XCZGGVF.mjs → settings-YQOPF3AI.mjs} +12 -12
  101. package/dist/cli/{setup-CKETRFFN.js → setup-3VJMKDEU.js} +49 -49
  102. package/dist/cli/{setup-TOSX6NER.mjs → setup-O5U5IEVW.mjs} +9 -9
  103. package/dist/cli/{skills-Q7NLCIJJ.mjs → skills-G6J5PF35.mjs} +7 -7
  104. package/dist/cli/skills-WZY3XDT3.js +36 -0
  105. package/dist/cli/{tools-GY6QMYTZ.mjs → tools-AG7SWL5Y.mjs} +16 -16
  106. package/dist/cli/tools-BXQBL72Q.js +56 -0
  107. package/dist/cli/{update-A7JRUN4S.mjs → update-K73DD6CR.mjs} +9 -9
  108. package/dist/cli/update-XYP5EII6.js +34 -0
  109. package/dist/cli/{views-GUWC4SNI.js → views-4D2OTLIO.js} +21 -21
  110. package/dist/cli/{views-JG7FDEJR.mjs → views-MO6DIOMR.mjs} +6 -6
  111. package/dist/cli/{workflow-QZCYSQ5G.mjs → workflow-MMZMAELI.mjs} +7 -7
  112. package/dist/cli/{workflow-CXNW7ICH.js → workflow-ZEMFCS4Y.js} +17 -17
  113. package/dist/{client-CE4QBVbp.d.mts → client-DLG9mHDh.d.mts} +1 -1
  114. package/dist/{client-B1fixtK1.d.ts → client-X-FJD5Dp.d.ts} +1 -1
  115. package/dist/{client-core-C-3FVlVq.d.ts → client-core-0jmHfFBv.d.ts} +1 -1
  116. package/dist/{client-core-2BkNBgrx.d.mts → client-core-WtnqyBwY.d.mts} +1 -1
  117. package/dist/index.d.mts +3 -3
  118. package/dist/index.d.ts +3 -3
  119. package/dist/index.js +9 -9
  120. package/dist/index.mjs +6 -6
  121. package/dist/install-integrity.json +110 -108
  122. package/dist/plays/play-description.d.mts +1 -1
  123. package/dist/plays/play-description.d.ts +1 -1
  124. package/dist/plays/run-request.d.mts +1 -1
  125. package/dist/plays/run-request.d.ts +1 -1
  126. package/dist/release.d.mts +1 -1
  127. package/dist/release.d.ts +1 -1
  128. package/dist/release.js +2 -2
  129. package/dist/release.mjs +1 -1
  130. package/dist/server.d.mts +2 -2
  131. package/dist/server.d.ts +2 -2
  132. package/dist/server.js +5 -5
  133. package/dist/server.mjs +3 -3
  134. package/package.json +1 -1
  135. package/dist/cli/auth-XA3K5LH2.js +0 -43
  136. package/dist/cli/concurrent-runs-help-HIPM5BBV.js +0 -21
  137. package/dist/cli/describe-LWZCGAXU.js +0 -49
  138. package/dist/cli/git-OV2TGYVE.js +0 -25
  139. package/dist/cli/search-HUN2YRQE.js +0 -32
  140. package/dist/cli/sessions-T2RNWC6B.js +0 -22
  141. package/dist/cli/skills-FXM2RHHO.js +0 -36
  142. package/dist/cli/tools-XLVDZTWQ.js +0 -56
  143. package/dist/cli/update-AZINHILP.js +0 -34
@@ -0,0 +1,352 @@
1
+ import {
2
+ getAuthedHttpClient,
3
+ printCommandEnvelope
4
+ } from "./chunk-TT4JUUC3.mjs";
5
+ import {
6
+ cliFeatureEnabled
7
+ } from "./chunk-Z5YRKX7K.mjs";
8
+ import "./chunk-2VRKBHMD.mjs";
9
+ import "./chunk-CQBIO6HW.mjs";
10
+ import "./chunk-DLIRSHV6.mjs";
11
+ import "./chunk-JL2OTMSG.mjs";
12
+ import "./chunk-SWO5QOXB.mjs";
13
+ import "./chunk-WZYKRD7T.mjs";
14
+ import "./chunk-KRD6H754.mjs";
15
+
16
+ // src/cli/commands/mcp.ts
17
+ import { stdin as input } from "process";
18
+ var AUTH_MODES = ["none", "headers", "oauth"];
19
+ function collect(value, previous = []) {
20
+ return [...previous, value];
21
+ }
22
+ function base(slug) {
23
+ return `/api/v2/mcp-connections/${encodeURIComponent(slug)}`;
24
+ }
25
+ async function readHeaders(options) {
26
+ const fromEnv = options.headerEnv ?? [];
27
+ if (fromEnv.length > 0 && options.headersStdin) {
28
+ throw new Error("Use either --header-env or --headers-stdin, not both.");
29
+ }
30
+ if (options.headersStdin) {
31
+ if (input.isTTY) {
32
+ throw new Error(
33
+ `--headers-stdin requires piped stdin, for example: printf '{"Authorization":"Bearer ..."}' | deepline mcp connect ...`
34
+ );
35
+ }
36
+ const chunks = [];
37
+ for await (const chunk of input) {
38
+ chunks.push(Buffer.isBuffer(chunk) ? chunk : Buffer.from(chunk));
39
+ }
40
+ let parsed;
41
+ try {
42
+ parsed = JSON.parse(Buffer.concat(chunks).toString("utf8"));
43
+ } catch {
44
+ throw new Error(
45
+ "--headers-stdin expects a JSON object of header names to values."
46
+ );
47
+ }
48
+ if (!parsed || typeof parsed !== "object" || Array.isArray(parsed)) {
49
+ throw new Error(
50
+ "--headers-stdin expects a JSON object of header names to values."
51
+ );
52
+ }
53
+ return parsed;
54
+ }
55
+ if (fromEnv.length === 0) return void 0;
56
+ const headers = {};
57
+ for (const entry of fromEnv) {
58
+ const separator = entry.indexOf("=");
59
+ const name = entry.slice(0, separator).trim();
60
+ const variable = entry.slice(separator + 1).trim();
61
+ if (separator <= 0 || !/^[A-Za-z_][A-Za-z0-9_]*$/.test(variable)) {
62
+ throw new Error(
63
+ `--header-env expects Header-Name=ENV_VAR, got "${entry}".`
64
+ );
65
+ }
66
+ const value = process.env[variable];
67
+ if (value === void 0 || value === "") {
68
+ throw new Error(`Environment variable ${variable} is not set.`);
69
+ }
70
+ headers[name] = value;
71
+ }
72
+ return headers;
73
+ }
74
+ function renderConnection(connection) {
75
+ const reason = connection.statusReason ? ` \u2014 ${connection.statusReason}` : "";
76
+ return `${connection.slug} ${connection.status} ${connection.authMode} ${connection.toolCount} tools ${connection.serverUrl}${reason}`;
77
+ }
78
+ function effectLabel(tool) {
79
+ if (tool.readOnly) return "read";
80
+ return tool.idempotent ? "idempotent write" : "write";
81
+ }
82
+ function renderTool(slug, tool) {
83
+ const state = tool.approval === "changed" ? "on, CHANGED \u2014 approve with enable" : tool.approval === "approved" ? "on" : "off";
84
+ return `mcp.${slug}.${tool.name} [${state}] ${effectLabel(tool)}${tool.description ? ` \u2014 ${tool.description.split("\n")[0].slice(0, 120)}` : ""}`;
85
+ }
86
+ async function handleConnect(name, url, forbidden, options) {
87
+ if (forbidden.length > 0) {
88
+ throw new Error(
89
+ "Do not pass header values as arguments. Use --header-env Name=ENV_VAR or --headers-stdin."
90
+ );
91
+ }
92
+ const headers = await readHeaders(options);
93
+ const authMode = options.auth ?? (headers ? "headers" : "none");
94
+ if (!AUTH_MODES.includes(authMode)) {
95
+ throw new Error("--auth must be none, headers, or oauth.");
96
+ }
97
+ const { http } = getAuthedHttpClient();
98
+ const response = await http.post(
99
+ "/api/v2/mcp-connections",
100
+ {
101
+ name,
102
+ url,
103
+ auth_mode: authMode,
104
+ ...headers ? { headers } : {},
105
+ ...options.displayName ? { display_name: options.displayName } : {}
106
+ }
107
+ );
108
+ const connection = response.connection;
109
+ printCommandEnvelope(
110
+ {
111
+ connection,
112
+ render: {
113
+ sections: [
114
+ {
115
+ title: "mcp connection",
116
+ lines: [
117
+ renderConnection(connection),
118
+ `Turn tools on: deepline mcp tools ${connection.slug}, then deepline mcp enable ${connection.slug} <tool...>`
119
+ ]
120
+ }
121
+ ]
122
+ }
123
+ },
124
+ { json: options.json }
125
+ );
126
+ }
127
+ async function handleList(options) {
128
+ const { http } = getAuthedHttpClient();
129
+ const { connections } = await http.get(
130
+ "/api/v2/mcp-connections"
131
+ );
132
+ printCommandEnvelope(
133
+ {
134
+ connections,
135
+ count: connections.length,
136
+ render: {
137
+ sections: [
138
+ {
139
+ title: "mcp connections",
140
+ lines: connections.length ? connections.map(renderConnection) : [
141
+ "No MCP connections. Add one with: deepline mcp connect <name> <url>"
142
+ ]
143
+ }
144
+ ]
145
+ }
146
+ },
147
+ { json: options.json }
148
+ );
149
+ }
150
+ async function handleServers(options) {
151
+ const { http } = getAuthedHttpClient();
152
+ const { servers } = await http.get(
153
+ "/api/v2/mcp-connections/servers"
154
+ );
155
+ printCommandEnvelope(
156
+ {
157
+ servers,
158
+ render: {
159
+ sections: [
160
+ {
161
+ title: "known mcp servers",
162
+ lines: servers.map(
163
+ (server) => `${server.key} ${server.displayName} ${server.authMode} ${server.url}${server.knownToolCount ? ` (${server.knownToolCount} known tools)` : ""}`
164
+ )
165
+ }
166
+ ]
167
+ }
168
+ },
169
+ { json: options.json }
170
+ );
171
+ }
172
+ async function handleTools(slug, options) {
173
+ const { http } = getAuthedHttpClient();
174
+ const query = new URLSearchParams();
175
+ if (options.cursor) query.set("cursor", options.cursor);
176
+ if (options.limit) query.set("limit", options.limit);
177
+ const suffix = query.size > 0 ? `?${query.toString()}` : "";
178
+ const page = await http.get(`${base(slug)}/tools${suffix}`);
179
+ printCommandEnvelope(
180
+ {
181
+ connection: page.connection,
182
+ tools: page.tools,
183
+ next_cursor: page.next_cursor,
184
+ render: {
185
+ sections: [
186
+ {
187
+ title: `tools on ${slug}`,
188
+ lines: [
189
+ ...page.tools.length ? page.tools.map((tool) => renderTool(slug, tool)) : ["No tools listed yet. Run: deepline mcp refresh " + slug],
190
+ ...page.next_cursor ? [
191
+ `More: deepline mcp tools ${slug} --cursor ${page.next_cursor}`
192
+ ] : []
193
+ ]
194
+ }
195
+ ]
196
+ }
197
+ },
198
+ { json: options.json }
199
+ );
200
+ }
201
+ async function handleSetEnabled(slug, tools, enabled, options) {
202
+ if (tools.length === 0) throw new Error("Name at least one tool.");
203
+ const { http } = getAuthedHttpClient();
204
+ const result = await http.patch(
205
+ `${base(slug)}/tools`,
206
+ {
207
+ tools,
208
+ enabled
209
+ }
210
+ );
211
+ printCommandEnvelope(
212
+ {
213
+ updated: result.updated,
214
+ enabled,
215
+ render: {
216
+ sections: [
217
+ {
218
+ title: enabled ? "enabled" : "disabled",
219
+ lines: result.updated.map((name) => `mcp.${slug}.${name}`)
220
+ }
221
+ ]
222
+ }
223
+ },
224
+ { json: options.json }
225
+ );
226
+ }
227
+ async function handleRefresh(slug, options) {
228
+ const { http } = getAuthedHttpClient();
229
+ const result = await http.post(`${base(slug)}/refresh`, {});
230
+ printCommandEnvelope(
231
+ {
232
+ ...result,
233
+ render: {
234
+ sections: [
235
+ {
236
+ title: "mcp refresh",
237
+ lines: [
238
+ renderConnection(result.connection),
239
+ `${result.listed} tools listed, ${result.added} new, ${result.changed} changed.`
240
+ ]
241
+ }
242
+ ]
243
+ }
244
+ },
245
+ { json: options.json }
246
+ );
247
+ }
248
+ async function handleSetHeaders(slug, forbidden, options) {
249
+ if (forbidden.length > 0) {
250
+ throw new Error(
251
+ "Do not pass header values as arguments. Use --header-env Name=ENV_VAR or --headers-stdin."
252
+ );
253
+ }
254
+ const headers = await readHeaders(options);
255
+ if (!headers) {
256
+ throw new Error(
257
+ "Pass headers with --header-env Name=ENV_VAR or --headers-stdin."
258
+ );
259
+ }
260
+ const { http } = getAuthedHttpClient();
261
+ const { connection } = await http.put(
262
+ `${base(slug)}/headers`,
263
+ { headers }
264
+ );
265
+ printCommandEnvelope(
266
+ {
267
+ connection,
268
+ render: {
269
+ sections: [
270
+ { title: "mcp connection", lines: [renderConnection(connection)] }
271
+ ]
272
+ }
273
+ },
274
+ { json: options.json }
275
+ );
276
+ }
277
+ async function handleRemove(slug, options) {
278
+ const { http } = getAuthedHttpClient();
279
+ await http.delete(base(slug));
280
+ printCommandEnvelope(
281
+ {
282
+ deleted: slug,
283
+ render: {
284
+ sections: [{ title: "mcp connection", lines: [`Removed ${slug}.`] }]
285
+ }
286
+ },
287
+ { json: options.json }
288
+ );
289
+ }
290
+ var MCP_CONNECTIONS_FEATURE = "mcp-connections";
291
+ function registerMcpCommands(program) {
292
+ const mcp = program.command("mcp", { hidden: !cliFeatureEnabled(MCP_CONNECTIONS_FEATURE) }).description(
293
+ "Connect your workspace's remote MCP servers and call their tools."
294
+ ).addHelpText(
295
+ "after",
296
+ `
297
+ Notes:
298
+ Each turned-on tool is callable as mcp.<connection>.<tool>, for example with
299
+ deepline tools execute mcp.notion.search_pages. New tools start off. If a
300
+ server changes a tool's schema, calls fail until you approve the new version
301
+ with deepline mcp enable. Header values are never accepted as arguments.
302
+
303
+ Examples:
304
+ deepline mcp servers
305
+ deepline mcp connect deepwiki https://mcp.deepwiki.com/mcp
306
+ deepline mcp connect vendor https://mcp.example.com/mcp --header-env Authorization=VENDOR_AUTH
307
+ printf '{"X-Api-Key":"..."}' | deepline mcp connect vendor https://mcp.example.com/mcp --headers-stdin
308
+ deepline mcp list
309
+ deepline mcp tools deepwiki
310
+ deepline mcp enable deepwiki read_wiki_structure ask_question
311
+ deepline mcp refresh deepwiki
312
+ deepline mcp remove deepwiki
313
+ `
314
+ );
315
+ mcp.command("servers").description("List well-known MCP servers you can connect.").option("--json", "Emit JSON output").action(async (options) => handleServers(options));
316
+ mcp.command("connect").description("Connect a remote MCP server and list its tools.").argument("<name>", "Connection name: lowercase letters, digits and _").argument("<url>", "The server URL (https)").argument("[forbidden...]", "Do not pass header values here").option(
317
+ "--auth <mode>",
318
+ "none, headers, or oauth (default: headers when headers are given, else none)"
319
+ ).option(
320
+ "--header-env <Name=ENV_VAR>",
321
+ "Send a header whose value comes from an environment variable (repeatable)",
322
+ collect
323
+ ).option("--headers-stdin", "Read headers as a JSON object from piped stdin").option("--display-name <name>", "Display name for a new server").option("--json", "Emit JSON output").action(
324
+ async (name, url, forbidden, options) => handleConnect(name, url, forbidden ?? [], options)
325
+ );
326
+ mcp.command("list").description("List this workspace's MCP connections.").option("--json", "Emit JSON output").action(async (options) => handleList(options));
327
+ mcp.command("tools").description("List a connection's tools and whether each is on.").argument("<name>", "Connection name").option("--cursor <cursor>", "Continue from a previous page").option("--limit <n>", "Tools per page (1-200, default 100)").option("--json", "Emit JSON output").action(
328
+ async (name, options) => handleTools(name, options)
329
+ );
330
+ mcp.command("enable").description("Turn tools on, approving their current version.").argument("<name>", "Connection name").argument("<tools...>", "Tool names").option("--json", "Emit JSON output").action(
331
+ async (name, tools, options) => handleSetEnabled(name, tools, true, options)
332
+ );
333
+ mcp.command("disable").description("Turn tools off.").argument("<name>", "Connection name").argument("<tools...>", "Tool names").option("--json", "Emit JSON output").action(
334
+ async (name, tools, options) => handleSetEnabled(name, tools, false, options)
335
+ );
336
+ mcp.command("refresh").description("Re-list the server's tools now.").argument("<name>", "Connection name").option("--json", "Emit JSON output").action(
337
+ async (name, options) => handleRefresh(name, options)
338
+ );
339
+ mcp.command("set-headers").description("Replace a header-auth connection's headers and verify it.").argument("<name>", "Connection name").argument("[forbidden...]", "Do not pass header values here").option(
340
+ "--header-env <Name=ENV_VAR>",
341
+ "Send a header whose value comes from an environment variable (repeatable)",
342
+ collect
343
+ ).option("--headers-stdin", "Read headers as a JSON object from piped stdin").option("--json", "Emit JSON output").action(
344
+ async (name, forbidden, options) => handleSetHeaders(name, forbidden ?? [], options)
345
+ );
346
+ mcp.command("remove").description("Delete a connection and its stored credentials.").argument("<name>", "Connection name").option("--json", "Emit JSON output").action(
347
+ async (name, options) => handleRemove(name, options)
348
+ );
349
+ }
350
+ export {
351
+ registerMcpCommands
352
+ };