deepline 0.3.540 → 0.3.541
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/dist/bundling-sources/sdk/src/release.ts +1 -1
- package/dist/cli/auth-V76O674K.js +43 -0
- package/dist/cli/{auth-32TURPHH.mjs → auth-WJXA7XGM.mjs} +5 -5
- package/dist/cli/{billing-6433M4BX.js → billing-34IV5DSV.js} +92 -92
- package/dist/cli/{billing-NSH3NOHV.mjs → billing-SHS4HMWT.mjs} +8 -8
- package/dist/cli/{chunk-H6IA6XRE.js → chunk-2TAGAPLL.js} +2 -2
- package/dist/cli/{chunk-XIIQNSWA.js → chunk-323I5KQ5.js} +8 -8
- package/dist/cli/{chunk-MH22LQKZ.mjs → chunk-53QZ24DP.mjs} +2 -2
- package/dist/cli/{chunk-KN6ELDPL.mjs → chunk-5LNWLEO3.mjs} +2 -2
- package/dist/cli/{chunk-DV3ESQ4X.js → chunk-5N4ENMYE.js} +1 -1
- package/dist/cli/{chunk-BD3VAPB4.mjs → chunk-6PJAC3P5.mjs} +1 -1
- package/dist/cli/{chunk-AOYW62XO.js → chunk-6TZEDCN7.js} +3 -3
- package/dist/cli/{chunk-XYM3SQZN.mjs → chunk-7AUQSK24.mjs} +1 -1
- package/dist/cli/{chunk-WCM64BRH.mjs → chunk-ABDXKELH.mjs} +5 -5
- package/dist/cli/{chunk-DWE2VE5I.mjs → chunk-AU7ZKXW5.mjs} +1 -1
- package/dist/cli/{chunk-HLHDCFKL.mjs → chunk-BMNLD63A.mjs} +4 -4
- package/dist/cli/{chunk-2U4VACUA.js → chunk-BUCTWJBM.js} +2 -2
- package/dist/cli/{chunk-EXAXDEIF.js → chunk-C2LYJ3EX.js} +13 -13
- package/dist/cli/{chunk-UJYX4VLX.js → chunk-CNBPATLI.js} +5 -5
- package/dist/cli/{chunk-ZTJQKHLM.js → chunk-CY5LW6DW.js} +2 -2
- package/dist/cli/{chunk-Y6647AIY.mjs → chunk-DF7ARQRB.mjs} +2 -2
- package/dist/cli/{chunk-PJOMRUFP.mjs → chunk-DHC7EGI7.mjs} +5 -5
- package/dist/cli/{chunk-BZVVSUE2.mjs → chunk-ECPCZVDM.mjs} +1 -1
- package/dist/cli/{chunk-HKWJD45V.js → chunk-F3TLGM2U.js} +5 -5
- package/dist/cli/{chunk-MVIVF4BW.js → chunk-FOCNY4GV.js} +3 -3
- package/dist/cli/{chunk-37VFUQMU.mjs → chunk-FRPJSFNL.mjs} +2 -2
- package/dist/cli/{chunk-IYQZVEV4.mjs → chunk-FTKX7OGB.mjs} +5 -5
- package/dist/cli/{chunk-BNNGM2E5.js → chunk-FVZ5Y5L6.js} +15 -15
- package/dist/cli/{chunk-MLDLN6WG.js → chunk-FYQWTENQ.js} +53 -53
- package/dist/cli/{chunk-JPU5YLQG.mjs → chunk-GLINYHY7.mjs} +1 -1
- package/dist/cli/{chunk-KFAJYK2N.mjs → chunk-H74CLEMB.mjs} +3 -3
- package/dist/cli/{chunk-LPMI4CYW.js → chunk-IZXMX65M.js} +107 -107
- package/dist/cli/{chunk-S3ULSGFH.mjs → chunk-JZNKEHXQ.mjs} +2 -2
- package/dist/cli/{chunk-J3TAEPFA.js → chunk-KIYETQ6K.js} +26 -26
- package/dist/cli/{chunk-B6UZUQ2O.mjs → chunk-LRPFCB2P.mjs} +1 -1
- package/dist/cli/{chunk-AJVK4XC5.js → chunk-M6XIKHBS.js} +4 -4
- package/dist/cli/{chunk-M4DB6BBP.js → chunk-MPYM6TUO.js} +44 -44
- package/dist/cli/{chunk-SXVYFOBG.mjs → chunk-NB4AIXEA.mjs} +3 -3
- package/dist/cli/{chunk-TNUM4DFA.js → chunk-OK4JMVTM.js} +7 -7
- package/dist/cli/{chunk-3GVIVIER.js → chunk-POZPEDW7.js} +5 -5
- package/dist/cli/{chunk-WDHHQEWQ.js → chunk-Q66ADD4O.js} +41 -41
- package/dist/cli/{chunk-JGFGWWOF.mjs → chunk-QI76LGE3.mjs} +10 -10
- package/dist/cli/{chunk-FR3AII3W.mjs → chunk-RYYGNUNO.mjs} +2 -2
- package/dist/cli/{chunk-N6DMKVKO.js → chunk-S6FF7Q5P.js} +10 -10
- package/dist/cli/{chunk-LXLCQP4A.js → chunk-S7NKIEHL.js} +16 -16
- package/dist/cli/{chunk-ZJFU2COM.mjs → chunk-UC5QFQGC.mjs} +5 -5
- package/dist/cli/{chunk-XL3CEPZA.js → chunk-UKO6POLZ.js} +9 -9
- package/dist/cli/{chunk-WHYNYL3M.js → chunk-UXXFCOE3.js} +6 -6
- package/dist/cli/{chunk-Z2OYTXLK.mjs → chunk-VMIIUMAN.mjs} +1 -1
- package/dist/cli/{chunk-BGBRA2S6.js → chunk-WIV3E6Y7.js} +22 -22
- package/dist/cli/{chunk-SINNEITW.mjs → chunk-WZMG2M65.mjs} +4 -4
- package/dist/cli/{chunk-AB6DFHGL.mjs → chunk-XO2SGONT.mjs} +2 -2
- package/dist/cli/{chunk-SGMDRYAD.mjs → chunk-XTR32PMA.mjs} +1 -1
- package/dist/cli/{chunk-VAOGM5VS.js → chunk-ZD673XAL.js} +19 -19
- package/dist/cli/{chunk-TZVW5JH3.mjs → chunk-ZL2DER5D.mjs} +1 -1
- package/dist/cli/concurrent-runs-help-MFEPUP6Y.js +21 -0
- package/dist/cli/{concurrent-runs-help-DU5STFGB.mjs → concurrent-runs-help-ZJ77SAEU.mjs} +6 -6
- package/dist/cli/{csv-FBNS6SM3.js → csv-MJLIZZOR.js} +13 -13
- package/dist/cli/{csv-OJCMBODT.mjs → csv-PX7F5YJN.mjs} +4 -4
- package/dist/cli/{db-XRGJJ2KA.js → db-BNCNAY4G.js} +27 -27
- package/dist/cli/{db-43RQRF64.mjs → db-KPKGTHPA.mjs} +6 -6
- package/dist/cli/{describe-I42Y3PWR.mjs → describe-5OUJA5TH.mjs} +17 -17
- package/dist/cli/describe-7MF5AHIU.js +49 -0
- package/dist/cli/{executions-QXGVQHQF.mjs → executions-NMQY4GEY.mjs} +6 -6
- package/dist/cli/{executions-LH46O4PG.js → executions-YNOFR7T2.js} +8 -8
- package/dist/cli/{feedback-ELFINGTM.mjs → feedback-LWYEO5LL.mjs} +6 -6
- package/dist/cli/{feedback-ERYIV6MT.js → feedback-RCP5DPO6.js} +14 -14
- package/dist/cli/{git-V2XWB6LN.mjs → git-3O4PFP3Q.mjs} +5 -5
- package/dist/cli/git-WLQ3BS6K.js +25 -0
- package/dist/cli/index.js +144 -140
- package/dist/cli/index.mjs +46 -42
- package/dist/cli/{legacy-noops-ULL2EA37.mjs → legacy-noops-KFP674JT.mjs} +6 -6
- package/dist/cli/{legacy-noops-Y3OKNVWH.js → legacy-noops-ZPZRG366.js} +9 -9
- package/dist/cli/mcp-HCXDW6PL.js +352 -0
- package/dist/cli/mcp-OCYUXQ6L.mjs +352 -0
- package/dist/cli/{monitors-DNQXCRJZ.js → monitors-7Q7YT22Y.js} +100 -100
- package/dist/cli/{monitors-L34NROM3.mjs → monitors-V5KJIJJE.mjs} +7 -7
- package/dist/cli/{org-L3HTEEXL.mjs → org-C3QLHX7U.mjs} +6 -6
- package/dist/cli/{org-JETA62CO.js → org-S37K6QYH.js} +86 -86
- package/dist/cli/{play-GTGJRNWI.js → play-MLREAYHJ.js} +317 -317
- package/dist/cli/{play-JHGLSSJP.mjs → play-MXQ2DKML.mjs} +17 -17
- package/dist/cli/{providers-IQVHZJ27.mjs → providers-FDJ4ZOST.mjs} +6 -6
- package/dist/cli/{providers-7VH7PH2Q.js → providers-PPDWY7DH.js} +9 -9
- package/dist/cli/{quickstart-ZDBC45PM.mjs → quickstart-2Z57AMB7.mjs} +4 -4
- package/dist/cli/{quickstart-M25JNU3O.js → quickstart-BOWQM7S7.js} +6 -6
- package/dist/cli/{run-NEEWZBTX.mjs → run-5RNJGPQ2.mjs} +22 -22
- package/dist/cli/{run-MPZGX3YD.js → run-66HXNJNV.js} +42 -42
- package/dist/cli/{search-YXAFB4QQ.mjs → search-7G4FYQYO.mjs} +7 -7
- package/dist/cli/search-LTUIIV6W.js +32 -0
- package/dist/cli/{search-output-67BBIXIZ.mjs → search-output-6K4FHCVI.mjs} +4 -4
- package/dist/cli/{search-output-4PH5HSJC.js → search-output-L6ICQDBL.js} +6 -6
- package/dist/cli/{secrets-445FER3C.mjs → secrets-FTQPCU7O.mjs} +6 -6
- package/dist/cli/{secrets-HLUBDN3H.js → secrets-PWFJKF7G.js} +15 -15
- package/dist/cli/sessions-2IVFGTPA.js +22 -0
- package/dist/cli/{sessions-CCKXJNWT.mjs → sessions-YSSAAQVJ.mjs} +6 -6
- package/dist/cli/{settings-WXJIQS5J.js → settings-CZEMF2WD.js} +85 -85
- package/dist/cli/{settings-3XCZGGVF.mjs → settings-KN7GNZ5J.mjs} +12 -12
- package/dist/cli/{setup-TOSX6NER.mjs → setup-5WLHGH57.mjs} +9 -9
- package/dist/cli/{setup-CKETRFFN.js → setup-RW4X6DX4.js} +49 -49
- package/dist/cli/{skills-Q7NLCIJJ.mjs → skills-DLVI7IZK.mjs} +7 -7
- package/dist/cli/skills-WT42AZVH.js +36 -0
- package/dist/cli/tools-D6STYBQG.js +56 -0
- package/dist/cli/{tools-GY6QMYTZ.mjs → tools-JVYQF7P3.mjs} +16 -16
- package/dist/cli/{update-A7JRUN4S.mjs → update-XKLXU7YS.mjs} +9 -9
- package/dist/cli/update-XTUKBC3J.js +34 -0
- package/dist/cli/{views-JG7FDEJR.mjs → views-QRRCWP6B.mjs} +6 -6
- package/dist/cli/{views-GUWC4SNI.js → views-YNUYFS3S.js} +21 -21
- package/dist/cli/{workflow-QZCYSQ5G.mjs → workflow-KYFMA4LM.mjs} +7 -7
- package/dist/cli/{workflow-CXNW7ICH.js → workflow-YUKADKCJ.js} +17 -17
- package/dist/index.js +9 -9
- package/dist/index.mjs +6 -6
- package/dist/install-integrity.json +106 -104
- package/dist/release.d.mts +1 -1
- package/dist/release.d.ts +1 -1
- package/dist/release.js +2 -2
- package/dist/release.mjs +1 -1
- package/dist/server.js +5 -5
- package/dist/server.mjs +3 -3
- package/package.json +1 -1
- package/dist/cli/auth-XA3K5LH2.js +0 -43
- package/dist/cli/concurrent-runs-help-HIPM5BBV.js +0 -21
- package/dist/cli/describe-LWZCGAXU.js +0 -49
- package/dist/cli/git-OV2TGYVE.js +0 -25
- package/dist/cli/search-HUN2YRQE.js +0 -32
- package/dist/cli/sessions-T2RNWC6B.js +0 -22
- package/dist/cli/skills-FXM2RHHO.js +0 -36
- package/dist/cli/tools-XLVDZTWQ.js +0 -56
- package/dist/cli/update-AZINHILP.js +0 -34
|
@@ -0,0 +1,352 @@
|
|
|
1
|
+
import {
|
|
2
|
+
getAuthedHttpClient,
|
|
3
|
+
printCommandEnvelope
|
|
4
|
+
} from "./chunk-FRPJSFNL.mjs";
|
|
5
|
+
import {
|
|
6
|
+
cliFeatureEnabled
|
|
7
|
+
} from "./chunk-AU7ZKXW5.mjs";
|
|
8
|
+
import "./chunk-7AUQSK24.mjs";
|
|
9
|
+
import "./chunk-CQBIO6HW.mjs";
|
|
10
|
+
import "./chunk-DLIRSHV6.mjs";
|
|
11
|
+
import "./chunk-JL2OTMSG.mjs";
|
|
12
|
+
import "./chunk-ZL2DER5D.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
|
+
};
|