@wootsup/yt-builder-mcp 0.2.0-alpha.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 (299) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +221 -0
  3. package/bin/yt-builder-mcp.js +59 -0
  4. package/dist/auth.d.ts +39 -0
  5. package/dist/auth.d.ts.map +1 -0
  6. package/dist/auth.js +93 -0
  7. package/dist/auth.js.map +1 -0
  8. package/dist/client.d.ts +84 -0
  9. package/dist/client.d.ts.map +1 -0
  10. package/dist/client.js +151 -0
  11. package/dist/client.js.map +1 -0
  12. package/dist/clients/claude-code.d.ts +18 -0
  13. package/dist/clients/claude-code.d.ts.map +1 -0
  14. package/dist/clients/claude-code.js +53 -0
  15. package/dist/clients/claude-code.js.map +1 -0
  16. package/dist/clients/claude-desktop.d.ts +19 -0
  17. package/dist/clients/claude-desktop.d.ts.map +1 -0
  18. package/dist/clients/claude-desktop.js +56 -0
  19. package/dist/clients/claude-desktop.js.map +1 -0
  20. package/dist/clients/cline.d.ts +26 -0
  21. package/dist/clients/cline.d.ts.map +1 -0
  22. package/dist/clients/cline.js +80 -0
  23. package/dist/clients/cline.js.map +1 -0
  24. package/dist/clients/codex-cli.d.ts +42 -0
  25. package/dist/clients/codex-cli.d.ts.map +1 -0
  26. package/dist/clients/codex-cli.js +194 -0
  27. package/dist/clients/codex-cli.js.map +1 -0
  28. package/dist/clients/continue.d.ts +13 -0
  29. package/dist/clients/continue.d.ts.map +1 -0
  30. package/dist/clients/continue.js +52 -0
  31. package/dist/clients/continue.js.map +1 -0
  32. package/dist/clients/cursor.d.ts +12 -0
  33. package/dist/clients/cursor.d.ts.map +1 -0
  34. package/dist/clients/cursor.js +38 -0
  35. package/dist/clients/cursor.js.map +1 -0
  36. package/dist/clients/gemini-cli.d.ts +18 -0
  37. package/dist/clients/gemini-cli.d.ts.map +1 -0
  38. package/dist/clients/gemini-cli.js +44 -0
  39. package/dist/clients/gemini-cli.js.map +1 -0
  40. package/dist/clients/home.d.ts +14 -0
  41. package/dist/clients/home.d.ts.map +1 -0
  42. package/dist/clients/home.js +20 -0
  43. package/dist/clients/home.js.map +1 -0
  44. package/dist/clients/index.d.ts +52 -0
  45. package/dist/clients/index.d.ts.map +1 -0
  46. package/dist/clients/index.js +72 -0
  47. package/dist/clients/index.js.map +1 -0
  48. package/dist/clients/roo-code.d.ts +23 -0
  49. package/dist/clients/roo-code.d.ts.map +1 -0
  50. package/dist/clients/roo-code.js +69 -0
  51. package/dist/clients/roo-code.js.map +1 -0
  52. package/dist/clients/zed.d.ts +12 -0
  53. package/dist/clients/zed.d.ts.map +1 -0
  54. package/dist/clients/zed.js +41 -0
  55. package/dist/clients/zed.js.map +1 -0
  56. package/dist/errors/hints.d.ts +51 -0
  57. package/dist/errors/hints.d.ts.map +1 -0
  58. package/dist/errors/hints.js +95 -0
  59. package/dist/errors/hints.js.map +1 -0
  60. package/dist/errors/mask.d.ts +35 -0
  61. package/dist/errors/mask.d.ts.map +1 -0
  62. package/dist/errors/mask.js +49 -0
  63. package/dist/errors/mask.js.map +1 -0
  64. package/dist/errors/sanitize.d.ts +31 -0
  65. package/dist/errors/sanitize.d.ts.map +1 -0
  66. package/dist/errors/sanitize.js +90 -0
  67. package/dist/errors/sanitize.js.map +1 -0
  68. package/dist/errors.d.ts +42 -0
  69. package/dist/errors.d.ts.map +1 -0
  70. package/dist/errors.js +61 -0
  71. package/dist/errors.js.map +1 -0
  72. package/dist/gateway/advanced-tool/discovery.d.ts +19 -0
  73. package/dist/gateway/advanced-tool/discovery.d.ts.map +1 -0
  74. package/dist/gateway/advanced-tool/discovery.js +53 -0
  75. package/dist/gateway/advanced-tool/discovery.js.map +1 -0
  76. package/dist/gateway/advanced-tool/domains.d.ts +42 -0
  77. package/dist/gateway/advanced-tool/domains.d.ts.map +1 -0
  78. package/dist/gateway/advanced-tool/domains.js +88 -0
  79. package/dist/gateway/advanced-tool/domains.js.map +1 -0
  80. package/dist/gateway/advanced-tool/execute.d.ts +29 -0
  81. package/dist/gateway/advanced-tool/execute.d.ts.map +1 -0
  82. package/dist/gateway/advanced-tool/execute.js +54 -0
  83. package/dist/gateway/advanced-tool/execute.js.map +1 -0
  84. package/dist/gateway/advanced-tool/index.d.ts +36 -0
  85. package/dist/gateway/advanced-tool/index.d.ts.map +1 -0
  86. package/dist/gateway/advanced-tool/index.js +39 -0
  87. package/dist/gateway/advanced-tool/index.js.map +1 -0
  88. package/dist/gateway/advanced-tool/register.d.ts +18 -0
  89. package/dist/gateway/advanced-tool/register.d.ts.map +1 -0
  90. package/dist/gateway/advanced-tool/register.js +62 -0
  91. package/dist/gateway/advanced-tool/register.js.map +1 -0
  92. package/dist/gateway/advanced-tool.d.ts +13 -0
  93. package/dist/gateway/advanced-tool.d.ts.map +1 -0
  94. package/dist/gateway/advanced-tool.js +13 -0
  95. package/dist/gateway/advanced-tool.js.map +1 -0
  96. package/dist/gateway/capturing-server.d.ts +117 -0
  97. package/dist/gateway/capturing-server.d.ts.map +1 -0
  98. package/dist/gateway/capturing-server.js +103 -0
  99. package/dist/gateway/capturing-server.js.map +1 -0
  100. package/dist/gateway/essentials.d.ts +49 -0
  101. package/dist/gateway/essentials.d.ts.map +1 -0
  102. package/dist/gateway/essentials.js +62 -0
  103. package/dist/gateway/essentials.js.map +1 -0
  104. package/dist/gateway/test-support.d.ts +41 -0
  105. package/dist/gateway/test-support.d.ts.map +1 -0
  106. package/dist/gateway/test-support.js +60 -0
  107. package/dist/gateway/test-support.js.map +1 -0
  108. package/dist/index.d.ts +25 -0
  109. package/dist/index.d.ts.map +1 -0
  110. package/dist/index.js +77 -0
  111. package/dist/index.js.map +1 -0
  112. package/dist/install-skill.d.ts +35 -0
  113. package/dist/install-skill.d.ts.map +1 -0
  114. package/dist/install-skill.js +107 -0
  115. package/dist/install-skill.js.map +1 -0
  116. package/dist/platform/index.d.ts +49 -0
  117. package/dist/platform/index.d.ts.map +1 -0
  118. package/dist/platform/index.js +38 -0
  119. package/dist/platform/index.js.map +1 -0
  120. package/dist/server.d.ts +50 -0
  121. package/dist/server.d.ts.map +1 -0
  122. package/dist/server.js +117 -0
  123. package/dist/server.js.map +1 -0
  124. package/dist/setup-cli.d.ts +100 -0
  125. package/dist/setup-cli.d.ts.map +1 -0
  126. package/dist/setup-cli.js +355 -0
  127. package/dist/setup-cli.js.map +1 -0
  128. package/dist/setup-prompts.d.ts +41 -0
  129. package/dist/setup-prompts.d.ts.map +1 -0
  130. package/dist/setup-prompts.js +142 -0
  131. package/dist/setup-prompts.js.map +1 -0
  132. package/dist/setup-token.d.ts +38 -0
  133. package/dist/setup-token.d.ts.map +1 -0
  134. package/dist/setup-token.js +106 -0
  135. package/dist/setup-token.js.map +1 -0
  136. package/dist/setup-wizard-defaults.d.ts +43 -0
  137. package/dist/setup-wizard-defaults.d.ts.map +1 -0
  138. package/dist/setup-wizard-defaults.js +160 -0
  139. package/dist/setup-wizard-defaults.js.map +1 -0
  140. package/dist/setup-wizard-handshake.d.ts +25 -0
  141. package/dist/setup-wizard-handshake.d.ts.map +1 -0
  142. package/dist/setup-wizard-handshake.js +103 -0
  143. package/dist/setup-wizard-handshake.js.map +1 -0
  144. package/dist/setup-wizard-types.d.ts +148 -0
  145. package/dist/setup-wizard-types.d.ts.map +1 -0
  146. package/dist/setup-wizard-types.js +11 -0
  147. package/dist/setup-wizard-types.js.map +1 -0
  148. package/dist/setup-wizard.d.ts +33 -0
  149. package/dist/setup-wizard.d.ts.map +1 -0
  150. package/dist/setup-wizard.js +166 -0
  151. package/dist/setup-wizard.js.map +1 -0
  152. package/dist/setup.d.ts +17 -0
  153. package/dist/setup.d.ts.map +1 -0
  154. package/dist/setup.js +33 -0
  155. package/dist/setup.js.map +1 -0
  156. package/dist/tools/elements/builders.d.ts +24 -0
  157. package/dist/tools/elements/builders.d.ts.map +1 -0
  158. package/dist/tools/elements/builders.js +150 -0
  159. package/dist/tools/elements/builders.js.map +1 -0
  160. package/dist/tools/elements/handlers-write.d.ts +48 -0
  161. package/dist/tools/elements/handlers-write.d.ts.map +1 -0
  162. package/dist/tools/elements/handlers-write.js +141 -0
  163. package/dist/tools/elements/handlers-write.js.map +1 -0
  164. package/dist/tools/elements/handlers.d.ts +56 -0
  165. package/dist/tools/elements/handlers.d.ts.map +1 -0
  166. package/dist/tools/elements/handlers.js +113 -0
  167. package/dist/tools/elements/handlers.js.map +1 -0
  168. package/dist/tools/elements/index.d.ts +28 -0
  169. package/dist/tools/elements/index.d.ts.map +1 -0
  170. package/dist/tools/elements/index.js +27 -0
  171. package/dist/tools/elements/index.js.map +1 -0
  172. package/dist/tools/elements.d.ts +13 -0
  173. package/dist/tools/elements.d.ts.map +1 -0
  174. package/dist/tools/elements.js +13 -0
  175. package/dist/tools/elements.js.map +1 -0
  176. package/dist/tools/elicitation.d.ts +87 -0
  177. package/dist/tools/elicitation.d.ts.map +1 -0
  178. package/dist/tools/elicitation.js +100 -0
  179. package/dist/tools/elicitation.js.map +1 -0
  180. package/dist/tools/format/elements-format.d.ts +34 -0
  181. package/dist/tools/format/elements-format.d.ts.map +1 -0
  182. package/dist/tools/format/elements-format.js +112 -0
  183. package/dist/tools/format/elements-format.js.map +1 -0
  184. package/dist/tools/format/health-format.d.ts +73 -0
  185. package/dist/tools/format/health-format.d.ts.map +1 -0
  186. package/dist/tools/format/health-format.js +178 -0
  187. package/dist/tools/format/health-format.js.map +1 -0
  188. package/dist/tools/format/inspection-format.d.ts +45 -0
  189. package/dist/tools/format/inspection-format.d.ts.map +1 -0
  190. package/dist/tools/format/inspection-format.js +125 -0
  191. package/dist/tools/format/inspection-format.js.map +1 -0
  192. package/dist/tools/format/pages-format.d.ts +39 -0
  193. package/dist/tools/format/pages-format.d.ts.map +1 -0
  194. package/dist/tools/format/pages-format.js +110 -0
  195. package/dist/tools/format/pages-format.js.map +1 -0
  196. package/dist/tools/format/sources-format.d.ts +25 -0
  197. package/dist/tools/format/sources-format.d.ts.map +1 -0
  198. package/dist/tools/format/sources-format.js +113 -0
  199. package/dist/tools/format/sources-format.js.map +1 -0
  200. package/dist/tools/health.d.ts +22 -0
  201. package/dist/tools/health.d.ts.map +1 -0
  202. package/dist/tools/health.js +147 -0
  203. package/dist/tools/health.js.map +1 -0
  204. package/dist/tools/index.d.ts +23 -0
  205. package/dist/tools/index.d.ts.map +1 -0
  206. package/dist/tools/index.js +23 -0
  207. package/dist/tools/index.js.map +1 -0
  208. package/dist/tools/inspection.d.ts +14 -0
  209. package/dist/tools/inspection.d.ts.map +1 -0
  210. package/dist/tools/inspection.js +115 -0
  211. package/dist/tools/inspection.js.map +1 -0
  212. package/dist/tools/layout-flatten.d.ts +63 -0
  213. package/dist/tools/layout-flatten.d.ts.map +1 -0
  214. package/dist/tools/layout-flatten.js +95 -0
  215. package/dist/tools/layout-flatten.js.map +1 -0
  216. package/dist/tools/pages/builders.d.ts +14 -0
  217. package/dist/tools/pages/builders.d.ts.map +1 -0
  218. package/dist/tools/pages/builders.js +97 -0
  219. package/dist/tools/pages/builders.js.map +1 -0
  220. package/dist/tools/pages/handlers-read.d.ts +24 -0
  221. package/dist/tools/pages/handlers-read.d.ts.map +1 -0
  222. package/dist/tools/pages/handlers-read.js +141 -0
  223. package/dist/tools/pages/handlers-read.js.map +1 -0
  224. package/dist/tools/pages/handlers-write.d.ts +21 -0
  225. package/dist/tools/pages/handlers-write.d.ts.map +1 -0
  226. package/dist/tools/pages/handlers-write.js +52 -0
  227. package/dist/tools/pages/handlers-write.js.map +1 -0
  228. package/dist/tools/pages/index.d.ts +17 -0
  229. package/dist/tools/pages/index.d.ts.map +1 -0
  230. package/dist/tools/pages/index.js +17 -0
  231. package/dist/tools/pages/index.js.map +1 -0
  232. package/dist/tools/pages/schemas.d.ts +30 -0
  233. package/dist/tools/pages/schemas.d.ts.map +1 -0
  234. package/dist/tools/pages/schemas.js +30 -0
  235. package/dist/tools/pages/schemas.js.map +1 -0
  236. package/dist/tools/pages.d.ts +13 -0
  237. package/dist/tools/pages.d.ts.map +1 -0
  238. package/dist/tools/pages.js +13 -0
  239. package/dist/tools/pages.js.map +1 -0
  240. package/dist/tools/progress-phases.d.ts +46 -0
  241. package/dist/tools/progress-phases.d.ts.map +1 -0
  242. package/dist/tools/progress-phases.js +48 -0
  243. package/dist/tools/progress-phases.js.map +1 -0
  244. package/dist/tools/shared-schemas.d.ts +15 -0
  245. package/dist/tools/shared-schemas.d.ts.map +1 -0
  246. package/dist/tools/shared-schemas.js +30 -0
  247. package/dist/tools/shared-schemas.js.map +1 -0
  248. package/dist/tools/sources/builders.d.ts +13 -0
  249. package/dist/tools/sources/builders.d.ts.map +1 -0
  250. package/dist/tools/sources/builders.js +88 -0
  251. package/dist/tools/sources/builders.js.map +1 -0
  252. package/dist/tools/sources/handlers-bind.d.ts +26 -0
  253. package/dist/tools/sources/handlers-bind.d.ts.map +1 -0
  254. package/dist/tools/sources/handlers-bind.js +123 -0
  255. package/dist/tools/sources/handlers-bind.js.map +1 -0
  256. package/dist/tools/sources/handlers.d.ts +45 -0
  257. package/dist/tools/sources/handlers.d.ts.map +1 -0
  258. package/dist/tools/sources/handlers.js +84 -0
  259. package/dist/tools/sources/handlers.js.map +1 -0
  260. package/dist/tools/sources/index.d.ts +19 -0
  261. package/dist/tools/sources/index.d.ts.map +1 -0
  262. package/dist/tools/sources/index.js +18 -0
  263. package/dist/tools/sources/index.js.map +1 -0
  264. package/dist/tools/sources.d.ts +14 -0
  265. package/dist/tools/sources.d.ts.map +1 -0
  266. package/dist/tools/sources.js +14 -0
  267. package/dist/tools/sources.js.map +1 -0
  268. package/dist/tools/sparse-fields.d.ts +80 -0
  269. package/dist/tools/sparse-fields.d.ts.map +1 -0
  270. package/dist/tools/sparse-fields.js +144 -0
  271. package/dist/tools/sparse-fields.js.map +1 -0
  272. package/dist/tools/tool-builder/annotations.d.ts +22 -0
  273. package/dist/tools/tool-builder/annotations.d.ts.map +1 -0
  274. package/dist/tools/tool-builder/annotations.js +35 -0
  275. package/dist/tools/tool-builder/annotations.js.map +1 -0
  276. package/dist/tools/tool-builder/define.d.ts +31 -0
  277. package/dist/tools/tool-builder/define.d.ts.map +1 -0
  278. package/dist/tools/tool-builder/define.js +31 -0
  279. package/dist/tools/tool-builder/define.js.map +1 -0
  280. package/dist/tools/tool-builder/index.d.ts +28 -0
  281. package/dist/tools/tool-builder/index.d.ts.map +1 -0
  282. package/dist/tools/tool-builder/index.js +27 -0
  283. package/dist/tools/tool-builder/index.js.map +1 -0
  284. package/dist/tools/tool-builder/results.d.ts +59 -0
  285. package/dist/tools/tool-builder/results.d.ts.map +1 -0
  286. package/dist/tools/tool-builder/results.js +125 -0
  287. package/dist/tools/tool-builder/results.js.map +1 -0
  288. package/dist/tools/tool-builder/types.d.ts +82 -0
  289. package/dist/tools/tool-builder/types.d.ts.map +1 -0
  290. package/dist/tools/tool-builder/types.js +9 -0
  291. package/dist/tools/tool-builder/types.js.map +1 -0
  292. package/dist/tools/tool-builder.d.ts +16 -0
  293. package/dist/tools/tool-builder.d.ts.map +1 -0
  294. package/dist/tools/tool-builder.js +16 -0
  295. package/dist/tools/tool-builder.js.map +1 -0
  296. package/icon.png +0 -0
  297. package/manifest.json +63 -0
  298. package/package.json +81 -0
  299. package/skills/yootheme-builder/SKILL.md +582 -0
