@plitzi/sdk-mcp 0.39.1 → 0.39.2

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 (193) hide show
  1. package/CHANGELOG.md +15 -0
  2. package/README.md +5 -1
  3. package/dist/createServer.d.ts +3 -2
  4. package/dist/createServer.js +3 -13
  5. package/dist/index.js +8 -8
  6. package/dist/modules/mcp/accessibilityOutline.js +1 -2
  7. package/dist/modules/mcp/apps/index.js +3 -4
  8. package/dist/modules/mcp/apps/render/index.js +3 -7
  9. package/dist/modules/mcp/apps/render/styles.js +2 -3
  10. package/dist/modules/mcp/apps/shared/assets.d.ts +6 -0
  11. package/dist/modules/mcp/apps/shared/assets.js +15 -4
  12. package/dist/modules/mcp/apps/shared/bundle.js +3 -4
  13. package/dist/modules/mcp/apps/shared/index.d.ts +1 -1
  14. package/dist/modules/mcp/apps/shared/page.js +3 -5
  15. package/dist/modules/mcp/apps/shared/registerApp.js +1 -2
  16. package/dist/modules/mcp/apps/shared/resolve.js +1 -2
  17. package/dist/modules/mcp/apps/shared/zodEnglishOnly.js +1 -2
  18. package/dist/modules/mcp/catalogs/observed.js +1 -2
  19. package/dist/modules/mcp/catalogs/pluginCatalog.d.ts +1 -1
  20. package/dist/modules/mcp/catalogs/pluginCatalog.js +1 -2
  21. package/dist/modules/mcp/catalogs/registry.d.ts +2 -1
  22. package/dist/modules/mcp/catalogs/registry.js +1 -2
  23. package/dist/modules/mcp/handler.d.ts +1 -1
  24. package/dist/modules/mcp/handler.js +1 -2
  25. package/dist/modules/mcp/helpers/callToolResult.js +1 -2
  26. package/dist/modules/mcp/helpers/components.js +1 -2
  27. package/dist/modules/mcp/helpers/computeVersion.js +1 -2
  28. package/dist/modules/mcp/helpers/guide/index.js +1 -2
  29. package/dist/modules/mcp/helpers/guide/instructions.js +1 -2
  30. package/dist/modules/mcp/helpers/guide/logic.js +1 -2
  31. package/dist/modules/mcp/helpers/guide/practice.js +4 -4
  32. package/dist/modules/mcp/helpers/guide/reference.js +1 -2
  33. package/dist/modules/mcp/helpers/guide/server.d.ts +1 -1
  34. package/dist/modules/mcp/helpers/guide/server.js +3 -4
  35. package/dist/modules/mcp/helpers/guide/structure.js +1 -2
  36. package/dist/modules/mcp/helpers/guide/styling.js +1 -2
  37. package/dist/modules/mcp/helpers/guide/values.js +1 -2
  38. package/dist/modules/mcp/helpers/interactions.js +1 -2
  39. package/dist/modules/mcp/helpers/log.d.ts +1 -1
  40. package/dist/modules/mcp/helpers/log.js +2 -3
  41. package/dist/modules/mcp/helpers/opResult.js +1 -2
  42. package/dist/modules/mcp/helpers/space.d.ts +2 -1
  43. package/dist/modules/mcp/helpers/space.js +1 -2
  44. package/dist/modules/mcp/helpers/uris.js +1 -2
  45. package/dist/modules/mcp/localScreenshotClient.js +9 -6
  46. package/dist/modules/mcp/previewClient.js +1 -2
  47. package/dist/modules/mcp/proxy/config.d.ts +1 -1
  48. package/dist/modules/mcp/proxy/config.js +2 -3
  49. package/dist/modules/mcp/proxy/fetch.js +1 -2
  50. package/dist/modules/mcp/proxy/grant.js +1 -2
  51. package/dist/modules/mcp/proxy/guard.js +2 -3
  52. package/dist/modules/mcp/proxy/handler.d.ts +1 -1
  53. package/dist/modules/mcp/proxy/handler.js +2 -3
  54. package/dist/modules/mcp/proxy/payload.js +1 -2
  55. package/dist/modules/mcp/proxy/rewrite.js +1 -2
  56. package/dist/modules/mcp/proxy/sign.js +1 -2
  57. package/dist/modules/mcp/proxy/types.js +1 -2
  58. package/dist/modules/mcp/resources/actions.js +2 -3
  59. package/dist/modules/mcp/resources/canonical.js +1 -2
  60. package/dist/modules/mcp/resources/connectors.js +2 -3
  61. package/dist/modules/mcp/resources/core.js +4 -5
  62. package/dist/modules/mcp/resources/data.js +1 -2
  63. package/dist/modules/mcp/resources/envelope.js +1 -2
  64. package/dist/modules/mcp/resources/explain.js +1 -2
  65. package/dist/modules/mcp/resources/functions.js +1 -2
  66. package/dist/modules/mcp/resources/primer.js +7 -8
  67. package/dist/modules/mcp/resources/register.d.ts +1 -1
  68. package/dist/modules/mcp/resources/register.js +6 -7
  69. package/dist/modules/mcp/resources/renderGuide.js +2 -3
  70. package/dist/modules/mcp/resources/router.js +3 -4
  71. package/dist/modules/mcp/resources/schema.js +3 -4
  72. package/dist/modules/mcp/resources/style.js +2 -3
  73. package/dist/modules/mcp/screenshotClient.js +6 -5
  74. package/dist/modules/mcp/server.d.ts +1 -1
  75. package/dist/modules/mcp/server.js +4 -5
  76. package/dist/modules/mcp/tools/activity.js +1 -2
  77. package/dist/modules/mcp/tools/apply/dispatch.js +4 -5
  78. package/dist/modules/mcp/tools/apply/index.d.ts +4 -0
  79. package/dist/modules/mcp/tools/apply/index.js +3 -4
  80. package/dist/modules/mcp/tools/apply/writeResult.js +1 -2
  81. package/dist/modules/mcp/tools/describeOperation.js +2 -3
  82. package/dist/modules/mcp/tools/index.js +1 -2
  83. package/dist/modules/mcp/tools/intents.js +3 -4
  84. package/dist/modules/mcp/tools/look.js +2 -3
  85. package/dist/modules/mcp/tools/operations/actions/deleteAction.js +2 -3
  86. package/dist/modules/mcp/tools/operations/actions/document.d.ts +2 -0
  87. package/dist/modules/mcp/tools/operations/actions/document.js +4 -3
  88. package/dist/modules/mcp/tools/operations/actions/index.d.ts +4 -0
  89. package/dist/modules/mcp/tools/operations/actions/index.js +1 -2
  90. package/dist/modules/mcp/tools/operations/actions/patchAction.d.ts +2 -0
  91. package/dist/modules/mcp/tools/operations/actions/patchAction.js +3 -4
  92. package/dist/modules/mcp/tools/operations/actions/upsertAction.d.ts +2 -0
  93. package/dist/modules/mcp/tools/operations/actions/upsertAction.js +3 -4
  94. package/dist/modules/mcp/tools/operations/closed.js +1 -2
  95. package/dist/modules/mcp/tools/operations/connectors/deleteConnector.js +2 -3
  96. package/dist/modules/mcp/tools/operations/connectors/index.js +1 -2
  97. package/dist/modules/mcp/tools/operations/connectors/manifest.js +1 -2
  98. package/dist/modules/mcp/tools/operations/connectors/patchConnector.js +3 -4
  99. package/dist/modules/mcp/tools/operations/connectors/upsertConnector.js +3 -4
  100. package/dist/modules/mcp/tools/operations/data/index.js +1 -2
  101. package/dist/modules/mcp/tools/operations/functions/index.js +2 -3
  102. package/dist/modules/mcp/tools/operations/index.d.ts +8 -0
  103. package/dist/modules/mcp/tools/operations/index.js +1 -2
  104. package/dist/modules/mcp/tools/operations/schema/bindings/deleteBinding.js +1 -2
  105. package/dist/modules/mcp/tools/operations/schema/bindings/patchBinding.js +1 -2
  106. package/dist/modules/mcp/tools/operations/schema/bindings/upsertBinding.js +1 -2
  107. package/dist/modules/mcp/tools/operations/schema/components/deleteComponent.js +1 -2
  108. package/dist/modules/mcp/tools/operations/schema/components/upsertComponent.js +2 -3
  109. package/dist/modules/mcp/tools/operations/schema/elements/deleteElement.js +2 -3
  110. package/dist/modules/mcp/tools/operations/schema/elements/moveElement.js +3 -4
  111. package/dist/modules/mcp/tools/operations/schema/elements/patchElement.js +3 -4
  112. package/dist/modules/mcp/tools/operations/schema/elements/repeatElement.js +1 -2
  113. package/dist/modules/mcp/tools/operations/schema/elements/upsertElement.js +3 -4
  114. package/dist/modules/mcp/tools/operations/schema/flags/deleteFlag.js +2 -3
  115. package/dist/modules/mcp/tools/operations/schema/flags/upsertFlag.js +2 -3
  116. package/dist/modules/mcp/tools/operations/schema/folders/deleteFolder.js +2 -3
  117. package/dist/modules/mcp/tools/operations/schema/folders/upsertFolder.js +2 -3
  118. package/dist/modules/mcp/tools/operations/schema/interactions/deleteInteraction.js +1 -2
  119. package/dist/modules/mcp/tools/operations/schema/interactions/patchInteractionNode.js +1 -2
  120. package/dist/modules/mcp/tools/operations/schema/interactions/upsertInteractionFlow.js +2 -3
  121. package/dist/modules/mcp/tools/operations/schema/operations.js +1 -2
  122. package/dist/modules/mcp/tools/operations/schema/pages/deleteLayout.js +2 -3
  123. package/dist/modules/mcp/tools/operations/schema/pages/deletePage.js +2 -3
  124. package/dist/modules/mcp/tools/operations/schema/pages/upsertLayout.js +3 -4
  125. package/dist/modules/mcp/tools/operations/schema/pages/upsertPage.js +3 -4
  126. package/dist/modules/mcp/tools/operations/schema/settings/patchSettings.js +2 -3
  127. package/dist/modules/mcp/tools/operations/schema/shared.js +1 -2
  128. package/dist/modules/mcp/tools/operations/schema/translator.js +2 -3
  129. package/dist/modules/mcp/tools/operations/schema/variables/deleteVariable.js +2 -3
  130. package/dist/modules/mcp/tools/operations/schema/variables/upsertVariable.js +2 -3
  131. package/dist/modules/mcp/tools/operations/schema/write.js +3 -4
  132. package/dist/modules/mcp/tools/operations/schemaIds.js +1 -2
  133. package/dist/modules/mcp/tools/operations/style/definitions/deleteDefinition.js +1 -2
  134. package/dist/modules/mcp/tools/operations/style/definitions/patchDefinition.js +2 -3
  135. package/dist/modules/mcp/tools/operations/style/definitions/upsertDefinition.js +1 -2
  136. package/dist/modules/mcp/tools/operations/style/definitions/upsertDefinitions.js +1 -2
  137. package/dist/modules/mcp/tools/operations/style/fonts/deleteFont.js +2 -3
  138. package/dist/modules/mcp/tools/operations/style/fonts/upsertFont.js +2 -3
  139. package/dist/modules/mcp/tools/operations/style/globalStyles/deleteGlobalStyle.js +1 -2
  140. package/dist/modules/mcp/tools/operations/style/globalStyles/patchGlobalStyle.js +2 -3
  141. package/dist/modules/mcp/tools/operations/style/globalStyles/upsertGlobalStyle.js +1 -2
  142. package/dist/modules/mcp/tools/operations/style/idStyles/deleteIdStyle.js +1 -2
  143. package/dist/modules/mcp/tools/operations/style/idStyles/patchIdStyle.js +2 -3
  144. package/dist/modules/mcp/tools/operations/style/idStyles/upsertIdStyle.js +1 -2
  145. package/dist/modules/mcp/tools/operations/style/operations.js +1 -2
  146. package/dist/modules/mcp/tools/operations/style/shared.js +1 -2
  147. package/dist/modules/mcp/tools/operations/style/translator.js +1 -2
  148. package/dist/modules/mcp/tools/operations/style/validate.js +1 -2
  149. package/dist/modules/mcp/tools/operations/style/variables/deleteStyleVariable.js +2 -3
  150. package/dist/modules/mcp/tools/operations/style/variables/upsertStyleVariable.js +2 -3
  151. package/dist/modules/mcp/tools/operations/style/write.js +2 -3
  152. package/dist/modules/mcp/tools/read.js +2 -3
  153. package/dist/modules/mcp/tools/render.js +3 -4
  154. package/dist/modules/mcp/tools/renderWidget.js +2 -3
  155. package/dist/modules/mcp/tools/search.js +2 -3
  156. package/dist/modules/mcp/tools/shared/draftBatch.js +2 -3
  157. package/dist/modules/mcp/tools/shared/effects.js +1 -2
  158. package/dist/modules/mcp/tools/shared/expandOperations.js +1 -2
  159. package/dist/modules/mcp/tools/shared/interactionReport.js +1 -2
  160. package/dist/modules/mcp/tools/shared/lintDraft.js +1 -2
  161. package/dist/modules/mcp/tools/shared/look.js +1 -2
  162. package/dist/modules/mcp/tools/shared/newSuggestions.js +1 -2
  163. package/dist/modules/mcp/tools/shared/normalizeOperations.js +1 -2
  164. package/dist/modules/mcp/tools/shared/repeats.js +1 -2
  165. package/dist/modules/mcp/tools/shared/tool.js +1 -2
  166. package/dist/modules/mcp/tools/shared/validator/batch.js +1 -2
  167. package/dist/modules/mcp/tools/shared/validator/bindings.js +1 -2
  168. package/dist/modules/mcp/tools/shared/validator/connectors.js +2 -3
  169. package/dist/modules/mcp/tools/shared/validator/context.js +1 -2
  170. package/dist/modules/mcp/tools/shared/validator/css.js +2 -3
  171. package/dist/modules/mcp/tools/shared/validator/elements.js +2 -3
  172. package/dist/modules/mcp/tools/shared/validator/index.js +8 -9
  173. package/dist/modules/mcp/tools/shared/validator/interactions.js +2 -3
  174. package/dist/modules/mcp/tools/shared/validator/refs.js +1 -2
  175. package/dist/modules/mcp/tools/test.js +1 -2
  176. package/dist/modules/mcp/tools/tryFunction.js +1 -2
  177. package/dist/modules/mcp/types/screenshotTypes.d.ts +8 -0
  178. package/dist/options.d.ts +1 -1
  179. package/dist/pipeline.d.ts +2 -1
  180. package/dist/pipeline.js +4 -3
  181. package/dist/preview/createPreview.d.ts +1 -1
  182. package/dist/preview/createPreview.js +1 -2
  183. package/dist/preview.d.ts +7 -0
  184. package/dist/preview.js +1 -0
  185. package/dist/render.js +1 -1
  186. package/dist/server.js +3 -3
  187. package/dist/stages/mcp.d.ts +1 -1
  188. package/dist/stages/mcp.js +2 -3
  189. package/dist/stages/preview.d.ts +2 -1
  190. package/dist/stages/preview.js +3 -4
  191. package/dist/stages/proxy.d.ts +1 -1
  192. package/dist/stages/proxy.js +2 -3
  193. package/package.json +23 -16
