@caelo-cms/mcp-server 0.10.55 → 0.10.57

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.
Files changed (46) hide show
  1. package/LICENSE +373 -0
  2. package/README.md +7 -0
  3. package/dist/admin-server.d.ts +1 -15
  4. package/dist/admin-server.d.ts.map +1 -1
  5. package/dist/admin-server.js +72 -302
  6. package/dist/admin-server.js.map +1 -1
  7. package/dist/admin.js +7 -8
  8. package/dist/admin.js.map +1 -1
  9. package/dist/chat-bridge.d.ts +1 -1
  10. package/dist/chat-bridge.d.ts.map +1 -1
  11. package/dist/image-upload.d.ts +2 -75
  12. package/dist/image-upload.d.ts.map +1 -1
  13. package/dist/image-upload.js +40 -134
  14. package/dist/image-upload.js.map +1 -1
  15. package/dist/index.js +38 -30
  16. package/dist/index.js.map +1 -1
  17. package/dist/server.d.ts +0 -6
  18. package/dist/server.d.ts.map +1 -1
  19. package/dist/server.js +24 -259
  20. package/dist/server.js.map +1 -1
  21. package/dist/surfaces/admin-surface.d.ts +106 -0
  22. package/dist/surfaces/admin-surface.d.ts.map +1 -0
  23. package/dist/surfaces/admin-surface.js +183 -0
  24. package/dist/surfaces/admin-surface.js.map +1 -0
  25. package/dist/surfaces/chat-surface.d.ts +48 -0
  26. package/dist/surfaces/chat-surface.d.ts.map +1 -0
  27. package/dist/surfaces/chat-surface.js +190 -0
  28. package/dist/surfaces/chat-surface.js.map +1 -0
  29. package/dist/surfaces/index.d.ts +15 -0
  30. package/dist/surfaces/index.d.ts.map +1 -0
  31. package/dist/surfaces/index.js +15 -0
  32. package/dist/surfaces/index.js.map +1 -0
  33. package/dist/surfaces/upload.d.ts +32 -0
  34. package/dist/surfaces/upload.d.ts.map +1 -0
  35. package/dist/surfaces/upload.js +58 -0
  36. package/dist/surfaces/upload.js.map +1 -0
  37. package/dist/tool-definitions.d.ts +465 -0
  38. package/dist/tool-definitions.d.ts.map +1 -0
  39. package/dist/tool-definitions.js +256 -0
  40. package/dist/tool-definitions.js.map +1 -0
  41. package/dist/unconfigured.d.ts +26 -0
  42. package/dist/unconfigured.d.ts.map +1 -0
  43. package/dist/unconfigured.js +82 -0
  44. package/dist/unconfigured.js.map +1 -0
  45. package/package.json +10 -1
  46. package/power-catalogue.json +8030 -0
