@mcpcloud/cli 0.7.0-next-20260628020545 → 0.8.0-next-20260701231709
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/index.js +64 -14
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -4691,6 +4691,52 @@ function registerServerLifecycleCommands(servers) {
|
|
|
4691
4691
|
if (opts.wait && !waitDone)
|
|
4692
4692
|
throw new CliExitError(1);
|
|
4693
4693
|
}));
|
|
4694
|
+
servers.command("regenerate <serverId>").description("Re-fetch a server's source spec and rebuild its tools with the current codegen (preserves customizations). Wraps POST /api/v1/server/regenerate.").option("--org <organizationId>", "Organization ID").option("--project <projectId>", "Project ID (defaults to the server's project)").option("--source-url <url>", "Override the stored spec source URL (needed for GraphQL servers whose introspection endpoint wasn't persisted)").addHelpText("after", [
|
|
4695
|
+
"",
|
|
4696
|
+
"Regenerate re-introspects/re-parses the source and rebuilds each tool with",
|
|
4697
|
+
"the current codegen, so codegen fixes reach existing servers. It does not",
|
|
4698
|
+
"deploy — run `mcp servers deploy` afterwards to ship the rebuilt bundle.",
|
|
4699
|
+
"",
|
|
4700
|
+
"Examples:",
|
|
4701
|
+
" # Propagate codegen fixes into an existing server, then deploy:",
|
|
4702
|
+
" $ mcp servers regenerate srv_123 && mcp servers deploy srv_123 --wait",
|
|
4703
|
+
"",
|
|
4704
|
+
" # GraphQL server whose introspection endpoint must be supplied:",
|
|
4705
|
+
" $ mcp servers regenerate srv_123 --source-url https://api.example.com/graphql"
|
|
4706
|
+
].join(`
|
|
4707
|
+
`)).action(runAction(async (serverId, opts) => {
|
|
4708
|
+
const orgId = await resolveOrgId(opts.org);
|
|
4709
|
+
let projectId = opts.project;
|
|
4710
|
+
if (!projectId) {
|
|
4711
|
+
const serverData = await api.get("/api/v1/server", { organizationId: orgId, serverId });
|
|
4712
|
+
projectId = serverData.server.projectId;
|
|
4713
|
+
}
|
|
4714
|
+
if (!isJsonMode()) {
|
|
4715
|
+
printStep(`Regenerating ${c.bold(serverId)} from its source spec…`);
|
|
4716
|
+
}
|
|
4717
|
+
const data = await api.post("/api/v1/server/regenerate", {
|
|
4718
|
+
organizationId: orgId,
|
|
4719
|
+
projectId,
|
|
4720
|
+
serverId,
|
|
4721
|
+
...opts.sourceUrl ? { sourceUrl: opts.sourceUrl } : {}
|
|
4722
|
+
});
|
|
4723
|
+
const r = data.regeneration;
|
|
4724
|
+
if (isJsonMode()) {
|
|
4725
|
+
printJson({ regeneration: r });
|
|
4726
|
+
return;
|
|
4727
|
+
}
|
|
4728
|
+
printSuccess(`Regenerated ${c.bold(serverId)} (${r.sourceType}).`);
|
|
4729
|
+
printKeyValue({
|
|
4730
|
+
"tools updated": String(r.updated),
|
|
4731
|
+
"tools added": String(r.inserted),
|
|
4732
|
+
"tools dropped from spec": String(r.removed),
|
|
4733
|
+
generation: r.generationStatus
|
|
4734
|
+
});
|
|
4735
|
+
if (r.removed > 0) {
|
|
4736
|
+
printInfo(c.dim(` → ${r.removed} operation(s) no longer in the spec were kept, not deleted (removal stays a manual action): ${r.removedKeys.slice(0, 5).join(", ")}`));
|
|
4737
|
+
}
|
|
4738
|
+
printInfo(c.dim(` → run \`mcp servers deploy ${serverId} --wait\` to ship the regenerated bundle.`));
|
|
4739
|
+
}));
|
|
4694
4740
|
}
|
|
4695
4741
|
|
|
4696
4742
|
// src/commands/servers-mutations.ts
|
|
@@ -4901,6 +4947,12 @@ function looksLikeGraphql(spec) {
|
|
|
4901
4947
|
}
|
|
4902
4948
|
async function readSpecSource(spec, override, options = {}) {
|
|
4903
4949
|
const trimmedSpec = spec.trim();
|
|
4950
|
+
if (override === "graphql") {
|
|
4951
|
+
if (!isHttpUrl(trimmedSpec)) {
|
|
4952
|
+
throw new Error("--source-type graphql requires the GraphQL endpoint URL to introspect " + `(e.g. --spec https://api.example.com/graphql), got: ${spec}`);
|
|
4953
|
+
}
|
|
4954
|
+
return { sourceType: "graphql", sourceUrl: trimmedSpec };
|
|
4955
|
+
}
|
|
4904
4956
|
if (override === "url" || !override && isHttpUrl(trimmedSpec)) {
|
|
4905
4957
|
if (!isHttpUrl(trimmedSpec)) {
|
|
4906
4958
|
throw new Error(`--source-type url requires an http(s) --spec URL, got: ${spec}`);
|
|
@@ -4923,15 +4975,12 @@ async function readSpecSource(spec, override, options = {}) {
|
|
|
4923
4975
|
if (!content.trim()) {
|
|
4924
4976
|
throw new Error("The spec is empty — nothing to ingest.");
|
|
4925
4977
|
}
|
|
4926
|
-
|
|
4927
|
-
|
|
4928
|
-
|
|
4929
|
-
|
|
4930
|
-
sourceType = "graphql";
|
|
4931
|
-
} else {
|
|
4932
|
-
sourceType = "openapi";
|
|
4978
|
+
if (override !== "openapi") {
|
|
4979
|
+
if (/\.(graphql|gql)$/i.test(pathHint) || looksLikeGraphql(content)) {
|
|
4980
|
+
throw new Error("This looks like a GraphQL schema. Import GraphQL from its endpoint URL: " + "`--spec https://api.example.com/graphql --source-type graphql` " + "(SDL-file import is not supported).");
|
|
4981
|
+
}
|
|
4933
4982
|
}
|
|
4934
|
-
return { sourceType, rawSpec: content };
|
|
4983
|
+
return { sourceType: "openapi", rawSpec: content };
|
|
4935
4984
|
}
|
|
4936
4985
|
function buildIngestBody(args) {
|
|
4937
4986
|
const body = {
|
|
@@ -4939,10 +4988,10 @@ function buildIngestBody(args) {
|
|
|
4939
4988
|
projectId: args.projectId,
|
|
4940
4989
|
sourceType: args.payload.sourceType
|
|
4941
4990
|
};
|
|
4942
|
-
if (args.payload.sourceType === "
|
|
4943
|
-
body["sourceUrl"] = args.payload.sourceUrl;
|
|
4944
|
-
} else {
|
|
4991
|
+
if (args.payload.sourceType === "openapi") {
|
|
4945
4992
|
body["rawSpec"] = args.payload.rawSpec;
|
|
4993
|
+
} else {
|
|
4994
|
+
body["sourceUrl"] = args.payload.sourceUrl;
|
|
4946
4995
|
}
|
|
4947
4996
|
return body;
|
|
4948
4997
|
}
|
|
@@ -4977,12 +5026,13 @@ function validateSourceType(value) {
|
|
|
4977
5026
|
return v;
|
|
4978
5027
|
}
|
|
4979
5028
|
function registerServerSpecCommands(servers) {
|
|
4980
|
-
servers.command("ingest").description("Create a server from an OpenAPI
|
|
5029
|
+
servers.command("ingest").description("Create a server from an OpenAPI spec (file, URL, or @- stdin) or a GraphQL endpoint. Wraps POST /api/v1/server/ingest.").requiredOption("--project <projectId>", "Project to create the server in").requiredOption("--spec <file|url>", "OpenAPI spec (local file, http(s) URL, or @- for stdin), or — with --source-type graphql — the GraphQL endpoint URL to introspect").option("--org <organizationId>", "Organization ID").option("--source-type <type>", `Override spec classification: ${SOURCE_TYPES.join(" | ")} (OpenAPI auto-detected; graphql requires an endpoint URL)`).addHelpText("after", [
|
|
4981
5030
|
"",
|
|
4982
5031
|
"Examples:",
|
|
4983
5032
|
" $ mcp servers ingest --project proj_123 --spec ./openapi.yaml",
|
|
4984
5033
|
" $ mcp servers ingest --project proj_123 --spec https://api.example.com/openapi.json",
|
|
4985
|
-
"
|
|
5034
|
+
" # GraphQL: introspect a live endpoint (POST) — pass the URL, not SDL.",
|
|
5035
|
+
" $ mcp servers ingest --project proj_123 --spec https://api.example.com/graphql --source-type graphql"
|
|
4986
5036
|
].join(`
|
|
4987
5037
|
`)).action(runAction(async (opts) => {
|
|
4988
5038
|
const orgId = await resolveOrgId(opts.org);
|
|
@@ -29822,7 +29872,7 @@ async function pickServerName(override) {
|
|
|
29822
29872
|
return name;
|
|
29823
29873
|
}
|
|
29824
29874
|
function registerInitCommand(program2) {
|
|
29825
|
-
program2.command("init").description("Guided onboarding: pick org → pick/create project → create a server (empty skeleton, or generated from an OpenAPI/GraphQL spec via --from-spec)").option("--org <organizationId>", "Organization ID").option("--project <projectId>", "Reuse an existing project instead of creating one").option("--name <serverName>", "Name for the new server (skeleton path only)").option("--from-spec <file|url>", "Build
|
|
29875
|
+
program2.command("init").description("Guided onboarding: pick org → pick/create project → create a server (empty skeleton, or generated from an OpenAPI/GraphQL spec via --from-spec)").option("--org <organizationId>", "Organization ID").option("--project <projectId>", "Reuse an existing project instead of creating one").option("--name <serverName>", "Name for the new server (skeleton path only)").option("--from-spec <file|url>", "Build from an OpenAPI spec (local file, http(s) URL, or @- for stdin), or — with --source-type graphql — a GraphQL endpoint URL to introspect").option("--source-type <type>", `Override spec classification: ${SOURCE_TYPES.join(" | ")} (OpenAPI auto-detected; graphql requires an endpoint URL)`).option("--deploy", "After importing the spec, deploy the server").option("--wait", "With --deploy, follow events until the deploy is terminal").option("--wait-timeout <seconds>", "Max seconds to wait for a terminal deploy state (default 300)", "300").addHelpText("after", [
|
|
29826
29876
|
"",
|
|
29827
29877
|
"Two modes:",
|
|
29828
29878
|
" Skeleton (default): resolve org → pick/create project → create an empty server.",
|
package/package.json
CHANGED