@plitzi/sdk-server 0.30.19 → 0.31.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.
Files changed (242) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/dist/_virtual/_rolldown/runtime.js +13 -0
  3. package/dist/helpers/cache/TtlCache.js +2 -0
  4. package/dist/index.js +6 -1
  5. package/dist/modules/ai/AIEngine.js +120 -0
  6. package/dist/modules/mcp/handler.js +35 -16
  7. package/dist/modules/mcp/helpers.js +75 -0
  8. package/dist/modules/mcp/resources/glossary/binding.js +73 -0
  9. package/dist/modules/mcp/resources/glossary/collection.js +76 -0
  10. package/dist/modules/mcp/resources/glossary/displayMode.js +50 -0
  11. package/dist/modules/mcp/resources/glossary/element.js +68 -0
  12. package/dist/modules/mcp/resources/glossary/environment.js +48 -0
  13. package/dist/modules/mcp/resources/glossary/interaction.js +62 -0
  14. package/dist/modules/mcp/resources/glossary/page.js +70 -0
  15. package/dist/modules/mcp/resources/glossary/plugin.js +96 -0
  16. package/dist/modules/mcp/resources/glossary/resource.js +75 -0
  17. package/dist/modules/mcp/resources/glossary/schema.js +69 -0
  18. package/dist/modules/mcp/resources/glossary/schemaVariable.js +60 -0
  19. package/dist/modules/mcp/resources/glossary/segment.js +59 -0
  20. package/dist/modules/mcp/resources/glossary/space.js +73 -0
  21. package/dist/modules/mcp/resources/glossary/style.js +81 -0
  22. package/dist/modules/mcp/resources/glossary/styleSelector.js +77 -0
  23. package/dist/modules/mcp/resources/glossary/styleVariable.js +72 -0
  24. package/dist/modules/mcp/resources/index.js +71 -0
  25. package/dist/modules/mcp/resources/workflows/data.js +49 -0
  26. package/dist/modules/mcp/resources/workflows/elements.js +53 -0
  27. package/dist/modules/mcp/resources/workflows/segments.js +55 -0
  28. package/dist/modules/mcp/resources/workflows/styles.js +91 -0
  29. package/dist/modules/mcp/server.js +23 -113
  30. package/dist/modules/mcp/tools/collections/createCollection.js +25 -0
  31. package/dist/modules/mcp/tools/collections/createCollectionRecord.js +27 -0
  32. package/dist/modules/mcp/tools/collections/deleteCollection.js +16 -0
  33. package/dist/modules/mcp/tools/collections/deleteCollectionRecord.js +16 -0
  34. package/dist/modules/mcp/tools/collections/getCollection.js +21 -0
  35. package/dist/modules/mcp/tools/collections/getCollectionRecord.js +25 -0
  36. package/dist/modules/mcp/tools/collections/getCollectionRecords.js +29 -0
  37. package/dist/modules/mcp/tools/collections/getCollections.js +19 -0
  38. package/dist/modules/mcp/tools/collections/updateCollection.js +28 -0
  39. package/dist/modules/mcp/tools/collections/updateCollectionRecord.js +31 -0
  40. package/dist/modules/mcp/tools/docs/listResources.js +16 -0
  41. package/dist/modules/mcp/tools/docs/readResource.js +23 -0
  42. package/dist/modules/mcp/tools/index.js +150 -0
  43. package/dist/modules/mcp/tools/plugins/addPlugin.js +24 -0
  44. package/dist/modules/mcp/tools/plugins/listPlugins.js +20 -0
  45. package/dist/modules/mcp/tools/plugins/removePlugin.js +16 -0
  46. package/dist/modules/mcp/tools/plugins/updatePlugin.js +23 -0
  47. package/dist/modules/mcp/tools/resources/addResource.js +33 -0
  48. package/dist/modules/mcp/tools/resources/getResource.js +29 -0
  49. package/dist/modules/mcp/tools/resources/getResources.js +27 -0
  50. package/dist/modules/mcp/tools/resources/moveResource.js +30 -0
  51. package/dist/modules/mcp/tools/resources/removeResource.js +19 -0
  52. package/dist/modules/mcp/tools/segment/createSegment.js +27 -0
  53. package/dist/modules/mcp/tools/segment/deleteSegment.js +16 -0
  54. package/dist/modules/mcp/tools/segment/getSegment.js +19 -0
  55. package/dist/modules/mcp/tools/segment/getSegments.js +27 -0
  56. package/dist/modules/mcp/tools/segment/schema/elements/createSegmentElement.js +24 -0
  57. package/dist/modules/mcp/tools/segment/schema/elements/deleteSegmentElement.js +19 -0
  58. package/dist/modules/mcp/tools/segment/schema/elements/moveSegmentElement.js +28 -0
  59. package/dist/modules/mcp/tools/segment/schema/elements/updateSegmentElement.js +23 -0
  60. package/dist/modules/mcp/tools/segment/schema/variables/createSegmentVariable.js +41 -0
  61. package/dist/modules/mcp/tools/segment/schema/variables/deleteSegmentVariable.js +19 -0
  62. package/dist/modules/mcp/tools/segment/schema/variables/updateSegmentVariable.js +41 -0
  63. package/dist/modules/mcp/tools/segment/style/variables/createSegmentStyleVariable.js +34 -0
  64. package/dist/modules/mcp/tools/segment/style/variables/deleteSegmentStyleVariable.js +21 -0
  65. package/dist/modules/mcp/tools/segment/style/variables/updateSegmentStyleVariable.js +34 -0
  66. package/dist/modules/mcp/tools/segment/updateSegment.js +30 -0
  67. package/dist/modules/mcp/tools/space/schema/applyPreview.js +33 -0
  68. package/dist/modules/mcp/tools/space/schema/elements/cloneElement.js +34 -0
  69. package/dist/modules/mcp/tools/space/schema/elements/createElement.js +50 -0
  70. package/dist/modules/mcp/tools/space/schema/elements/deleteElement.js +16 -0
  71. package/dist/modules/mcp/tools/space/schema/elements/getElement.js +17 -0
  72. package/dist/modules/mcp/tools/space/schema/elements/getElements.js +21 -0
  73. package/dist/modules/mcp/tools/space/schema/elements/listElements.js +28 -0
  74. package/dist/modules/mcp/tools/space/schema/elements/moveElement.js +27 -0
  75. package/dist/modules/mcp/tools/space/schema/elements/updateElement.js +49 -0
  76. package/dist/modules/mcp/tools/space/schema/getSpaceSettings.js +46 -0
  77. package/dist/modules/mcp/tools/space/schema/pageFolders/createPageFolder.js +24 -0
  78. package/dist/modules/mcp/tools/space/schema/pageFolders/deletePageFolder.js +16 -0
  79. package/dist/modules/mcp/tools/space/schema/pageFolders/getPageFolder.js +17 -0
  80. package/dist/modules/mcp/tools/space/schema/pageFolders/getPageFolders.js +17 -0
  81. package/dist/modules/mcp/tools/space/schema/pageFolders/updatePageFolder.js +28 -0
  82. package/dist/modules/mcp/tools/space/schema/pages/createPage.js +37 -0
  83. package/dist/modules/mcp/tools/space/schema/pages/deletePage.js +16 -0
  84. package/dist/modules/mcp/tools/space/schema/pages/getPage.js +28 -0
  85. package/dist/modules/mcp/tools/space/schema/pages/getPageBySlug.js +17 -0
  86. package/dist/modules/mcp/tools/space/schema/pages/getPages.js +17 -0
  87. package/dist/modules/mcp/tools/space/schema/pages/updatePage.js +25 -0
  88. package/dist/modules/mcp/tools/space/schema/schemas.js +53 -0
  89. package/dist/modules/mcp/tools/space/schema/updateSpaceSettings.js +23 -0
  90. package/dist/modules/mcp/tools/space/schema/variables/createVariable.js +38 -0
  91. package/dist/modules/mcp/tools/space/schema/variables/deleteVariable.js +16 -0
  92. package/dist/modules/mcp/tools/space/schema/variables/getVariable.js +17 -0
  93. package/dist/modules/mcp/tools/space/schema/variables/getVariables.js +17 -0
  94. package/dist/modules/mcp/tools/space/schema/variables/updateVariable.js +38 -0
  95. package/dist/modules/mcp/tools/space/style/selectors/createStyleSelector.js +37 -0
  96. package/dist/modules/mcp/tools/space/style/selectors/deleteStyleSelector.js +24 -0
  97. package/dist/modules/mcp/tools/space/style/selectors/getStyleSelectors.js +20 -0
  98. package/dist/modules/mcp/tools/space/style/selectors/updateStyleSelector.js +37 -0
  99. package/dist/modules/mcp/tools/space/style/variables/createStyleVariable.js +33 -0
  100. package/dist/modules/mcp/tools/space/style/variables/deleteStyleVariable.js +20 -0
  101. package/dist/modules/mcp/tools/space/style/variables/getStyleVariable.js +19 -0
  102. package/dist/modules/mcp/tools/space/style/variables/getStyleVariables.js +16 -0
  103. package/dist/modules/mcp/tools/space/style/variables/updateStyleVariable.js +33 -0
  104. package/dist/package.js +62 -0
  105. package/dist/package.json.d.ts +67 -0
  106. package/dist/src/index.d.ts +2 -1
  107. package/dist/src/modules/ai/AIEngine.d.ts +20 -0
  108. package/dist/src/modules/ai/index.d.ts +3 -0
  109. package/dist/src/modules/mcp/handler.d.ts +5 -2
  110. package/dist/src/modules/mcp/helpers.d.ts +9 -0
  111. package/dist/src/modules/mcp/helpers.test.d.ts +1 -0
  112. package/dist/src/modules/mcp/index.d.ts +5 -0
  113. package/dist/src/modules/mcp/resources/glossary/binding.d.ts +7 -0
  114. package/dist/src/modules/mcp/resources/glossary/collection.d.ts +7 -0
  115. package/dist/src/modules/mcp/resources/glossary/displayMode.d.ts +7 -0
  116. package/dist/src/modules/mcp/resources/glossary/element.d.ts +7 -0
  117. package/dist/src/modules/mcp/resources/glossary/environment.d.ts +7 -0
  118. package/dist/src/modules/mcp/resources/glossary/interaction.d.ts +7 -0
  119. package/dist/src/modules/mcp/resources/glossary/page.d.ts +7 -0
  120. package/dist/src/modules/mcp/resources/glossary/plugin.d.ts +7 -0
  121. package/dist/src/modules/mcp/resources/glossary/resource.d.ts +7 -0
  122. package/dist/src/modules/mcp/resources/glossary/schema.d.ts +7 -0
  123. package/dist/src/modules/mcp/resources/glossary/schemaVariable.d.ts +7 -0
  124. package/dist/src/modules/mcp/resources/glossary/segment.d.ts +7 -0
  125. package/dist/src/modules/mcp/resources/glossary/space.d.ts +7 -0
  126. package/dist/src/modules/mcp/resources/glossary/style.d.ts +7 -0
  127. package/dist/src/modules/mcp/resources/glossary/styleSelector.d.ts +7 -0
  128. package/dist/src/modules/mcp/resources/glossary/styleVariable.d.ts +7 -0
  129. package/dist/src/modules/mcp/resources/index.d.ts +10 -0
  130. package/dist/src/modules/mcp/resources/workflows/data.d.ts +7 -0
  131. package/dist/src/modules/mcp/resources/workflows/elements.d.ts +7 -0
  132. package/dist/src/modules/mcp/resources/workflows/segments.d.ts +7 -0
  133. package/dist/src/modules/mcp/resources/workflows/styles.d.ts +7 -0
  134. package/dist/src/modules/mcp/server.d.ts +4 -3
  135. package/dist/src/modules/mcp/tools/collections/collections.test.d.ts +1 -0
  136. package/dist/src/modules/mcp/tools/collections/createCollection.d.ts +3 -0
  137. package/dist/src/modules/mcp/tools/collections/createCollectionRecord.d.ts +3 -0
  138. package/dist/src/modules/mcp/tools/collections/deleteCollection.d.ts +3 -0
  139. package/dist/src/modules/mcp/tools/collections/deleteCollectionRecord.d.ts +3 -0
  140. package/dist/src/modules/mcp/tools/collections/getCollection.d.ts +3 -0
  141. package/dist/src/modules/mcp/tools/collections/getCollectionRecord.d.ts +3 -0
  142. package/dist/src/modules/mcp/tools/collections/getCollectionRecords.d.ts +3 -0
  143. package/dist/src/modules/mcp/tools/collections/getCollections.d.ts +3 -0
  144. package/dist/src/modules/mcp/tools/collections/index.d.ts +10 -0
  145. package/dist/src/modules/mcp/tools/collections/updateCollection.d.ts +3 -0
  146. package/dist/src/modules/mcp/tools/collections/updateCollectionRecord.d.ts +3 -0
  147. package/dist/src/modules/mcp/tools/docs/index.d.ts +2 -0
  148. package/dist/src/modules/mcp/tools/docs/listResources.d.ts +3 -0
  149. package/dist/src/modules/mcp/tools/docs/readResource.d.ts +3 -0
  150. package/dist/src/modules/mcp/tools/index.d.ts +6 -0
  151. package/dist/src/modules/mcp/tools/plugins/addPlugin.d.ts +3 -0
  152. package/dist/src/modules/mcp/tools/plugins/index.d.ts +5 -0
  153. package/dist/src/modules/mcp/tools/plugins/listPlugins.d.ts +3 -0
  154. package/dist/src/modules/mcp/tools/plugins/plugins.test.d.ts +1 -0
  155. package/dist/src/modules/mcp/tools/plugins/removePlugin.d.ts +3 -0
  156. package/dist/src/modules/mcp/tools/plugins/updatePlugin.d.ts +3 -0
  157. package/dist/src/modules/mcp/tools/resources/addResource.d.ts +3 -0
  158. package/dist/src/modules/mcp/tools/resources/getResource.d.ts +3 -0
  159. package/dist/src/modules/mcp/tools/resources/getResources.d.ts +3 -0
  160. package/dist/src/modules/mcp/tools/resources/index.d.ts +6 -0
  161. package/dist/src/modules/mcp/tools/resources/moveResource.d.ts +3 -0
  162. package/dist/src/modules/mcp/tools/resources/removeResource.d.ts +3 -0
  163. package/dist/src/modules/mcp/tools/resources/resources.test.d.ts +1 -0
  164. package/dist/src/modules/mcp/tools/segment/createSegment.d.ts +3 -0
  165. package/dist/src/modules/mcp/tools/segment/deleteSegment.d.ts +3 -0
  166. package/dist/src/modules/mcp/tools/segment/getSegment.d.ts +3 -0
  167. package/dist/src/modules/mcp/tools/segment/getSegments.d.ts +3 -0
  168. package/dist/src/modules/mcp/tools/segment/index.d.ts +8 -0
  169. package/dist/src/modules/mcp/tools/segment/schema/elements/createSegmentElement.d.ts +3 -0
  170. package/dist/src/modules/mcp/tools/segment/schema/elements/deleteSegmentElement.d.ts +3 -0
  171. package/dist/src/modules/mcp/tools/segment/schema/elements/index.d.ts +5 -0
  172. package/dist/src/modules/mcp/tools/segment/schema/elements/moveSegmentElement.d.ts +3 -0
  173. package/dist/src/modules/mcp/tools/segment/schema/elements/segmentElements.test.d.ts +1 -0
  174. package/dist/src/modules/mcp/tools/segment/schema/elements/updateSegmentElement.d.ts +3 -0
  175. package/dist/src/modules/mcp/tools/segment/schema/index.d.ts +2 -0
  176. package/dist/src/modules/mcp/tools/segment/schema/variables/createSegmentVariable.d.ts +3 -0
  177. package/dist/src/modules/mcp/tools/segment/schema/variables/deleteSegmentVariable.d.ts +3 -0
  178. package/dist/src/modules/mcp/tools/segment/schema/variables/index.d.ts +4 -0
  179. package/dist/src/modules/mcp/tools/segment/schema/variables/segmentVariables.test.d.ts +1 -0
  180. package/dist/src/modules/mcp/tools/segment/schema/variables/updateSegmentVariable.d.ts +3 -0
  181. package/dist/src/modules/mcp/tools/segment/segment.test.d.ts +1 -0
  182. package/dist/src/modules/mcp/tools/segment/style/index.d.ts +1 -0
  183. package/dist/src/modules/mcp/tools/segment/style/variables/createSegmentStyleVariable.d.ts +3 -0
  184. package/dist/src/modules/mcp/tools/segment/style/variables/deleteSegmentStyleVariable.d.ts +3 -0
  185. package/dist/src/modules/mcp/tools/segment/style/variables/index.d.ts +4 -0
  186. package/dist/src/modules/mcp/tools/segment/style/variables/segmentStyleVariables.test.d.ts +1 -0
  187. package/dist/src/modules/mcp/tools/segment/style/variables/updateSegmentStyleVariable.d.ts +3 -0
  188. package/dist/src/modules/mcp/tools/segment/updateSegment.d.ts +3 -0
  189. package/dist/src/modules/mcp/tools/space/index.d.ts +2 -0
  190. package/dist/src/modules/mcp/tools/space/schema/applyPreview.d.ts +3 -0
  191. package/dist/src/modules/mcp/tools/space/schema/elements/cloneElement.d.ts +3 -0
  192. package/dist/src/modules/mcp/tools/space/schema/elements/createElement.d.ts +3 -0
  193. package/dist/src/modules/mcp/tools/space/schema/elements/deleteElement.d.ts +3 -0
  194. package/dist/src/modules/mcp/tools/space/schema/elements/elements.test.d.ts +1 -0
  195. package/dist/src/modules/mcp/tools/space/schema/elements/getElement.d.ts +3 -0
  196. package/dist/src/modules/mcp/tools/space/schema/elements/getElements.d.ts +3 -0
  197. package/dist/src/modules/mcp/tools/space/schema/elements/index.d.ts +9 -0
  198. package/dist/src/modules/mcp/tools/space/schema/elements/listElements.d.ts +3 -0
  199. package/dist/src/modules/mcp/tools/space/schema/elements/moveElement.d.ts +3 -0
  200. package/dist/src/modules/mcp/tools/space/schema/elements/updateElement.d.ts +3 -0
  201. package/dist/src/modules/mcp/tools/space/schema/getSpaceSettings.d.ts +3 -0
  202. package/dist/src/modules/mcp/tools/space/schema/index.d.ts +8 -0
  203. package/dist/src/modules/mcp/tools/space/schema/pageFolders/createPageFolder.d.ts +3 -0
  204. package/dist/src/modules/mcp/tools/space/schema/pageFolders/deletePageFolder.d.ts +3 -0
  205. package/dist/src/modules/mcp/tools/space/schema/pageFolders/getPageFolder.d.ts +3 -0
  206. package/dist/src/modules/mcp/tools/space/schema/pageFolders/getPageFolders.d.ts +3 -0
  207. package/dist/src/modules/mcp/tools/space/schema/pageFolders/index.d.ts +6 -0
  208. package/dist/src/modules/mcp/tools/space/schema/pageFolders/pageFolders.test.d.ts +1 -0
  209. package/dist/src/modules/mcp/tools/space/schema/pageFolders/updatePageFolder.d.ts +3 -0
  210. package/dist/src/modules/mcp/tools/space/schema/pages/createPage.d.ts +3 -0
  211. package/dist/src/modules/mcp/tools/space/schema/pages/deletePage.d.ts +3 -0
  212. package/dist/src/modules/mcp/tools/space/schema/pages/getPage.d.ts +3 -0
  213. package/dist/src/modules/mcp/tools/space/schema/pages/getPageBySlug.d.ts +3 -0
  214. package/dist/src/modules/mcp/tools/space/schema/pages/getPages.d.ts +3 -0
  215. package/dist/src/modules/mcp/tools/space/schema/pages/index.d.ts +7 -0
  216. package/dist/src/modules/mcp/tools/space/schema/pages/pages.test.d.ts +1 -0
  217. package/dist/src/modules/mcp/tools/space/schema/pages/updatePage.d.ts +3 -0
  218. package/dist/src/modules/mcp/tools/space/schema/schemas.d.ts +66 -0
  219. package/dist/src/modules/mcp/tools/space/schema/updateSpaceSettings.d.ts +3 -0
  220. package/dist/src/modules/mcp/tools/space/schema/variables/createVariable.d.ts +3 -0
  221. package/dist/src/modules/mcp/tools/space/schema/variables/deleteVariable.d.ts +3 -0
  222. package/dist/src/modules/mcp/tools/space/schema/variables/getVariable.d.ts +3 -0
  223. package/dist/src/modules/mcp/tools/space/schema/variables/getVariables.d.ts +3 -0
  224. package/dist/src/modules/mcp/tools/space/schema/variables/index.d.ts +6 -0
  225. package/dist/src/modules/mcp/tools/space/schema/variables/updateVariable.d.ts +3 -0
  226. package/dist/src/modules/mcp/tools/space/schema/variables/variables.test.d.ts +1 -0
  227. package/dist/src/modules/mcp/tools/space/space.test.d.ts +1 -0
  228. package/dist/src/modules/mcp/tools/space/style/index.d.ts +2 -0
  229. package/dist/src/modules/mcp/tools/space/style/selectors/createStyleSelector.d.ts +3 -0
  230. package/dist/src/modules/mcp/tools/space/style/selectors/deleteStyleSelector.d.ts +3 -0
  231. package/dist/src/modules/mcp/tools/space/style/selectors/getStyleSelectors.d.ts +3 -0
  232. package/dist/src/modules/mcp/tools/space/style/selectors/index.d.ts +5 -0
  233. package/dist/src/modules/mcp/tools/space/style/selectors/styleSelectors.test.d.ts +1 -0
  234. package/dist/src/modules/mcp/tools/space/style/selectors/updateStyleSelector.d.ts +3 -0
  235. package/dist/src/modules/mcp/tools/space/style/variables/createStyleVariable.d.ts +3 -0
  236. package/dist/src/modules/mcp/tools/space/style/variables/deleteStyleVariable.d.ts +3 -0
  237. package/dist/src/modules/mcp/tools/space/style/variables/getStyleVariable.d.ts +3 -0
  238. package/dist/src/modules/mcp/tools/space/style/variables/getStyleVariables.d.ts +3 -0
  239. package/dist/src/modules/mcp/tools/space/style/variables/index.d.ts +6 -0
  240. package/dist/src/modules/mcp/tools/space/style/variables/styleVariables.test.d.ts +1 -0
  241. package/dist/src/modules/mcp/tools/space/style/variables/updateStyleVariable.d.ts +3 -0
  242. package/package.json +18 -14