@@ -0,0 +1,103 @@
1
+ /**
2
+ * CapturingServer — registration interceptor wrapping a real McpServer.
3
+ *
4
+ * Tool routing (Wave G.1 / Design-Doc §3.1.1):
5
+ * - L3 direct (yootheme_builder_health, yootheme_builder_diagnose):
6
+ * skipped — no forward, no capture. These tools must already be
7
+ * registered directly on the real server BEFORE the CapturingServer
8
+ * wraps it, so the SDK never sees a duplicate name.
9
+ * - L1 essential (ESSENTIAL_TOOLS): forwarded to the real server as a
10
+ * first-class MCP tool reachable from `tools/list`.
11
+ * - L2 advanced (everything else): captured into the in-process
12
+ * advanced registry, reachable through the single
13
+ * `yootheme_builder_advanced` gateway tool.
14
+ *
15
+ * This is a typed wrapper, NOT a JS Proxy — TypeScript stays strict.
16
+ *
17
+ * Typing approach (mirrors the reference apimapper-mcp implementation):
18
+ * `ToolRegistrar` is the McpServer subsurface modules consume:
19
+ * `registerTool` + `registerResource`. `registerTool` is a hand-written
20
+ * generic mirroring the SDK signature EXCEPT its return type is `void`
21
+ * — captured tools have no live `RegisteredTool`, and no module reads
22
+ * the return value. A real `McpServer` is still assignable to
23
+ * `ToolRegistrar` (return-type bivariance for `void`), so every
24
+ * call-site accepts both shapes cast-free.
25
+ *
26
+ * Casts in this file (each documented + justified inline):
27
+ * 1. forwarded-essential — erases the handler's `InputArgs` generic to
28
+ * the SDK default when `config` is the erased `CapturedToolConfig`.
29
+ * 2. registry storage — erases the generic handler to the homogeneous
30
+ * `CapturedToolHandler` shape so one Map type fits all entries.
31
+ * 3. `registerResource` field — the SDK declares two overloads; a
32
+ * single spread-arg arrow cannot re-express the pair.
33
+ *
34
+ * @license MIT
35
+ */
36
+ import { isDirectTopLevel, isEssential } from './essentials.js';
37
+ /**
38
+ * Wraps a real McpServer. Forwards L1 essentials (and all resources) to it,
39
+ * captures L2 non-essentials into an in-process registry, and silently
40
+ * skips L3 direct top-level names that must already be on the real server.
41
+ */
42
+ export class CapturingServer {
43
+ realServer;
44
+ advancedRegistry = new Map();
45
+ constructor(realServer) {
46
+ this.realServer = realServer;
47
+ }
48
+ /**
49
+ * Routes a tool registration by name. Returns `void`: captured tools
50
+ * have no `RegisteredTool` and no `registerXTools` module reads the
51
+ * return value.
52
+ *
53
+ * Routing order matters: the L3-direct check is FIRST so a caller
54
+ * cannot accidentally re-route a direct-registered name through the
55
+ * gateway just by re-naming a future tool builder.
56
+ */
57
+ registerTool(name, config, handler) {
58
+ // L3 — direct top-level: already on the real server, do nothing.
59
+ // Returning early here prevents the SDK from raising a duplicate-name
60
+ // error when an L3 tool's builder is accidentally re-included in the
61
+ // forwarded tool list.
62
+ if (isDirectTopLevel(name)) {
63
+ return;
64
+ }
65
+ if (isEssential(name)) {
66
+ // L1 — forward to the real server.
67
+ //
68
+ // Cast: the SDK pairs `config.inputSchema` and the handler through
69
+ // one `InputArgs` generic. Here `config` is the erased
70
+ // `CapturedToolConfig`, so the SDK cannot re-infer that link; the
71
+ // handler is asserted to the SDK's default `ToolCallback` to satisfy
72
+ // the call. The runtime values are exactly what the SDK expects —
73
+ // only the static generic linkage is erased.
74
+ this.realServer.registerTool(name, config, handler);
75
+ return;
76
+ }
77
+ // L2 — capture into the advanced registry.
78
+ //
79
+ // Erase the generic handler to the captured-handler shape for
80
+ // homogeneous Map storage. The gateway validates `arguments` against
81
+ // the tool's Zod schema before invoking it, so the (args, extra)
82
+ // runtime contract holds.
83
+ this.advancedRegistry.set(name, {
84
+ config,
85
+ handler: handler,
86
+ });
87
+ }
88
+ /**
89
+ * Resources are always forwarded — they are not part of the tool cap.
90
+ *
91
+ * Cast: the SDK declares `registerResource` as two overloads; a single
92
+ * spread `(...args: RegisterResourceArgs)` arrow cannot re-express that
93
+ * overload pair, so the field is asserted to the SDK's exact member
94
+ * type. The spread forwards every argument verbatim, so the runtime
95
+ * contract is unchanged.
96
+ */
97
+ registerResource = ((...args) => this.realServer.registerResource(...args));
98
+ /** The captured non-essential tools, keyed by tool name. */
99
+ getAdvancedRegistry() {
100
+ return this.advancedRegistry;
101
+ }
102
+ }
103
+ //# sourceMappingURL=capturing-server.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"capturing-server.js","sourceRoot":"","sources":["../../src/gateway/capturing-server.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AAMH,OAAO,EAAE,gBAAgB,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AA8DhE;;;;GAIG;AACH,MAAM,OAAO,eAAe;IACP,UAAU,CAAY;IACtB,gBAAgB,GAAG,IAAI,GAAG,EAA6B,CAAC;IAEzE,YAAY,UAAqB;QAC7B,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC;IACjC,CAAC;IAED;;;;;;;;OAQG;IACH,YAAY,CACR,IAAY,EACZ,MAA0B,EAC1B,OAAgC;QAEhC,iEAAiE;QACjE,sEAAsE;QACtE,qEAAqE;QACrE,uBAAuB;QACvB,IAAI,gBAAgB,CAAC,IAAI,CAAC,EAAE,CAAC;YACzB,OAAO;QACX,CAAC;QAED,IAAI,WAAW,CAAC,IAAI,CAAC,EAAE,CAAC;YACpB,mCAAmC;YACnC,EAAE;YACF,mEAAmE;YACnE,uDAAuD;YACvD,kEAAkE;YAClE,qEAAqE;YACrE,kEAAkE;YAClE,6CAA6C;YAC7C,IAAI,CAAC,UAAU,CAAC,YAAY,CAAC,IAAI,EAAE,MAAM,EAAE,OAAuB,CAAC,CAAC;YACpE,OAAO;QACX,CAAC;QAED,2CAA2C;QAC3C,EAAE;QACF,8DAA8D;QAC9D,qEAAqE;QACrE,iEAAiE;QACjE,0BAA0B;QAC1B,IAAI,CAAC,gBAAgB,CAAC,GAAG,CAAC,IAAI,EAAE;YAC5B,MAAM;YACN,OAAO,EAAE,OAAyC;SACrD,CAAC,CAAC;IACP,CAAC;IAED;;;;;;;;OAQG;IACH,gBAAgB,GAAkC,CAAC,CAAC,GAAG,IAA0B,EAAE,EAAE,CACjF,IAAI,CAAC,UAAU,CAAC,gBAAgB,CAAC,GAAG,IAAI,CAAC,CAAkC,CAAC;IAEhF,4DAA4D;IAC5D,mBAAmB;QACf,OAAO,IAAI,CAAC,gBAAgB,CAAC;IACjC,CAAC;CACJ"}
@@ -0,0 +1,49 @@
1
+ /**
2
+ * Gateway-Hub — single source of truth for the YT Builder MCP
3
+ * 3-lane registration surface.
4
+ *
5
+ * Lanes (Wave G.1 / Design-Doc §3.1.1):
6
+ * L1 — ESSENTIAL_TOOLS forwarded by the CapturingServer as
7
+ * first-class MCP tools in `tools/list`.
8
+ * L2 — (advanced) every NON-essential, NON-direct tool is
9
+ * captured by the CapturingServer and
10
+ * reachable through the single
11
+ * `yootheme_builder_advanced` gateway tool.
12
+ * L3 — DIRECT_TOP_LEVEL_TOOLS registered directly on the real McpServer
13
+ * BEFORE the CapturingServer wraps it.
14
+ * The CapturingServer skips these names
15
+ * entirely (no forward, no capture) so the
16
+ * SDK never sees a duplicate registration.
17
+ *
18
+ * Why this split: Cursor caps MCP servers at ~40 tools. This adapter
19
+ * declares 22 tools (21 domain + 1 gateway). The 3-lane shape keeps
20
+ * `tools/list` at 7 (L1) + 2 (L3) + 1 (gateway) = 10 entries, well under
21
+ * the cap, while every tool stays fully reachable.
22
+ *
23
+ * Health + diagnose live in L3 because they MUST be the first thing an
24
+ * LLM-host calls when something is broken; routing them through a gateway
25
+ * would create a chicken-and-egg loop (the LLM would have to discover
26
+ * the gateway before it can diagnose why the gateway is unreachable).
27
+ *
28
+ * @license MIT
29
+ */
30
+ /**
31
+ * L1 — Tools kept as first-class entries in `tools/list`.
32
+ * Forwarded by the CapturingServer to the real McpServer.
33
+ */
34
+ export declare const ESSENTIAL_TOOLS: readonly ["yootheme_builder_pages_list", "yootheme_builder_get_etag", "yootheme_builder_element_list", "yootheme_builder_element_add", "yootheme_builder_element_update_settings", "yootheme_builder_sources_list", "yootheme_builder_element_types_list"];
35
+ /**
36
+ * L3 — Tools registered DIRECTLY on the real McpServer, BEFORE the
37
+ * CapturingServer wraps it. The CapturingServer treats these names as a
38
+ * no-op (no forward, no capture) so the SDK never sees a duplicate
39
+ * registration. Use this lane only for tools that must be reachable
40
+ * even if the gateway itself fails — currently health + diagnose.
41
+ */
42
+ export declare const DIRECT_TOP_LEVEL_TOOLS: readonly ["yootheme_builder_health", "yootheme_builder_diagnose"];
43
+ export type EssentialTool = (typeof ESSENTIAL_TOOLS)[number];
44
+ export type DirectTopLevelTool = (typeof DIRECT_TOP_LEVEL_TOOLS)[number];
45
+ /** True if `name` is in the L1 forwarded essentials surface. */
46
+ export declare function isEssential(name: string): boolean;
47
+ /** True if `name` is in the L3 direct top-level surface. */
48
+ export declare function isDirectTopLevel(name: string): boolean;
49
+ //# sourceMappingURL=essentials.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"essentials.d.ts","sourceRoot":"","sources":["../../src/gateway/essentials.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AAEH;;;GAGG;AACH,eAAO,MAAM,eAAe,4PAQlB,CAAC;AAEX;;;;;;GAMG;AACH,eAAO,MAAM,sBAAsB,mEAGzB,CAAC;AAEX,MAAM,MAAM,aAAa,GAAG,CAAC,OAAO,eAAe,CAAC,CAAC,MAAM,CAAC,CAAC;AAC7D,MAAM,MAAM,kBAAkB,GAAG,CAAC,OAAO,sBAAsB,CAAC,CAAC,MAAM,CAAC,CAAC;AAEzE,gEAAgE;AAChE,wBAAgB,WAAW,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAEjD;AAED,4DAA4D;AAC5D,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAEtD"}
@@ -0,0 +1,62 @@
1
+ /**
2
+ * Gateway-Hub — single source of truth for the YT Builder MCP
3
+ * 3-lane registration surface.
4
+ *
5
+ * Lanes (Wave G.1 / Design-Doc §3.1.1):
6
+ * L1 — ESSENTIAL_TOOLS forwarded by the CapturingServer as
7
+ * first-class MCP tools in `tools/list`.
8
+ * L2 — (advanced) every NON-essential, NON-direct tool is
9
+ * captured by the CapturingServer and
10
+ * reachable through the single
11
+ * `yootheme_builder_advanced` gateway tool.
12
+ * L3 — DIRECT_TOP_LEVEL_TOOLS registered directly on the real McpServer
13
+ * BEFORE the CapturingServer wraps it.
14
+ * The CapturingServer skips these names
15
+ * entirely (no forward, no capture) so the
16
+ * SDK never sees a duplicate registration.
17
+ *
18
+ * Why this split: Cursor caps MCP servers at ~40 tools. This adapter
19
+ * declares 22 tools (21 domain + 1 gateway). The 3-lane shape keeps
20
+ * `tools/list` at 7 (L1) + 2 (L3) + 1 (gateway) = 10 entries, well under
21
+ * the cap, while every tool stays fully reachable.
22
+ *
23
+ * Health + diagnose live in L3 because they MUST be the first thing an
24
+ * LLM-host calls when something is broken; routing them through a gateway
25
+ * would create a chicken-and-egg loop (the LLM would have to discover
26
+ * the gateway before it can diagnose why the gateway is unreachable).
27
+ *
28
+ * @license MIT
29
+ */
30
+ /**
31
+ * L1 — Tools kept as first-class entries in `tools/list`.
32
+ * Forwarded by the CapturingServer to the real McpServer.
33
+ */
34
+ export const ESSENTIAL_TOOLS = [
35
+ 'yootheme_builder_pages_list',
36
+ 'yootheme_builder_get_etag',
37
+ 'yootheme_builder_element_list',
38
+ 'yootheme_builder_element_add',
39
+ 'yootheme_builder_element_update_settings',
40
+ 'yootheme_builder_sources_list',
41
+ 'yootheme_builder_element_types_list',
42
+ ];
43
+ /**
44
+ * L3 — Tools registered DIRECTLY on the real McpServer, BEFORE the
45
+ * CapturingServer wraps it. The CapturingServer treats these names as a
46
+ * no-op (no forward, no capture) so the SDK never sees a duplicate
47
+ * registration. Use this lane only for tools that must be reachable
48
+ * even if the gateway itself fails — currently health + diagnose.
49
+ */
50
+ export const DIRECT_TOP_LEVEL_TOOLS = [
51
+ 'yootheme_builder_health',
52
+ 'yootheme_builder_diagnose',
53
+ ];
54
+ /** True if `name` is in the L1 forwarded essentials surface. */
55
+ export function isEssential(name) {
56
+ return ESSENTIAL_TOOLS.includes(name);
57
+ }
58
+ /** True if `name` is in the L3 direct top-level surface. */
59
+ export function isDirectTopLevel(name) {
60
+ return DIRECT_TOP_LEVEL_TOOLS.includes(name);
61
+ }
62
+ //# sourceMappingURL=essentials.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"essentials.js","sourceRoot":"","sources":["../../src/gateway/essentials.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AAEH;;;GAGG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG;IAC3B,6BAA6B;IAC7B,2BAA2B;IAC3B,+BAA+B;IAC/B,8BAA8B;IAC9B,0CAA0C;IAC1C,+BAA+B;IAC/B,qCAAqC;CAC/B,CAAC;AAEX;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,sBAAsB,GAAG;IAClC,yBAAyB;IACzB,2BAA2B;CACrB,CAAC;AAKX,gEAAgE;AAChE,MAAM,UAAU,WAAW,CAAC,IAAY;IACpC,OAAQ,eAAqC,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;AACjE,CAAC;AAED,4DAA4D;AAC5D,MAAM,UAAU,gBAAgB,CAAC,IAAY;IACzC,OAAQ,sBAA4C,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;AACxE,CAAC"}
@@ -0,0 +1,41 @@
1
+ /**
2
+ * Gateway test helpers — Wave G.1.
3
+ *
4
+ * After the gateway lands, tests that previously looked tools up from
5
+ * `McpServer._registeredTools` no longer find advanced tools (they're
6
+ * captured in the advanced registry, not on the real server). These
7
+ * helpers expose a unified view across all three lanes:
8
+ *
9
+ * - L1 essentials → real server's `_registeredTools`
10
+ * - L2 advanced → CapturingServer's `getAdvancedRegistry()`
11
+ * - L3 + gateway → real server's `_registeredTools`
12
+ *
13
+ * Test-only: never imported by any runtime path.
14
+ *
15
+ * @license MIT
16
+ */
17
+ import type { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
18
+ import type { CallToolResult } from '@modelcontextprotocol/sdk/types.js';
19
+ import type { CapturingServer } from './capturing-server.js';
20
+ /** A tool entry as seen by tests: handler + the registered config. */
21
+ export interface CollectedTool {
22
+ handler: (args: Record<string, unknown>, extra?: unknown) => CallToolResult | Promise<CallToolResult>;
23
+ title?: string;
24
+ description?: string;
25
+ inputSchema?: unknown;
26
+ annotations?: Record<string, unknown>;
27
+ }
28
+ /**
29
+ * Returns every tool — essentials + gateway on the real McpServer plus
30
+ * the advanced tools captured by the CapturingServer — keyed by tool
31
+ * name. The CapturingServer must have been used to register the L1/L2
32
+ * tools, and `registerAdvancedTool` must have run, before this is called.
33
+ *
34
+ * Production size = 22:
35
+ * 7 L1 essentials (real server) + 12 L2 advanced (registry)
36
+ * + 2 L3 direct (real server) + 1 gateway (real server) = 22.
37
+ */
38
+ export declare function collectAllRegisteredTools(server: McpServer, capturing: CapturingServer): Record<string, CollectedTool>;
39
+ /** By-name lookup over a `collectAllRegisteredTools` map. */
40
+ export declare function findTool(tools: Record<string, CollectedTool>, name: string): CollectedTool | undefined;
41
+ //# sourceMappingURL=test-support.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"test-support.d.ts","sourceRoot":"","sources":["../../src/gateway/test-support.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AACzE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oCAAoC,CAAC;AAEzE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAE7D,sEAAsE;AACtE,MAAM,WAAW,aAAa;IAC1B,OAAO,EAAE,CACL,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC7B,KAAK,CAAC,EAAE,OAAO,KACd,cAAc,GAAG,OAAO,CAAC,cAAc,CAAC,CAAC;IAC9C,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,WAAW,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACzC;AAkBD;;;;;;;;;GASG;AACH,wBAAgB,yBAAyB,CACrC,MAAM,EAAE,SAAS,EACjB,SAAS,EAAE,eAAe,GAC3B,MAAM,CAAC,MAAM,EAAE,aAAa,CAAC,CAuC/B;AAED,6DAA6D;AAC7D,wBAAgB,QAAQ,CACpB,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,aAAa,CAAC,EACpC,IAAI,EAAE,MAAM,GACb,aAAa,GAAG,SAAS,CAE3B"}
@@ -0,0 +1,60 @@
1
+ /**
2
+ * Gateway test helpers — Wave G.1.
3
+ *
4
+ * After the gateway lands, tests that previously looked tools up from
5
+ * `McpServer._registeredTools` no longer find advanced tools (they're
6
+ * captured in the advanced registry, not on the real server). These
7
+ * helpers expose a unified view across all three lanes:
8
+ *
9
+ * - L1 essentials → real server's `_registeredTools`
10
+ * - L2 advanced → CapturingServer's `getAdvancedRegistry()`
11
+ * - L3 + gateway → real server's `_registeredTools`
12
+ *
13
+ * Test-only: never imported by any runtime path.
14
+ *
15
+ * @license MIT
16
+ */
17
+ /**
18
+ * Returns every tool — essentials + gateway on the real McpServer plus
19
+ * the advanced tools captured by the CapturingServer — keyed by tool
20
+ * name. The CapturingServer must have been used to register the L1/L2
21
+ * tools, and `registerAdvancedTool` must have run, before this is called.
22
+ *
23
+ * Production size = 22:
24
+ * 7 L1 essentials (real server) + 12 L2 advanced (registry)
25
+ * + 2 L3 direct (real server) + 1 gateway (real server) = 22.
26
+ */
27
+ export function collectAllRegisteredTools(server, capturing) {
28
+ const result = {};
29
+ // The SDK changed the internal field name from `handler` to `callback`
30
+ // over its 1.x lifetime; accept either to keep the helper resilient.
31
+ const real = server;
32
+ for (const [name, tool] of Object.entries(real._registeredTools)) {
33
+ const callback = 'callback' in tool && typeof tool.callback === 'function'
34
+ ? tool.callback
35
+ : tool.handler;
36
+ result[name] = {
37
+ handler: callback,
38
+ title: tool.title,
39
+ description: tool.description,
40
+ inputSchema: tool.inputSchema,
41
+ annotations: tool.annotations,
42
+ };
43
+ }
44
+ for (const [name, entry] of capturing.getAdvancedRegistry()) {
45
+ const cfg = entry.config;
46
+ result[name] = {
47
+ handler: entry.handler,
48
+ title: cfg.title,
49
+ description: cfg.description,
50
+ inputSchema: cfg.inputSchema,
51
+ annotations: cfg.annotations,
52
+ };
53
+ }
54
+ return result;
55
+ }
56
+ /** By-name lookup over a `collectAllRegisteredTools` map. */
57
+ export function findTool(tools, name) {
58
+ return tools[name];
59
+ }
60
+ //# sourceMappingURL=test-support.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"test-support.js","sourceRoot":"","sources":["../../src/gateway/test-support.ts"],"names":[],"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,IAAI,CAAC,CAAC;AACvB,CAAC"}
@@ -0,0 +1,25 @@
1
+ /**
2
+ * MCP server entrypoint (stdio transport).
3
+ *
4
+ * Reads config from environment variables (see `auth.ts`), spins up a
5
+ * `McpServer` with all tools registered, connects to stdio, and lets
6
+ * the host (Claude Desktop / Cursor / Zed / …) drive.
7
+ *
8
+ * `YTB_MCP_TEST_MODE=1` short-circuits: prints the tool registry and
9
+ * exits 0. Used by the smoke test and by `release.php` to validate
10
+ * that the bundled `dist/` is loadable on the target Node version.
11
+ *
12
+ * @license MIT
13
+ */
14
+ export { createServer, SERVER_NAME, SERVER_VERSION } from './server.js';
15
+ export { RestClient, REST_NAMESPACE_PATH, encodeElementPath } from './client.js';
16
+ export { loadConfig, isTestMode, ENV_WP_URL, ENV_BEARER, ENV_TEST_MODE } from './auth.js';
17
+ export { ConfigError, RestError, NetworkError } from './errors.js';
18
+ export { buildAllTools } from './tools/index.js';
19
+ export { ESSENTIAL_TOOLS, DIRECT_TOP_LEVEL_TOOLS, isEssential, isDirectTopLevel, } from './gateway/essentials.js';
20
+ export { CapturingServer, type AdvancedToolEntry, type CapturedToolHandler, type ToolRegistrar, } from './gateway/capturing-server.js';
21
+ export { registerAdvancedTool } from './gateway/advanced-tool.js';
22
+ export { collectAllRegisteredTools, findTool, type CollectedTool, } from './gateway/test-support.js';
23
+ declare function main(): Promise<void>;
24
+ export { main };
25
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AASH,OAAO,EAAE,YAAY,EAAE,WAAW,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AACxE,OAAO,EAAE,UAAU,EAAE,mBAAmB,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AACjF,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAC1F,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AACnE,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACjD,OAAO,EACH,eAAe,EACf,sBAAsB,EACtB,WAAW,EACX,gBAAgB,GACnB,MAAM,yBAAyB,CAAC;AACjC,OAAO,EACH,eAAe,EACf,KAAK,iBAAiB,EACtB,KAAK,mBAAmB,EACxB,KAAK,aAAa,GACrB,MAAM,+BAA+B,CAAC;AACvC,OAAO,EAAE,oBAAoB,EAAE,MAAM,4BAA4B,CAAC;AAClE,OAAO,EACH,yBAAyB,EACzB,QAAQ,EACR,KAAK,aAAa,GACrB,MAAM,2BAA2B,CAAC;AAEnC,iBAAe,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC,CAsCnC;AAkBD,OAAO,EAAE,IAAI,EAAE,CAAC"}
package/dist/index.js ADDED
@@ -0,0 +1,77 @@
1
+ /**
2
+ * MCP server entrypoint (stdio transport).
3
+ *
4
+ * Reads config from environment variables (see `auth.ts`), spins up a
5
+ * `McpServer` with all tools registered, connects to stdio, and lets
6
+ * the host (Claude Desktop / Cursor / Zed / …) drive.
7
+ *
8
+ * `YTB_MCP_TEST_MODE=1` short-circuits: prints the tool registry and
9
+ * exits 0. Used by the smoke test and by `release.php` to validate
10
+ * that the bundled `dist/` is loadable on the target Node version.
11
+ *
12
+ * @license MIT
13
+ */
14
+ import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';
15
+ import { isTestMode, loadConfig } from './auth.js';
16
+ import { RestClient } from './client.js';
17
+ import { ConfigError } from './errors.js';
18
+ import { createServer } from './server.js';
19
+ export { createServer, SERVER_NAME, SERVER_VERSION } from './server.js';
20
+ export { RestClient, REST_NAMESPACE_PATH, encodeElementPath } from './client.js';
21
+ export { loadConfig, isTestMode, ENV_WP_URL, ENV_BEARER, ENV_TEST_MODE } from './auth.js';
22
+ export { ConfigError, RestError, NetworkError } from './errors.js';
23
+ export { buildAllTools } from './tools/index.js';
24
+ export { ESSENTIAL_TOOLS, DIRECT_TOP_LEVEL_TOOLS, isEssential, isDirectTopLevel, } from './gateway/essentials.js';
25
+ export { CapturingServer, } from './gateway/capturing-server.js';
26
+ export { registerAdvancedTool } from './gateway/advanced-tool.js';
27
+ export { collectAllRegisteredTools, findTool, } from './gateway/test-support.js';
28
+ async function main() {
29
+ const testMode = isTestMode();
30
+ let config;
31
+ try {
32
+ // In test mode, allow the bearer token to be missing — we exit before
33
+ // anyone calls a tool.
34
+ config = loadConfig({ allowMissingToken: testMode });
35
+ }
36
+ catch (e) {
37
+ if (e instanceof ConfigError) {
38
+ process.stderr.write(`[yt-builder-mcp] ${e.message}\n`);
39
+ process.exit(1);
40
+ }
41
+ throw e;
42
+ }
43
+ const client = new RestClient({
44
+ baseUrl: config.baseUrl,
45
+ bearerToken: config.bearerToken,
46
+ timeoutMs: config.timeoutMs,
47
+ });
48
+ const { mcp, tools } = createServer({ client });
49
+ if (testMode) {
50
+ // Print a one-line per tool summary to stderr (stdout is reserved
51
+ // for the JSON-RPC frame in real runs) and exit cleanly.
52
+ process.stderr.write(`[yt-builder-mcp] test mode — ${String(tools.length)} tools registered:\n`);
53
+ for (const tool of tools) {
54
+ process.stderr.write(` - ${tool.name}\n`);
55
+ }
56
+ process.exit(0);
57
+ }
58
+ const transport = new StdioServerTransport();
59
+ await mcp.connect(transport);
60
+ }
61
+ /**
62
+ * Auto-run unless explicitly disabled. Tests set `YTB_MCP_NO_AUTORUN=1`
63
+ * to import the module without firing up the stdio server.
64
+ *
65
+ * The bin dispatcher (`bin/yt-builder-mcp.js`) imports
66
+ * `dist/index.js` dynamically and expects `main()` to take over — so by
67
+ * default we run on import.
68
+ */
69
+ if (process.env.YTB_MCP_NO_AUTORUN !== '1') {
70
+ main().catch((e) => {
71
+ const message = e instanceof Error ? e.message : String(e);
72
+ process.stderr.write(`[yt-builder-mcp] fatal: ${message}\n`);
73
+ process.exit(1);
74
+ });
75
+ }
76
+ export { main };
77
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,EAAE,oBAAoB,EAAE,MAAM,2CAA2C,CAAC;AAEjF,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AACnD,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC1C,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAE3C,OAAO,EAAE,YAAY,EAAE,WAAW,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AACxE,OAAO,EAAE,UAAU,EAAE,mBAAmB,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AACjF,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAC1F,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AACnE,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACjD,OAAO,EACH,eAAe,EACf,sBAAsB,EACtB,WAAW,EACX,gBAAgB,GACnB,MAAM,yBAAyB,CAAC;AACjC,OAAO,EACH,eAAe,GAIlB,MAAM,+BAA+B,CAAC;AACvC,OAAO,EAAE,oBAAoB,EAAE,MAAM,4BAA4B,CAAC;AAClE,OAAO,EACH,yBAAyB,EACzB,QAAQ,GAEX,MAAM,2BAA2B,CAAC;AAEnC,KAAK,UAAU,IAAI;IACf,MAAM,QAAQ,GAAG,UAAU,EAAE,CAAC;IAE9B,IAAI,MAAM,CAAC;IACX,IAAI,CAAC;QACD,sEAAsE;QACtE,uBAAuB;QACvB,MAAM,GAAG,UAAU,CAAC,EAAE,iBAAiB,EAAE,QAAQ,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,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;QAC3D,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,2BAA2B,OAAO,IAAI,CAAC,CAAC;QAC7D,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IACpB,CAAC,CAAC,CAAC;AACP,CAAC;AAED,OAAO,EAAE,IAAI,EAAE,CAAC"}
@@ -0,0 +1,35 @@
1
+ /**
2
+ * `install-skill` subcommand for `@wootsup/yt-builder-mcp`.
3
+ *
4
+ * Copies the bundled `skills/yootheme-builder/` directory into the user's
5
+ * agent-skill folder (typically `~/.claude/skills/`) and appends a marker
6
+ * block to `~/AGENTS.md` so other AI clients pick it up automatically.
7
+ *
8
+ * Idempotent: re-running overwrites existing skill files and skips the
9
+ * AGENTS.md append when the marker is already present.
10
+ *
11
+ * Mirrors the pattern from `@wootsup/mcp install-skill` so users on both
12
+ * products get the same workflow.
13
+ *
14
+ * @license MIT
15
+ */
16
+ export declare const MARKER_LINE = "<!-- yt-builder-mcp:skill-installed -->";
17
+ export interface InstallSkillOptions {
18
+ /**
19
+ * Package root that contains the bundled `skills/` dir. Defaults to
20
+ * walking up from this file (works in both source and `dist/` layouts).
21
+ */
22
+ readonly pkgRoot?: string;
23
+ /** Target dir where the `yootheme-builder/` skill folder will land. */
24
+ readonly targetSkillsDir?: string;
25
+ /** Target AGENTS.md file to append the marker to. */
26
+ readonly targetAgentsFile?: string;
27
+ }
28
+ export interface InstallSkillResult {
29
+ readonly copied: boolean;
30
+ readonly markerAlreadyPresent: boolean;
31
+ readonly skillTargetDir: string;
32
+ readonly agentsFile: string;
33
+ }
34
+ export declare function installSkill(options?: InstallSkillOptions): Promise<InstallSkillResult>;
35
+ //# sourceMappingURL=install-skill.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"install-skill.d.ts","sourceRoot":"","sources":["../src/install-skill.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAgBH,eAAO,MAAM,WAAW,4CAA4C,CAAC;AAiBrE,MAAM,WAAW,mBAAmB;IAChC;;;OAGG;IACH,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC;IAC1B,uEAAuE;IACvE,QAAQ,CAAC,eAAe,CAAC,EAAE,MAAM,CAAC;IAClC,qDAAqD;IACrD,QAAQ,CAAC,gBAAgB,CAAC,EAAE,MAAM,CAAC;CACtC;AAED,MAAM,WAAW,kBAAkB;IAC/B,QAAQ,CAAC,MAAM,EAAE,OAAO,CAAC;IACzB,QAAQ,CAAC,oBAAoB,EAAE,OAAO,CAAC;IACvC,QAAQ,CAAC,cAAc,EAAE,MAAM,CAAC;IAChC,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;CAC/B;AAwCD,wBAAsB,YAAY,CAC9B,OAAO,GAAE,mBAAwB,GAClC,OAAO,CAAC,kBAAkB,CAAC,CAuC7B"}
@@ -0,0 +1,107 @@
1
+ /**
2
+ * `install-skill` subcommand for `@wootsup/yt-builder-mcp`.
3
+ *
4
+ * Copies the bundled `skills/yootheme-builder/` directory into the user's
5
+ * agent-skill folder (typically `~/.claude/skills/`) and appends a marker
6
+ * block to `~/AGENTS.md` so other AI clients pick it up automatically.
7
+ *
8
+ * Idempotent: re-running overwrites existing skill files and skips the
9
+ * AGENTS.md append when the marker is already present.
10
+ *
11
+ * Mirrors the pattern from `@wootsup/mcp install-skill` so users on both
12
+ * products get the same workflow.
13
+ *
14
+ * @license MIT
15
+ */
16
+ import { appendFileSync, copyFileSync, existsSync, mkdirSync, readdirSync, readFileSync, statSync, writeFileSync, } from 'node:fs';
17
+ import { homedir } from 'node:os';
18
+ import { dirname, join, resolve } from 'node:path';
19
+ import { fileURLToPath } from 'node:url';
20
+ export const MARKER_LINE = '<!-- yt-builder-mcp:skill-installed -->';
21
+ const MARKER_BLOCK = `
22
+
23
+ ## YT Builder MCP
24
+
25
+ ${MARKER_LINE}
26
+ The YOOtheme Builder skill is installed at \`~/.claude/skills/yootheme-builder/\`
27
+ — the universal-marker path recognised by Claude Desktop and other AI
28
+ clients that follow the \`~/AGENTS.md\` discovery protocol.
29
+
30
+ It documents the 22 MCP tools (21 domain + 1 gateway, 10 entries in
31
+ \`tools/list\`), the 5 canonical workflows (build hero, bind dynamic
32
+ source, clone section, diagnose 401, add custom element), and the
33
+ gateway routing model. Source: https://github.com/wootsup/yt-builder-mcp.
34
+ `;
35
+ function defaultPkgRoot() {
36
+ // src/install-skill.ts → pkg root is one level up.
37
+ // When running from dist/install-skill.js the layout is identical
38
+ // (TypeScript emits `dist/install-skill.js` mirroring `src/`).
39
+ const here = dirname(fileURLToPath(import.meta.url));
40
+ return resolve(here, '..');
41
+ }
42
+ function copyDirRecursive(src, dst) {
43
+ if (!existsSync(dst))
44
+ mkdirSync(dst, { recursive: true });
45
+ for (const entry of readdirSync(src)) {
46
+ const sPath = join(src, entry);
47
+ const dPath = join(dst, entry);
48
+ const stat = statSync(sPath);
49
+ if (stat.isDirectory()) {
50
+ copyDirRecursive(sPath, dPath);
51
+ }
52
+ else {
53
+ copyFileSync(sPath, dPath);
54
+ }
55
+ }
56
+ }
57
+ /**
58
+ * Locate the bundled `skills/yootheme-builder` directory.
59
+ *
60
+ * Production layout: the skill folder is bundled INSIDE the npm package
61
+ * (`packages/mcp/skills/yootheme-builder/`), next to `dist/`. The same
62
+ * layout exists in the source tree (per Design-Doc §13.1) so source-mode
63
+ * smoke tests and the published tarball use the same single path.
64
+ *
65
+ * Earlier drafts walked `../..` up to a monorepo-root `skills/` dir;
66
+ * that layout was eliminated in Round-1 audit fix C1 because it produced
67
+ * a tarball without `skills/` (skill-not-found at first run).
68
+ */
69
+ function findSkillSource(pkgRoot) {
70
+ return join(pkgRoot, 'skills', 'yootheme-builder');
71
+ }
72
+ export async function installSkill(options = {}) {
73
+ const pkgRoot = options.pkgRoot ?? defaultPkgRoot();
74
+ const targetSkillsDir = options.targetSkillsDir ?? join(homedir(), '.claude', 'skills');
75
+ const targetAgentsFile = options.targetAgentsFile ?? join(homedir(), 'AGENTS.md');
76
+ const srcSkillDir = findSkillSource(pkgRoot);
77
+ if (!existsSync(srcSkillDir)) {
78
+ throw new Error(`Bundled skill not found at ${srcSkillDir}. ` +
79
+ `Is the package installed correctly? (pkgRoot=${pkgRoot})`);
80
+ }
81
+ if (!existsSync(targetSkillsDir)) {
82
+ mkdirSync(targetSkillsDir, { recursive: true });
83
+ }
84
+ const skillTargetDir = join(targetSkillsDir, 'yootheme-builder');
85
+ copyDirRecursive(srcSkillDir, skillTargetDir);
86
+ let markerAlreadyPresent = false;
87
+ if (existsSync(targetAgentsFile)) {
88
+ const existing = readFileSync(targetAgentsFile, 'utf-8');
89
+ if (existing.includes(MARKER_LINE)) {
90
+ markerAlreadyPresent = true;
91
+ }
92
+ else {
93
+ appendFileSync(targetAgentsFile, MARKER_BLOCK);
94
+ }
95
+ }
96
+ else {
97
+ // Create with a sensible top-line and the marker block (trimmed).
98
+ writeFileSync(targetAgentsFile, MARKER_BLOCK.trimStart(), 'utf-8');
99
+ }
100
+ return {
101
+ copied: true,
102
+ markerAlreadyPresent,
103
+ skillTargetDir,
104
+ agentsFile: targetAgentsFile,
105
+ };
106
+ }
107
+ //# sourceMappingURL=install-skill.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"install-skill.js","sourceRoot":"","sources":["../src/install-skill.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EACH,cAAc,EACd,YAAY,EACZ,UAAU,EACV,SAAS,EACT,WAAW,EACX,YAAY,EACZ,QAAQ,EACR,aAAa,GAChB,MAAM,SAAS,CAAC;AACjB,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAClC,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACnD,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAEzC,MAAM,CAAC,MAAM,WAAW,GAAG,yCAAyC,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