@micropage-sh/mcp 0.1.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/LICENSE +21 -0
- package/README.md +38 -0
- package/dist/annotations.d.ts +20 -0
- package/dist/annotations.js +36 -0
- package/dist/annotations.js.map +1 -0
- package/dist/client/assets.d.ts +85 -0
- package/dist/client/assets.js +473 -0
- package/dist/client/assets.js.map +1 -0
- package/dist/client/auth-provider.d.ts +24 -0
- package/dist/client/auth-provider.js +10 -0
- package/dist/client/auth-provider.js.map +1 -0
- package/dist/client/builds.d.ts +82 -0
- package/dist/client/builds.js +166 -0
- package/dist/client/builds.js.map +1 -0
- package/dist/client/config.d.ts +18 -0
- package/dist/client/config.js +29 -0
- package/dist/client/config.js.map +1 -0
- package/dist/client/deploy-events.d.ts +98 -0
- package/dist/client/deploy-events.js +170 -0
- package/dist/client/deploy-events.js.map +1 -0
- package/dist/client/deploy-token.d.ts +48 -0
- package/dist/client/deploy-token.js +130 -0
- package/dist/client/deploy-token.js.map +1 -0
- package/dist/client/errors.d.ts +18 -0
- package/dist/client/errors.js +21 -0
- package/dist/client/errors.js.map +1 -0
- package/dist/client/http.d.ts +68 -0
- package/dist/client/http.js +191 -0
- package/dist/client/http.js.map +1 -0
- package/dist/client/jwt.d.ts +13 -0
- package/dist/client/jwt.js +23 -0
- package/dist/client/jwt.js.map +1 -0
- package/dist/client/lock.d.ts +16 -0
- package/dist/client/lock.js +67 -0
- package/dist/client/lock.js.map +1 -0
- package/dist/client/pages.d.ts +47 -0
- package/dist/client/pages.js +131 -0
- package/dist/client/pages.js.map +1 -0
- package/dist/client/posts.d.ts +108 -0
- package/dist/client/posts.js +187 -0
- package/dist/client/posts.js.map +1 -0
- package/dist/client/project-ref.d.ts +68 -0
- package/dist/client/project-ref.js +118 -0
- package/dist/client/project-ref.js.map +1 -0
- package/dist/client/session-store.d.ts +81 -0
- package/dist/client/session-store.js +271 -0
- package/dist/client/session-store.js.map +1 -0
- package/dist/client/submissions.d.ts +59 -0
- package/dist/client/submissions.js +111 -0
- package/dist/client/submissions.js.map +1 -0
- package/dist/client/tier.d.ts +42 -0
- package/dist/client/tier.js +76 -0
- package/dist/client/tier.js.map +1 -0
- package/dist/content/index.d.ts +5 -0
- package/dist/content/index.js +28 -0
- package/dist/content/index.js.map +1 -0
- package/dist/context.d.ts +30 -0
- package/dist/context.js +2 -0
- package/dist/context.js.map +1 -0
- package/dist/guards.d.ts +55 -0
- package/dist/guards.js +168 -0
- package/dist/guards.js.map +1 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +16 -0
- package/dist/index.js.map +1 -0
- package/dist/progress.d.ts +7 -0
- package/dist/progress.js +25 -0
- package/dist/progress.js.map +1 -0
- package/dist/reference/prompts.d.ts +6 -0
- package/dist/reference/prompts.js +110 -0
- package/dist/reference/prompts.js.map +1 -0
- package/dist/reference/resources.d.ts +2 -0
- package/dist/reference/resources.js +41 -0
- package/dist/reference/resources.js.map +1 -0
- package/dist/reference/tool.d.ts +21 -0
- package/dist/reference/tool.js +50 -0
- package/dist/reference/tool.js.map +1 -0
- package/dist/reference/topics.d.ts +29 -0
- package/dist/reference/topics.js +91 -0
- package/dist/reference/topics.js.map +1 -0
- package/dist/reference.d.ts +9 -0
- package/dist/reference.js +20 -0
- package/dist/reference.js.map +1 -0
- package/dist/server.d.ts +29 -0
- package/dist/server.js +75 -0
- package/dist/server.js.map +1 -0
- package/dist/tools/account.d.ts +34 -0
- package/dist/tools/account.js +128 -0
- package/dist/tools/account.js.map +1 -0
- package/dist/tools/builds.d.ts +95 -0
- package/dist/tools/builds.js +403 -0
- package/dist/tools/builds.js.map +1 -0
- package/dist/tools/files.d.ts +71 -0
- package/dist/tools/files.js +205 -0
- package/dist/tools/files.js.map +1 -0
- package/dist/tools/forms.d.ts +59 -0
- package/dist/tools/forms.js +177 -0
- package/dist/tools/forms.js.map +1 -0
- package/dist/tools/posts.d.ts +191 -0
- package/dist/tools/posts.js +600 -0
- package/dist/tools/posts.js.map +1 -0
- package/dist/tools/projects.d.ts +201 -0
- package/dist/tools/projects.js +553 -0
- package/dist/tools/projects.js.map +1 -0
- package/dist/tools/shared.d.ts +33 -0
- package/dist/tools/shared.js +41 -0
- package/dist/tools/shared.js.map +1 -0
- package/dist/version.d.ts +2 -0
- package/dist/version.js +8 -0
- package/dist/version.js.map +1 -0
- package/package.json +67 -0
|
@@ -0,0 +1,553 @@
|
|
|
1
|
+
import * as z from "zod";
|
|
2
|
+
import { DESTRUCTIVE, OUT, RO, WRITE } from "../annotations.js";
|
|
3
|
+
import { BuildRefInput, findBuild, getBuildById, parseBuildRef, saveDraft } from "../client/builds.js";
|
|
4
|
+
import { MicropageError } from "../client/errors.js";
|
|
5
|
+
import { eq, inList } from "../client/http.js";
|
|
6
|
+
import { concatPages } from "../client/pages.js";
|
|
7
|
+
import { PROJECT_COLUMNS, ProjectRef, resolveProject, toProject, } from "../client/project-ref.js";
|
|
8
|
+
import { EXAMPLES } from "../content/index.js";
|
|
9
|
+
import { elicitConfirmation, requireConfirmMatch } from "../guards.js";
|
|
10
|
+
import { BUILD_SUMMARY_COLUMNS, BuildSummary, ProjectSummary, gateTool, structuredResult } from "./shared.js";
|
|
11
|
+
// ---------------------------------------------------------------------------
|
|
12
|
+
// list_projects
|
|
13
|
+
// ---------------------------------------------------------------------------
|
|
14
|
+
export const ListProjectsInput = z.object({}).strict();
|
|
15
|
+
export const ListProjectsOutput = z.object({
|
|
16
|
+
projects: z.array(ProjectSummary.extend({
|
|
17
|
+
active_build: BuildSummary.nullable().describe("The build the editor and CLI work on (default publish target). May be a draft newer than what is live."),
|
|
18
|
+
})),
|
|
19
|
+
count: z.number(),
|
|
20
|
+
});
|
|
21
|
+
function summarize(project) {
|
|
22
|
+
return {
|
|
23
|
+
id: project.id,
|
|
24
|
+
uuid: project.uuid,
|
|
25
|
+
name: project.name,
|
|
26
|
+
domain: project.domain,
|
|
27
|
+
custom_domain: project.custom_domain,
|
|
28
|
+
status: project.status,
|
|
29
|
+
active_build_id: project.active_build_id,
|
|
30
|
+
created_at: project.created_at,
|
|
31
|
+
live_url: project.live_url,
|
|
32
|
+
editor_url: project.editor_url,
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
function toBuildSummary(row) {
|
|
36
|
+
return {
|
|
37
|
+
id: row.id,
|
|
38
|
+
number: row.number ?? null,
|
|
39
|
+
status: row.status ?? null,
|
|
40
|
+
updated_at: row.updated_at ?? null,
|
|
41
|
+
failure_reason: row.failure_reason ?? null,
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
export async function runListProjects(ctx) {
|
|
45
|
+
await gateTool(ctx, "list_projects");
|
|
46
|
+
const rows = await ctx.http.select("projects", { select: PROJECT_COLUMNS, order: "id.desc" });
|
|
47
|
+
const activeIds = rows.map((r) => r.active_build_id).filter((id) => typeof id === "number");
|
|
48
|
+
const builds = activeIds.length > 0
|
|
49
|
+
? await ctx.http.select("builds", {
|
|
50
|
+
select: BUILD_SUMMARY_COLUMNS,
|
|
51
|
+
filters: { id: inList(activeIds) },
|
|
52
|
+
})
|
|
53
|
+
: [];
|
|
54
|
+
const byId = new Map(builds.map((b) => [b.id, toBuildSummary(b)]));
|
|
55
|
+
const projects = rows.map((row) => ({
|
|
56
|
+
...summarize(toProject(row, ctx.config)),
|
|
57
|
+
active_build: row.active_build_id === null ? null : (byId.get(row.active_build_id) ?? null),
|
|
58
|
+
}));
|
|
59
|
+
return { projects, count: projects.length };
|
|
60
|
+
}
|
|
61
|
+
// ---------------------------------------------------------------------------
|
|
62
|
+
// get_project
|
|
63
|
+
// ---------------------------------------------------------------------------
|
|
64
|
+
export const GetProjectInput = z.object({ project: ProjectRef }).strict();
|
|
65
|
+
const CustomDomainStatus = z.object({
|
|
66
|
+
hostname: z.string(),
|
|
67
|
+
attached: z.boolean().describe("True once the custom domain is wired to the site."),
|
|
68
|
+
status: z.string().nullable().describe("Cloudflare custom hostname status: pending, active, blocked, failed, ..."),
|
|
69
|
+
ssl_status: z
|
|
70
|
+
.string()
|
|
71
|
+
.nullable()
|
|
72
|
+
.describe("Certificate state: initializing, pending_validation, pending_issuance, pending_deployment, active, ..."),
|
|
73
|
+
verification_errors: z.unknown().nullable(),
|
|
74
|
+
last_checked_at: z.string().nullable(),
|
|
75
|
+
cname_target: z.string().describe("What the hostname must CNAME to."),
|
|
76
|
+
});
|
|
77
|
+
export const GetProjectOutput = z.object({
|
|
78
|
+
project: ProjectSummary,
|
|
79
|
+
active_build: BuildSummary.nullable().describe("The build the editor and CLI work on; publish_build's default."),
|
|
80
|
+
latest_build: BuildSummary.nullable().describe("The highest-numbered build."),
|
|
81
|
+
last_deployed_build: BuildSummary.nullable().describe("What is live right now, if anything was ever deployed."),
|
|
82
|
+
failure_reason: z.string().nullable().describe("Why the active or latest build failed, when it did."),
|
|
83
|
+
custom_domain: CustomDomainStatus.nullable(),
|
|
84
|
+
});
|
|
85
|
+
export async function runGetProject(ctx, args) {
|
|
86
|
+
await gateTool(ctx, "get_project");
|
|
87
|
+
const project = await resolveProject(ctx, args.project);
|
|
88
|
+
const byProject = { project_id: eq(project.id) };
|
|
89
|
+
const [latest, deployed, active, ch] = await Promise.all([
|
|
90
|
+
ctx.http.selectOne("builds", {
|
|
91
|
+
select: BUILD_SUMMARY_COLUMNS,
|
|
92
|
+
filters: byProject,
|
|
93
|
+
order: "number.desc",
|
|
94
|
+
}),
|
|
95
|
+
ctx.http.selectOne("builds", {
|
|
96
|
+
select: BUILD_SUMMARY_COLUMNS,
|
|
97
|
+
filters: { ...byProject, status: eq("deployed") },
|
|
98
|
+
order: "number.desc",
|
|
99
|
+
}),
|
|
100
|
+
project.active_build_id === null
|
|
101
|
+
? Promise.resolve(null)
|
|
102
|
+
: ctx.http.selectOne("builds", {
|
|
103
|
+
select: BUILD_SUMMARY_COLUMNS,
|
|
104
|
+
filters: { id: eq(project.active_build_id) },
|
|
105
|
+
}),
|
|
106
|
+
project.custom_domain
|
|
107
|
+
? ctx.http.selectOne("projects", {
|
|
108
|
+
select: "domain_active,custom_hostname_status,custom_hostname_ssl_status,custom_hostname_verification_errors,custom_hostname_last_checked_at",
|
|
109
|
+
filters: { id: eq(project.id) },
|
|
110
|
+
})
|
|
111
|
+
: Promise.resolve(null),
|
|
112
|
+
]);
|
|
113
|
+
const activeBuild = active ? toBuildSummary(active) : null;
|
|
114
|
+
const latestBuild = latest ? toBuildSummary(latest) : null;
|
|
115
|
+
const failed = [activeBuild, latestBuild].find((b) => b?.status === "failed");
|
|
116
|
+
return {
|
|
117
|
+
project: summarize(project),
|
|
118
|
+
active_build: activeBuild,
|
|
119
|
+
latest_build: latestBuild,
|
|
120
|
+
last_deployed_build: deployed ? toBuildSummary(deployed) : null,
|
|
121
|
+
failure_reason: failed?.failure_reason ?? null,
|
|
122
|
+
custom_domain: project.custom_domain
|
|
123
|
+
? {
|
|
124
|
+
hostname: project.custom_domain,
|
|
125
|
+
attached: ch?.domain_active ?? false,
|
|
126
|
+
status: ch?.custom_hostname_status ?? null,
|
|
127
|
+
ssl_status: ch?.custom_hostname_ssl_status ?? null,
|
|
128
|
+
verification_errors: ch?.custom_hostname_verification_errors ?? null,
|
|
129
|
+
last_checked_at: ch?.custom_hostname_last_checked_at ?? null,
|
|
130
|
+
cname_target: `cname.${ctx.config.baseDomain}`,
|
|
131
|
+
}
|
|
132
|
+
: null,
|
|
133
|
+
};
|
|
134
|
+
}
|
|
135
|
+
// ---------------------------------------------------------------------------
|
|
136
|
+
// get_page_source
|
|
137
|
+
// ---------------------------------------------------------------------------
|
|
138
|
+
export const GetPageSourceInput = z
|
|
139
|
+
.object({
|
|
140
|
+
project: ProjectRef,
|
|
141
|
+
version: BuildRefInput.optional().describe("Which build's source to read: a build number (\"v12\" or 12) or id (\"id:4567\"). Defaults to the active " +
|
|
142
|
+
"build (the draft or published build the editor and CLI work on), else the latest build."),
|
|
143
|
+
})
|
|
144
|
+
.strict();
|
|
145
|
+
export const GetPageSourceOutput = z.object({
|
|
146
|
+
project: ProjectSummary,
|
|
147
|
+
build: z
|
|
148
|
+
.object({
|
|
149
|
+
id: z.number(),
|
|
150
|
+
number: z.number().nullable(),
|
|
151
|
+
status: z.string().nullable(),
|
|
152
|
+
updated_at: z.string().nullable(),
|
|
153
|
+
is_active: z.boolean().describe("True when this is the project's active build."),
|
|
154
|
+
})
|
|
155
|
+
.nullable()
|
|
156
|
+
.describe("Null when the project has no builds yet."),
|
|
157
|
+
source: z
|
|
158
|
+
.string()
|
|
159
|
+
.nullable()
|
|
160
|
+
.describe("The raw .page markup. Several files were merged into one when saved; edit it as landing.page."),
|
|
161
|
+
llms_txt: z.string().nullable().describe("The site's /llms.txt as stored on this build, if any."),
|
|
162
|
+
assets: z
|
|
163
|
+
.array(z.string())
|
|
164
|
+
.nullable()
|
|
165
|
+
.describe("Filenames uploaded to the project, usable as `img: <- filename`. Null if the list could not be read."),
|
|
166
|
+
});
|
|
167
|
+
const SOURCE_COLUMNS = "id,number,status,updated_at,raw_content,llms_txt:json_content->site->>llms_txt";
|
|
168
|
+
async function listAssetNames(ctx, projectId) {
|
|
169
|
+
try {
|
|
170
|
+
const data = await ctx.http.invokeGet("list-files", {
|
|
171
|
+
project_id: String(projectId),
|
|
172
|
+
});
|
|
173
|
+
const names = (data?.files ?? []).map((f) => f.filename).filter((n) => typeof n === "string" && n !== "");
|
|
174
|
+
return [...new Set(names)].sort();
|
|
175
|
+
}
|
|
176
|
+
catch {
|
|
177
|
+
// The file list is a convenience here; list_files reports its own errors.
|
|
178
|
+
return null;
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
export async function runGetPageSource(ctx, args) {
|
|
182
|
+
await gateTool(ctx, "get_page_source");
|
|
183
|
+
const project = await resolveProject(ctx, args.project);
|
|
184
|
+
let build;
|
|
185
|
+
if (args.version !== undefined) {
|
|
186
|
+
build = await findBuild(ctx.http, project.id, parseBuildRef(args.version), SOURCE_COLUMNS);
|
|
187
|
+
}
|
|
188
|
+
else {
|
|
189
|
+
build =
|
|
190
|
+
project.active_build_id === null
|
|
191
|
+
? null
|
|
192
|
+
: await getBuildById(ctx.http, project.id, project.active_build_id, SOURCE_COLUMNS);
|
|
193
|
+
build ??= await ctx.http.selectOne("builds", {
|
|
194
|
+
select: SOURCE_COLUMNS,
|
|
195
|
+
filters: { project_id: eq(project.id) },
|
|
196
|
+
order: "number.desc",
|
|
197
|
+
});
|
|
198
|
+
}
|
|
199
|
+
const assets = await listAssetNames(ctx, project.id);
|
|
200
|
+
return {
|
|
201
|
+
project: summarize(project),
|
|
202
|
+
build: build
|
|
203
|
+
? {
|
|
204
|
+
id: build.id,
|
|
205
|
+
number: build.number ?? null,
|
|
206
|
+
status: build.status ?? null,
|
|
207
|
+
updated_at: build.updated_at ?? null,
|
|
208
|
+
is_active: build.id === project.active_build_id,
|
|
209
|
+
}
|
|
210
|
+
: null,
|
|
211
|
+
source: build?.raw_content ?? null,
|
|
212
|
+
llms_txt: build?.llms_txt ?? null,
|
|
213
|
+
assets,
|
|
214
|
+
};
|
|
215
|
+
}
|
|
216
|
+
// ---------------------------------------------------------------------------
|
|
217
|
+
// create_project
|
|
218
|
+
// ---------------------------------------------------------------------------
|
|
219
|
+
/** Full-page example handed out as the starter (components-* files are fragments). */
|
|
220
|
+
export const STARTER_EXAMPLE = "startup-landing";
|
|
221
|
+
const DOMAIN_RE = /^[a-z0-9](?:[a-z0-9-]{0,56}[a-z0-9])?$/;
|
|
222
|
+
export const CreateProjectInput = z
|
|
223
|
+
.object({
|
|
224
|
+
name: z.string().trim().min(1).max(100).describe("Project name shown in the editor, e.g. \"Acme waitlist\"."),
|
|
225
|
+
domain: z
|
|
226
|
+
.string()
|
|
227
|
+
.trim()
|
|
228
|
+
.toLowerCase()
|
|
229
|
+
.max(80)
|
|
230
|
+
.optional()
|
|
231
|
+
.describe("Optional micropage subdomain: \"acme\" serves at https://acme.micropage.sh. Lowercase letters, digits and " +
|
|
232
|
+
"hyphens, up to 58 characters. Omit it to get one derived from the name plus a short random suffix."),
|
|
233
|
+
})
|
|
234
|
+
.strict();
|
|
235
|
+
export const CreateProjectOutput = z.object({
|
|
236
|
+
project: ProjectSummary,
|
|
237
|
+
starter: z.object({
|
|
238
|
+
example: z.string().describe("Which bundled example the starter source is."),
|
|
239
|
+
source: z.string().describe("A complete .page file to adapt and pass to save_page as landing.page."),
|
|
240
|
+
referenced_files: z
|
|
241
|
+
.array(z.string())
|
|
242
|
+
.describe("Files the starter references with `<-`; upload them with upload_asset or remove those lines."),
|
|
243
|
+
other_examples: z.array(z.string()).describe("More examples, readable with get_markup_reference."),
|
|
244
|
+
}),
|
|
245
|
+
next_steps: z.string(),
|
|
246
|
+
});
|
|
247
|
+
export function normalizeDomain(input, baseDomain) {
|
|
248
|
+
let d = input.trim().toLowerCase().replace(/^https?:\/\//, "").replace(/\/.*$/, "");
|
|
249
|
+
const suffix = `.${baseDomain.toLowerCase()}`;
|
|
250
|
+
if (d.endsWith(suffix))
|
|
251
|
+
d = d.slice(0, -suffix.length);
|
|
252
|
+
if (!DOMAIN_RE.test(d)) {
|
|
253
|
+
throw new MicropageError("INVALID_DOMAIN", `"${input}" is not a valid micropage subdomain. Use 1-58 lowercase letters, digits and hyphens, not starting or ` +
|
|
254
|
+
`ending with a hyphen (e.g. "acme-launch"), or omit domain to get one from the name. Nothing was created.`);
|
|
255
|
+
}
|
|
256
|
+
return d;
|
|
257
|
+
}
|
|
258
|
+
function referencedFiles(source) {
|
|
259
|
+
const out = new Set();
|
|
260
|
+
for (const m of source.matchAll(/<-\s*([^\s<>]+\.[A-Za-z0-9]{1,8})\s*$/gm)) {
|
|
261
|
+
if (!/^https?:/i.test(m[1]))
|
|
262
|
+
out.add(m[1]);
|
|
263
|
+
}
|
|
264
|
+
return [...out].sort();
|
|
265
|
+
}
|
|
266
|
+
export async function runCreateProject(ctx, args) {
|
|
267
|
+
const domain = args.domain ? normalizeDomain(args.domain, ctx.config.baseDomain) : undefined;
|
|
268
|
+
await gateTool(ctx, "create_project");
|
|
269
|
+
let rows;
|
|
270
|
+
try {
|
|
271
|
+
rows = await ctx.http.insert("projects", { name: args.name, ...(domain ? { domain } : {}) });
|
|
272
|
+
}
|
|
273
|
+
catch (err) {
|
|
274
|
+
if (err instanceof MicropageError && err.status === 409) {
|
|
275
|
+
throw new MicropageError("DOMAIN_TAKEN", `The subdomain "${domain ?? "(generated)"}" is already taken. Pick another domain, or omit it. Nothing was created.`, { status: 409, data: err.data, cause: err });
|
|
276
|
+
}
|
|
277
|
+
if (err instanceof MicropageError && (err.status === 403 || err.status === 401)) {
|
|
278
|
+
throw new MicropageError("PROJECT_LIMIT", "micropage refused to create another project, most likely because the account is at its plan's project " +
|
|
279
|
+
"limit (Pro: 5, Pro+: 20). Tell the user to delete an unused project or upgrade. Nothing was created.", { ...(err.status === undefined ? {} : { status: err.status }), data: err.data, cause: err });
|
|
280
|
+
}
|
|
281
|
+
throw err;
|
|
282
|
+
}
|
|
283
|
+
const row = rows[0];
|
|
284
|
+
if (!row)
|
|
285
|
+
throw new MicropageError("CREATE_FAILED", "Creating the project returned no row. Call list_projects to check, then retry.");
|
|
286
|
+
const project = toProject({
|
|
287
|
+
id: row.id,
|
|
288
|
+
uuid: row.uuid,
|
|
289
|
+
name: row.name ?? args.name,
|
|
290
|
+
domain: row.domain ?? null,
|
|
291
|
+
custom_domain: row.custom_domain ?? null,
|
|
292
|
+
active_build_id: row.active_build_id ?? null,
|
|
293
|
+
status: row.status ?? null,
|
|
294
|
+
created_at: row.created_at ?? null,
|
|
295
|
+
}, ctx.config);
|
|
296
|
+
const source = EXAMPLES[STARTER_EXAMPLE] ?? Object.values(EXAMPLES)[0] ?? "";
|
|
297
|
+
return {
|
|
298
|
+
project: summarize(project),
|
|
299
|
+
starter: {
|
|
300
|
+
example: STARTER_EXAMPLE,
|
|
301
|
+
source,
|
|
302
|
+
referenced_files: referencedFiles(source),
|
|
303
|
+
other_examples: Object.keys(EXAMPLES).filter((n) => n !== STARTER_EXAMPLE && !n.startsWith("components-")),
|
|
304
|
+
},
|
|
305
|
+
next_steps: "The project is empty and nothing is live yet. Rewrite the starter for the user's brief, call save_page with " +
|
|
306
|
+
"pages: [{ name: \"landing.page\", content }], show the user the editor_url to preview, and call publish_build " +
|
|
307
|
+
"only when the user asks to go live.",
|
|
308
|
+
};
|
|
309
|
+
}
|
|
310
|
+
// ---------------------------------------------------------------------------
|
|
311
|
+
// save_page
|
|
312
|
+
// ---------------------------------------------------------------------------
|
|
313
|
+
export const MAX_PAGE_FILES = 50;
|
|
314
|
+
export const SavePageInput = z
|
|
315
|
+
.object({
|
|
316
|
+
project: ProjectRef,
|
|
317
|
+
pages: z
|
|
318
|
+
.array(z
|
|
319
|
+
.object({
|
|
320
|
+
name: z
|
|
321
|
+
.string()
|
|
322
|
+
.trim()
|
|
323
|
+
.min(1)
|
|
324
|
+
.max(100)
|
|
325
|
+
.describe("File name ending in .page. landing.page is merged first; the rest follow sorted by name."),
|
|
326
|
+
content: z.string().describe("The complete .page markup of this file (not a diff)."),
|
|
327
|
+
})
|
|
328
|
+
.strict())
|
|
329
|
+
.min(1)
|
|
330
|
+
.max(MAX_PAGE_FILES)
|
|
331
|
+
.describe("The whole site source as one or more .page files, merged like the CLI does (landing.page first, then the " +
|
|
332
|
+
"others by name, a blank line between). Pass every file each time: this replaces the source, it does not patch it."),
|
|
333
|
+
llms_txt: z
|
|
334
|
+
.string()
|
|
335
|
+
.optional()
|
|
336
|
+
.describe("The site's /llms.txt, stored verbatim. Omit to keep the current build's llms.txt; pass an empty string to remove it."),
|
|
337
|
+
})
|
|
338
|
+
.strict();
|
|
339
|
+
export const SavePageOutput = z.object({
|
|
340
|
+
project: ProjectSummary,
|
|
341
|
+
build: z.object({
|
|
342
|
+
id: z.number().describe("Build id; pass it to publish_build as build \"id:<id>\" to publish exactly this draft."),
|
|
343
|
+
number: z.number().nullable(),
|
|
344
|
+
status: z.string().nullable(),
|
|
345
|
+
}),
|
|
346
|
+
action: z
|
|
347
|
+
.enum(["updated_draft", "created_draft"])
|
|
348
|
+
.describe("updated_draft: the active draft (or failed build) was overwritten. created_draft: a new draft was made active."),
|
|
349
|
+
previous_active_build_id: z.number().nullable(),
|
|
350
|
+
issues: z
|
|
351
|
+
.array(z.string())
|
|
352
|
+
.describe("Problems the compiler flagged, e.g. a referenced file that does not exist. Fix them before publishing."),
|
|
353
|
+
page_count: z.number(),
|
|
354
|
+
llms_txt: z.enum(["kept", "set", "removed", "none"]),
|
|
355
|
+
live: z.literal(false).describe("Always false: save_page never changes the live site; the draft goes live only with publish_build."),
|
|
356
|
+
preview_url: z.string().describe("Where the user can preview this draft: the project in the micropage editor."),
|
|
357
|
+
live_url: z.string().nullable().describe("The public URL; it still shows the last published build."),
|
|
358
|
+
next: z.string(),
|
|
359
|
+
});
|
|
360
|
+
export async function runSavePage(ctx, args) {
|
|
361
|
+
const text = concatPages(args.pages);
|
|
362
|
+
await gateTool(ctx, "save_page");
|
|
363
|
+
const project = await resolveProject(ctx, args.project);
|
|
364
|
+
const saved = await saveDraft(ctx.http, ctx.config, {
|
|
365
|
+
projectId: project.id,
|
|
366
|
+
activeBuildId: project.active_build_id,
|
|
367
|
+
text,
|
|
368
|
+
llmsTxt: args.llms_txt,
|
|
369
|
+
});
|
|
370
|
+
return {
|
|
371
|
+
project: summarize({ ...project, active_build_id: saved.build.id }),
|
|
372
|
+
build: saved.build,
|
|
373
|
+
action: saved.action,
|
|
374
|
+
previous_active_build_id: saved.previous_active_build_id,
|
|
375
|
+
issues: saved.issues,
|
|
376
|
+
page_count: saved.page_count,
|
|
377
|
+
llms_txt: saved.llms_txt,
|
|
378
|
+
live: false,
|
|
379
|
+
preview_url: project.editor_url,
|
|
380
|
+
live_url: project.live_url,
|
|
381
|
+
next: "Saved as a draft: it never goes live until publish_build. Show the user the preview_url" +
|
|
382
|
+
(saved.issues.length > 0 ? " and fix the issues listed" : "") +
|
|
383
|
+
`, and call publish_build (build "id:${saved.build.id}", confirm: true) only when the user asks to publish.`,
|
|
384
|
+
};
|
|
385
|
+
}
|
|
386
|
+
// ---------------------------------------------------------------------------
|
|
387
|
+
// delete_project (registered only with MICROPAGE_MCP_ALLOW_DELETE=1)
|
|
388
|
+
// ---------------------------------------------------------------------------
|
|
389
|
+
export const DeleteProjectInput = z
|
|
390
|
+
.object({
|
|
391
|
+
project: ProjectRef,
|
|
392
|
+
confirm_domain: z
|
|
393
|
+
.string()
|
|
394
|
+
.trim()
|
|
395
|
+
.max(300)
|
|
396
|
+
.optional()
|
|
397
|
+
.describe("The project's micropage domain, typed back to confirm (e.g. \"acme-3f9a1c\" or \"acme-3f9a1c.micropage.sh\"). " +
|
|
398
|
+
"Ask the user to confirm the deletion first; get_project shows the domain."),
|
|
399
|
+
})
|
|
400
|
+
.strict();
|
|
401
|
+
export const DeleteProjectOutput = z.object({
|
|
402
|
+
deleted: z.boolean(),
|
|
403
|
+
already_removed: z.boolean().describe("True when the server reported the project as already gone (HTTP 404)."),
|
|
404
|
+
project_id: z.number(),
|
|
405
|
+
uuid: z.string(),
|
|
406
|
+
domain: z.string().nullable(),
|
|
407
|
+
note: z.string(),
|
|
408
|
+
});
|
|
409
|
+
export const DELETE_ELICIT_KEY = "confirm_delete_project";
|
|
410
|
+
export async function runDeleteProject(ctx, args, handlerCtx) {
|
|
411
|
+
await gateTool(ctx, "delete_project");
|
|
412
|
+
const project = await resolveProject(ctx, args.project);
|
|
413
|
+
const expected = project.domain ?? project.uuid;
|
|
414
|
+
const suffix = `.${ctx.config.baseDomain.toLowerCase()}`;
|
|
415
|
+
const given = args.confirm_domain?.toLowerCase().endsWith(suffix)
|
|
416
|
+
? args.confirm_domain.slice(0, -suffix.length)
|
|
417
|
+
: args.confirm_domain;
|
|
418
|
+
requireConfirmMatch(given, expected, "confirm_domain", `Deleting project "${project.name ?? expected}"`);
|
|
419
|
+
const outcome = elicitConfirmation(handlerCtx, ctx.clientCapabilities(handlerCtx), {
|
|
420
|
+
key: DELETE_ELICIT_KEY,
|
|
421
|
+
message: `Permanently delete the micropage project "${project.name ?? expected}" (${project.live_url ?? expected})? ` +
|
|
422
|
+
"Its site goes offline and the project and its builds are removed. This cannot be undone.",
|
|
423
|
+
});
|
|
424
|
+
if (outcome.status === "pending")
|
|
425
|
+
return outcome.result;
|
|
426
|
+
if (outcome.status === "declined") {
|
|
427
|
+
throw new MicropageError("DECLINED", "The user declined the deletion in the confirmation prompt. Nothing was deleted.");
|
|
428
|
+
}
|
|
429
|
+
// delete-project answers 403 both for "not yours" and for a project that is
|
|
430
|
+
// gone, so only a 404 is read as already removed. The project was resolved
|
|
431
|
+
// above, so a 403 here is a real refusal or a race, and is reported as such.
|
|
432
|
+
let alreadyRemoved = false;
|
|
433
|
+
try {
|
|
434
|
+
await ctx.http.invoke("delete-project", { projectId: project.id });
|
|
435
|
+
}
|
|
436
|
+
catch (err) {
|
|
437
|
+
if (err instanceof MicropageError && err.status === 404)
|
|
438
|
+
alreadyRemoved = true;
|
|
439
|
+
else if (err instanceof MicropageError && err.status === 403) {
|
|
440
|
+
throw new MicropageError("DELETE_REFUSED", `micropage refused to delete "${project.name ?? expected}" (HTTP 403: project not found or access denied). It may have ` +
|
|
441
|
+
"been deleted meanwhile; call get_project to check. Nothing else was changed.", { status: 403, data: err.data, cause: err });
|
|
442
|
+
}
|
|
443
|
+
else
|
|
444
|
+
throw err;
|
|
445
|
+
}
|
|
446
|
+
return {
|
|
447
|
+
deleted: true,
|
|
448
|
+
already_removed: alreadyRemoved,
|
|
449
|
+
project_id: project.id,
|
|
450
|
+
uuid: project.uuid,
|
|
451
|
+
domain: project.domain,
|
|
452
|
+
note: alreadyRemoved
|
|
453
|
+
? "The project was already removed on the server."
|
|
454
|
+
: "Deletion started. The site, its Cloudflare Pages project and DNS are cleaned up in the background over the next minutes.",
|
|
455
|
+
};
|
|
456
|
+
}
|
|
457
|
+
// ---------------------------------------------------------------------------
|
|
458
|
+
export function registerProjectTools(server, ctx) {
|
|
459
|
+
server.registerTool("list_projects", {
|
|
460
|
+
title: "List micropage projects",
|
|
461
|
+
description: `List every micropage project in the signed-in account: uuid, numeric id, name, micropage domain, custom domain, live URL, editor URL, and the status and number of each project's active build.
|
|
462
|
+
|
|
463
|
+
Use it to find the \`project\` value other tools need (uuid, id or domain all work), or when the user refers to a site by name and you do not know which project it is. The active build is the one the editor and CLI work on; it can be a draft newer than what is live, so call get_project for what is actually deployed, failure reasons and custom-domain status.
|
|
464
|
+
|
|
465
|
+
Read-only. Not available with a deploy token, which is limited to its one project.`,
|
|
466
|
+
inputSchema: ListProjectsInput,
|
|
467
|
+
outputSchema: ListProjectsOutput,
|
|
468
|
+
annotations: RO,
|
|
469
|
+
}, async () => {
|
|
470
|
+
const result = await runListProjects(ctx);
|
|
471
|
+
return structuredResult(result, `${result.count} project(s).`);
|
|
472
|
+
});
|
|
473
|
+
server.registerTool("get_project", {
|
|
474
|
+
title: "Show one micropage project",
|
|
475
|
+
description: `Show one micropage project in detail: live URL, editor URL, the active build (the default publish target), the latest build, the build that is live now, the failure reason if a build failed, and read-only custom-domain status (Cloudflare hostname and certificate state, and the CNAME target).
|
|
476
|
+
|
|
477
|
+
Use it to check what is live versus drafted before publishing, to explain why a build failed, or to answer "is my custom domain working?". Accepts the project's uuid, numeric id, micropage domain ("acme" or "acme.micropage.sh") or custom domain.
|
|
478
|
+
|
|
479
|
+
It does not return the page source (use get_page_source) or follow a deploy in progress (use get_deploy_status), and it cannot change the custom domain; that is done in the micropage editor.`,
|
|
480
|
+
inputSchema: GetProjectInput,
|
|
481
|
+
outputSchema: GetProjectOutput,
|
|
482
|
+
annotations: RO,
|
|
483
|
+
}, async (args) => {
|
|
484
|
+
const result = await runGetProject(ctx, args);
|
|
485
|
+
const p = result.project;
|
|
486
|
+
return structuredResult(result, `${p.name ?? p.uuid}: ${p.live_url ?? "no live URL yet"}.`);
|
|
487
|
+
});
|
|
488
|
+
server.registerTool("get_page_source", {
|
|
489
|
+
title: "Read a project's .page source",
|
|
490
|
+
description: `Return the raw .page markup of a micropage project's active build (or of a given build number), plus its stored llms.txt and the filenames uploaded to the project.
|
|
491
|
+
|
|
492
|
+
Call it before editing an existing site: change the returned source and send the whole file back with save_page as landing.page. Pass \`version\` to read an older build, e.g. to restore it. The source was merged from all .page files when saved, so it comes back as one file.
|
|
493
|
+
|
|
494
|
+
Read-only; it does not show what is live (get_project tells you which build is deployed) and does not download images.`,
|
|
495
|
+
inputSchema: GetPageSourceInput,
|
|
496
|
+
outputSchema: GetPageSourceOutput,
|
|
497
|
+
annotations: RO,
|
|
498
|
+
}, async (args) => {
|
|
499
|
+
const result = await runGetPageSource(ctx, args);
|
|
500
|
+
const b = result.build;
|
|
501
|
+
return structuredResult(result, b ? `Source of build v${b.number ?? "?"} (${b.status ?? "unknown"}${b.is_active ? ", active" : ""}).` : "This project has no builds yet.");
|
|
502
|
+
});
|
|
503
|
+
server.registerTool("create_project", {
|
|
504
|
+
title: "Create a micropage project",
|
|
505
|
+
description: `Create a new, empty micropage project in the signed-in account and return it together with a complete starter .page file (one of the bundled examples) to adapt.
|
|
506
|
+
|
|
507
|
+
Use it when the user wants a new site. Each call creates another project and counts against the plan's project limit (Pro: 5, Pro+: 20), so check list_projects first when the user may mean an existing site. Nothing is published: write the page, call save_page, and publish only on request.
|
|
508
|
+
|
|
509
|
+
It does not write local files (it is not \`micropage projects create\`) and cannot set a custom domain; that is done in the editor.`,
|
|
510
|
+
inputSchema: CreateProjectInput,
|
|
511
|
+
outputSchema: CreateProjectOutput,
|
|
512
|
+
annotations: WRITE,
|
|
513
|
+
}, async (args) => {
|
|
514
|
+
const result = await runCreateProject(ctx, args);
|
|
515
|
+
return structuredResult(result, `Created ${result.project.name ?? result.project.uuid} (${result.project.domain ?? "no domain"}). Not live yet.`);
|
|
516
|
+
});
|
|
517
|
+
server.registerTool("save_page", {
|
|
518
|
+
title: "Save .page source as a draft",
|
|
519
|
+
description: `Compile .page markup and save it as the project's draft build. It never goes live until publish_build deploys it: call publish_build only when the user asks. Post changes rebuild the live site, not this draft.
|
|
520
|
+
|
|
521
|
+
Pass the whole site source each time (pages: [{ name: "landing.page", content }], extra .page files are merged after it by name). If the project's active build is a draft or a failed build it is overwritten; otherwise a new draft is created and made active. Returns the build id and number, compiler issues (such as a missing image file) and the editor URL where the user can preview the draft; drafts have no public URL.
|
|
522
|
+
|
|
523
|
+
Images are not uploaded here: call upload_asset first, then reference the file with \`img: <- filename\`. Call get_markup_reference before writing markup you are unsure of. Saving also registers the source's forms on the project.`,
|
|
524
|
+
inputSchema: SavePageInput,
|
|
525
|
+
outputSchema: SavePageOutput,
|
|
526
|
+
// Overwrites the active draft (or failed build) in place.
|
|
527
|
+
annotations: DESTRUCTIVE,
|
|
528
|
+
}, async (args) => {
|
|
529
|
+
const result = await runSavePage(ctx, args);
|
|
530
|
+
const verb = result.action === "updated_draft" ? "Updated" : "Created";
|
|
531
|
+
return structuredResult(result, `${verb} draft v${result.build.number ?? "?"} (id ${result.build.id}); not live.` +
|
|
532
|
+
(result.issues.length > 0 ? ` ${result.issues.length} issue(s) to fix.` : ""));
|
|
533
|
+
});
|
|
534
|
+
if (ctx.flags.allowDelete) {
|
|
535
|
+
server.registerTool("delete_project", {
|
|
536
|
+
title: "Delete a micropage project",
|
|
537
|
+
description: `Permanently delete a micropage project: its live site goes offline, and its Cloudflare Pages project, DNS record and the project record with its builds are removed. It cannot be undone.
|
|
538
|
+
|
|
539
|
+
Only call it when the user explicitly asks to delete this specific project. Pass \`confirm_domain\` with the project's micropage domain (from get_project) after the user has confirmed; a mismatch is refused without changing anything. Clients that support it also show the user a confirmation prompt, and declining aborts.
|
|
540
|
+
|
|
541
|
+
Never use it to "reset" a site; save_page and publish_build replace the content instead. Available only because MICROPAGE_MCP_ALLOW_DELETE is set.`,
|
|
542
|
+
inputSchema: DeleteProjectInput,
|
|
543
|
+
outputSchema: DeleteProjectOutput,
|
|
544
|
+
annotations: OUT,
|
|
545
|
+
}, async (args, handlerCtx) => {
|
|
546
|
+
const result = await runDeleteProject(ctx, args, handlerCtx);
|
|
547
|
+
if (!("deleted" in result))
|
|
548
|
+
return result;
|
|
549
|
+
return structuredResult(result, `Deleted ${result.domain ?? result.uuid}.`);
|
|
550
|
+
});
|
|
551
|
+
}
|
|
552
|
+
}
|
|
553
|
+
//# sourceMappingURL=projects.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"projects.js","sourceRoot":"","sources":["../../src/tools/projects.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,CAAC,MAAM,KAAK,CAAC;AAEzB,OAAO,EAAE,WAAW,EAAE,GAAG,EAAE,EAAE,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAChE,OAAO,EAAE,aAAa,EAAE,SAAS,EAAE,YAAY,EAAE,aAAa,EAAE,SAAS,EAAwB,MAAM,qBAAqB,CAAC;AAC7H,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,EAAE,EAAE,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAC/C,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,EACL,eAAe,EACf,UAAU,EACV,cAAc,EACd,SAAS,GAGV,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAE/C,OAAO,EAAE,kBAAkB,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC;AACvE,OAAO,EAAE,qBAAqB,EAAE,YAAY,EAAE,cAAc,EAAE,QAAQ,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAE9G,8EAA8E;AAC9E,gBAAgB;AAChB,8EAA8E;AAE9E,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC;AAEvD,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,CAAC,MAAM,CAAC;IACzC,QAAQ,EAAE,CAAC,CAAC,KAAK,CACf,cAAc,CAAC,MAAM,CAAC;QACpB,YAAY,EAAE,YAAY,C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I,MAAM,CAAC,MAAM,CAAC,MAAM,mBAAmB,CAAC,CAAC,CAAC,EAAE,CAAC,CAChF,CAAC;IACJ,CAAC,CACF,CAAC;IAEF,IAAI,GAAG,CAAC,KAAK,CAAC,WAAW,EAAE,CAAC;QAC1B,MAAM,CAAC,YAAY,CACjB,gBAAgB,EAChB;YACE,KAAK,EAAE,4BAA4B;YACnC,WAAW,EAAE;;;;mJAI8H;YAC3I,WAAW,EAAE,kBAAkB;YAC/B,YAAY,EAAE,mBAAmB;YACjC,WAAW,EAAE,GAAG;SACjB,EACD,KAAK,EAAE,IAAI,EAAE,UAAU,EAAiD,EAAE;YACxE,MAAM,MAAM,GAAG,MAAM,gBAAgB,CAAC,GAAG,EAAE,IAAI,EAAE,UAAU,CAAC,CAAC;YAC7D,IAAI,CAAC,CAAC,SAAS,IAAI,MAAM,CAAC;gBAAE,OAAO,MAAM,CAAC;YAC1C,OAAO,gBAAgB,CAAC,MAAM,EAAE,WAAW,MAAM,CAAC,MAAM,IAAI,MAAM,CAAC,IAAI,GAAG,CAAC,CAAC;QAC9E,CAAC,CACF,CAAC;IACJ,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import type { CallToolResult } from "@modelcontextprotocol/server";
|
|
2
|
+
import * as z from "zod";
|
|
3
|
+
import type { ToolContext } from "../context.js";
|
|
4
|
+
/**
|
|
5
|
+
* Every tool handler except whoami calls this first, before any other
|
|
6
|
+
* network call: the deploy-token tool allowlist, then the paid-plan gate
|
|
7
|
+
* (cached 5 min; skipped in deploy-token mode, since only Pro+ can mint one).
|
|
8
|
+
*/
|
|
9
|
+
export declare function gateTool(ctx: Pick<ToolContext, "auth" | "tier">, tool: string): Promise<void>;
|
|
10
|
+
/** A result carrying structuredContent plus the same data as text for hosts that only read content. */
|
|
11
|
+
export declare function structuredResult<T extends Record<string, unknown>>(data: T, summary?: string): CallToolResult;
|
|
12
|
+
/** Build summary shared by project and build tools. */
|
|
13
|
+
export declare const BuildSummary: z.ZodObject<{
|
|
14
|
+
id: z.ZodNumber;
|
|
15
|
+
number: z.ZodNullable<z.ZodNumber>;
|
|
16
|
+
status: z.ZodNullable<z.ZodString>;
|
|
17
|
+
updated_at: z.ZodNullable<z.ZodString>;
|
|
18
|
+
failure_reason: z.ZodNullable<z.ZodString>;
|
|
19
|
+
}, z.core.$strip>;
|
|
20
|
+
export type BuildSummary = z.infer<typeof BuildSummary>;
|
|
21
|
+
export declare const BUILD_SUMMARY_COLUMNS = "id,number,status,updated_at,failure_reason";
|
|
22
|
+
export declare const ProjectSummary: z.ZodObject<{
|
|
23
|
+
id: z.ZodNumber;
|
|
24
|
+
uuid: z.ZodString;
|
|
25
|
+
name: z.ZodNullable<z.ZodString>;
|
|
26
|
+
domain: z.ZodNullable<z.ZodString>;
|
|
27
|
+
custom_domain: z.ZodNullable<z.ZodString>;
|
|
28
|
+
status: z.ZodNullable<z.ZodString>;
|
|
29
|
+
active_build_id: z.ZodNullable<z.ZodNumber>;
|
|
30
|
+
created_at: z.ZodNullable<z.ZodString>;
|
|
31
|
+
live_url: z.ZodNullable<z.ZodString>;
|
|
32
|
+
editor_url: z.ZodString;
|
|
33
|
+
}, z.core.$strip>;
|