@@ -0,0 +1,77 @@
1
+ //#region src/modules/mcp/resources/glossary/styleSelector.ts
2
+ var styleSelectorResource = {
3
+ uri: "plitzi://docs/style-selector",
4
+ name: "Plitzi Docs: Style Selector",
5
+ description: "A CSS selector entry in the Plitzi style system — holds all visual rules for one selector across states and variants.",
6
+ mimeType: "text/markdown",
7
+ content: `# Style Selector (StyleItem)
8
+
9
+ A **style selector** is a single entry in \`style.platform[displayMode]\`. It represents one CSS selector (class, element, or ID) and stores all its CSS rules organized by sub-selector, state, and variant.
10
+
11
+ ## TypeScript Shape
12
+
13
+ \`\`\`typescript
14
+ type StyleItem = {
15
+ name: string; // The CSS selector (e.g. '.hero-section')
16
+ type: 'class' | 'element' | 'id';
17
+ variables?: Partial<StyleVariables>; // Design tokens scoped to this selector
18
+ attributes: Record<string, StyleBlock>; // CSS per sub-selector slot
19
+ cache: string; // Pre-compiled CSS (auto-managed)
20
+ componentType?: string; // Plugin type that created this selector
21
+ };
22
+
23
+ type StyleBlock = {
24
+ default?: StyleObject; // Normal state CSS
25
+ states?: Partial<Record<StyleState, StyleObject>>;// Pseudo-class overrides
26
+ variants?: Record<string, Omit<StyleBlock, 'variants'>>; // Named variants
27
+ };
28
+
29
+ type StyleState = 'hover' | 'active' | 'focus' | 'disabled' | 'checked' | 'visited';
30
+ type StyleObject = Partial<Record<StyleCategory, string | number>>;
31
+ \`\`\`
32
+
33
+ ## Sub-selector Slots
34
+
35
+ The \`attributes\` object is keyed by **slot names**, not raw CSS selectors. Each slot maps to a structural part of the component:
36
+
37
+ - \`base\` — always present; targets the root DOM element of the component.
38
+ - Other slots (e.g. \`header\`, \`body\`, \`icon\`, \`label\`) target internal parts defined by the plugin.
39
+
40
+ The mapping from slot name → CSS selector is managed by the plugin renderer.
41
+
42
+ ## Variants
43
+
44
+ Variants allow a single selector to have multiple named visual appearances (e.g. \`primary\`, \`danger\`, \`sm\`, \`lg\`). An element activates a variant through \`definition.initialState.styleVariant\`:
45
+
46
+ \`\`\`typescript
47
+ // element.definition.initialState.styleVariant
48
+ {
49
+ base: { base: 'primary' } // Apply 'primary' variant on the 'base' slot
50
+ }
51
+ \`\`\`
52
+
53
+ ## Relationship to Elements
54
+
55
+ Elements reference style selectors via \`definition.styleSelectors\`:
56
+
57
+ \`\`\`typescript
58
+ // element.definition.styleSelectors
59
+ {
60
+ base: '.hero-section', // Points to style.platform.desktop['.hero-section']
61
+ title: '.hero-title' // Points to style.platform.desktop['.hero-title']
62
+ }
63
+ \`\`\`
64
+
65
+ ## Display Modes
66
+
67
+ A style selector can exist in multiple display modes (\`desktop\`, \`tablet\`, \`mobile\`). Rules in \`tablet\` and \`mobile\` override the desktop base at their respective breakpoints.
68
+
69
+ ## Common Operations
70
+
71
+ - \`create_style_selector\` — add a new StyleItem to a display mode.
72
+ - \`update_style_selector\` — modify \`attributes\` for an existing selector.
73
+ - \`delete_style_selector\` — remove a selector from a display mode.
74
+ `
75
+ };
76
+ //#endregion
77
+ export { styleSelectorResource };
@@ -0,0 +1,72 @@
1
+ //#region src/modules/mcp/resources/glossary/styleVariable.ts
2
+ var styleVariableResource = {
3
+ uri: "plitzi://docs/style-variable",
4
+ name: "Plitzi Docs: Style Variable",
5
+ description: "Design tokens in the Plitzi style system — reusable values for colors, spacing, shadows, and custom properties.",
6
+ mimeType: "text/markdown",
7
+ content: `# Style Variable
8
+
9
+ **Style variables** are design tokens stored in the \`Style\` object. They define reusable values (colors, spacing units, shadows, custom properties) that can be referenced across all CSS rules in the space.
10
+
11
+ ## TypeScript Shape
12
+
13
+ \`\`\`typescript
14
+ enum StyleVariableCategory {
15
+ COLOR = 'color',
16
+ SPACING = 'spacing',
17
+ SHADOW = 'shadow',
18
+ CUSTOM = 'custom'
19
+ }
20
+
21
+ type StyleVariables = Record<StyleVariableCategory, StyleVariableGroup>;
22
+ type StyleVariableGroup = Record<string, StyleVariableValue>;
23
+
24
+ // Value can be a plain string/number or theme-aware (different per light/dark)
25
+ type StyleVariableValue =
26
+ | string
27
+ | number
28
+ | {
29
+ light?: string;
30
+ dark?: string;
31
+ default?: string;
32
+ };
33
+ \`\`\`
34
+
35
+ ## Categories
36
+
37
+ - **\`color\`** — color tokens (e.g. \`primary\`, \`background\`, \`text-muted\`). Values can be theme-aware (different for light vs. dark).
38
+ - **\`spacing\`** — spacing units (e.g. \`sm\`, \`md\`, \`lg\`). Plain numbers or CSS values.
39
+ - **\`shadow\`** — box-shadow definitions (e.g. \`card\`, \`modal\`).
40
+ - **\`custom\`** — any other token (border radius, font size, z-index, etc.).
41
+
42
+ ## Theme-Aware Values
43
+
44
+ When a design system supports multiple themes, a variable value can vary:
45
+
46
+ \`\`\`typescript
47
+ { light: '#ffffff', dark: '#1a1a1a', default: '#ffffff' }
48
+ \`\`\`
49
+
50
+ The \`default\` key is used when no theme preference is detected.
51
+
52
+ ## Scope
53
+
54
+ Variables can be scoped at two levels:
55
+
56
+ 1. **Style-level** (\`style.variables\`) — global tokens available everywhere in the space.
57
+ 2. **Selector-level** (\`styleItem.variables\`) — tokens scoped to one CSS selector (override global for that component).
58
+
59
+ ## Common Operations
60
+
61
+ - \`create_style_variable\` — add a new token with a category and name.
62
+ - \`update_style_variable\` — change a token's value.
63
+ - \`delete_style_variable\` — remove a token.
64
+
65
+ ## Relationships
66
+
67
+ - Referenced by **Style Selectors** via CSS variable syntax or direct value interpolation.
68
+ - **Schema Variables** are different — they are schema-level data variables, not CSS design tokens.
69
+ `
70
+ };
71
+ //#endregion
72
+ export { styleVariableResource };
@@ -0,0 +1,71 @@
1
+ import { bindingResource } from "./glossary/binding.js";
2
+ import { collectionResource } from "./glossary/collection.js";
3
+ import { displayModeResource } from "./glossary/displayMode.js";
4
+ import { elementResource } from "./glossary/element.js";
5
+ import { environmentResource } from "./glossary/environment.js";
6
+ import { interactionResource } from "./glossary/interaction.js";
7
+ import { pageResource } from "./glossary/page.js";
8
+ import { pluginResource } from "./glossary/plugin.js";
9
+ import { resourceResource } from "./glossary/resource.js";
10
+ import { schemaResource } from "./glossary/schema.js";
11
+ import { schemaVariableResource } from "./glossary/schemaVariable.js";
12
+ import { segmentResource } from "./glossary/segment.js";
13
+ import { spaceResource } from "./glossary/space.js";
14
+ import { styleResource } from "./glossary/style.js";
15
+ import { styleSelectorResource } from "./glossary/styleSelector.js";
16
+ import { styleVariableResource } from "./glossary/styleVariable.js";
17
+ import { workflowDataResource } from "./workflows/data.js";
18
+ import { workflowElementsResource } from "./workflows/elements.js";
19
+ import { workflowSegmentsResource } from "./workflows/segments.js";
20
+ import { workflowStylesResource } from "./workflows/styles.js";
21
+ //#region src/modules/mcp/resources/index.ts
22
+ var glossaryResources = [
23
+ schemaResource,
24
+ elementResource,
25
+ pageResource,
26
+ styleResource,
27
+ styleSelectorResource,
28
+ styleVariableResource,
29
+ segmentResource,
30
+ pluginResource,
31
+ collectionResource,
32
+ spaceResource,
33
+ environmentResource,
34
+ schemaVariableResource,
35
+ resourceResource,
36
+ bindingResource,
37
+ interactionResource,
38
+ displayModeResource
39
+ ];
40
+ var workflowResources = [
41
+ workflowElementsResource,
42
+ workflowStylesResource,
43
+ workflowSegmentsResource,
44
+ workflowDataResource
45
+ ];
46
+ var registerResources = (server, custom = [], onRead) => {
47
+ for (const r of [
48
+ ...glossaryResources,
49
+ ...workflowResources,
50
+ ...custom
51
+ ]) server.registerResource(r.name, r.uri, {
52
+ description: r.description,
53
+ mimeType: r.mimeType
54
+ }, () => {
55
+ onRead?.(r.name, r.uri);
56
+ return { contents: [{
57
+ uri: r.uri,
58
+ mimeType: r.mimeType,
59
+ text: r.content
60
+ }] };
61
+ });
62
+ };
63
+ var allResources = [...glossaryResources, ...workflowResources];
64
+ var getResourceList = () => allResources.map(({ uri, name, description }) => ({
65
+ uri,
66
+ name,
67
+ description
68
+ }));
69
+ var getResourceByUri = (uri) => allResources.find((r) => r.uri === uri);
70
+ //#endregion
71
+ export { getResourceByUri, getResourceList, registerResources };
@@ -0,0 +1,49 @@
1
+ //#region src/modules/mcp/resources/workflows/data.ts
2
+ var workflowDataResource = {
3
+ uri: "plitzi://workflows/data",
4
+ name: "Plitzi Workflow: Data",
5
+ description: "Step-by-step guide for schema variables, collection records, and data bindings.",
6
+ mimeType: "text/markdown",
7
+ content: `# Workflow: Data — Variables, Collections, Bindings
8
+
9
+ ## Schema variables (space-level named values)
10
+
11
+ Variables are typed, named values that elements can bind to.
12
+
13
+ 1. Create a variable with \`create_variable\`:
14
+ \`\`\`json
15
+ { "variable": { "name": "heroTitle", "type": "text", "value": "Welcome", "category": "Content" } }
16
+ \`\`\`
17
+ 2. Update it with \`update_variable\` (identified by name).
18
+ 3. Delete with \`delete_variable\` — any element bindings referencing it will break.
19
+
20
+ ## Collection records (CMS data)
21
+
22
+ 1. List collections: \`get_collections\` → pick the target \`id\`.
23
+ 2. Inspect the collection's field definitions: \`get_collection\` → \`fields\`.
24
+ 3. Create a record with \`create_collection_record\`:
25
+ \`\`\`json
26
+ { "collectionId": "<id>", "values": { "title": "My Product", "price": 99 }, "status": "published" }
27
+ \`\`\`
28
+ 4. Update a record with \`update_collection_record\` (by \`recordId\`).
29
+ 5. List records with \`get_collection_records\` — supports optional \`filter\` and \`limit\`.
30
+
31
+ ## Bindings (connecting data to elements)
32
+
33
+ A binding maps a data source (variable or collection field) to an element's attribute or style at runtime.
34
+ Read \`plitzi://docs/binding\` for the full binding structure before working with bindings.
35
+
36
+ General flow:
37
+ 1. Ensure the variable or collection exists.
38
+ 2. Get the target element via \`get_element\` to inspect its current \`definition.bindings\`.
39
+ 3. Use \`update_element\` with the updated \`props\` that include the binding reference.
40
+
41
+ ## Reading the current state
42
+
43
+ - \`get_schema\` → \`variables\` — all space-level variables with types and values.
44
+ - \`get_collections\` — all collections in the space.
45
+ - \`get_collection_records\` — records from a specific collection.
46
+ `
47
+ };
48
+ //#endregion
49
+ export { workflowDataResource };
@@ -0,0 +1,53 @@
1
+ //#region src/modules/mcp/resources/workflows/elements.ts
2
+ var workflowElementsResource = {
3
+ uri: "plitzi://workflows/elements",
4
+ name: "Plitzi Workflow: Elements",
5
+ description: "Step-by-step guide for adding, nesting, moving, and removing elements on a page.",
6
+ mimeType: "text/markdown",
7
+ content: `# Workflow: Working with Elements
8
+
9
+ ## Add an element to a page
10
+
11
+ 1. Get the target page ID:
12
+ - \`get_builder_context\` → \`currentPageId\` (active page in the builder), OR
13
+ - \`get_schema\` → \`pages[]\` (all page IDs)
14
+ 2. Get valid element types: \`get_builder_context\` → \`elementDefaults\` keys.
15
+ 3. Call \`create_element\`:
16
+ \`\`\`json
17
+ { "element": { "type": "container", "label": "Hero" }, "parentId": "<pageId>" }
18
+ \`\`\`
19
+ 4. The response contains the created element with \`definition.styleSelectors\` (e.g. \`{ "base": ".el-abc123" }\`).
20
+ 5. Use those selectors to style the element → see **plitzi://workflows/styles**.
21
+
22
+ ## Nest elements (container → children)
23
+
24
+ Repeat \`create_element\` using the container's \`id\` as \`parentId\`:
25
+ \`\`\`json
26
+ { "element": { "type": "text", "label": "Heading" }, "parentId": "<containerId>" }
27
+ \`\`\`
28
+
29
+ ## Read the current element tree
30
+
31
+ - \`get_schema\` → \`flat\` — full map of all elements keyed by ID, with \`definition.parentId\` and \`definition.items\`.
32
+ - \`list_elements\` — lighter; returns id, label, type, parentId for every element.
33
+ - \`get_element\` — full detail for a single element (attributes, bindings, interactions).
34
+
35
+ ## Move an element
36
+
37
+ \`move_element\` with \`elementId\`, \`toParentId\`, and \`dropPosition\`:
38
+ - \`"inside"\` — appends as last child of the target (default).
39
+ - \`"top"\` / \`"bottom"\` — inserts before/after the target's siblings.
40
+
41
+ ## Update an element
42
+
43
+ \`update_element\` — change \`label\`, \`props\` (component attributes), or \`runtime\`.
44
+ For style changes use \`update_style_selector\`, not \`props\`.
45
+
46
+ ## Delete an element
47
+
48
+ \`delete_element\` removes the element and all its descendants. This cannot be undone.
49
+ Always confirm with the user before calling this.
50
+ `
51
+ };
52
+ //#endregion
53
+ export { workflowElementsResource };
@@ -0,0 +1,55 @@
1
+ //#region src/modules/mcp/resources/workflows/segments.ts
2
+ var workflowSegmentsResource = {
3
+ uri: "plitzi://workflows/segments",
4
+ name: "Plitzi Workflow: Segments",
5
+ description: "Step-by-step guide for creating and populating reusable segment templates.",
6
+ mimeType: "text/markdown",
7
+ content: `# Workflow: Working with Segments
8
+
9
+ A segment is a reusable UI template with its own isolated schema and style.
10
+ It is NOT placed on a page directly — it is defined once and referenced by elements across the space.
11
+
12
+ ## Create a segment and populate it
13
+
14
+ 1. Call \`create_segment\`:
15
+ \`\`\`json
16
+ { "name": "Product Card", "description": "Reusable card for product listings" }
17
+ \`\`\`
18
+ The response contains:
19
+ - \`id\` — segment ID (used by all subsequent segment calls)
20
+ - \`definition.baseElementId\` — the root element ID inside the segment
21
+
22
+ 2. Add elements to the segment root using \`create_segment_element\`:
23
+ \`\`\`json
24
+ { "segmentId": "<id>", "element": { "type": "container", "label": "Card" }, "parentId": "<baseElementId>" }
25
+ \`\`\`
26
+
27
+ 3. Nest elements inside by using the returned element \`id\` as the next \`parentId\`:
28
+ \`\`\`json
29
+ { "segmentId": "<id>", "element": { "type": "text", "label": "Title" }, "parentId": "<cardId>" }
30
+ \`\`\`
31
+
32
+ 4. Style segment elements the same way as page elements:
33
+ - Get the element's \`definition.styleSelectors\` from the \`create_segment_element\` response.
34
+ - Call \`update_style_selector\` with the selector and CSS rules.
35
+
36
+ 5. For segment-scoped design tokens (not shared with the space), use \`create_segment_style_variable\`.
37
+
38
+ ## Update segment metadata
39
+
40
+ \`update_segment\` — rename the segment or update its description.
41
+
42
+ ## Delete a segment
43
+
44
+ \`delete_segment\` removes the segment, its entire schema, and its style. Cannot be undone.
45
+ Always confirm with the user before calling this.
46
+
47
+ ## Segment variables
48
+
49
+ Segments can have their own typed variables (scoped to the segment):
50
+ - \`create_segment_variable\` — add a variable to the segment.
51
+ - \`update_segment_variable\` / \`delete_segment_variable\` — manage existing ones.
52
+ `
53
+ };
54
+ //#endregion
55
+ export { workflowSegmentsResource };
@@ -0,0 +1,91 @@
1
+ //#region src/modules/mcp/resources/workflows/styles.ts
2
+ var workflowStylesResource = {
3
+ uri: "plitzi://workflows/styles",
4
+ name: "Plitzi Workflow: Styles",
5
+ description: "Step-by-step guide for styling elements, using design tokens, and working across breakpoints.",
6
+ mimeType: "text/markdown",
7
+ content: `# Workflow: Styling Elements
8
+
9
+ ## Style an element after creating it
10
+
11
+ Every element has a \`definition.styleSelectors\` map (e.g. \`{ "base": ".el-abc123", "icon": ".el-abc123-icon" }\`).
12
+ These are the CSS class strings registered in the space style system.
13
+
14
+ 1. Get the element's \`styleSelectors\` — from the \`create_element\` / \`get_element\` response.
15
+ 2. Call \`update_style_selector\`:
16
+ \`\`\`json
17
+ {
18
+ "displayMode": "desktop",
19
+ "selector": ".el-abc123",
20
+ "type": "class",
21
+ "style": { "base": { "backgroundColor": "#3b82f6", "padding": "16px" } }
22
+ }
23
+ \`\`\`
24
+ 3. To style other breakpoints, repeat with \`"displayMode": "tablet"\` or \`"mobile"\`.
25
+ 4. To style sub-slots (e.g. icon, header, body): use the corresponding selector from \`styleSelectors\` and the slot name as the style key.
26
+
27
+ ## Update a specific CSS property (path parameter)
28
+
29
+ The \`path\` parameter in \`update_style_selector\` controls the scope of the update:
30
+
31
+ | path | style value | result |
32
+ |------|------------|--------|
33
+ | omitted | \`{ base: { color: "#fff" } }\` | Replaces **all** attributes of the selector |
34
+ | \`"base.color"\` | \`"#fff"\` | Updates only \`color\` inside the \`base\` slot |
35
+ | \`"base.color"\` | \`undefined\` / omitted | **Deletes** the \`color\` property from \`base\` |
36
+ | omitted | \`undefined\` / omitted | **Clears** all attributes from the selector |
37
+
38
+ Example — update only the background color without touching other properties:
39
+ \`\`\`json
40
+ {
41
+ "displayMode": "desktop",
42
+ "selector": ".el-abc123",
43
+ "type": "class",
44
+ "path": "base.backgroundColor",
45
+ "style": { "base": { "backgroundColor": "#ef4444" } }
46
+ }
47
+ \`\`\`
48
+
49
+ ## Create a new selector from scratch
50
+
51
+ Use \`create_style_selector\` when you need a CSS class that isn't tied to a specific element (shared utility class):
52
+ \`\`\`json
53
+ {
54
+ "displayMode": "desktop",
55
+ "selector": ".hero-banner",
56
+ "type": "class",
57
+ "style": { "base": { "minHeight": "400px" } }
58
+ }
59
+ \`\`\`
60
+
61
+ ## Use design tokens (CSS variables)
62
+
63
+ Tokens let you reuse values across many selectors.
64
+
65
+ 1. Create a token with \`create_style_variable\`:
66
+ \`\`\`json
67
+ { "category": "color", "name": "brand", "value": { "light": "#3b82f6", "dark": "#60a5fa", "default": "#3b82f6" } }
68
+ \`\`\`
69
+ 2. Reference the token by name in any style rule:
70
+ \`\`\`json
71
+ { "base": { "color": "var(--plitzi-brand)" } }
72
+ \`\`\`
73
+
74
+ ## Responsive styles
75
+
76
+ Apply the same selector at different display modes to override values:
77
+ 1. Desktop (default): \`update_style_selector\` with \`"displayMode": "desktop"\`.
78
+ 2. Tablet overrides: \`update_style_selector\` with \`"displayMode": "tablet"\`.
79
+ 3. Mobile overrides: \`update_style_selector\` with \`"displayMode": "mobile"\`.
80
+
81
+ Only the overriding properties need to be included in each breakpoint call.
82
+
83
+ ## Preview and inspect current styles
84
+
85
+ - To see how a saved element currently looks: use \`preview_element\` — it returns its schema+style for display.
86
+ - The \`style.platform\` in the response is keyed by displayMode, then by selector, and shows the actual CSS rules applied.
87
+ - \`get_schema\` does not include style data — use \`preview_element\` to read an element's live styles.
88
+ `
89
+ };
90
+ //#endregion
91
+ export { workflowStylesResource };
@@ -1,119 +1,29 @@
1
- import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
2
- import { z } from "zod";
1
+ import { bindTools } from "./helpers.js";
2
+ import { registerResources } from "./resources/index.js";
3
+ import { tools_exports } from "./tools/index.js";
4
+ import package_default from "../../package.js";
5
+ import { McpServer } from "@modelcontextprotocol/sdk/server/mcp";
3
6
  //#region src/modules/mcp/server.ts