@@ -1,8 +1,8 @@
1
+ import { warnOnce } from "./context.js";
1
2
  import { findConnectorEntry } from "../../../helpers/space.js";
2
3
  import { toManifest } from "../../operations/connectors/upsertConnector.js";
3
- import { warnOnce } from "./context.js";
4
4
  import { validateConnectorManifest } from "@plitzi/sdk-shared/connectors";
5
- //#region src/modules/mcp/tools/shared/validator/connectors.ts
5
+ // src/modules/mcp/tools/shared/validator/connectors.ts
6
6
  /** Run the one shared manifest validator and fold its report into the batch result. Errors reject the batch;
7
7
  * warnings ride along — notably "reads {{credential.…}} but names no credential", which is expected here: the
8
8
  * agent authors the manifest and the space owner attaches the secret afterwards. */
@@ -71,5 +71,4 @@ var checkProviderElement = (space, ctx, ref, runtime, props, batchConnectors, ba
71
71
  });
72
72
  });
73
73
  };
74
- //#endregion
75
74
  export { batchDeclaredConnectors, checkConnectorOp, checkProviderElement };
@@ -1,4 +1,4 @@
1
- //#region src/modules/mcp/tools/shared/validator/context.ts
1
+ // src/modules/mcp/tools/shared/validator/context.ts
2
2
  var VAR_REF = /\{\{\s*([A-Za-z_][\w.-]*)\s*\}\}/g;
