@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 @@
|
|
|
1
|
+
{"version":3,"file":"prompts.js","sourceRoot":"","sources":["../../src/reference/prompts.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,CAAC,MAAM,KAAK,CAAC;AAEzB,MAAM,IAAI,GAAG,CAAC,KAAwC,EAAmB,EAAE,CAAC,CAAC;IAC3E,QAAQ,EAAE;QACR;YACE,IAAI,EAAE,MAAM;YACZ,OAAO,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,EAAe,EAAE,CAAC,OAAO,CAAC,KAAK,QAAQ,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE;SACpG;KACF;CACF,CAAC,CAAC;AAEH,MAAM,YAAY,GAChB,oGAAoG;IACpG,2GAA2G;IAC3G,uEAAuE,CAAC;AAE1E;;;GAGG;AACH,MAAM,UAAU,eAAe,CAAC,MAAiB;IAC/C,MAAM,CAAC,cAAc,CACnB,qBAAqB,EACrB;QACE,KAAK,EAAE,uBAAuB;QAC9B,WAAW,EACT,oLAAoL;QACtL,UAAU,EAAE,CAAC,CAAC,MAAM,CAAC;YACnB,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,2EAA2E,CAAC;YACvG,KAAK,EAAE,CAAC;iBACL,MAAM,EAAE;iBACR,QAAQ,EAAE;iBACV,QAAQ,CAAC,yEAAyE,CAAC;SACvF,CAAC;KACH,EACD,CAAC,EAAE,KAAK,EAAE,KAAK,EAAE,EAAE,EAAE,CACnB,IAAI,CAAC;QAC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AAC,EAAE,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,EAAE,EAAE,CAC/B,IAAI,CAAC;QACH,0CAA0C,OAAO,GAAG;QACpD,EAAE;QACF,UAAU,KAAK,EAAE;QACjB,QAAQ,IAAI,aAAa,QAAQ,EAAE;QACnC,EAAE;QACF,QAAQ;QACR,oHAAoH;QACpH,6GAA6G;QAC7G,+PAA+P;QAC/P,iEAAiE;QACjE,EAAE;QACF,uEAAuE;QACvE,qLAAqL;QACrL,8FAA8F;QAC9F,4KAA4K;KAC7K,CAAC,CACL,CAAC;IAEF,MAAM,CAAC,cAAc,CACnB,oBAAoB,EACpB;QACE,KAAK,EAAE,yBAAyB;QAChC,WAAW,EACT,wMAAwM;QAC1M,UAAU,EAAE,CAAC,CAAC,MAAM,CAAC;YACnB,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,+DAA+D,CAAC;YAC7F,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,iDAAiD,CAAC;SACxF,CAAC;KACH,EACD,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,EAAE,EAAE,CACpB,IAAI,CAAC;QACH,yDAAyD,OAAO,GAAG,IAAI,CAAC,CAAC,CAAC,WAAW,IAAI,GAAG,CAAC,CAAC,CAAC,EAAE,GAAG;QACpG,EAAE;QACF,QAAQ;QACR,0CAA0C,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC,iBAAiB,CAAC,CAAC,CAAC,0DAA0D,CAAC;QACpI,oKAAoK;QACpK,sGAAsG;QACtG,EAAE;QACF,4TAA4T;QAC5T,EAAE;QACF,oLAAoL;KACrL,CAAC,CACL,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { McpServer, ResourceNotFoundError, ResourceTemplate } from "@modelcontextprotocol/server";
|
|
2
|
+
import { EXAMPLES } from "../content/index.js";
|
|
3
|
+
import { DOCS, EXAMPLE_NAMES, REFERENCE_CACHE_HINT, exampleSummary, exampleUri, unknownExampleMessage, } from "./topics.js";
|
|
4
|
+
const EXAMPLE_MIME = "text/plain";
|
|
5
|
+
export function registerResources(server) {
|
|
6
|
+
for (const doc of DOCS) {
|
|
7
|
+
server.registerResource(doc.name, doc.uri, {
|
|
8
|
+
title: doc.title,
|
|
9
|
+
description: doc.description,
|
|
10
|
+
mimeType: doc.mimeType,
|
|
11
|
+
cacheHint: REFERENCE_CACHE_HINT,
|
|
12
|
+
}, async (uri) => ({ contents: [{ uri: uri.href, mimeType: doc.mimeType, text: doc.text() }] }));
|
|
13
|
+
}
|
|
14
|
+
server.registerResource("example", new ResourceTemplate("micropage://examples/{name}", {
|
|
15
|
+
list: () => ({
|
|
16
|
+
resources: EXAMPLE_NAMES.map((name) => ({
|
|
17
|
+
uri: exampleUri(name),
|
|
18
|
+
name: `example-${name}`,
|
|
19
|
+
title: `Example: ${name}`,
|
|
20
|
+
description: `${exampleSummary(name)}. A complete, valid .page example file to copy section layout and tag patterns from when writing markup.`,
|
|
21
|
+
mimeType: EXAMPLE_MIME,
|
|
22
|
+
})),
|
|
23
|
+
}),
|
|
24
|
+
complete: {
|
|
25
|
+
name: (value) => EXAMPLE_NAMES.filter((n) => n.startsWith(value)),
|
|
26
|
+
},
|
|
27
|
+
}), {
|
|
28
|
+
title: "Example .page file",
|
|
29
|
+
description: "A complete, valid .page file to copy patterns from. {name} is one of the names in micropage://examples (e.g. startup-landing, portfolio, components-pricing-and-forms).",
|
|
30
|
+
mimeType: EXAMPLE_MIME,
|
|
31
|
+
cacheHint: REFERENCE_CACHE_HINT,
|
|
32
|
+
}, async (uri, variables) => {
|
|
33
|
+
const raw = variables.name;
|
|
34
|
+
const name = Array.isArray(raw) ? raw[0] : raw;
|
|
35
|
+
const text = name === undefined ? undefined : EXAMPLES[name];
|
|
36
|
+
if (text === undefined)
|
|
37
|
+
throw new ResourceNotFoundError(uri.href, unknownExampleMessage(name ?? ""));
|
|
38
|
+
return { contents: [{ uri: uri.href, mimeType: EXAMPLE_MIME, text }] };
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
//# sourceMappingURL=resources.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resources.js","sourceRoot":"","sources":["../../src/reference/resources.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,qBAAqB,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAC;AAElG,OAAO,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAC/C,OAAO,EACL,IAAI,EACJ,aAAa,EACb,oBAAoB,EACpB,cAAc,EACd,UAAU,EACV,qBAAqB,GACtB,MAAM,aAAa,CAAC;AAErB,MAAM,YAAY,GAAG,YAAY,CAAC;AAElC,MAAM,UAAU,iBAAiB,CAAC,MAAiB;IACjD,KAAK,MAAM,GAAG,IAAI,IAAI,EAAE,CAAC;QACvB,MAAM,CAAC,gBAAgB,CACrB,GAAG,CAAC,IAAI,EACR,GAAG,CAAC,GAAG,EACP;YACE,KAAK,EAAE,GAAG,CAAC,KAAK;YAChB,WAAW,EAAE,GAAG,CAAC,WAAW;YAC5B,QAAQ,EAAE,GAAG,CAAC,QAAQ;YACtB,SAAS,EAAE,oBAAoB;SAChC,EACD,KAAK,EAAE,GAAG,EAAE,EAAE,CAAC,CAAC,EAAE,QAAQ,EAAE,CAAC,EAAE,GAAG,EAAE,GAAG,CAAC,IAAI,EAAE,QAAQ,EAAE,GAAG,CAAC,QAAQ,EAAE,IAAI,EAAE,GAAG,CAAC,IAAI,EAAE,EAAE,CAAC,EAAE,CAAC,CAC7F,CAAC;IACJ,CAAC;IAED,MAAM,CAAC,gBAAgB,CACrB,SAAS,EACT,IAAI,gBAAgB,CAAC,6BAA6B,EAAE;QAClD,IAAI,EAAE,GAAG,EAAE,CAAC,CAAC;YACX,SAAS,EAAE,aAAa,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CA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olResult, McpServer } from "@modelcontextprotocol/server";
|
|
2
|
+
import * as z from "zod";
|
|
3
|
+
export declare const TOPICS: readonly ["grammar", "grammar_full", "posts_format", "agent_guide", "examples_index", "example"];
|
|
4
|
+
export declare const GetMarkupReferenceInput: z.ZodObject<{
|
|
5
|
+
topic: z.ZodOptional<z.ZodEnum<{
|
|
6
|
+
grammar: "grammar";
|
|
7
|
+
grammar_full: "grammar_full";
|
|
8
|
+
posts_format: "posts_format";
|
|
9
|
+
agent_guide: "agent_guide";
|
|
10
|
+
examples_index: "examples_index";
|
|
11
|
+
example: "example";
|
|
12
|
+
}>>;
|
|
13
|
+
example: z.ZodOptional<z.ZodString>;
|
|
14
|
+
}, z.core.$strict>;
|
|
15
|
+
export type GetMarkupReferenceArgs = z.infer<typeof GetMarkupReferenceInput>;
|
|
16
|
+
export declare function runGetMarkupReference(args: GetMarkupReferenceArgs): CallToolResult;
|
|
17
|
+
/**
|
|
18
|
+
* The same text the micropage:// resources serve. It exists because many MCP
|
|
19
|
+
* hosts never read resources, and a model without the grammar invents tags.
|
|
20
|
+
*/
|
|
21
|
+
export declare function registerReferenceTool(server: McpServer): void;
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import * as z from "zod";
|
|
2
|
+
import { RO, hints } from "../annotations.js";
|
|
3
|
+
import { EXAMPLES } from "../content/index.js";
|
|
4
|
+
import { DOC_TOPICS, EXAMPLE_NAMES, docFor, unknownExampleMessage } from "./topics.js";
|
|
5
|
+
export const TOPICS = [...DOC_TOPICS, "example"];
|
|
6
|
+
export const GetMarkupReferenceInput = z
|
|
7
|
+
.object({
|
|
8
|
+
topic: z
|
|
9
|
+
.enum(TOPICS)
|
|
10
|
+
.optional()
|
|
11
|
+
.describe("What to return. grammar: the short .page grammar (start here). grammar_full: the complete reference. " +
|
|
12
|
+
"posts_format: post fields and lifecycle. agent_guide: editing rules. examples_index: example names. " +
|
|
13
|
+
"example: one example file (set `example`). Defaults to grammar, or to example when `example` is set."),
|
|
14
|
+
example: z
|
|
15
|
+
.string()
|
|
16
|
+
.optional()
|
|
17
|
+
.describe(`Example name, used with topic "example". One of: ${EXAMPLE_NAMES.join(", ")}.`),
|
|
18
|
+
})
|
|
19
|
+
.strict();
|
|
20
|
+
const text = (t, isError = false) => ({
|
|
21
|
+
content: [{ type: "text", text: t }],
|
|
22
|
+
...(isError ? { isError: true } : {}),
|
|
23
|
+
});
|
|
24
|
+
export function runGetMarkupReference(args) {
|
|
25
|
+
const topic = args.topic ?? (args.example !== undefined ? "example" : "grammar");
|
|
26
|
+
if (topic !== "example")
|
|
27
|
+
return text(docFor(topic).text());
|
|
28
|
+
const name = args.example?.trim().replace(/\.page$/, "");
|
|
29
|
+
if (!name)
|
|
30
|
+
return text(`topic "example" needs \`example\`: one of ${EXAMPLE_NAMES.join(", ")}.`, true);
|
|
31
|
+
const body = EXAMPLES[name];
|
|
32
|
+
return body === undefined ? text(unknownExampleMessage(name), true) : text(body);
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* The same text the micropage:// resources serve. It exists because many MCP
|
|
36
|
+
* hosts never read resources, and a model without the grammar invents tags.
|
|
37
|
+
*/
|
|
38
|
+
export function registerReferenceTool(server) {
|
|
39
|
+
server.registerTool("get_markup_reference", {
|
|
40
|
+
title: "Get the .page markup reference",
|
|
41
|
+
description: `Return micropage reference text: the .page grammar, the full reference, the posts format, the agent editing guide, the example index, or one complete example file.
|
|
42
|
+
|
|
43
|
+
Call this before writing or editing .page markup (and before drafting a post), unless you already have the grammar in context. The vocabulary is closed: tags that are not in the grammar are not rendered, so never guess. Start with topic "grammar"; use "examples_index" then "example" to copy a layout close to what the user wants.
|
|
44
|
+
|
|
45
|
+
This mirrors the micropage://grammar, micropage://grammar/full, micropage://posts/format, micropage://agent-guide and micropage://examples/{name} resources, for hosts that do not read resources. Local and read-only: no network call, no account needed.`,
|
|
46
|
+
inputSchema: GetMarkupReferenceInput,
|
|
47
|
+
annotations: hints(RO, { openWorldHint: false }),
|
|
48
|
+
}, async (args) => runGetMarkupReference(args));
|
|
49
|
+
}
|
|
50
|
+
//# sourceMappingURL=tool.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tool.js","sourceRoot":"","sources":["../../src/reference/tool.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,CAAC,MAAM,KAAK,CAAC;AAEzB,OAAO,EAAE,EAAE,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAC9C,OAAO,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAC/C,OAAO,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,EAAE,qBAAqB,EAAE,MAAM,aAAa,CAAC;AAEvF,MAAM,CAAC,MAAM,MAAM,GAAG,CAAC,GAAG,UAAU,EAAE,SAAS,CAAU,CAAC;AAE1D,MAAM,CAAC,MAAM,uBAAuB,GAAG,CAAC;KACrC,MAAM,CAAC;IACN,KAAK,EAAE,CAAC;SACL,IAAI,CAAC,MAAM,CAAC;SACZ,QAAQ,EAAE;SACV,QAAQ,CACP,uGAAuG;QACrG,sGAAsG;QACtG,sGAAsG,CACzG;IACH,OAAO,EAAE,CAAC;SACP,MAAM,EAAE;SACR,QAAQ,EAAE;SACV,QAAQ,CAAC,oDAAoD,aAAa,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC;CAC7F,CAAC;KACD,MAAM,EAAE,CAAC;AAIZ,MAAM,IAAI,GAAG,CAAC,CAAS,EAAE,OAAO,GAAG,KAAK,EAAkB,EAAE,CAAC,CAAC;IAC5D,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC,EAAE,CAAC;IACpC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;CACtC,CAAC,CAAC;AAEH,MAAM,UAAU,qBAAqB,CAAC,IAA4B;IAChE,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,IAAI,CAAC,IAAI,CAAC,OAAO,KAAK,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC;IACjF,IAAI,KAAK,KAAK,SAAS;QAAE,OAAO,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC;IAE3D,MAAM,IAAI,GAAG,IAAI,CAAC,OAAO,EAAE,IAAI,EAAE,CAAC,OAAO,CAAC,SAAS,EAAE,EAAE,CAAC,CAAC;IACzD,IAAI,CAAC,IAAI;QAAE,OAAO,IAAI,CAAC,6CAA6C,aAAa,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,IAAI,CAAC,CAAC;IACvG,MAAM,IAAI,GAAG,QAAQ,CAAC,IAAI,CAAC,CAAC;IAC5B,OAAO,IAAI,KAAK,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC,qBAAqB,CAAC,IAAI,CAAC,EAAE,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AACnF,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,qBAAqB,CAAC,MAAiB;IACrD,MAAM,CAAC,YAAY,CACjB,sBAAsB,EACtB;QACE,KAAK,EAAE,gCAAgC;QACvC,WAAW,EAAE;;;;4PAIyO;QACtP,WAAW,EAAE,uBAAuB;QACpC,WAAW,EAAE,KAAK,CAAC,EAAE,EAAE,EAAE,aAAa,EAAE,KAAK,EAAE,CAAC;KACjD,EACD,KAAK,EAAE,IAAI,EAAE,EAAE,CAAC,qBAAqB,CAAC,IAAI,CAAC,CAC5C,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import type { CacheHint } from "@modelcontextprotocol/server";
|
|
2
|
+
/** A day. The reference changes when the docs ship, not per request. */
|
|
3
|
+
export declare const REFERENCE_TTL_MS = 86400000;
|
|
4
|
+
export declare const REFERENCE_CACHE_HINT: Readonly<CacheHint>;
|
|
5
|
+
export declare const EXAMPLE_NAMES: readonly string[];
|
|
6
|
+
export declare const EXAMPLE_URI_PREFIX = "micropage://examples/";
|
|
7
|
+
export declare const exampleUri: (name: string) => string;
|
|
8
|
+
/** "Title: description" from an example's [site] block, for listings. */
|
|
9
|
+
export declare function exampleSummary(name: string): string;
|
|
10
|
+
export declare function examplesIndex(): string;
|
|
11
|
+
/** Lists the valid names, so a wrong guess can be corrected in one step. */
|
|
12
|
+
export declare function unknownExampleMessage(name: string): string;
|
|
13
|
+
export declare const DOC_TOPICS: readonly ["grammar", "grammar_full", "posts_format", "agent_guide", "examples_index"];
|
|
14
|
+
export type DocTopic = (typeof DOC_TOPICS)[number];
|
|
15
|
+
export interface DocResource {
|
|
16
|
+
topic: DocTopic;
|
|
17
|
+
name: string;
|
|
18
|
+
uri: string;
|
|
19
|
+
title: string;
|
|
20
|
+
description: string;
|
|
21
|
+
mimeType: string;
|
|
22
|
+
text: () => string;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* One table drives both the resources and get_markup_reference, so the tool
|
|
26
|
+
* can never serve something the resources don't (or vice versa).
|
|
27
|
+
*/
|
|
28
|
+
export declare const DOCS: readonly DocResource[];
|
|
29
|
+
export declare function docFor(topic: DocTopic): DocResource;
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import { AGENT_GUIDE, EXAMPLES, GRAMMAR, GRAMMAR_FULL, POSTS_FORMAT } from "../content/index.js";
|
|
2
|
+
/** A day. The reference changes when the docs ship, not per request. */
|
|
3
|
+
export const REFERENCE_TTL_MS = 86_400_000;
|
|
4
|
+
export const REFERENCE_CACHE_HINT = Object.freeze({
|
|
5
|
+
ttlMs: REFERENCE_TTL_MS,
|
|
6
|
+
cacheScope: "public",
|
|
7
|
+
});
|
|
8
|
+
export const EXAMPLE_NAMES = Object.freeze(Object.keys(EXAMPLES).sort());
|
|
9
|
+
export const EXAMPLE_URI_PREFIX = "micropage://examples/";
|
|
10
|
+
export const exampleUri = (name) => `${EXAMPLE_URI_PREFIX}${name}`;
|
|
11
|
+
/** "Title: description" from an example's [site] block, for listings. */
|
|
12
|
+
export function exampleSummary(name) {
|
|
13
|
+
const body = EXAMPLES[name] ?? "";
|
|
14
|
+
const title = /^title:\s*(.+)$/m.exec(body)?.[1]?.trim();
|
|
15
|
+
const description = /^description:\s*(.+)$/m.exec(body)?.[1]?.trim();
|
|
16
|
+
return [title, description].filter(Boolean).join(": ") || name;
|
|
17
|
+
}
|
|
18
|
+
export function examplesIndex() {
|
|
19
|
+
return [
|
|
20
|
+
"# Micropage .page examples",
|
|
21
|
+
"",
|
|
22
|
+
"Complete, valid `.page` files. Copy their patterns rather than inventing markup. Read one with",
|
|
23
|
+
"`get_markup_reference` (topic `example`, example `<name>`) or the resource `micropage://examples/<name>`.",
|
|
24
|
+
"",
|
|
25
|
+
...EXAMPLE_NAMES.map((name) => `- \`${name}\` — ${exampleSummary(name)}`),
|
|
26
|
+
"",
|
|
27
|
+
].join("\n");
|
|
28
|
+
}
|
|
29
|
+
/** Lists the valid names, so a wrong guess can be corrected in one step. */
|
|
30
|
+
export function unknownExampleMessage(name) {
|
|
31
|
+
return `Unknown example "${name}". Valid names: ${EXAMPLE_NAMES.join(", ")}.`;
|
|
32
|
+
}
|
|
33
|
+
export const DOC_TOPICS = ["grammar", "grammar_full", "posts_format", "agent_guide", "examples_index"];
|
|
34
|
+
/**
|
|
35
|
+
* One table drives both the resources and get_markup_reference, so the tool
|
|
36
|
+
* can never serve something the resources don't (or vice versa).
|
|
37
|
+
*/
|
|
38
|
+
export const DOCS = Object.freeze([
|
|
39
|
+
{
|
|
40
|
+
topic: "grammar",
|
|
41
|
+
name: "grammar",
|
|
42
|
+
uri: "micropage://grammar",
|
|
43
|
+
title: "Micropage .page grammar",
|
|
44
|
+
description: "The short, canonical .page grammar (docs.micropage.sh/llms.txt): file shape, the closed set of section and element tags, and the rules for agents. Read before writing or editing markup.",
|
|
45
|
+
mimeType: "text/markdown",
|
|
46
|
+
text: () => GRAMMAR,
|
|
47
|
+
},
|
|
48
|
+
{
|
|
49
|
+
topic: "grammar_full",
|
|
50
|
+
name: "grammar-full",
|
|
51
|
+
uri: "micropage://grammar/full",
|
|
52
|
+
title: "Micropage .page grammar (full)",
|
|
53
|
+
description: "The complete .page reference (docs.micropage.sh/llms-full.txt): every site key, element, form option and modifier with examples. Use when the short grammar does not answer the question.",
|
|
54
|
+
mimeType: "text/markdown",
|
|
55
|
+
text: () => GRAMMAR_FULL,
|
|
56
|
+
},
|
|
57
|
+
{
|
|
58
|
+
topic: "posts_format",
|
|
59
|
+
name: "posts-format",
|
|
60
|
+
uri: "micropage://posts/format",
|
|
61
|
+
title: "Posts format",
|
|
62
|
+
description: "How a post is shaped (title, slug, description, visibility, hero, email list, subject, preview, Markdown body) and its lifecycle: draft, publish, live edits, unpublish, re-send on re-publish.",
|
|
63
|
+
mimeType: "text/markdown",
|
|
64
|
+
text: () => POSTS_FORMAT,
|
|
65
|
+
},
|
|
66
|
+
{
|
|
67
|
+
topic: "agent_guide",
|
|
68
|
+
name: "agent-guide",
|
|
69
|
+
uri: "micropage://agent-guide",
|
|
70
|
+
title: "Agent guide",
|
|
71
|
+
description: "How to edit a micropage project safely: project layout, the closed tag vocabulary in brief, and the editing rules (edit in place, no invented tags, no inline colors, no markdown fences).",
|
|
72
|
+
mimeType: "text/markdown",
|
|
73
|
+
text: () => AGENT_GUIDE,
|
|
74
|
+
},
|
|
75
|
+
{
|
|
76
|
+
topic: "examples_index",
|
|
77
|
+
name: "examples",
|
|
78
|
+
uri: "micropage://examples",
|
|
79
|
+
title: "Example index",
|
|
80
|
+
description: "The bundled example .page files by name with a one-line summary each (SaaS launch, portfolio, restaurant, conference, docs, blog, component references). Pick one to copy patterns from.",
|
|
81
|
+
mimeType: "text/markdown",
|
|
82
|
+
text: examplesIndex,
|
|
83
|
+
},
|
|
84
|
+
]);
|
|
85
|
+
export function docFor(topic) {
|
|
86
|
+
const doc = DOCS.find((d) => d.topic === topic);
|
|
87
|
+
if (!doc)
|
|
88
|
+
throw new Error(`no reference document for topic ${topic}`);
|
|
89
|
+
return doc;
|
|
90
|
+
}
|
|
91
|
+
//# sourceMappingURL=topics.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"topics.js","sourceRoot":"","sources":["../../src/reference/topics.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAEjG,wEAAwE;AACxE,MAAM,CAAC,MAAM,gBAAgB,GAAG,UAAU,CAAC;AAE3C,MAAM,CAAC,MAAM,oBAAoB,GAAwB,MAAM,CAAC,MAAM,CAAC;IACrE,KAAK,EAAE,gBAAgB;IACvB,UAAU,EAAE,QAAQ;CACrB,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,aAAa,GAAsB,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC;AAE5F,MAAM,CAAC,MAAM,kBAAkB,GAAG,uBAAuB,CAAC;AAE1D,MAAM,CAAC,MAAM,UAAU,GAAG,CAAC,IAAY,EAAU,EAAE,CAAC,GAAG,kBAAkB,GAAG,IAAI,EAAE,CAAC;AAEnF,yEAAyE;AACzE,MAAM,UAAU,cAAc,CAAC,IAAY;IACzC,MAAM,IAAI,GAAG,QAAQ,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC;IAClC,MAAM,KAAK,GAAG,kBAAkB,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,CAAC;IACzD,MAAM,WAAW,GAAG,wBAAwB,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,CAAC;IACrE,OAAO,CAAC,KAAK,EAAE,WAAW,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,IAA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Ae;QACzB,IAAI,EAAE,GAAG,EAAE,CAAC,YAAY;KACzB;IACD;QACE,KAAK,EAAE,aAAa;QACpB,IAAI,EAAE,aAAa;QACnB,GAAG,EAAE,yBAAyB;QAC9B,KAAK,EAAE,aAAa;QACpB,WAAW,EACT,4LAA4L;QAC9L,QAAQ,EAAE,eAAe;QACzB,IAAI,EAAE,GAAG,EAAE,CAAC,WAAW;KACxB;IACD;QACE,KAAK,EAAE,gBAAgB;QACvB,IAAI,EAAE,UAAU;QAChB,GAAG,EAAE,sBAAsB;QAC3B,KAAK,EAAE,eAAe;QACtB,WAAW,EACT,0LAA0L;QAC5L,QAAQ,EAAE,eAAe;QACzB,IAAI,EAAE,aAAa;KACpB;CACF,CAAC,CAAC;AAEH,MAAM,UAAU,MAAM,CAAC,KAAe;IACpC,MAAM,GAAG,GAAG,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,KAAK,KAAK,KAAK,CAAC,CAAC;IAChD,IAAI,CAAC,GAAG;QAAE,MAAM,IAAI,KAAK,CAAC,mCAAmC,KAAK,EAAE,CAAC,CAAC;IACtE,OAAO,GAAG,CAAC;AACb,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { McpServer, McpServerOptions } from "@modelcontextprotocol/server";
|
|
2
|
+
import type { ToolContext } from "./context.js";
|
|
3
|
+
/**
|
|
4
|
+
* Cache hints for the list results the SDK builds itself. tools/list is left
|
|
5
|
+
* out on purpose: which tools exist depends on the user's env switches.
|
|
6
|
+
*/
|
|
7
|
+
export declare const LIST_CACHE_HINTS: NonNullable<McpServerOptions["cacheHints"]>;
|
|
8
|
+
/** micropage:// resources, the four workflow prompts, and get_markup_reference. */
|
|
9
|
+
export declare function registerReference(server: McpServer, _ctx: ToolContext): void;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { registerPrompts } from "./reference/prompts.js";
|
|
2
|
+
import { registerResources } from "./reference/resources.js";
|
|
3
|
+
import { registerReferenceTool } from "./reference/tool.js";
|
|
4
|
+
import { REFERENCE_CACHE_HINT } from "./reference/topics.js";
|
|
5
|
+
/**
|
|
6
|
+
* Cache hints for the list results the SDK builds itself. tools/list is left
|
|
7
|
+
* out on purpose: which tools exist depends on the user's env switches.
|
|
8
|
+
*/
|
|
9
|
+
export const LIST_CACHE_HINTS = {
|
|
10
|
+
"resources/list": REFERENCE_CACHE_HINT,
|
|
11
|
+
"resources/templates/list": REFERENCE_CACHE_HINT,
|
|
12
|
+
"prompts/list": REFERENCE_CACHE_HINT,
|
|
13
|
+
};
|
|
14
|
+
/** micropage:// resources, the four workflow prompts, and get_markup_reference. */
|
|
15
|
+
export function registerReference(server, _ctx) {
|
|
16
|
+
registerResources(server);
|
|
17
|
+
registerPrompts(server);
|
|
18
|
+
registerReferenceTool(server);
|
|
19
|
+
}
|
|
20
|
+
//# sourceMappingURL=reference.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"reference.js","sourceRoot":"","sources":["../src/reference.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AACzD,OAAO,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAC7D,OAAO,EAAE,qBAAqB,EAAE,MAAM,qBAAqB,CAAC;AAC5D,OAAO,EAAE,oBAAoB,EAAE,MAAM,uBAAuB,CAAC;AAE7D;;;GAGG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAgD;IAC3E,gBAAgB,EAAE,oBAAoB;IACtC,0BAA0B,EAAE,oBAAoB;IAChD,cAAc,EAAE,oBAAoB;CACrC,CAAC;AAEF,mFAAmF;AACnF,MAAM,UAAU,iBAAiB,CAAC,MAAiB,EAAE,IAAiB;IACpE,iBAAiB,CAAC,MAAM,CAAC,CAAC;IAC1B,eAAe,CAAC,MAAM,CAAC,CAAC;IACxB,qBAAqB,CAAC,MAAM,CAAC,CAAC;AAChC,CAAC"}
|
package/dist/server.d.ts
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { McpServer, type McpRequestContext, type McpServerFactory } from "@modelcontextprotocol/server";
|
|
2
|
+
import type { AuthProvider } from "./client/auth-provider.js";
|
|
3
|
+
import { type MicropageConfig } from "./client/config.js";
|
|
4
|
+
import { type FetchLike } from "./client/http.js";
|
|
5
|
+
import type { ServerDeps } from "./context.js";
|
|
6
|
+
export declare const SERVER_NAME = "micropage";
|
|
7
|
+
export interface CreateDepsOptions {
|
|
8
|
+
/** Replaces global fetch for every outbound call (tests). */
|
|
9
|
+
fetch?: FetchLike;
|
|
10
|
+
now?: () => number;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Picks where tokens come from: a deploy token when MICROPAGE_DEPLOY_TOKEN and
|
|
14
|
+
* MICROPAGE_DEPLOY_PROJECT are both set (only one set throws), else the CLI
|
|
15
|
+
* session file. The session provider is used even when the file does not
|
|
16
|
+
* exist yet, so a `micropage login` after the server started takes effect
|
|
17
|
+
* without a restart; until then every call fails with NOT_LOGGED_IN.
|
|
18
|
+
*/
|
|
19
|
+
export declare function createAuthProvider(env: NodeJS.ProcessEnv, config: MicropageConfig, options?: CreateDepsOptions): AuthProvider;
|
|
20
|
+
/** Builds the process-wide deps from the environment. */
|
|
21
|
+
export declare function createDeps(env?: NodeJS.ProcessEnv, options?: CreateDepsOptions): ServerDeps;
|
|
22
|
+
/**
|
|
23
|
+
* Builds one server instance. Transport-agnostic and factory-shaped on
|
|
24
|
+
* purpose: serveStdio calls it once per connection (plus a discarded
|
|
25
|
+
* discovery probe) and a future HTTP entry would call it per request, so all
|
|
26
|
+
* long-lived state (token refresh, caches) lives in `deps`, never here.
|
|
27
|
+
*/
|
|
28
|
+
export declare function createServer(ctx: McpRequestContext, deps: ServerDeps): McpServer;
|
|
29
|
+
export declare function createServerFactory(deps: ServerDeps): McpServerFactory;
|
package/dist/server.js
ADDED
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import { CLIENT_CAPABILITIES_META_KEY, McpServer, } from "@modelcontextprotocol/server";
|
|
2
|
+
import { loadConfig } from "./client/config.js";
|
|
3
|
+
import { DeployTokenAuthProvider, readDeployTokenEnv } from "./client/deploy-token.js";
|
|
4
|
+
import { Http } from "./client/http.js";
|
|
5
|
+
import { SessionAuthProvider, sessionFilePath } from "./client/session-store.js";
|
|
6
|
+
import { PlanGate } from "./client/tier.js";
|
|
7
|
+
import { readEnvFlags } from "./guards.js";
|
|
8
|
+
import { LIST_CACHE_HINTS, registerReference } from "./reference.js";
|
|
9
|
+
import { registerAccountTools } from "./tools/account.js";
|
|
10
|
+
import { registerBuildTools } from "./tools/builds.js";
|
|
11
|
+
import { registerFileTools } from "./tools/files.js";
|
|
12
|
+
import { registerFormTools } from "./tools/forms.js";
|
|
13
|
+
import { registerPostTools } from "./tools/posts.js";
|
|
14
|
+
import { registerProjectTools } from "./tools/projects.js";
|
|
15
|
+
import { VERSION } from "./version.js";
|
|
16
|
+
export const SERVER_NAME = "micropage";
|
|
17
|
+
/**
|
|
18
|
+
* Picks where tokens come from: a deploy token when MICROPAGE_DEPLOY_TOKEN and
|
|
19
|
+
* MICROPAGE_DEPLOY_PROJECT are both set (only one set throws), else the CLI
|
|
20
|
+
* session file. The session provider is used even when the file does not
|
|
21
|
+
* exist yet, so a `micropage login` after the server started takes effect
|
|
22
|
+
* without a restart; until then every call fails with NOT_LOGGED_IN.
|
|
23
|
+
*/
|
|
24
|
+
export function createAuthProvider(env, config, options = {}) {
|
|
25
|
+
const shared = {
|
|
26
|
+
config,
|
|
27
|
+
...(options.fetch ? { fetch: options.fetch } : {}),
|
|
28
|
+
...(options.now ? { now: options.now } : {}),
|
|
29
|
+
};
|
|
30
|
+
const deploy = readDeployTokenEnv(env);
|
|
31
|
+
if (deploy)
|
|
32
|
+
return new DeployTokenAuthProvider({ ...shared, ...deploy });
|
|
33
|
+
return new SessionAuthProvider({ ...shared, path: sessionFilePath(env) });
|
|
34
|
+
}
|
|
35
|
+
/** Builds the process-wide deps from the environment. */
|
|
36
|
+
export function createDeps(env = process.env, options = {}) {
|
|
37
|
+
const config = loadConfig(env);
|
|
38
|
+
const auth = createAuthProvider(env, config, options);
|
|
39
|
+
const http = new Http({ config, auth, ...(options.fetch ? { fetch: options.fetch } : {}) });
|
|
40
|
+
const tier = new PlanGate({ http, auth, ...(options.now ? { now: options.now } : {}) });
|
|
41
|
+
return { config, auth, http, tier, flags: readEnvFlags(env) };
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Builds one server instance. Transport-agnostic and factory-shaped on
|
|
45
|
+
* purpose: serveStdio calls it once per connection (plus a discarded
|
|
46
|
+
* discovery probe) and a future HTTP entry would call it per request, so all
|
|
47
|
+
* long-lived state (token refresh, caches) lives in `deps`, never here.
|
|
48
|
+
*/
|
|
49
|
+
export function createServer(ctx, deps) {
|
|
50
|
+
const server = new McpServer({ name: SERVER_NAME, version: VERSION }, { cacheHints: LIST_CACHE_HINTS });
|
|
51
|
+
const toolCtx = {
|
|
52
|
+
...deps,
|
|
53
|
+
era: ctx.era,
|
|
54
|
+
clientCapabilities: (handlerCtx) => {
|
|
55
|
+
if (ctx.era === "modern") {
|
|
56
|
+
const envelope = handlerCtx.mcpReq.envelope;
|
|
57
|
+
return envelope?.[CLIENT_CAPABILITIES_META_KEY];
|
|
58
|
+
}
|
|
59
|
+
// 2025-era connections declare capabilities once, at initialize.
|
|
60
|
+
return server.server.getClientCapabilities();
|
|
61
|
+
},
|
|
62
|
+
};
|
|
63
|
+
registerAccountTools(server, toolCtx);
|
|
64
|
+
registerProjectTools(server, toolCtx);
|
|
65
|
+
registerBuildTools(server, toolCtx);
|
|
66
|
+
registerFileTools(server, toolCtx);
|
|
67
|
+
registerFormTools(server, toolCtx);
|
|
68
|
+
registerPostTools(server, toolCtx);
|
|
69
|
+
registerReference(server, toolCtx);
|
|
70
|
+
return server;
|
|
71
|
+
}
|
|
72
|
+
export function createServerFactory(deps) {
|
|
73
|
+
return (ctx) => createServer(ct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";
|
|
2
|
+
import * as z from "zod";
|
|
3
|
+
import type { ToolContext } from "../context.js";
|
|
4
|
+
export declare const WhoamiInput: z.ZodObject<{}, z.core.$strict>;
|
|
5
|
+
export declare const WhoamiOutput: z.ZodObject<{
|
|
6
|
+
logged_in: z.ZodBoolean;
|
|
7
|
+
auth_mode: z.ZodEnum<{
|
|
8
|
+
session: "session";
|
|
9
|
+
deploy_token: "deploy_token";
|
|
10
|
+
none: "none";
|
|
11
|
+
}>;
|
|
12
|
+
user_id: z.ZodNullable<z.ZodString>;
|
|
13
|
+
email: z.ZodNullable<z.ZodString>;
|
|
14
|
+
name: z.ZodNullable<z.ZodString>;
|
|
15
|
+
plan_tier: z.ZodNullable<z.ZodEnum<{
|
|
16
|
+
free: "free";
|
|
17
|
+
pro: "pro";
|
|
18
|
+
pro_plus: "pro_plus";
|
|
19
|
+
}>>;
|
|
20
|
+
paid_plan: z.ZodNullable<z.ZodBoolean>;
|
|
21
|
+
subscription: z.ZodNullable<z.ZodObject<{
|
|
22
|
+
status: z.ZodNullable<z.ZodString>;
|
|
23
|
+
plan_tier: z.ZodNullable<z.ZodString>;
|
|
24
|
+
provider: z.ZodNullable<z.ZodString>;
|
|
25
|
+
product_name: z.ZodNullable<z.ZodString>;
|
|
26
|
+
current_period_end: z.ZodNullable<z.ZodString>;
|
|
27
|
+
}, z.core.$strip>>;
|
|
28
|
+
pinned_project_uuid: z.ZodNullable<z.ZodString>;
|
|
29
|
+
config_path: z.ZodNullable<z.ZodString>;
|
|
30
|
+
note: z.ZodNullable<z.ZodString>;
|
|
31
|
+
}, z.core.$strip>;
|
|
32
|
+
export type WhoamiResult = z.infer<typeof WhoamiOutput>;
|
|
33
|
+
export declare function runWhoami(ctx: ToolContext): Promise<WhoamiResult>;
|
|
34
|
+
export declare function registerAccountTools(server: McpServer, ctx: ToolContext): void;
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
import * as z from "zod";
|
|
2
|
+
import { RO } from "../annotations.js";
|
|
3
|
+
import { isMicropageError } from "../client/errors.js";
|
|
4
|
+
import { eq, inList } from "../client/http.js";
|
|
5
|
+
import { decodeJwtClaims } from "../client/jwt.js";
|
|
6
|
+
import { LOGIN_HINT, SessionAuthProvider } from "../client/session-store.js";
|
|
7
|
+
import { UPGRADE_MESSAGE, isPaidTier } from "../client/tier.js";
|
|
8
|
+
import { assertDeployTokenAllows } from "../guards.js";
|
|
9
|
+
import { structuredResult } from "./shared.js";
|
|
10
|
+
export const WhoamiInput = z.object({}).strict();
|
|
11
|
+
export const WhoamiOutput = z.object({
|
|
12
|
+
logged_in: z.boolean(),
|
|
13
|
+
auth_mode: z.enum(["session", "deploy_token", "none"]),
|
|
14
|
+
user_id: z.string().nullable(),
|
|
15
|
+
email: z.string().nullable(),
|
|
16
|
+
name: z.string().nullable(),
|
|
17
|
+
plan_tier: z.enum(["free", "pro", "pro_plus"]).nullable().describe("Null when it could not be read."),
|
|
18
|
+
paid_plan: z.boolean().nullable().describe("Every tool except whoami and get_markup_reference needs a paid plan."),
|
|
19
|
+
subscription: z
|
|
20
|
+
.object({
|
|
21
|
+
status: z.string().nullable(),
|
|
22
|
+
plan_tier: z.string().nullable(),
|
|
23
|
+
provider: z.string().nullable(),
|
|
24
|
+
product_name: z.string().nullable(),
|
|
25
|
+
current_period_end: z.string().nullable(),
|
|
26
|
+
})
|
|
27
|
+
.nullable(),
|
|
28
|
+
pinned_project_uuid: z.string().nullable().describe("Deploy-token mode only: the one project this server may touch."),
|
|
29
|
+
config_path: z.string().nullable().describe("The CLI session file in use (session mode)."),
|
|
30
|
+
note: z.string().nullable().describe("What to tell the user, when something needs their action."),
|
|
31
|
+
});
|
|
32
|
+
const AUTH_FAILURES = new Set(["NOT_LOGGED_IN", "SESSION_EXPIRED", "SESSION_UNREADABLE", "DEPLOY_TOKEN_INVALID"]);
|
|
33
|
+
export async function runWhoami(ctx) {
|
|
34
|
+
assertDeployTokenAllows(ctx.auth, "whoami");
|
|
35
|
+
const configPath = ctx.auth instanceof SessionAuthProvider ? ctx.auth.path : null;
|
|
36
|
+
const base = {
|
|
37
|
+
logged_in: false,
|
|
38
|
+
auth_mode: ctx.auth.mode,
|
|
39
|
+
user_id: null,
|
|
40
|
+
email: null,
|
|
41
|
+
name: null,
|
|
42
|
+
plan_tier: null,
|
|
43
|
+
paid_plan: null,
|
|
44
|
+
subscription: null,
|
|
45
|
+
pinned_project_uuid: ctx.auth.pinnedProjectUuid ?? null,
|
|
46
|
+
config_path: configPath,
|
|
47
|
+
note: null,
|
|
48
|
+
};
|
|
49
|
+
let token;
|
|
50
|
+
try {
|
|
51
|
+
token = await ctx.auth.getAccessToken();
|
|
52
|
+
}
|
|
53
|
+
catch (err) {
|
|
54
|
+
if (isMicropageError(err) && AUTH_FAILURES.has(err.code)) {
|
|
55
|
+
return { ...base, note: err.message };
|
|
56
|
+
}
|
|
57
|
+
throw err;
|
|
58
|
+
}
|
|
59
|
+
const claims = decodeJwtClaims(token);
|
|
60
|
+
let user;
|
|
61
|
+
if (ctx.auth.mode === "deploy_token") {
|
|
62
|
+
// The minted deploy JWT has no auth session behind it, so read identity from its claims.
|
|
63
|
+
user = { ...(claims?.sub ? { id: claims.sub } : {}), email: claims?.email ?? null };
|
|
64
|
+
}
|
|
65
|
+
else {
|
|
66
|
+
try {
|
|
67
|
+
user = await ctx.http.request("GET", `${ctx.config.supabaseUrl}/auth/v1/user`);
|
|
68
|
+
}
|
|
69
|
+
catch (err) {
|
|
70
|
+
if (isMicropageError(err) && AUTH_FAILURES.has(err.code)) {
|
|
71
|
+
return { ...base, note: `The micropage login session is no longer valid. ${LOGIN_HINT}` };
|
|
72
|
+
}
|
|
73
|
+
throw err;
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
const userId = user.id ?? claims?.sub ?? null;
|
|
77
|
+
let tier = null;
|
|
78
|
+
try {
|
|
79
|
+
tier = await ctx.tier.getPlanTier();
|
|
80
|
+
}
|
|
81
|
+
catch {
|
|
82
|
+
// Reported as null; the gate in other tools will surface the real error.
|
|
83
|
+
}
|
|
84
|
+
let subscription = null;
|
|
85
|
+
if (userId) {
|
|
86
|
+
subscription = await ctx.http
|
|
87
|
+
.selectOne("subscriptions", {
|
|
88
|
+
select: "status,plan_tier,provider,product_name,current_period_end",
|
|
89
|
+
filters: { user_id: eq(userId), status: inList(["active", "trialing", "paused"]) },
|
|
90
|
+
order: "updated_at.desc",
|
|
91
|
+
})
|
|
92
|
+
.catch(() => null);
|
|
93
|
+
}
|
|
94
|
+
const meta = user.user_metadata ?? {};
|
|
95
|
+
const name = [meta.full_name, meta.user_name, meta.name].find((v) => typeof v === "string" && v !== "");
|
|
96
|
+
const paid = tier === null ? null : isPaidTier(tier);
|
|
97
|
+
return {
|
|
98
|
+
...base,
|
|
99
|
+
logged_in: true,
|
|
100
|
+
user_id: userId,
|
|
101
|
+
email: user.email ?? null,
|
|
102
|
+
name: name ?? null,
|
|
103
|
+
plan_tier: tier,
|
|
104
|
+
paid_plan: ctx.auth.mode === "deploy_token" ? true : paid,
|
|
105
|
+
subscription,
|
|
106
|
+
note: paid === false && ctx.auth.mode !== "deploy_token" ? UPGRADE_MESSAGE : null,
|
|
107
|
+
};
|
|
108
|
+
}
|
|
109
|
+
export function registerAccountTools(server, ctx) {
|
|
110
|
+
server.registerTool("whoami", {
|
|
111
|
+
title: "Show the micropage account in use",
|
|
112
|
+
description: `Report which micropage account this server acts as: email, plan tier, subscription, and whether it runs on the user's \`micropage login\` session or on a project deploy token (and if so, which project it is pinned to).
|
|
113
|
+
|
|
114
|
+
Call it first when a micropage tool fails with a login, session or plan error, or when the user asks which account is connected. It never fails for a missing login: it returns logged_in false and a note saying what the user must do (usually run \`micropage login\` in a terminal). It does not log in, log out, or change anything.
|
|
115
|
+
|
|
116
|
+
Do not call it before every task; the other tools report login and plan problems themselves.`,
|
|
117
|
+
inputSchema: WhoamiInput,
|
|
118
|
+
outputSchema: WhoamiOutput,
|
|
119
|
+
annotations: RO,
|
|
120
|
+
}, async () => {
|
|
121
|
+
const result = await runWhoami(ctx);
|
|
122
|
+
const summary = result.logged_in
|
|
123
|
+
? `Signed in as ${result.email ?? result.user_id ?? "(unknown)"} (${result.plan_tier ?? "plan unknown"}, ${result.auth_mode}).`
|
|
124
|
+
: `Not signed in. ${result.note ?? ""}`.trim();
|
|
125
|
+
return structuredResult(result, summary);
|
|
126
|
+
});
|
|
127
|
+
}
|
|
128
|
+
//# sourceMappingURL=account.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"account.js","sourceRoot":"","sources":["../../src/tools/account.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,CAAC,MAAM,KAAK,CAAC;AAEzB,OAAO,EAAE,EAAE,EAAE,MAAM,mBAAmB,CAAC;AACvC,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AACvD,OAAO,EAAE,EAAE,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAC/C,OAAO,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AACnD,OAAO,EAAE,UAAU,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAC;AAC7E,OAAO,EAAE,eAAe,EAAE,UAAU,EAAiB,MAAM,mBAAmB,CAAC;AAE/E,OAAO,EAAE,uBAAuB,EAAE,MAAM,cAAc,CAAC;AACvD,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAE/C,MAAM,CAAC,MAAM,WAAW,GAAG,CAAC,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC;AAEjD,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC,CAAC,MAAM,CAAC;IACnC,SAAS,EAAE,CAAC,CAAC,OAAO,EAAE;IACtB,SAAS,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,SAAS,EAAE,cAAc,EAAE,MAAM,CAAC,CAAC;IACtD,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAC9B,KAAK,EAAE,CA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