4
- var ok = (data) => ({ content: [{
5
- type: "text",
6
- text: JSON.stringify(data, null, 2)
7
- }] });
8
- var err = (message) => ({
9
- content: [{
10
- type: "text",
11
- text: message
12
- }],
13
- isError: true
14
- });
15
- var createMcpServer = (adapters) => {
7
+ var createMcpServer = (adapters = {}, engine, tools, prompts, resources) => {
8
+ const boundTools = bindTools([...Object.values(tools_exports), ...tools ?? []], adapters);
16
9
  const server = new McpServer({
17
- name: "plitzi-schema-agent",
18
- version: "1.0.0"
19
- });
20
- server.tool("list_spaces", "List all spaces available in the system", {}, async () => {
21
- return ok(await adapters.listSpaces());
22
- });
23
- server.tool("get_schema", "Get the full element tree for a space and environment", {
24
- spaceId: z.number().describe("Space ID"),
25
- environment: z.string().describe("Environment name (e.g. main, production)")
26
- }, async ({ spaceId, environment }) => {
27
- const schema = await adapters.getSchema(spaceId, environment);
28
- if (!schema) return err(`Schema not found for space ${spaceId} / ${environment}`);
29
- return ok(schema);
30
- });
31
- server.tool("list_elements", "List all element IDs, types and labels for a space and environment", {
32
- spaceId: z.number(),
33
- environment: z.string()
34
- }, async ({ spaceId, environment }) => {
35
- const schema = await adapters.getSchema(spaceId, environment);
36
- if (!schema) return err(`Schema not found for space ${spaceId} / ${environment}`);
37
- return ok(Object.values(schema.elements).map(({ id, type, label, parentId, runtime }) => ({
38
- id,
39
- type,
40
- label,
41
- parentId,
42
- runtime
43
- })));
44
- });
45
- server.tool("get_element", "Get the full details of a single element by ID", {
46
- spaceId: z.number(),
47
- environment: z.string(),
48
- elementId: z.string().describe("Element ID")
49
- }, async ({ spaceId, environment, elementId }) => {
50
- const schema = await adapters.getSchema(spaceId, environment);
51
- if (!schema) return err(`Schema not found for space ${spaceId} / ${environment}`);
52
- const element = schema.elements[elementId];
53
- if (!element) return err(`Element ${elementId} not found`);
54
- return ok(element);
55
- });
56
- server.tool("create_element", "Add a new element to the schema. Returns the created element with its generated ID.", {
57
- spaceId: z.number(),
58
- environment: z.string(),
59
- type: z.string().describe("Component type (e.g. Container, Text, Button, Image)"),
60
- label: z.string().describe("Human-readable name for the element"),
61
- props: z.record(z.string(), z.unknown()).optional().describe("Component props/attributes"),
62
- runtime: z.enum([
63
- "server",
64
- "client",
65
- "shared"
66
- ]).optional().describe("Rendering runtime"),
67
- parentId: z.string().optional().describe("Parent element ID; omit to place at root"),
68
- position: z.number().optional().describe("Zero-based insertion index within the parent")
69
- }, async ({ spaceId, environment, type, label, props, runtime, parentId, position }) => {
70
- return ok(await adapters.createElement(spaceId, environment, {
71
- type,
72
- label,
73
- props,
74
- runtime
75
- }, parentId, position));
76
- });
77
- server.tool("update_element", "Update an existing element — label, props, styles, or runtime", {
78
- spaceId: z.number(),
79
- environment: z.string(),
80
- elementId: z.string(),
81
- label: z.string().optional(),
82
- props: z.record(z.string(), z.unknown()).optional(),
83
- styles: z.record(z.string(), z.unknown()).optional(),
84
- runtime: z.enum([
85
- "server",
86
- "client",
87
- "shared"
88
- ]).optional()
89
- }, async ({ spaceId, environment, elementId, label, props, styles, runtime }) => {
90
- return ok(await adapters.updateElement(spaceId, environment, elementId, {
91
- label,
92
- props,
93
- styles,
94
- runtime
95
- }));
96
- });
97
- server.tool("delete_element", "Remove an element and all its descendants from the schema", {
98
- spaceId: z.number(),
99
- environment: z.string(),
100
- elementId: z.string()
101
- }, async ({ spaceId, environment, elementId }) => {
102
- await adapters.deleteElement(spaceId, environment, elementId);
103
- return ok({ deleted: elementId });
104
- });
105
- server.tool("publish_schema", "Publish the current draft schema as a new immutable revision", {
106
- spaceId: z.number(),
107
- environment: z.string()
108
- }, async ({ spaceId, environment }) => {
109
- return ok(await adapters.publishSchema(spaceId, environment));
110
- });
111
- if (adapters.listPlugins) {
112
- const listPlugins = adapters.listPlugins;
113
- server.tool("list_plugins", "List all plugins registered in the system", {}, async () => {
114
- return ok(await listPlugins());
115
- });
10
+ name: "plitzi-mcp",
11
+ version: package_default.version
12
+ });
13
+ engine.setToolsAvailables(boundTools);
14
+ registerResources(server, resources, engine.readResource);
15
+ for (const tool of boundTools) {
16
+ if (!engine.can(tool.name)) continue;
17
+ const { title, description, inputSchema, annotations } = tool.mcpDefinition;
18
+ const definition = {
19
+ title,
20
+ description,
21
+ inputSchema,
22
+ annotations
23
+ };
24
+ server.registerTool(tool.name, definition, engine.execute(tool.name, tool.handler));
116
25
  }
26
+ if (prompts) for (const prompt of prompts) server.registerPrompt(prompt.name, prompt.definition, engine.executePrompt(prompt.name, prompt.handler));
117
27
  return server;
118
28
  };