3
3
  var CSS_VAR = /var\(\s*--([A-Za-z_][\w-]*)\s*\)/g;
4
4
  var RAW_CODE_TYPES = /* @__PURE__ */ new Set([
@@ -31,5 +31,4 @@ var checkObservedName = (value, observed, kind, resource, path, ctx) => {
31
31
  if (!value || observed.size === 0 || observed.has(value)) return;
32
32
  warnOnce(ctx, `${kind} "${value}" at ${path} was not seen in this space. Verify against ${resource}; it may still be valid.`);
33
33
  };
34
- //#endregion
35
34
  export { RAW_CODE_TYPES, checkObservedName, checkStyleVarRefs, checkVarRefs, warnOnce };
@@ -1,6 +1,6 @@
1
- import { ambiguousShorthands, expandShorthand, isCssProperty, suggestCssProperty } from "../../../catalogs/index.js";
2
1
  import { checkStyleVarRefs, checkVarRefs } from "./context.js";
3
- //#region src/modules/mcp/tools/shared/validator/css.ts
2
+ import { ambiguousShorthands, expandShorthand, isCssProperty, suggestCssProperty } from "../../../catalogs/index.js";
3
+ // src/modules/mcp/tools/shared/validator/css.ts
4
4
  var checkCss = (css, path, ctx) => {
5
5
  if (!css) return;
6
6
  const declared = {};
@@ -40,5 +40,4 @@ var checkSlotCss = (slot, path, ctx) => {
40
40
  checkCss(dm.mobile, `${path}.variants.${name}.mobile`, ctx);
41
41
  }
42
42
  };
43
- //#endregion
44
43
  export { checkCss, checkSlotCss };
@@ -1,7 +1,7 @@
1
- import { definitionVariantNames } from "../../operations/style/translator.js";
2
1
  import { RAW_CODE_TYPES, warnOnce } from "./context.js";
3
2
  import { checkIdRef } from "./refs.js";
4
- //#region src/modules/mcp/tools/shared/validator/elements.ts
3
+ import { definitionVariantNames } from "../../operations/style/translator.js";
4
+ // src/modules/mcp/tools/shared/validator/elements.ts
5
5
  var checkTypeProps = (type, props, path, ctx) => {
6
6
  const meta = ctx.typeMeta.get(type);
7
7
  if (!props || RAW_CODE_TYPES.has(type) || meta?.custom === false) return;
@@ -51,5 +51,4 @@ var checkElementInput = (element, path, ctx, seen) => {
51
51
  checkElementProps(element, path, ctx);
52
52
  element.children?.forEach((child, i) => checkElementInput(child, `${path}.children[${i}]`, ctx, seen));
53
53
  };
54
- //#endregion
55
54
  export { checkElementInput, checkRawMarkup, checkTypeProps, checkVariantApplication };
@@ -1,19 +1,19 @@
1
- import { componentView, findComponentByRef } from "../../../helpers/components.js";
2
- import { findElementByRef, findFolderByRef, findPageByRef, findRootByRef, folderAncestorIds, getLayoutElements, getPageElements, pageFoldersOf, resolveRef, routeParamNames } from "../../../helpers/space.js";
3
- import { observedDataSources, observedInteractionActions } from "../../../catalogs/observed.js";
4
- import { buildTypeRegistry } from "../../../catalogs/registry.js";
5
- import { MAX_OPS } from "../../operations/index.js";
6
1
  import { batchDeclaredElements, batchDeclaredFolders, batchDeclaredPages, batchDeclaredVariants, batchDeclaredVars } from "./batch.js";
7
- import { checkObservedName, warnOnce } from "./context.js";
8
2
  import { checkBindingTarget } from "./bindings.js";
9
3
  import { batchDeclaredConnectors, checkConnectorOp, checkProviderElement } from "./connectors.js";
4
+ import { checkObservedName, warnOnce } from "./context.js";
10
5
  import { checkSlotCss } from "./css.js";
11
- import { checkRef } from "./refs.js";
12
6
  import { checkElementInput, checkRawMarkup, checkTypeProps, checkVariantApplication } from "./elements.js";
13
7
  import { checkInteractionNode } from "./interactions.js";
8
+ import { checkRef } from "./refs.js";
9
+ import { observedDataSources, observedInteractionActions } from "../../../catalogs/observed.js";
10
+ import { buildTypeRegistry } from "../../../catalogs/registry.js";
11
+ import { componentView, findComponentByRef } from "../../../helpers/components.js";
12
+ import { findElementByRef, findFolderByRef, findPageByRef, findRootByRef, folderAncestorIds, getLayoutElements, getPageElements, pageFoldersOf, resolveRef, routeParamNames } from "../../../helpers/space.js";
13
+ import { MAX_OPS } from "../../operations/index.js";
14
14
  import { isValidElementId, treeOf } from "@plitzi/sdk-schema";
15
15
  import { closest } from "@plitzi/sdk-authoring";
16
- //#region src/modules/mcp/tools/shared/validator/index.ts
16
+ // src/modules/mcp/tools/shared/validator/index.ts
17
17
  var STYLE_CATEGORIES = [
18
18
  "color",
19
19
  "spacing",
@@ -330,5 +330,4 @@ var validateOperations = (space, ops, mode = "space") => {
330
330
  warnings: ctx.warnings
331
331
  };
332
332
  };
333
- //#endregion
334
333
  export { validateOperations };
@@ -1,7 +1,7 @@
1
+ import { checkObservedName, warnOnce } from "./context.js";
1
2
  import { getElementCallback, getGlobalCallback, getUtility, hiddenParams, reconcileParams } from "../../../catalogs/index.js";
2
3
  import { NULLISH_ELEMENT_IDS } from "../../../helpers/interactions.js";
3
- import { checkObservedName, warnOnce } from "./context.js";
4
- //#region src/modules/mcp/tools/shared/validator/interactions.ts
4
+ // src/modules/mcp/tools/shared/validator/interactions.ts
5
5
  var ELEMENT_FIELD_ACTIONS = /* @__PURE__ */ new Set(["setState", "toggleState"]);
6
6
  var checkParams = (label, action, params, spec, base, ctx) => {
7
7
  const unknown = Object.keys(params).filter((key) => !(key in spec));
@@ -78,5 +78,4 @@ var checkInteractionNode = (node, base, ctx, hostRef) => {
78
78
  case "utility": checkUtility(node, base, ctx);
79
79
  }
80
80
  };
81
- //#endregion
82
81
  export { checkInteractionNode };
@@ -1,5 +1,5 @@
1
1
  import { isValidElementId } from "@plitzi/sdk-schema";
2
- //#region src/modules/mcp/tools/shared/validator/refs.ts
2
+ // src/modules/mcp/tools/shared/validator/refs.ts
3
3
  var REF_RE = /^[a-zA-Z0-9._-]+$/;
4
4
  var checkRef = (ref, path, ctx) => {
5
5
  if (!ref || ref.trim().length === 0) {
@@ -24,5 +24,4 @@ var checkIdRef = (ref, path, ctx) => {
24
24
  hint: "Use only letters, numbers, hyphens and underscores (e.g. \"hero-cta\" or \"my_list_card\"). The name IS the element id, which the runtime embeds in source names like `apiContainer_<id>.field` and in interaction targets — a dot would break those paths."
25
25
  });
26
26
  };
27
- //#endregion
28
27
  export { REF_RE, checkIdRef, checkRef };
@@ -1,7 +1,7 @@
1
1
  import { defineTool } from "./shared/tool.js";
2
2
  import { e2eTestProblems, journeyStartWarnings, readSpaceTests, runUnitTests, testAccountWarnings, unitTestProblems } from "@plitzi/sdk-authoring";
3
3
  import { z } from "zod";
4
- //#region src/modules/mcp/tools/test.ts
4
+ // src/modules/mcp/tools/test.ts
5
5
  var testShape = {
6
6
  action: z.enum([
7
7
  "list",
@@ -81,5 +81,4 @@ var testTool = defineTool({
81
81
  access: "write",
82
82
  run: (input, ctx) => test(input, ctx)
83
83
  });
84
- //#endregion
85
84
  export { test, testShape, testTool };
@@ -1,6 +1,6 @@
1
1
  import { defineTool } from "./shared/tool.js";
2
2
  import { z } from "zod";
3
- //#region src/modules/mcp/tools/tryFunction.ts
3
+ // src/modules/mcp/tools/tryFunction.ts
4
4
  var tryFunctionShape = {
5
5
  task: z.string().describe("`<namespace>.<action>`"),
6
6
  params: z.record(z.string(), z.unknown()).optional(),
@@ -39,5 +39,4 @@ var tryFunctionTool = defineTool({
39
39
  access: "write",
40
40
  run: (input, ctx) => tryFunction(input, ctx)
41
41
  });
42
- //#endregion
43
42
  export { tryFunction, tryFunctionShape, tryFunctionTool };
@@ -43,6 +43,14 @@ export type ScreenshotInput = {
43
43
  * `accessibility`, and the caller says so rather than failing.
44
44
  */
45
45
  views?: CaptureView[];
46
+ /**
47
+ * How the picture is encoded: `png` when left out — what a check that compares pixels needs — or `webp`, for a picture
48
+ * a person is shown, at a tenth of the size (a full-page thumbnail was 2 MB of PNG). A browser service that cannot
49
+ * answers PNG, and the image's `mimeType` says which it got.
50
+ */
51
+ format?: 'png' | 'webp';
52
+ /** WebP's quality, 1–100. Default 80. */
53
+ quality?: number;
46
54
  };
47
55
  /** How a look reaches the headless-browser service. The consumer injects an implementation (an HTTP
48
56
  * client to the dedicated browser pod); absent, or a capture that fails (pod down) and answers `ok:false` rather than
package/dist/options.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { OAuthConfig } from '@plitzi/sdk-shared';
1
+ import { OAuthConfig } from '@plitzi/sdk-kernel/types';
2
2
  /** How a rendered widget reaches ANYTHING outside its sandbox — images, media, fonts, and the endpoints an
3
3
  * apiContainer fetches. A widget runs in an iframe under a CSP the host builds from the origins this server
4
4
  * declares on its `ui://` resource, which is read before any widget exists (and the spec allows no per-call CSP),
@@ -1,5 +1,6 @@
1
1
  import { McpOptions } from './options';
2
- import { BaseContext, PipelineExtensions, Stage } from '@plitzi/sdk-server/kernel';
2
+ import { BaseContext, Stage } from '@plitzi/sdk-kernel/http';
3
+ import { PipelineExtensions } from '@plitzi/sdk-server';
3
4
  export declare const buildMCPPipeline: (options?: McpOptions) => Stage<BaseContext>[];
4
5
  /** What this package contributes to somebody else's PAGE server: the MCP endpoint alongside SSR on one port.
5
6
  * Every stage here gates itself — MCP is self-authenticating, the widget proxy must stay reachable without a
package/dist/pipeline.js CHANGED
@@ -1,11 +1,13 @@
1
1
  import { createMcpOnlyStage, createMcpStage } from "./stages/mcp.js";
2
2
  import { previewStage } from "./stages/preview.js";
3
3
  import { createWidgetProxyStage } from "./stages/proxy.js";
4
- import { configStaticStage, healthStage } from "@plitzi/sdk-server/kernel";
4
+ import { configStaticStage, healthStage } from "@plitzi/sdk-kernel/http";
5
+ import { statsStage } from "@plitzi/sdk-kernel/stats";
5
6
  import { createOAuthGuardStage, createOAuthStage } from "@plitzi/sdk-server/oauth";
6
- //#region src/pipeline.ts
7
+ // src/pipeline.ts
7
8
  var buildMCPPipeline = (options = {}) => [
8
9
  healthStage,
10
+ statsStage,
9
11
  configStaticStage,
10
12
  createWidgetProxyStage(options),
11
13
  createOAuthStage(options.oauth),
@@ -25,5 +27,4 @@ var mcpExtensions = (options = {}) => ({ preAuth: [
25
27
  createMcpStage(options),
26
28
  previewStage
27
29
  ] });
28
- //#endregion
29
30
  export { buildMCPPipeline, mcpExtensions };
@@ -1,6 +1,6 @@
1
1
  import { PreviewRequestBody, PreviewResult } from '../modules/mcp/types';
2
+ import { SSRPageServerConfig, SSRTemplateFn } from '@plitzi/sdk-server';
2
3
  import { PluginManager, ServerCaches } from '@plitzi/sdk-server/ssr';
3
- import { SSRPageServerConfig, SSRTemplateFn } from '@plitzi/sdk-shared';
4
4
  /** Build a preview of a page: apply any unsaved `operations` to a clone (never persisted), render the resulting
5
5
  * draft to full HTML via the SSR pipeline, and stash the draft under a token so a browser can fetch the exact same
6
6
  * render at `?__pt=<token>`. With no operations it previews persisted state.
@@ -3,7 +3,7 @@ import { findPageByRef, getPageElements } from "../modules/mcp/helpers/space.js"
3
3
  import { draftBatch } from "../modules/mcp/tools/shared/draftBatch.js";
4
4
  import { randomUUID } from "node:crypto";
5
5
  import { buildBody } from "@plitzi/sdk-server/ssr";
6
- //#region src/preview/createPreview.ts
6
+ // src/preview/createPreview.ts
7
7
  var resolvePagePath = (schema, pageRef) => {
8
8
  const pages = getPageElements(schema);
9
9
  const page = pageRef ? findPageByRef(schema, pageRef) : pages.find((p) => p.attributes.default) ?? pages[0];
@@ -83,5 +83,4 @@ var createPreview = async (body, config, renderFn, pluginManager, caches) => {
83
83
  ...token ? { expiresInMs: ttlMs } : {}
84
84
  };
85
85
  };
86
- //#endregion
87
86
  export { createPreview };
@@ -0,0 +1,7 @@
1
+ /** The draft-preview endpoint alone, for the page server that mounts it: `POST /__preview` applies unsaved operations
2
+ * to a copy of the draft and renders it.
3
+ *
4
+ * Import it as `@plitzi/sdk-mcp/preview`. The package root carries the MCP server too — its SDK, its tools, its
5
+ * resources — which a page server never runs; and what a preview itself needs (the operations, their lint, the
6
+ * render) is loaded by the first preview the process is asked for, not when it starts. */
7
+ export { previewStage } from './stages/preview';
@@ -0,0 +1 @@
1
+ export { previewStage } from "./stages/preview.js";
package/dist/render.js CHANGED
@@ -1,3 +1,3 @@
1
- import { renderGuideCore, renderGuideText, renderGuideTopicUri, renderGuideTopics } from "./modules/mcp/resources/renderGuide.js";
2
1
  import { HOST_PAGE_REF, render, renderWidgetShape } from "./modules/mcp/tools/renderWidget.js";
2
+ import { renderGuideCore, renderGuideText, renderGuideTopicUri, renderGuideTopics } from "./modules/mcp/resources/renderGuide.js";
3
3
  export { HOST_PAGE_REF as RENDER_ROOT_REF, render, renderGuideCore, renderGuideText, renderGuideTopicUri, renderGuideTopics, renderWidgetShape };
package/dist/server.js CHANGED
@@ -1,9 +1,9 @@
1
1
  import { createMcpServer } from "./modules/mcp/server.js";
2
+ import { createServer } from "./createServer.js";
3
+ import { buildMCPPipeline } from "./pipeline.js";
2
4
  import { handleMcp, readMcpBody, serveMcp } from "./modules/mcp/handler.js";
3
5
  import { createHttpPreviewClient } from "./modules/mcp/previewClient.js";
6
+ import { pluginCatalog, stringDeclarations } from "./modules/mcp/catalogs/pluginCatalog.js";
4
7
  import { createHttpScreenshotClient } from "./modules/mcp/screenshotClient.js";
5
- import { buildMCPPipeline } from "./pipeline.js";
6
- import { createServer } from "./createServer.js";
7
8
  import { createLocalScreenshotClient, resolveLocalBrowser } from "./modules/mcp/localScreenshotClient.js";
8
- import { pluginCatalog, stringDeclarations } from "./modules/mcp/catalogs/pluginCatalog.js";
9
9
  export { buildMCPPipeline, createHttpPreviewClient, createHttpScreenshotClient, createLocalScreenshotClient, createMcpServer, createServer, handleMcp, pluginCatalog, readMcpBody, resolveLocalBrowser, serveMcp, stringDeclarations };
@@ -1,4 +1,4 @@
1
1
  import { McpOptions } from '../options';
2
- import { Stage } from '@plitzi/sdk-server/kernel';
2
+ import { Stage } from '@plitzi/sdk-kernel/http';
3
3
  export declare const createMcpStage: (options?: McpOptions) => Stage;
4
4
  export declare const createMcpOnlyStage: (options?: McpOptions) => Stage;
@@ -1,8 +1,8 @@
1
- import { requestProxy } from "../modules/mcp/proxy/config.js";
2
1
  import { handleMcp } from "../modules/mcp/handler.js";
3
2
  import { createHttpPreviewClient } from "../modules/mcp/previewClient.js";
3
+ import { requestProxy } from "../modules/mcp/proxy/config.js";
4
4
  import { createHttpScreenshotClient } from "../modules/mcp/screenshotClient.js";
5
- //#region src/stages/mcp.ts
5
+ // src/stages/mcp.ts
6
6
  var DEFAULT_PATH = "/mcp";
7
7
  var serveMcp = async (ctx, options) => {
8
8
  const { previewClient, screenshot } = options;
@@ -26,5 +26,4 @@ var createMcpOnlyStage = (options = {}) => async (ctx) => {
26
26
  await serveMcp(ctx, options);
27
27
  return true;
28
28
  };
29
- //#endregion
30
29
  export { createMcpOnlyStage, createMcpStage };
@@ -1,2 +1,3 @@
1
- import { SSRContext, Stage } from '@plitzi/sdk-server/kernel';
1
+ import { Stage } from '@plitzi/sdk-kernel/http';
2
+ import { SSRContext } from '@plitzi/sdk-server';
2
3
  export declare const previewStage: Stage<SSRContext>;
@@ -1,7 +1,6 @@
1
- import { createPreview } from "../preview/createPreview.js";
2
- import { readRawBody } from "@plitzi/sdk-server/kernel";
1
+ import { readRawBody } from "@plitzi/sdk-kernel/http";
3
2
  import { createHash, timingSafeEqual } from "node:crypto";
4
- //#region src/stages/preview.ts
3
+ // src/stages/preview.ts
5
4
  var PREVIEW_PATH_DEFAULT = "/__preview";
6
5
  var digest = (value) => createHash("sha256").update(value).digest();
7
6
  /**
@@ -63,8 +62,8 @@ var previewStage = async (ctx) => {
63
62
  error: "BAD_REQUEST",
64
63
  message: "revision must be a positive integer when given."
65
64
  });
65
+ const { createPreview } = await import("../preview/createPreview.js");
66
66
  const result = await createPreview(body, ctx.config, ctx.renderFn, ctx.pluginManager, ctx.caches);
67
67
  return json(ctx, result.ok ? 200 : 422, result);
68
68
  };
69
- //#endregion
70
69
  export { previewStage };
@@ -1,3 +1,3 @@
1
1
  import { McpOptions } from '../options';
2
- import { Stage } from '@plitzi/sdk-server/kernel';
2
+ import { Stage } from '@plitzi/sdk-kernel/http';
3
3
  export declare const createWidgetProxyStage: (options?: McpOptions) => Stage;
@@ -1,6 +1,6 @@
1
- import { proxySettings } from "../modules/mcp/proxy/config.js";
2
1
  import { handleProxyRequest } from "../modules/mcp/proxy/handler.js";
3
- //#region src/stages/proxy.ts
2
+ import { proxySettings } from "../modules/mcp/proxy/config.js";
3
+ // src/stages/proxy.ts
4
4
  var createWidgetProxyStage = (options = {}) => {
5
5
  const settings = proxySettings(options.proxy);
6
6
  return async (ctx) => {
@@ -10,5 +10,4 @@ var createWidgetProxyStage = (options = {}) => {
10
10
  return true;
11
11
  };
12
12
  };
13
- //#endregion
14
13
  export { createWidgetProxyStage };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@plitzi/sdk-mcp",
3
- "version": "0.39.1",
3
+ "version": "0.39.2",
4
4
  "license": "AGPL-3.0",
5
5
  "files": [
6
6
  "dist",
@@ -27,6 +27,12 @@
27
27
  "types": "./dist/render.d.ts",
28
28
  "import": "./dist/render.js",
29
29
  "default": "./dist/render.js"
30
+ },
31
+ "./preview": {
32
+ "@plitzi/source": "./src/preview.ts",
33
+ "types": "./dist/preview.d.ts",
34
+ "import": "./dist/preview.js",
35
+ "default": "./dist/preview.js"
30
36
  }
31
37
  },
32
38
  "repository": {
@@ -40,13 +46,14 @@
40
46
  "sideEffects": false,
41
47
  "dependencies": {
42
48
  "@modelcontextprotocol/ext-apps": "^1.7.5",
43
- "@modelcontextprotocol/sdk": "^1.32.1",
44
- "@plitzi/plitzi-sdk": "0.39.1",
45
- "@plitzi/sdk-authoring": "0.39.1",
46
- "@plitzi/sdk-schema": "0.39.1",
47
- "@plitzi/sdk-server": "0.39.1",
48
- "@plitzi/sdk-shared": "0.39.1",
49
- "@plitzi/sdk-style": "0.39.1",
49
+ "@modelcontextprotocol/sdk": "^1.32.2",
50
+ "@plitzi/plitzi-sdk": "0.39.2",
51
+ "@plitzi/sdk-authoring": "0.39.2",
52
+ "@plitzi/sdk-kernel": "0.39.2",
53
+ "@plitzi/sdk-schema": "0.39.2",
54
+ "@plitzi/sdk-server": "0.39.2",
55
+ "@plitzi/sdk-shared": "0.39.2",
56
+ "@plitzi/sdk-style": "0.39.2",
50
57
  "ejs": "^7.0.2",
51
58
  "esbuild": "^0.28.2",
52
59
  "zod": "^4.6.7"
@@ -58,20 +65,20 @@
58
65
  "devDependencies": {
59
66
  "@types/ejs": "^3.1.5",
60
67
  "@types/jsdom": "^30.0.0",
61
- "@types/node": "^26.6.5",
68
+ "@types/node": "^26.6.6",
62
69
  "@types/react": "^19.3.0",
63
- "@vitejs/plugin-react": "^6.1.2",
64
- "@vitest/coverage-v8": "^5.0.5",
70
+ "@vitejs/plugin-react": "^6.3.0",
71
+ "@vitest/coverage-v8": "^5.1.0",
65
72
  "eslint": "^9.39.5",
66
73
  "eslint-plugin-import": "^2.32.0",
67
- "jsdom": "^30.1.3",
74
+ "jsdom": "^31.0.0",
68
75
  "react": "^19.3.1",
69
76
  "react-dom": "^19.3.1",
70
77
  "tsx": "^4.23.15",
71
78
  "typescript": "^6.0.3",
72
- "vite": "^8.3.4",
79
+ "vite": "^8.3.7",
73
80
  "vite-plugin-dts": "^5.1.2",
74
- "vitest": "^5.0.5"
81
+ "vitest": "^5.1.0"
75
82
  },
76
83
  "scripts": {
77
84
  "start": "TSX_TSCONFIG_PATH=tsconfig.app.json node --import tsx dev/main.ts",
@@ -81,8 +88,8 @@
81
88
  "inspector:legacy": "yarn dlx @modelcontextprotocol/inspector@1.0.1",
82
89
  "build:dev": "vite build --mode development",
83
90
  "build:prod": "vite build",
84
- "lint": "TIMING=1 eslint ./src ./dev",
85
- "typecheck": "tsc -p tsconfig.app.json --noEmit",
91
+ "lint": "TIMING=1 eslint --cache --cache-location .eslintcache --cache-strategy content ./src ./dev",
92
+ "typecheck": "tsc -p tsconfig.app.json --noEmit --incremental --tsBuildInfoFile .tsbuildinfo/app.tsbuildinfo",
86
93
  "test": "vitest run",
87
94
  "test:e2e": "vitest run src/modules/mcp/e2e",
88
95
  "test:coverage": "vitest run --coverage",