@@ -0,0 +1,256 @@
1
+ // SPDX-License-Identifier: MPL-2.0
2
+ /**
3
+ * The MCP tool definitions, input schemas and `instructions` of Caelo's two
4
+ * MCP surfaces — ONE copy, used by the stdio shims in this package and by
5
+ * the admin's remote Streamable HTTP endpoints (issue #806). A connecting
6
+ * agent must see the same names, schemas and instructions whichever way it
7
+ * reaches the site; editing them here changes both.
8
+ *
9
+ * Pure module (zod only): no transport, no filesystem, no network.
10
+ */
11
+ import { z } from "zod";
12
+ // ─── instructions (#552) ────────────────────────────────────────────────
13
+ /**
14
+ * MCP `instructions` for the chat-scope server (#552), injected into the
15
+ * connecting agent's context so it uses caelo_chat as a conversation with
16
+ * the site's own agent rather than a one-shot command.
17
+ */
18
+ export const CHAT_MCP_INSTRUCTIONS = [
19
+ "This server talks to a Caelo CMS site's own AI agent through caelo_chat; describe the outcome you want and the agent decides how to build it.",
20
+ "Pass the chatSessionId from a reply to continue the same conversation; omit it only to start a new one.",
21
+ "Changes land on that chat's preview branch; nothing reaches the live site until the operator publishes in the Caelo admin. Some actions wait for the operator's approval click there.",
22
+ "When a reply says the turn is waiting for the operator's approval, call caelo_await_approval with the chatSessionId: it waits for the decision and returns your turn's continuation. Never re-send the request; you cannot approve anything yourself.",
23
+ ].join("\n");
24
+ /**
25
+ * MCP `instructions` for the admin server (#552). Clients such as Claude
26
+ * Code put this into the agent's context on connect, so a freshly
27
+ * connected agent knows the session protocol without the operator
28
+ * pasting anything: without a session every write fails, without the
29
+ * context it works without the site's rules and brand voice.
30
+ */
31
+ export const ADMIN_MCP_INSTRUCTIONS = [
32
+ "This server edits a Caelo CMS site. Before any other caelo tool:",
33
+ "1. Call caelo_open_session once. It resumes the operator's most recent open session (pass newSession: true only when the operator asks for a fresh one; chatSessionId resumes a specific one). Every write lands in the site's shared draft (or the session's own experiment branch); you may stage finished work with stage_changes, but nothing reaches the live site until the operator clicks Publish live in the Caelo admin.",
34
+ "2. Call caelo_get_context once and follow it: it carries the site model, tool playbook, staging rules, site memory (brand voice, glossary) and the skills index.",
35
+ "3. Load every skill the context marks ALWAYS APPLIES with load_skill before the work it covers (e.g. before writing any visitor-facing copy).",
36
+ "Every tool in this list works over MCP, including approval-gated ones (marked APPROVAL-GATED — deploys, users/roles, languages/locales, plugin settings, bulk deletes …). Call them yourself: Caelo shows the operator an approval card in the Caelo admin (their Live Edit chat and the pending-approvals page), the call waits for Approve/Reject and returns the decision; if the wait times out, call caelo_await_approval with the proposalId. Tell the operator what you requested and that they approve the card in Caelo. Never ask the operator to paste a prompt into the Caelo admin chat or to do a step there that a tool here can do, and never re-propose a pending proposal.",
37
+ "After every stage_changes, call get_quality_audit (it waits for the result) and fix every open problem it names, then Stage and re-read until it passes: the target is 100 in every category and zero findings, and a score that dropped since the page's previous audit points at a recent change — check those changes first. Do not report open scores or findings to the operator as a result — only what you proved cannot be fixed in the site.",
38
+ "Tool errors name the next step to take; follow them instead of retrying unchanged.",
39
+ ].join("\n");
40
+ // ─── caelo_upload_images (both surfaces) ────────────────────────────────
41
+ /** Per-image size cap (matches the admin's chat-attachment cap). */
42
+ export const MAX_IMAGE_BYTES = 5 * 1024 * 1024;
43
+ /** Uploaded media references accepted by caelo_chat; never accept object-store keys. */
44
+ export const uploadedImageSchema = z
45
+ .object({
46
+ assetId: z.string().uuid(),
47
+ mime: z.enum(["image/png", "image/jpeg", "image/webp", "image/gif"]),
48
+ alt: z.string().max(2048).optional(),
49
+ })
50
+ .strict();
51
+ const imageInput = z
52
+ .object({
53
+ filePath: z.string().min(1).max(4096).optional(),
54
+ base64: z
55
+ .string()
56
+ .min(4)
57
+ .max(Math.ceil(MAX_IMAGE_BYTES / 3) * 4)
58
+ .regex(/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/)
59
+ .optional(),
60
+ filename: z.string().min(1).max(512).optional(),
61
+ alt: z.string().max(2048).optional(),
62
+ reference: z.boolean().optional(),
63
+ })
64
+ .strict()
65
+ .refine((i) => (i.filePath === undefined) !== (i.base64 === undefined), "Supply exactly one of filePath or base64");
66
+ /** A bounded batch; each file has its own success/error result for safe retries. */
67
+ export const uploadImagesInput = z.object({ images: z.array(imageInput).min(1).max(4) }).strict();
68
+ const UPLOAD_IMAGES_INPUT_SCHEMA = {
69
+ type: "object",
70
+ required: ["images"],
71
+ additionalProperties: false,
72
+ properties: {
73
+ images: {
74
+ type: "array",
75
+ minItems: 1,
76
+ maxItems: 4,
77
+ items: {
78
+ type: "object",
79
+ additionalProperties: false,
80
+ properties: {
81
+ filePath: {
82
+ type: "string",
83
+ description: "Path on the MCP server machine. Mutually exclusive with base64.",
84
+ },
85
+ base64: {
86
+ type: "string",
87
+ description: "Raw image bytes as base64. Mutually exclusive with filePath.",
88
+ },
89
+ filename: { type: "string", description: "Optional media filename." },
90
+ alt: { type: "string", description: "Optional description of the image." },
91
+ reference: {
92
+ type: "boolean",
93
+ description: "True for an image that only guides generation/editing; it is never placed on a page.",
94
+ },
95
+ },
96
+ oneOf: [{ required: ["filePath"] }, { required: ["base64"] }],
97
+ },
98
+ },
99
+ },
100
+ };
101
+ const UPLOAD_IMAGES_COMMON = "Files become shared CMS media assets. Set reference: true for images that only guide image generation or editing " +
102
+ "(character sheets, style samples): they stay out of the page-image library and are never published. " +
103
+ "Returns attachments for caelo_chat " +
104
+ "or asset IDs for page tools. Uploading does not send a chat message or publish a page. " +
105
+ "Results are per file: retry only failures.";
106
+ /** Exposed in both stdio catalogues, including chat-scoped connections. */
107
+ export const UPLOAD_IMAGES_TOOL = {
108
+ name: "caelo_upload_images",
109
+ description: "Upload 1–4 PNG, JPEG, WebP or GIF images (5 MiB each) to the Caelo media library. " +
110
+ "Prefer filePath for files on the machine running this MCP server; otherwise supply raw base64 (no data URL). " +
111
+ `${UPLOAD_IMAGES_COMMON} Requires the token owner's current content.write permission.`,
112
+ inputSchema: UPLOAD_IMAGES_INPUT_SCHEMA,
113
+ };
114
+ /**
115
+ * The same tool over a remote connection (#806): identical name and schema;
116
+ * the description says what differs — the server runs in the Caelo admin,
117
+ * so it cannot read files on the agent's machine and only base64 works.
118
+ */
119
+ export const REMOTE_UPLOAD_IMAGES_TOOL = {
120
+ name: UPLOAD_IMAGES_TOOL.name,
121
+ description: "Upload 1–4 PNG, JPEG, WebP or GIF images (5 MiB each) to the Caelo media library. " +
122
+ "Supply raw base64 (no data URL): this is a remote connection, so the server cannot read files on your machine and filePath is refused. " +
123
+ `${UPLOAD_IMAGES_COMMON} Requires your current content.write permission.`,
124
+ inputSchema: UPLOAD_IMAGES_INPUT_SCHEMA,
125
+ };
126
+ // ─── chat surface ───────────────────────────────────────────────────────
127
+ export const caeloChatInputSchema = z
128
+ .object({
129
+ attachments: z.array(uploadedImageSchema).max(4).optional(),
130
+ message: z.string().min(1).max(50_000),
131
+ chatSessionId: z.string().uuid().optional(),
132
+ pageId: z.string().uuid().optional(),
133
+ })
134
+ .strict();
135
+ export const CAELO_CHAT_TOOL = {
136
+ name: "caelo_chat",
137
+ description: "Talk to your Caelo CMS install's AI agent. Same agent that powers the live-edit chat overlay — it can read pages, propose edits, queue Owner-approval proposals, summarise plugin data. Continues an existing chat session (when chatSessionId is supplied) or starts a fresh one. Returns the agent's reply text plus structured tool-call summaries.",
138
+ inputSchema: {
139
+ type: "object",
140
+ required: ["message"],
141
+ properties: {
142
+ attachments: {
143
+ type: "array",
144
+ maxItems: 4,
145
+ description: "Attachments returned by caelo_upload_images.",
146
+ items: z.toJSONSchema(uploadedImageSchema),
147
+ },
148
+ message: {
149
+ type: "string",
150
+ description: "What you want to say to the Caelo agent.",
151
+ },
152
+ chatSessionId: {
153
+ type: "string",
154
+ description: "Optional. Chat session UUID to continue. Omit to start a fresh page-unbound chat.",
155
+ },
156
+ pageId: {
157
+ type: "string",
158
+ description: "Optional. Bind a NEW chat to one page so the agent's page-context block is populated. Same shape as /edit?page=<id>.",
159
+ },
160
+ },
161
+ },
162
+ };
163
+ export const chatAwaitApprovalInput = z.object({ chatSessionId: z.string().uuid() }).strict();
164
+ /** Issue #658 — keep waiting on the approval cards a caelo_chat turn paused on. */
165
+ export const CHAT_AWAIT_APPROVAL_TOOL = {
166
+ name: "caelo_await_approval",
167
+ description: "Wait for the operator's Approve/Reject on the approval cards your caelo_chat turn paused on, then " +
168
+ "continue that turn and return its reply (the change applied, or the agent's reaction to a rejection). " +
169
+ "Use it when a caelo_chat reply says it is still waiting for approval. You cannot approve anything " +
170
+ "yourself — only the operator can, in the Caelo admin.",
171
+ inputSchema: {
172
+ type: "object",
173
+ properties: {
174
+ chatSessionId: {
175
+ type: "string",
176
+ description: "The chatSessionId from the caelo_chat reply that is waiting.",
177
+ },
178
+ },
179
+ required: ["chatSessionId"],
180
+ },
181
+ };
182
+ // ─── admin (Power-MCP) surface ──────────────────────────────────────────
183
+ export const openSessionInput = z
184
+ .object({
185
+ title: z.string().min(1).max(200).optional(),
186
+ pageId: z.string().uuid().optional(),
187
+ chatSessionId: z.string().uuid().optional(),
188
+ newSession: z.boolean().optional(),
189
+ })
190
+ .strict();
191
+ export const OPEN_SESSION_TOOL = {
192
+ name: "caelo_open_session",
193
+ description: "Open the Caelo work session your subsequent tool calls run in. Every write lands in the site's shared " +
194
+ "draft — invisible to the live site until it is staged and the operator clicks Publish live in the Caelo admin. " +
195
+ "Call this ONCE before any other caelo tool. By default it RESUMES the operator's own most recent open " +
196
+ "session (so earlier unstaged work continues in the same chat); pass newSession: true only when the " +
197
+ "operator wants a separate fresh session, or chatSessionId to resume a specific one. Optional pageId " +
198
+ "resumes (or opens) that page's session.",
199
+ inputSchema: {
200
+ type: "object",
201
+ properties: {
202
+ title: { type: "string", description: "Session title shown in the Caelo admin chat list." },
203
+ pageId: { type: "string", description: "Optional page UUID to bind the session to." },
204
+ chatSessionId: {
205
+ type: "string",
206
+ description: "Resume this specific session instead of the most recent one.",
207
+ },
208
+ newSession: {
209
+ type: "boolean",
210
+ description: "Open a fresh session instead of resuming the most recent open one.",
211
+ },
212
+ },
213
+ },
214
+ };
215
+ export const adminAwaitApprovalInput = z.object({ proposalId: z.string().uuid() }).strict();
216
+ /** Issue #658 — keep waiting for a decision after a gated call's wait timed out. */
217
+ export const ADMIN_AWAIT_APPROVAL_TOOL = {
218
+ name: "caelo_await_approval",
219
+ description: "Wait for the operator's Approve/Reject on a proposal you queued with an approval-gated tool, and return " +
220
+ "the decision (applied / rejected with reason / …). Use it when a gated tool's result says it is still " +
221
+ "waiting. You cannot approve anything yourself — only the operator can, in the Caelo admin.",
222
+ inputSchema: {
223
+ type: "object",
224
+ properties: {
225
+ proposalId: {
226
+ type: "string",
227
+ description: "The id from the gated tool's 'Queued proposal <id>' result.",
228
+ },
229
+ },
230
+ required: ["proposalId"],
231
+ },
232
+ };
233
+ export const GET_CONTEXT_TOOL = {
234
+ name: "caelo_get_context",
235
+ description: "Fetch the Caelo install's composed site context: how pages/modules/content instances fit together, " +
236
+ "the tool playbook, staging rules, site memory (brand voice, glossary) and the active skills index. " +
237
+ "Load this once before working; load individual skills on demand via the load_skill tool.",
238
+ inputSchema: { type: "object", properties: {} },
239
+ };
240
+ /**
241
+ * The chat server's whole tool list (stdio flavour). Static, so it also
242
+ * serves the credential-less listing MCP directories inspect (#841); the
243
+ * remote surface swaps in its own upload tool.
244
+ */
245
+ export const CHAT_TOOLS = [UPLOAD_IMAGES_TOOL, CHAT_AWAIT_APPROVAL_TOOL, CAELO_CHAT_TOOL];
246
+ /**
247
+ * The tools Power-MCP adds in front of the admin's catalogue (stdio
248
+ * flavour) — also the head of the credential-less listing (#841).
249
+ */
250
+ export const ADMIN_LOCAL_TOOLS = [
251
+ UPLOAD_IMAGES_TOOL,
252
+ OPEN_SESSION_TOOL,
253
+ GET_CONTEXT_TOOL,
254
+ ADMIN_AWAIT_APPROVAL_TOOL,
255
+ ];
256
+ //# sourceMappingURL=tool-definitions.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tool-definitions.js","sourceRoot":"","sources":["../src/tool-definitions.ts"],"names":[],"mappings":"AAAA,mCAAmC;AAEnC;;;;;;;;GAQG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,2EAA2E;AAE3E;;;;GAIG;AACH,MAAM,CAAC,MAAM,qBAAqB,GAAG;IACnC,+IAA+I;IAC/I,yGAAyG;IACzG,uLAAuL;IACvL,uPAAuP;CACxP,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAEb;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,sBAAsB,GAAG;IACpC,kEAAkE;IAClE,oaAAoa;IACpa,kKAAkK;IAClK,+IAA+I;IAC/I,8pBAA8pB;IAC9pB,ubAAub;IACvb,oFAAoF;CACrF,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAEb,2EAA2E;AAE3E,oEAAoE;AACpE,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,GAAG,IAAI,GAAG,IAAI,CAAC;AAE/C,wFAAwF;AACxF,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAC;KACjC,MAAM,CAAC;IACN,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,IAAI,EAAE;IAC1B,IAAI,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,WAAW,EAAE,YAAY,EAAE,YAAY,EAAE,WAAW,CAAC,CAAC;IACpE,GAAG,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,QAAQ,EAAE;CACrC,CAAC;KACD,MAAM,EAAE,CAAC;AAEZ,MAAM,UAAU,GAAG,CAAC;KACjB,MAAM,CAAC;IACN,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,IAAI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AAU,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC;AAE5F,oFAAoF;AACpF,MAAM,CAAC,MAAM,yBAAyB,GAAG;IACvC,IAAI,EAAE,sBAAsB;IAC5B,WAAW,EACT,0GAA0G;QAC1G,wGAAwG;QACxG,4FAA4F;IAC9F,WAAW,EAAE;QACX,IAAI,EAAE,QAAiB;QACvB,UAAU,EAAE;YACV,UAAU,EAAE;gBACV,IAAI,EAAE,QAAQ;gBACd,WAAW,EAAE,6DAA6D;aAC3E;SACF;QACD,QAAQ,EAAE,CAAC,YAAY,CAAC;KACzB;CACF,CAAC;AAEF,MAAM,CAAC,MAAM,gBAAgB,GAAG;IAC9B,IAAI,EAAE,mBAAmB;IACzB,WAAW,EACT,qGAAqG;QACrG,qGAAqG;QACrG,0FAA0F;IAC5F,WAAW,EAAE,EAAE,IAAI,EAAE,QAAiB,EAAE,UAAU,EAAE,EAAE,EAAE;CACzD,CAAC;AAEF;;;;GAIG;AACH,MAAM,CAAC,MAAM,UAAU,GAAG,CAAC,kBAAkB,EAAE,wBAAwB,EAAE,eAAe,CAAU,CAAC;AAEnG;;;GAGG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAG;IAC/B,kBAAkB;IAClB,iBAAiB;IACjB,gBAAgB;IAChB,yBAAyB;CACjB,CAAC"}
@@ -0,0 +1,26 @@
1
+ import type { Transport } from "@modelcontextprotocol/sdk/shared/transport.js";
2
+ /**
3
+ * The Power-MCP tools shipped with this release. Throws when the
4
+ * snapshot is missing or malformed — a package without it is a broken
5
+ * release, not something to list around.
6
+ */
7
+ export declare function loadPowerCatalogue(): Array<{
8
+ name: string;
9
+ description: string;
10
+ inputSchema: Record<string, unknown>;
11
+ }>;
12
+ /** The two variables every mode needs to reach an admin install. */
13
+ export type CredentialVar = "CAELO_ADMIN_URL" | "CAELO_MCP_TOKEN";
14
+ /** Which credential variables are unset or empty in `env`. */
15
+ export declare function missingCredentials(env: NodeJS.ProcessEnv): CredentialVar[];
16
+ /** The error every tool call returns while credentials are missing. */
17
+ export declare function describeMissingCredentials(mode: "chat" | "admin", missing: readonly CredentialVar[]): string;
18
+ export interface StartUnconfiguredOpts {
19
+ readonly mode: "chat" | "admin";
20
+ readonly missing: readonly CredentialVar[];
21
+ /** Defaults to stdio; tests pass an in-memory transport. */
22
+ readonly transport?: Transport;
23
+ }
24
+ /** Serves the mode's tool list (see the file header) and fails every call. */
25
+ export declare function startUnconfiguredServer(opts: StartUnconfiguredOpts): Promise<void>;
26
+ //# sourceMappingURL=unconfigured.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"unconfigured.d.ts","sourceRoot":"","sources":["../src/unconfigured.ts"],"names":[],"mappings":"AA0BA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,+CAA+C,CAAC;AAwB/E;;;;GAIG;AACH,wBAAgB,kBAAkB,IAAI,KAAK,CAAC;IAC1C,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACtC,CAAC,CAKD;AAED,oEAAoE;AACpE,MAAM,MAAM,aAAa,GAAG,iBAAiB,GAAG,iBAAiB,CAAC;AAElE,8DAA8D;AAC9D,wBAAgB,kBAAkB,CAAC,GAAG,EAAE,MAAM,CAAC,UAAU,GAAG,aAAa,EAAE,CAE1E;AAED,uEAAuE;AACvE,wBAAgB,0BAA0B,CACxC,IAAI,EAAE,MAAM,GAAG,OAAO,EACtB,OAAO,EAAE,SAAS,aAAa,EAAE,GAChC,MAAM,CAQR;AAED,MAAM,WAAW,qBAAqB;IACpC,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC;IAChC,QAAQ,CAAC,OAAO,EAAE,SAAS,aAAa,EAAE,CAAC;IAC3C,4DAA4D;IAC5D,QAAQ,CAAC,SAAS,CAAC,EAAE,SAAS,CAAC;CAChC;AAED,8EAA8E;AAC9E,wBAAsB,uBAAuB,CAAC,IAAI,EAAE,qBAAqB,GAAG,OAAO,CAAC,IAAI,CAAC,CAwBxF"}
@@ -0,0 +1,82 @@
1
+ // SPDX-License-Identifier: MPL-2.0
2
+ /**
3
+ * Issue #841 — the server answers `initialize` + `tools/list` without
4
+ * credentials, so MCP directories (Glama, the official registry's
5
+ * scanners, awesome-mcp-servers via Glama) can inspect it. They start
6
+ * the bin with no env and ask for the tool list; exiting there kept
7
+ * Caelo unlisted.
8
+ *
9
+ * This is not a fallback in the CLAUDE.md §2 sense: nothing degrades
10
+ * silently. The process says on stderr that it is unconfigured, and
11
+ * every tool call fails with the variables to set. The version
12
+ * handshake is skipped because there is no admin to ask — and it cannot
13
+ * move to the first call instead: it re-execs the whole process as the
14
+ * admin's release, which is only possible before the client's
15
+ * `initialize` has been answered.
16
+ *
17
+ * Power-MCP's real catalogue comes from the admin, so unconfigured it
18
+ * lists the snapshot shipped with this release (`power-catalogue.json`,
19
+ * written by scripts/power-catalogue.ts at release cut) — directories
20
+ * then show the tools an operator actually gets.
21
+ */
22
+ import { readFileSync } from "node:fs";
23
+ import { Server } from "@modelcontextprotocol/sdk/server/index.js";
24
+ import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
25
+ import { CallToolRequestSchema, ListToolsRequestSchema } from "@modelcontextprotocol/sdk/types.js";
26
+ import { z } from "zod";
27
+ import { ADMIN_LOCAL_TOOLS, ADMIN_MCP_INSTRUCTIONS, CHAT_MCP_INSTRUCTIONS, CHAT_TOOLS, } from "./tool-definitions.js";
28
+ import { ownVersion } from "./version-handshake.js";
29
+ const powerCatalogueSchema = z.object({
30
+ version: z.string(),
31
+ tools: z
32
+ .array(z.object({
33
+ name: z.string(),
34
+ description: z.string(),
35
+ inputSchema: z.record(z.string(), z.unknown()),
36
+ }))
37
+ .min(1),
38
+ });
39
+ /**
40
+ * The Power-MCP tools shipped with this release. Throws when the
41
+ * snapshot is missing or malformed — a package without it is a broken
42
+ * release, not something to list around.
43
+ */
44
+ export function loadPowerCatalogue() {
45
+ const raw = readFileSync(new URL("../power-catalogue.json", import.meta.url), "utf8");
46
+ return powerCatalogueSchema
47
+ .parse(JSON.parse(raw))
48
+ .tools.map(({ name, description, inputSchema }) => ({ name, description, inputSchema }));
49
+ }
50
+ /** Which credential variables are unset or empty in `env`. */
51
+ export function missingCredentials(env) {
52
+ return ["CAELO_ADMIN_URL", "CAELO_MCP_TOKEN"].filter((name) => !env[name]);
53
+ }
54
+ /** The error every tool call returns while credentials are missing. */
55
+ export function describeMissingCredentials(mode, missing) {
56
+ const scope = mode === "admin" ? "an ADMIN-scoped" : "a";
57
+ return (`This Caelo MCP server is not connected to a Caelo install: ${missing.join(" and ")} ` +
58
+ `${missing.length === 1 ? "is" : "are"} not set. Set CAELO_ADMIN_URL to your admin's https:// address ` +
59
+ `and CAELO_MCP_TOKEN to ${scope} token minted at /settings/mcp on that install, then restart the ` +
60
+ "MCP server. The operator has to do this in the MCP client's config; retrying the call will not help.");
61
+ }
62
+ /** Serves the mode's tool list (see the file header) and fails every call. */
63
+ export async function startUnconfiguredServer(opts) {
64
+ const server = new Server({
65
+ name: opts.mode === "admin" ? "caelo-admin-mcp" : "caelo-mcp-server",
66
+ version: ownVersion(),
67
+ }, {
68
+ capabilities: { tools: {} },
69
+ instructions: opts.mode === "admin" ? ADMIN_MCP_INSTRUCTIONS : CHAT_MCP_INSTRUCTIONS,
70
+ });
71
+ const error = describeMissingCredentials(opts.mode, opts.missing);
72
+ const tools = opts.mode === "admin" ? [...ADMIN_LOCAL_TOOLS, ...loadPowerCatalogue()] : [...CHAT_TOOLS];
73
+ server.setRequestHandler(ListToolsRequestSchema, async () => ({ tools }));
74
+ server.setRequestHandler(CallToolRequestSchema, async () => ({
75
+ isError: true,
76
+ content: [{ type: "text", text: error }],
77
+ }));
78
+ // stderr: stdout is the stdio transport.
79
+ console.error(`caelo mcp: ${error}`);
80
+ await server.connect(opts.transport ?? new StdioServerTransport());
81
+ }
82
+ //# sourceMappingURL=unconfigured.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"unconfigured.js","sourceRoot":"","sources":["../src/unconfigured.ts"],"names":[],"mappings":"AAAA,mCAAmC;AAEnC;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,EAAE,MAAM,EAAE,MAAM,2CAA2C,CAAC;AACnE,OAAO,EAAE,oBAAoB,EAAE,MAAM,2CAA2C,CAAC;AAEjF,OAAO,EAAE,qBAAqB,EAAE,sBAAsB,EAAE,MAAM,oCAAoC,CAAC;AACnG,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EACL,iBAAiB,EACjB,sBAAsB,EACtB,qBAAqB,EACrB,UAAU,GACX,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AAEpD,MAAM,oBAAoB,GAAG,CAAC,CAAC,MAAM,CAAC;IACpC,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE;IACnB,KAAK,EAAE,CAAC;SACL,KAAK,CACJ,CAAC,CAAC,MAAM,CAAC;QACP,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE;QAChB,WAAW,EAAE,CAAC,CAAC,MAAM,EAAE;QACvB,WAAW,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC;KAC/C,CAAC,CACH;SACA,GAAG,CAAC,CAAC,CAAC;CACV,CAAC,CAAC;AAEH;;;;GAIG;AACH,MAAM,UAAU,kBAAkB;IAKhC,MAAM,GAAG,GAAG,YAAY,CAAC,IAAI,GAAG,CAAC,yBAAyB,EAAE,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,MAAM,CAAC,CAAC;IACtF,OAAO,oBAAoB;SACxB,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC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GAAG,0BAA0B,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,OAAO,CAAC,CAAC;IAClE,MAAM,KAAK,GACT,IAAI,CAAC,IAAI,KAAK,OAAO,CAAC,CAAC,CAAC,CAAC,GAAG,iBAAiB,EAAE,GAAG,kBAAkB,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,UAAU,CAAC,CAAC;IAE5F,MAAM,CAAC,iBAAiB,CAAC,sBAAsB,EAAE,KAAK,IAAI,EAAE,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,CAAC,CAAC;IAC1E,MAAM,CAAC,iBAAiB,CAAC,qBAAqB,EAAE,KAAK,IAAI,EAAE,CAAC,CAAC;QAC3D,OAAO,EAAE,IAAI;QACb,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC;KACzC,CAAC,CAAC,CAAC;IAEJ,yCAAyC;IACzC,OAAO,CAAC,KAAK,CAAC,cAAc,KAAK,EAAE,CAAC,CAAC;IACrC,MAAM,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,SAAS,IAAI,IAAI,oBAAoB,EAAE,CAAC,CAAC;AACrE,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,7 @@
1
1
  {
2
2
  "name": "@caelo-cms/mcp-server",
3
- "version": "0.10.55",
3
+ "mcpName": "io.github.caelo-cms/caelo",
4
+ "version": "0.10.57",
4
5
  "private": false,
5
6
  "license": "MPL-2.0",
6
7
  "description": "MCP servers for Caelo CMS: `caelo_chat` (talk to Caelo's own AI) and the admin-scoped Power-MCP (the full chat-runner tool catalogue, driven by your own agent). Lets Claude Code (or any MCP-aware client) drive a Caelo install from outside the browser.",
@@ -23,10 +24,18 @@
23
24
  "types": "./dist/index.d.ts",
24
25
  "import": "./dist/index.js",
25
26
  "default": "./dist/index.js"
27
+ },
28
+ "./surfaces": {
29
+ "types": "./dist/surfaces/index.d.ts",
30
+ "bun": "./src/surfaces/index.ts",
31
+ "development": "./src/surfaces/index.ts",
32
+ "import": "./dist/surfaces/index.js",
33
+ "default": "./dist/surfaces/index.js"
26
34
  }
27
35
  },
28
36
  "files": [
29
37
  "dist/",
38
+ "power-catalogue.json",
30
39
  "README.md",
31
40
  "package.json"
32
41
  ],