@scalar/cli 2.14.0 → 2.15.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +33 -1
- package/chunks/{action-XA4MEYFP.js → action-2UZWKMSJ.js} +6 -6
- package/chunks/{action-EPGLU5E3.js → action-3QQSKGM3.js} +6 -6
- package/chunks/{action-VS22CPVB.js → action-3W4IC7QL.js} +6 -6
- package/chunks/{action-MJI3TI3W.js → action-777R7LOG.js} +10 -9
- package/chunks/{action-APTGKF4W.js → action-7LK4RUDP.js} +11 -10
- package/chunks/{action-RRQNVUFW.js → action-B2WWTOF6.js} +6 -6
- package/chunks/{action-FOITEQNQ.js → action-ENDUKGWS.js} +6 -6
- package/chunks/{action-OP5DCAHN.js → action-G2WBTXOK.js} +3 -3
- package/chunks/{action-Y4MKBDRC.js → action-HDT7EO7W.js} +8 -8
- package/chunks/{action-SCOJRZKD.js → action-HOCCP353.js} +2 -2
- package/chunks/{action-FLX3ESH7.js → action-IU2AVNOW.js} +11 -10
- package/chunks/{action-DJXZWPL7.js → action-IUAYC2SC.js} +1 -1
- package/chunks/{action-VEP7LZPN.js → action-JNH4DCZX.js} +4 -4
- package/chunks/{action-4HYLZRYW.js → action-LD5B5QQ4.js} +14 -13
- package/chunks/{action-EYOZ457H.js → action-MBAAYXKK.js} +4 -4
- package/chunks/{action-GOFCT7XK.js → action-MJHLG7AE.js} +14 -13
- package/chunks/{action-4MJXPSQU.js → action-NZJ4Z64U.js} +6 -6
- package/chunks/{action-VY3DRAO4.js → action-P2RPH5R2.js} +3 -3
- package/chunks/{action-BL5PWLFV.js → action-PDSSIW2A.js} +9 -9
- package/chunks/{action-C7CNI7TP.js → action-PNSWHIHC.js} +5 -5
- package/chunks/{action-VW2POHCL.js → action-QJMRAFOF.js} +7 -6
- package/chunks/{action-ZOU7EPX5.js → action-T7SD3ETN.js} +6 -6
- package/chunks/{action-VAJSWBMD.js → action-TY4BZEMN.js} +6 -6
- package/chunks/{action-P2QEJUBK.js → action-ZTLOQZTT.js} +8 -7
- package/chunks/actions-D5OHPBWC.js +327 -0
- package/chunks/{actions-PBYTDEMH.js → actions-RI42JY6H.js} +27 -6
- package/chunks/{asyncapi-KCA6ZH3Q.js → asyncapi-YBTWMTW6.js} +3 -3
- package/chunks/{build.action-54FHG7VL.js → build.action-4YDNDBXC.js} +8 -8
- package/chunks/{chunk-AAWPGVMG.js → chunk-42MIV6WF.js} +1 -1
- package/chunks/{chunk-GO3TSREI.js → chunk-7FGJIUDN.js} +3 -3
- package/chunks/{chunk-WKMOUBQJ.js → chunk-ANP5XF26.js} +1257 -1019
- package/chunks/{chunk-H5AMMMQ3.js → chunk-BMQFEKHA.js} +113 -8
- package/chunks/{chunk-VJ7FHLN4.js → chunk-DLYMDGFW.js} +1 -1
- package/chunks/{chunk-3CRO6NY4.js → chunk-DWJMPHLY.js} +1 -1
- package/chunks/{chunk-S3U2VMVL.js → chunk-ERZ3HYB5.js} +0 -94
- package/chunks/{chunk-DTZBE4ZX.js → chunk-G5WWW7VD.js} +2 -2
- package/chunks/{chunk-QTMJ3VUZ.js → chunk-GOKHFNB2.js} +2 -2
- package/chunks/{chunk-WZUA7IAV.js → chunk-IPWJEGPD.js} +2 -2
- package/chunks/{chunk-2SBHCZPG.js → chunk-KOLEQNLG.js} +1 -1
- package/chunks/{chunk-WZSU45SV.js → chunk-MGGMCT77.js} +1 -1
- package/chunks/{chunk-KZSM2SUL.js → chunk-QXOUDBFK.js} +2 -2
- package/chunks/{chunk-7ZDC34NA.js → chunk-SHRUJFQI.js} +3 -1
- package/chunks/{chunk-KKHTS43A.js → chunk-T76K7QNX.js} +2 -2
- package/chunks/{chunk-KXMZXTLK.js → chunk-TR5U7G7T.js} +2 -1
- package/chunks/{chunk-42YF4H6W.js → chunk-TW2UASEW.js} +1 -1
- package/chunks/chunk-VBHPHAGS.js +114 -0
- package/chunks/{chunk-PRW5TKYS.js → chunk-Y6GKZ2FM.js} +1 -1
- package/chunks/{chunk-F5Q7FJRG.js → chunk-Z6HOHGUJ.js} +17 -0
- package/chunks/{create.action-NB3YYZ7K.js → create.action-52K3XAYN.js} +8 -8
- package/chunks/{delete.action-5BT3TXVZ.js → delete.action-3NMOQPIR.js} +8 -8
- package/chunks/{delete.action-DWMQYW62.js → delete.action-47LPLTOX.js} +8 -8
- package/chunks/{diff.action-ENOOLRRB.js → diff.action-5TLC2EHT.js} +8 -7
- package/chunks/{get.action-55JDC2MJ.js → get.action-BCMLG7C7.js} +8 -7
- package/chunks/{get.action-2ASGSZW3.js → get.action-TOZ474GO.js} +8 -8
- package/chunks/{list.action-NCG6Q6S2.js → list.action-6ZWEENT6.js} +9 -9
- package/chunks/{list.action-6QBQFGVR.js → list.action-CMAA5KTY.js} +8 -8
- package/chunks/{publish.action-4Y5EXBOY.js → publish.action-U3VIU5LZ.js} +11 -10
- package/chunks/{update.action-6OE54B5O.js → update.action-QZOP25ME.js} +8 -8
- package/chunks/{update.action-4V6MQMWG.js → update.action-UQHZYVTP.js} +8 -8
- package/index.js +175 -114
- package/package.json +1 -1
- package/skills/scalar-cli/SKILL.md +8 -1
- package/template.md +31 -0
|
@@ -4,18 +4,19 @@ import {
|
|
|
4
4
|
} from "./chunk-NAC63XJF.js";
|
|
5
5
|
import {
|
|
6
6
|
fetchFromRegistry
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-DLYMDGFW.js";
|
|
8
8
|
import {
|
|
9
9
|
registry
|
|
10
|
-
} from "./chunk-
|
|
11
|
-
import "./chunk-
|
|
10
|
+
} from "./chunk-ERZ3HYB5.js";
|
|
11
|
+
import "./chunk-VBHPHAGS.js";
|
|
12
|
+
import "./chunk-TW2UASEW.js";
|
|
12
13
|
import "./chunk-RE5Z56QD.js";
|
|
13
14
|
import "./chunk-VUXPDHTQ.js";
|
|
14
15
|
import {
|
|
15
16
|
getAuthData
|
|
16
|
-
} from "./chunk-
|
|
17
|
-
import "./chunk-
|
|
18
|
-
import "./chunk-
|
|
17
|
+
} from "./chunk-42MIV6WF.js";
|
|
18
|
+
import "./chunk-TR5U7G7T.js";
|
|
19
|
+
import "./chunk-DWJMPHLY.js";
|
|
19
20
|
import "./chunk-6BQHLHBE.js";
|
|
20
21
|
import "./chunk-BOCMOHQA.js";
|
|
21
22
|
import "./chunk-E24BNP6E.js";
|
|
@@ -12,21 +12,21 @@ import {
|
|
|
12
12
|
} from "./chunk-SNQFFEYH.js";
|
|
13
13
|
import {
|
|
14
14
|
apiService
|
|
15
|
-
} from "./chunk-
|
|
16
|
-
import "./chunk-
|
|
15
|
+
} from "./chunk-BMQFEKHA.js";
|
|
16
|
+
import "./chunk-ANP5XF26.js";
|
|
17
17
|
import "./chunk-7FS7BAUX.js";
|
|
18
|
-
import "./chunk-
|
|
18
|
+
import "./chunk-Z6HOHGUJ.js";
|
|
19
19
|
import "./chunk-EOTD7HAV.js";
|
|
20
20
|
import "./chunk-USVU6AC2.js";
|
|
21
21
|
import "./chunk-W7P6VTCG.js";
|
|
22
22
|
import "./chunk-5D3T63G4.js";
|
|
23
23
|
import {
|
|
24
24
|
getMetadata
|
|
25
|
-
} from "./chunk-
|
|
25
|
+
} from "./chunk-42MIV6WF.js";
|
|
26
26
|
import {
|
|
27
27
|
config
|
|
28
|
-
} from "./chunk-
|
|
29
|
-
import "./chunk-
|
|
28
|
+
} from "./chunk-TR5U7G7T.js";
|
|
29
|
+
import "./chunk-DWJMPHLY.js";
|
|
30
30
|
import "./chunk-6BQHLHBE.js";
|
|
31
31
|
import "./chunk-BOCMOHQA.js";
|
|
32
32
|
import {
|
|
@@ -1,21 +1,21 @@
|
|
|
1
1
|
import { createRequire as $$cR } from "node:module"; const require = $$cR(import.meta.url);
|
|
2
2
|
import {
|
|
3
3
|
BaseCollections
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-SHRUJFQI.js";
|
|
5
5
|
import {
|
|
6
6
|
getDatabaseClient
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-GOKHFNB2.js";
|
|
8
8
|
import "./chunk-7FS7BAUX.js";
|
|
9
|
-
import "./chunk-
|
|
9
|
+
import "./chunk-Z6HOHGUJ.js";
|
|
10
10
|
import "./chunk-EOTD7HAV.js";
|
|
11
11
|
import "./chunk-W7P6VTCG.js";
|
|
12
12
|
import "./chunk-RE5Z56QD.js";
|
|
13
13
|
import "./chunk-VUXPDHTQ.js";
|
|
14
14
|
import {
|
|
15
15
|
getAuthData
|
|
16
|
-
} from "./chunk-
|
|
17
|
-
import "./chunk-
|
|
18
|
-
import "./chunk-
|
|
16
|
+
} from "./chunk-42MIV6WF.js";
|
|
17
|
+
import "./chunk-TR5U7G7T.js";
|
|
18
|
+
import "./chunk-DWJMPHLY.js";
|
|
19
19
|
import {
|
|
20
20
|
teamSchema
|
|
21
21
|
} from "./chunk-6BQHLHBE.js";
|
|
@@ -3,18 +3,19 @@ import {
|
|
|
3
3
|
defaultWaitSeconds,
|
|
4
4
|
observePublish,
|
|
5
5
|
timeoutSchema
|
|
6
|
-
} from "./chunk-
|
|
7
|
-
import "./chunk-
|
|
6
|
+
} from "./chunk-G5WWW7VD.js";
|
|
7
|
+
import "./chunk-MGGMCT77.js";
|
|
8
8
|
import "./chunk-SNQFFEYH.js";
|
|
9
|
-
import "./chunk-
|
|
10
|
-
import "./chunk-
|
|
9
|
+
import "./chunk-ERZ3HYB5.js";
|
|
10
|
+
import "./chunk-VBHPHAGS.js";
|
|
11
|
+
import "./chunk-GOKHFNB2.js";
|
|
11
12
|
import "./chunk-RE5Z56QD.js";
|
|
12
13
|
import "./chunk-VUXPDHTQ.js";
|
|
13
14
|
import {
|
|
14
15
|
getAuthData
|
|
15
|
-
} from "./chunk-
|
|
16
|
-
import "./chunk-
|
|
17
|
-
import "./chunk-
|
|
16
|
+
} from "./chunk-42MIV6WF.js";
|
|
17
|
+
import "./chunk-TR5U7G7T.js";
|
|
18
|
+
import "./chunk-DWJMPHLY.js";
|
|
18
19
|
import "./chunk-6BQHLHBE.js";
|
|
19
20
|
import "./chunk-BOCMOHQA.js";
|
|
20
21
|
import "./chunk-4ORL4MST.js";
|
|
@@ -0,0 +1,327 @@
|
|
|
1
|
+
import { createRequire as $$cR } from "node:module"; const require = $$cR(import.meta.url);
|
|
2
|
+
import {
|
|
3
|
+
writeJson
|
|
4
|
+
} from "./chunk-SNQFFEYH.js";
|
|
5
|
+
import {
|
|
6
|
+
buildMcpAddressUrl
|
|
7
|
+
} from "./chunk-VBHPHAGS.js";
|
|
8
|
+
import {
|
|
9
|
+
mcpClients
|
|
10
|
+
} from "./chunk-BMQFEKHA.js";
|
|
11
|
+
import "./chunk-ANP5XF26.js";
|
|
12
|
+
import "./chunk-7FS7BAUX.js";
|
|
13
|
+
import "./chunk-Z6HOHGUJ.js";
|
|
14
|
+
import "./chunk-EOTD7HAV.js";
|
|
15
|
+
import "./chunk-USVU6AC2.js";
|
|
16
|
+
import "./chunk-W7P6VTCG.js";
|
|
17
|
+
import "./chunk-5D3T63G4.js";
|
|
18
|
+
import "./chunk-42MIV6WF.js";
|
|
19
|
+
import {
|
|
20
|
+
config
|
|
21
|
+
} from "./chunk-TR5U7G7T.js";
|
|
22
|
+
import "./chunk-DWJMPHLY.js";
|
|
23
|
+
import "./chunk-6BQHLHBE.js";
|
|
24
|
+
import "./chunk-BOCMOHQA.js";
|
|
25
|
+
import {
|
|
26
|
+
cancelOperation,
|
|
27
|
+
confirm,
|
|
28
|
+
requireInteractive
|
|
29
|
+
} from "./chunk-XUX6JXU5.js";
|
|
30
|
+
import "./chunk-IRQJDPZE.js";
|
|
31
|
+
import "./chunk-2KSOARE4.js";
|
|
32
|
+
import {
|
|
33
|
+
output,
|
|
34
|
+
printTable
|
|
35
|
+
} from "./chunk-T5HJUAWB.js";
|
|
36
|
+
import "./chunk-4S3DGMMZ.js";
|
|
37
|
+
import "./chunk-7PNOYE6B.js";
|
|
38
|
+
import "./chunk-Q26DFKTY.js";
|
|
39
|
+
import {
|
|
40
|
+
docVersionSchema,
|
|
41
|
+
external_exports,
|
|
42
|
+
namespaceSchema,
|
|
43
|
+
nanoidSchema,
|
|
44
|
+
slugSchema
|
|
45
|
+
} from "./chunk-I57ID5K7.js";
|
|
46
|
+
import "./chunk-3MZYUBJ6.js";
|
|
47
|
+
|
|
48
|
+
// src/domains/mcp/metadata.ts
|
|
49
|
+
function serverMetadata(server) {
|
|
50
|
+
return {
|
|
51
|
+
id: server.id,
|
|
52
|
+
uid: server.uid,
|
|
53
|
+
name: server.name,
|
|
54
|
+
namespace: server.namespace,
|
|
55
|
+
slug: server.slug,
|
|
56
|
+
url: buildMcpAddressUrl({
|
|
57
|
+
baseUrl: config.mcpUrl,
|
|
58
|
+
namespace: server.namespace,
|
|
59
|
+
slug: server.slug
|
|
60
|
+
})
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
// src/domains/mcp/sources.ts
|
|
65
|
+
var apiReferenceSchema = external_exports.string().transform((value, context) => {
|
|
66
|
+
const match = /^@?([^/]+)\/([^/@]+)(?:@([^/]+))?$/.exec(value);
|
|
67
|
+
const parsed = external_exports.object({
|
|
68
|
+
namespace: namespaceSchema,
|
|
69
|
+
slug: slugSchema,
|
|
70
|
+
version: docVersionSchema.optional()
|
|
71
|
+
}).safeParse({
|
|
72
|
+
namespace: match?.[1],
|
|
73
|
+
slug: match?.[2],
|
|
74
|
+
version: match?.[3]
|
|
75
|
+
});
|
|
76
|
+
if (!parsed.success) {
|
|
77
|
+
context.addIssue({
|
|
78
|
+
code: "custom",
|
|
79
|
+
message: "Use --api namespace/slug or namespace/slug@version."
|
|
80
|
+
});
|
|
81
|
+
return external_exports.NEVER;
|
|
82
|
+
}
|
|
83
|
+
return parsed.data;
|
|
84
|
+
});
|
|
85
|
+
async function resolveApi(reference, { core, agent }) {
|
|
86
|
+
const api = await core.managedDocs.getApiDoc(
|
|
87
|
+
reference.namespace,
|
|
88
|
+
reference.slug
|
|
89
|
+
);
|
|
90
|
+
if (api.error)
|
|
91
|
+
return output.error().title("Could not load API description").message(api.message).exit("error");
|
|
92
|
+
const version = api.data.versions.find(
|
|
93
|
+
(entry) => entry.version === (reference.version ?? api.data.version)
|
|
94
|
+
);
|
|
95
|
+
if (!version)
|
|
96
|
+
return output.error().title("API version not found").message("Check the version or publish it with scalar registry publish.").exit("error");
|
|
97
|
+
const available = await agent.registry.getVersionOperations({
|
|
98
|
+
params: { versionUid: version.uid }
|
|
99
|
+
});
|
|
100
|
+
if (available.error)
|
|
101
|
+
return output.error().title("API version is unavailable for MCP").message(available.message).exit("error");
|
|
102
|
+
if (available.data.embedStatus !== "success")
|
|
103
|
+
return output.error().title("API version is not ready for MCP").message(
|
|
104
|
+
`Embedding status: ${available.data.embedStatus}. Check the API description in Scalar Dashboard before creating the server.`
|
|
105
|
+
).exit("error");
|
|
106
|
+
return { apiUid: api.data.uid, versionUid: version.uid };
|
|
107
|
+
}
|
|
108
|
+
async function resolveDocsProject(uid, { core, agent }) {
|
|
109
|
+
let cursor;
|
|
110
|
+
const seen = /* @__PURE__ */ new Set();
|
|
111
|
+
while (true) {
|
|
112
|
+
const result = await core.docsProject.listProjects({ limit: 200, cursor });
|
|
113
|
+
if (result.error)
|
|
114
|
+
return output.error().title("Could not load Docs projects").message(result.message).exit("error");
|
|
115
|
+
const project2 = result.data.data.find((entry) => entry.uid === uid);
|
|
116
|
+
if (project2) {
|
|
117
|
+
return checkDocsProject(project2, agent);
|
|
118
|
+
}
|
|
119
|
+
if (!result.data.hasMore) break;
|
|
120
|
+
const next = result.data.nextCursor;
|
|
121
|
+
if (!next || seen.has(next))
|
|
122
|
+
return output.error().title("Could not load all Docs projects").message("The server returned an invalid continuation cursor.").exit("error");
|
|
123
|
+
seen.add(next);
|
|
124
|
+
cursor = next;
|
|
125
|
+
}
|
|
126
|
+
const legacy = await core.github.getProjects();
|
|
127
|
+
if (legacy.error)
|
|
128
|
+
return output.error().title("Could not load Docs projects").message(legacy.message).exit("error");
|
|
129
|
+
const project = legacy.data.find((entry) => entry.uid === uid);
|
|
130
|
+
if (!project)
|
|
131
|
+
return output.error().title("Docs project not found").message(
|
|
132
|
+
"Run scalar project list --json to find a project UID in the current team."
|
|
133
|
+
).exit("error");
|
|
134
|
+
return checkDocsProject(project, agent);
|
|
135
|
+
}
|
|
136
|
+
async function checkDocsProject(project, agent) {
|
|
137
|
+
if (!project.activeDeployment)
|
|
138
|
+
return output.error().title("Docs project has no active publish").message(
|
|
139
|
+
"Publish the project with scalar project publish before creating its MCP server."
|
|
140
|
+
).exit("error");
|
|
141
|
+
const available = await agent.docs.getProject({
|
|
142
|
+
params: { projectUid: project.uid }
|
|
143
|
+
});
|
|
144
|
+
if (available.error)
|
|
145
|
+
return output.error().title("Docs project is unavailable for MCP").message(available.message).exit("error");
|
|
146
|
+
return project.uid;
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
// src/domains/mcp/actions.ts
|
|
150
|
+
var nameSchema = external_exports.string().trim().min(1).max(100);
|
|
151
|
+
var identitySchema = external_exports.object({
|
|
152
|
+
name: nameSchema.optional(),
|
|
153
|
+
slug: slugSchema.optional()
|
|
154
|
+
});
|
|
155
|
+
function validate(schema, input) {
|
|
156
|
+
const parsed = schema.safeParse(input);
|
|
157
|
+
if (!parsed.success)
|
|
158
|
+
return output.error().title("Invalid input").message(parsed.error.issues[0]?.message).exit("error");
|
|
159
|
+
return parsed.data;
|
|
160
|
+
}
|
|
161
|
+
function printServer(server, options) {
|
|
162
|
+
if (options.json) {
|
|
163
|
+
writeJson(server);
|
|
164
|
+
return;
|
|
165
|
+
}
|
|
166
|
+
output.info().title(server.name).line(`ID: ${server.id}`).line(`Record UID: ${server.uid}`).line(`Address: ${server.url}`).print();
|
|
167
|
+
}
|
|
168
|
+
async function listAction(options) {
|
|
169
|
+
const { agent } = await mcpClients();
|
|
170
|
+
const result = await agent.mcp.listServers({});
|
|
171
|
+
if (result.error)
|
|
172
|
+
return output.error().title("Could not list MCP servers").message(result.message).exit("error");
|
|
173
|
+
const servers = result.data.map(serverMetadata);
|
|
174
|
+
if (options.json) {
|
|
175
|
+
writeJson(servers);
|
|
176
|
+
return;
|
|
177
|
+
}
|
|
178
|
+
if (!servers.length) {
|
|
179
|
+
output.info().message("No MCP servers found in the current team.").print();
|
|
180
|
+
return;
|
|
181
|
+
}
|
|
182
|
+
printTable(
|
|
183
|
+
[
|
|
184
|
+
{ name: "name", title: "Name" },
|
|
185
|
+
{ name: "id", title: "Server ID" },
|
|
186
|
+
{ name: "url", title: "Address" }
|
|
187
|
+
],
|
|
188
|
+
servers
|
|
189
|
+
);
|
|
190
|
+
}
|
|
191
|
+
async function getAction(id, options) {
|
|
192
|
+
validate(external_exports.uuid(), id);
|
|
193
|
+
const { agent } = await mcpClients();
|
|
194
|
+
const result = await agent.mcp.getServer({ params: { id } });
|
|
195
|
+
if (result.error)
|
|
196
|
+
return output.error().title("Could not load MCP server").message(result.message).exit("error");
|
|
197
|
+
const installations = await agent.mcp.listInstallations({ params: { id } });
|
|
198
|
+
if (installations.error)
|
|
199
|
+
return output.error().title("Could not load MCP environments").message(installations.message).exit("error");
|
|
200
|
+
const server = serverMetadata(result.data);
|
|
201
|
+
const environments = installations.data.map((entry) => ({
|
|
202
|
+
name: entry.slug,
|
|
203
|
+
version: entry.mcpVersion,
|
|
204
|
+
isPrivate: entry.isPrivate,
|
|
205
|
+
url: buildMcpAddressUrl({
|
|
206
|
+
baseUrl: config.mcpUrl,
|
|
207
|
+
namespace: server.namespace,
|
|
208
|
+
slug: server.slug,
|
|
209
|
+
environment: entry.slug
|
|
210
|
+
})
|
|
211
|
+
}));
|
|
212
|
+
if (options.json) {
|
|
213
|
+
writeJson({ ...server, environments });
|
|
214
|
+
return;
|
|
215
|
+
}
|
|
216
|
+
printServer(server, options);
|
|
217
|
+
for (const environment of environments)
|
|
218
|
+
output.info().line(
|
|
219
|
+
`${environment.name}: ${environment.version ?? "No served version"} (${environment.url})`
|
|
220
|
+
).print();
|
|
221
|
+
}
|
|
222
|
+
async function createAction(options) {
|
|
223
|
+
const input = validate(
|
|
224
|
+
identitySchema.extend({
|
|
225
|
+
name: nameSchema,
|
|
226
|
+
api: apiReferenceSchema.optional(),
|
|
227
|
+
project: nanoidSchema.optional()
|
|
228
|
+
}).refine(
|
|
229
|
+
(value) => Boolean(value.api) !== Boolean(value.project),
|
|
230
|
+
"Provide exactly one of --api or --project."
|
|
231
|
+
),
|
|
232
|
+
options
|
|
233
|
+
);
|
|
234
|
+
const clients = await mcpClients();
|
|
235
|
+
const source = input.api ? await resolveApi(input.api, clients) : void 0;
|
|
236
|
+
const projectUid = input.project ? await resolveDocsProject(input.project, clients) : void 0;
|
|
237
|
+
const result = await clients.core.mcpServers.create({
|
|
238
|
+
name: input.name,
|
|
239
|
+
slug: input.slug,
|
|
240
|
+
...source && {
|
|
241
|
+
apiUids: [source.apiUid],
|
|
242
|
+
versionUids: [source.versionUid],
|
|
243
|
+
documentTracking: [
|
|
244
|
+
{ versionUid: source.versionUid, trackMode: "pinned" }
|
|
245
|
+
]
|
|
246
|
+
},
|
|
247
|
+
...projectUid && {
|
|
248
|
+
projectUids: [projectUid],
|
|
249
|
+
docsProjectTracking: [
|
|
250
|
+
{ projectUid, trackMode: "track-active-publish" }
|
|
251
|
+
]
|
|
252
|
+
},
|
|
253
|
+
defaultHeaders: true
|
|
254
|
+
}).catch(() => null);
|
|
255
|
+
if (!result || result.error)
|
|
256
|
+
return output.error().title("Could not confirm MCP server creation").message(
|
|
257
|
+
`${result?.message ?? "The request did not return a usable response."} Run scalar mcp list before repeating the create command; the server may already exist.`
|
|
258
|
+
).exit("error");
|
|
259
|
+
const server = serverMetadata(result.data.server);
|
|
260
|
+
const linked = source ? await clients.agent.mcp.listDocumentVersions({ params: { id: server.id } }).then(
|
|
261
|
+
(response) => !response.error && response.data.some((version) => version.uid === source.versionUid)
|
|
262
|
+
).catch(() => false) : await clients.agent.mcp.listServerPublishes({ params: { id: server.id } }).then(
|
|
263
|
+
(response) => !response.error && response.data.some((publish) => publish.projectUid === projectUid)
|
|
264
|
+
).catch(() => false);
|
|
265
|
+
if (!linked)
|
|
266
|
+
return output.error().title("MCP server created, but its source link could not be confirmed").message(
|
|
267
|
+
`Server ID: ${server.id}. Check the source in Scalar Dashboard. Run scalar mcp get ${server.id} to inspect the server or scalar mcp delete ${server.id} --yes to remove it before creating another.`
|
|
268
|
+
).exit("error");
|
|
269
|
+
if (options.json) {
|
|
270
|
+
writeJson({ ...server, status: "created" });
|
|
271
|
+
return;
|
|
272
|
+
}
|
|
273
|
+
printServer(server, options);
|
|
274
|
+
output.info().message(
|
|
275
|
+
`MCP server created. Run scalar mcp get ${server.id} to inspect its served versions; endpoint readiness has not been checked.`
|
|
276
|
+
).print();
|
|
277
|
+
}
|
|
278
|
+
async function updateAction(id, options) {
|
|
279
|
+
validate(external_exports.uuid(), id);
|
|
280
|
+
const input = validate(
|
|
281
|
+
identitySchema.refine(
|
|
282
|
+
(value) => value.name !== void 0 || value.slug !== void 0,
|
|
283
|
+
"Provide --name or --slug."
|
|
284
|
+
),
|
|
285
|
+
options
|
|
286
|
+
);
|
|
287
|
+
const { core, agent } = await mcpClients();
|
|
288
|
+
const server = await agent.mcp.getServer({ params: { id } });
|
|
289
|
+
if (server.error)
|
|
290
|
+
return output.error().title("Could not load MCP server").message(server.message).exit("error");
|
|
291
|
+
const result = await core.mcpServers.update(server.data.uid, input);
|
|
292
|
+
if (result.error)
|
|
293
|
+
return output.error().title("Could not update MCP server").message(result.message).exit("error");
|
|
294
|
+
printServer(serverMetadata(result.data), options);
|
|
295
|
+
}
|
|
296
|
+
async function deleteAction(id, options) {
|
|
297
|
+
validate(external_exports.uuid(), id);
|
|
298
|
+
if (!options.yes)
|
|
299
|
+
requireInteractive(
|
|
300
|
+
"Pass --yes to confirm deletion of this MCP server.",
|
|
301
|
+
options.json
|
|
302
|
+
);
|
|
303
|
+
const { core, agent } = await mcpClients();
|
|
304
|
+
const server = await agent.mcp.getServer({ params: { id } });
|
|
305
|
+
if (server.error)
|
|
306
|
+
return output.error().title("Could not load MCP server").message(server.message).exit("error");
|
|
307
|
+
if (!options.yes && !await confirm({
|
|
308
|
+
message: `Delete MCP server "${server.data.name}" (${id}) and stop its endpoints?`,
|
|
309
|
+
initialValue: false
|
|
310
|
+
}))
|
|
311
|
+
return cancelOperation();
|
|
312
|
+
const result = await core.mcpServers.delete(server.data.uid);
|
|
313
|
+
if (result.error)
|
|
314
|
+
return output.error().title("Could not delete MCP server").message(result.message).exit("error");
|
|
315
|
+
if (options.json) {
|
|
316
|
+
writeJson({ id, uid: server.data.uid, deleted: true });
|
|
317
|
+
return;
|
|
318
|
+
}
|
|
319
|
+
output.info().message(`MCP server "${server.data.name}" deleted.`).print();
|
|
320
|
+
}
|
|
321
|
+
export {
|
|
322
|
+
createAction,
|
|
323
|
+
deleteAction,
|
|
324
|
+
getAction,
|
|
325
|
+
listAction,
|
|
326
|
+
updateAction
|
|
327
|
+
};
|
|
@@ -1,23 +1,23 @@
|
|
|
1
1
|
import { createRequire as $$cR } from "node:module"; const require = $$cR(import.meta.url);
|
|
2
2
|
import {
|
|
3
3
|
apiService
|
|
4
|
-
} from "./chunk-
|
|
5
|
-
import "./chunk-
|
|
4
|
+
} from "./chunk-BMQFEKHA.js";
|
|
5
|
+
import "./chunk-ANP5XF26.js";
|
|
6
6
|
import {
|
|
7
7
|
accessGroupDomains,
|
|
8
8
|
accessGroupNameSchema,
|
|
9
9
|
emailDomainSchema
|
|
10
10
|
} from "./chunk-7FS7BAUX.js";
|
|
11
|
-
import "./chunk-
|
|
11
|
+
import "./chunk-Z6HOHGUJ.js";
|
|
12
12
|
import "./chunk-EOTD7HAV.js";
|
|
13
13
|
import "./chunk-USVU6AC2.js";
|
|
14
14
|
import "./chunk-W7P6VTCG.js";
|
|
15
15
|
import "./chunk-5D3T63G4.js";
|
|
16
|
-
import "./chunk-
|
|
16
|
+
import "./chunk-42MIV6WF.js";
|
|
17
17
|
import {
|
|
18
18
|
config
|
|
19
|
-
} from "./chunk-
|
|
20
|
-
import "./chunk-
|
|
19
|
+
} from "./chunk-TR5U7G7T.js";
|
|
20
|
+
import "./chunk-DWJMPHLY.js";
|
|
21
21
|
import "./chunk-6BQHLHBE.js";
|
|
22
22
|
import "./chunk-BOCMOHQA.js";
|
|
23
23
|
import {
|
|
@@ -35,6 +35,7 @@ import "./chunk-4S3DGMMZ.js";
|
|
|
35
35
|
import "./chunk-7PNOYE6B.js";
|
|
36
36
|
import "./chunk-Q26DFKTY.js";
|
|
37
37
|
import {
|
|
38
|
+
emailSchema,
|
|
38
39
|
external_exports,
|
|
39
40
|
slugSchema
|
|
40
41
|
} from "./chunk-I57ID5K7.js";
|
|
@@ -74,6 +75,16 @@ var argsSchema = external_exports.discriminatedUnion("operation", [
|
|
|
74
75
|
...common,
|
|
75
76
|
operation: external_exports.literal("remove-domain"),
|
|
76
77
|
domain: emailDomainSchema
|
|
78
|
+
}),
|
|
79
|
+
external_exports.object({
|
|
80
|
+
...common,
|
|
81
|
+
operation: external_exports.literal("add-email"),
|
|
82
|
+
email: emailSchema
|
|
83
|
+
}),
|
|
84
|
+
external_exports.object({
|
|
85
|
+
...common,
|
|
86
|
+
operation: external_exports.literal("remove-email"),
|
|
87
|
+
email: emailSchema
|
|
77
88
|
})
|
|
78
89
|
]);
|
|
79
90
|
async function runAction(input) {
|
|
@@ -151,6 +162,10 @@ async function runAction(input) {
|
|
|
151
162
|
});
|
|
152
163
|
case "delete":
|
|
153
164
|
return client.accessGroups.delete(group.data.uid);
|
|
165
|
+
case "add-email":
|
|
166
|
+
return client.accessGroups.addEmail(group.data.uid, args.email);
|
|
167
|
+
case "remove-email":
|
|
168
|
+
return client.accessGroups.removeEmail(group.data.uid, args.email);
|
|
154
169
|
case "add-domain":
|
|
155
170
|
return client.accessGroups.addDomain(group.data.uid, args.domain);
|
|
156
171
|
case "remove-domain":
|
|
@@ -162,6 +177,8 @@ async function runAction(input) {
|
|
|
162
177
|
{
|
|
163
178
|
update: "Could not update access group",
|
|
164
179
|
delete: "Could not delete access group",
|
|
180
|
+
"add-email": "Could not add email",
|
|
181
|
+
"remove-email": "Could not remove email",
|
|
165
182
|
"add-domain": "Could not add domain",
|
|
166
183
|
"remove-domain": "Could not remove domain"
|
|
167
184
|
}[args.operation]
|
|
@@ -175,6 +192,10 @@ async function runAction(input) {
|
|
|
175
192
|
return `Updated access group "${args.newSlug ?? args.slug}".`;
|
|
176
193
|
case "delete":
|
|
177
194
|
return `Deleted access group "${args.slug}".`;
|
|
195
|
+
case "add-email":
|
|
196
|
+
return `Added email "${args.email}" to access group "${args.slug}".`;
|
|
197
|
+
case "remove-email":
|
|
198
|
+
return `Removed email "${args.email}" from access group "${args.slug}".`;
|
|
178
199
|
case "add-domain":
|
|
179
200
|
return `Added domain "${args.domain}" to access group "${args.slug}".`;
|
|
180
201
|
case "remove-domain":
|
|
@@ -6,9 +6,9 @@ import {
|
|
|
6
6
|
watchFile
|
|
7
7
|
} from "./chunk-RE5Z56QD.js";
|
|
8
8
|
import "./chunk-VUXPDHTQ.js";
|
|
9
|
-
import "./chunk-
|
|
10
|
-
import "./chunk-
|
|
11
|
-
import "./chunk-
|
|
9
|
+
import "./chunk-42MIV6WF.js";
|
|
10
|
+
import "./chunk-TR5U7G7T.js";
|
|
11
|
+
import "./chunk-DWJMPHLY.js";
|
|
12
12
|
import "./chunk-6BQHLHBE.js";
|
|
13
13
|
import "./chunk-BOCMOHQA.js";
|
|
14
14
|
import {
|
|
@@ -4,16 +4,16 @@ import {
|
|
|
4
4
|
} from "./chunk-SNQFFEYH.js";
|
|
5
5
|
import {
|
|
6
6
|
BaseCollections
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-SHRUJFQI.js";
|
|
8
8
|
import {
|
|
9
9
|
getDatabaseClient
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-GOKHFNB2.js";
|
|
11
11
|
import {
|
|
12
12
|
apiService
|
|
13
|
-
} from "./chunk-
|
|
14
|
-
import "./chunk-
|
|
13
|
+
} from "./chunk-BMQFEKHA.js";
|
|
14
|
+
import "./chunk-ANP5XF26.js";
|
|
15
15
|
import "./chunk-7FS7BAUX.js";
|
|
16
|
-
import "./chunk-
|
|
16
|
+
import "./chunk-Z6HOHGUJ.js";
|
|
17
17
|
import {
|
|
18
18
|
sdkSchema
|
|
19
19
|
} from "./chunk-EOTD7HAV.js";
|
|
@@ -24,9 +24,9 @@ import "./chunk-RE5Z56QD.js";
|
|
|
24
24
|
import "./chunk-VUXPDHTQ.js";
|
|
25
25
|
import {
|
|
26
26
|
getAuthData
|
|
27
|
-
} from "./chunk-
|
|
28
|
-
import "./chunk-
|
|
29
|
-
import "./chunk-
|
|
27
|
+
} from "./chunk-42MIV6WF.js";
|
|
28
|
+
import "./chunk-TR5U7G7T.js";
|
|
29
|
+
import "./chunk-DWJMPHLY.js";
|
|
30
30
|
import {
|
|
31
31
|
teamSchema
|
|
32
32
|
} from "./chunk-6BQHLHBE.js";
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { createRequire as $$cR } from "node:module"; const require = $$cR(import.meta.url);
|
|
2
2
|
import {
|
|
3
3
|
fetchFromRegistry
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-DLYMDGFW.js";
|
|
5
5
|
import {
|
|
6
6
|
registry
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-ERZ3HYB5.js";
|
|
8
8
|
import {
|
|
9
9
|
getAuthData
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-42MIV6WF.js";
|
|
11
11
|
|
|
12
12
|
// src/domains/schema/download.ts
|
|
13
13
|
async function downloadSchema(input) {
|