119
29
  //#endregion
@@ -0,0 +1,25 @@
1
+ import { getAllowedModes } from "../../helpers.js";
2
+ import { z } from "zod";
3
+ //#region src/modules/mcp/tools/collections/createCollection.ts
4
+ var createCollectionTool = {
5
+ name: "create_collection",
6
+ adapterName: "createCollection",
7
+ mcpDefinition: {
8
+ title: "Create Collection",
9
+ description: "Create a new collection — a structured data store for the space.\n\nProvide field definitions in fields as a map of field name to field config. Records can be created afterwards via create_collection_record.",
10
+ inputSchema: z.object({
11
+ name: z.string().describe("Singular collection name (e.g. \"Product\")"),
12
+ namePlural: z.string().describe("Plural collection name (e.g. \"Products\")"),
13
+ description: z.string().optional().describe("Short description of what this collection stores"),
14
+ privacy: z.enum(["public", "private"]).optional().describe("\"public\" allows unauthenticated reads; \"private\" requires auth"),
15
+ fields: z.record(z.string(), z.unknown()).describe("Field definitions keyed by field name — each value is a field config object")
16
+ }),
17
+ outputSchema: z.object({
18
+ id: z.string().describe("Collection ID"),
19
+ name: z.string().describe("Collection name")
20
+ }).catchall(z.unknown()).describe("The created collection")
21
+ },
22
+ definition: { allowedModes: getAllowedModes("write") }
23
+ };
24
+ //#endregion
25
+ export { createCollectionTool as default };
@@ -0,0 +1,27 @@
1
+ import { getAllowedModes } from "../../helpers.js";
2
+ import { z } from "zod";
3
+ //#region src/modules/mcp/tools/collections/createCollectionRecord.ts
4
+ var createCollectionRecordTool = {
5
+ name: "create_collection_record",
6
+ adapterName: "createCollectionRecord",
7
+ mcpDefinition: {
8
+ title: "Create Collection Record",
9
+ description: "Create a new record in a collection. Pass field values matching the collection's field definitions.",
10
+ inputSchema: z.object({
11
+ collectionId: z.string().describe("Collection ID"),
12
+ values: z.record(z.string(), z.union([
13
+ z.string(),
14
+ z.number(),
15
+ z.boolean()
16
+ ])).describe("Field values keyed by field name — keys must match the collection field definitions (see get_collection)"),
17
+ status: z.enum(["draft", "published"]).optional().describe("Publication status; defaults to \"draft\"")
18
+ }),
19
+ outputSchema: z.object({
20
+ id: z.string().describe("Record ID"),
21
+ collectionId: z.string().describe("Collection ID")
22
+ }).catchall(z.unknown()).describe("The created record")
23
+ },
24
+ definition: { allowedModes: getAllowedModes("write") }
25
+ };
26
+ //#endregion
27
+ export { createCollectionRecordTool as default };