@uluops/registry-mcp 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (272) hide show
  1. package/CHANGELOG.md +152 -0
  2. package/README.md +228 -0
  3. package/dist/client/sdk-error-mapper.d.ts +30 -0
  4. package/dist/client/sdk-error-mapper.d.ts.map +1 -0
  5. package/dist/client/sdk-error-mapper.js +129 -0
  6. package/dist/client/sdk-error-mapper.js.map +1 -0
  7. package/dist/config/index.d.ts +17 -0
  8. package/dist/config/index.d.ts.map +1 -0
  9. package/dist/config/index.js +92 -0
  10. package/dist/config/index.js.map +1 -0
  11. package/dist/config/tool-registry.d.ts +9 -0
  12. package/dist/config/tool-registry.d.ts.map +1 -0
  13. package/dist/config/tool-registry.js +386 -0
  14. package/dist/config/tool-registry.js.map +1 -0
  15. package/dist/index.d.ts +10 -0
  16. package/dist/index.d.ts.map +1 -0
  17. package/dist/index.js +160 -0
  18. package/dist/index.js.map +1 -0
  19. package/dist/resources/definition-types.d.ts +6 -0
  20. package/dist/resources/definition-types.d.ts.map +1 -0
  21. package/dist/resources/definition-types.js +31 -0
  22. package/dist/resources/definition-types.js.map +1 -0
  23. package/dist/resources/definitions.d.ts +7 -0
  24. package/dist/resources/definitions.d.ts.map +1 -0
  25. package/dist/resources/definitions.js +11 -0
  26. package/dist/resources/definitions.js.map +1 -0
  27. package/dist/resources/index.d.ts +12 -0
  28. package/dist/resources/index.d.ts.map +1 -0
  29. package/dist/resources/index.js +19 -0
  30. package/dist/resources/index.js.map +1 -0
  31. package/dist/resources/models.d.ts +7 -0
  32. package/dist/resources/models.d.ts.map +1 -0
  33. package/dist/resources/models.js +11 -0
  34. package/dist/resources/models.js.map +1 -0
  35. package/dist/resources/providers.d.ts +7 -0
  36. package/dist/resources/providers.d.ts.map +1 -0
  37. package/dist/resources/providers.js +11 -0
  38. package/dist/resources/providers.js.map +1 -0
  39. package/dist/resources/response-helpers.d.ts +8 -0
  40. package/dist/resources/response-helpers.d.ts.map +1 -0
  41. package/dist/resources/response-helpers.js +51 -0
  42. package/dist/resources/response-helpers.js.map +1 -0
  43. package/dist/tools/archive-definition.d.ts +24 -0
  44. package/dist/tools/archive-definition.d.ts.map +1 -0
  45. package/dist/tools/archive-definition.js +19 -0
  46. package/dist/tools/archive-definition.js.map +1 -0
  47. package/dist/tools/batch-publish.d.ts +38 -0
  48. package/dist/tools/batch-publish.d.ts.map +1 -0
  49. package/dist/tools/batch-publish.js +64 -0
  50. package/dist/tools/batch-publish.js.map +1 -0
  51. package/dist/tools/batch-users.d.ts +17 -0
  52. package/dist/tools/batch-users.d.ts.map +1 -0
  53. package/dist/tools/batch-users.js +14 -0
  54. package/dist/tools/batch-users.js.map +1 -0
  55. package/dist/tools/check-forkable.d.ts +23 -0
  56. package/dist/tools/check-forkable.d.ts.map +1 -0
  57. package/dist/tools/check-forkable.js +17 -0
  58. package/dist/tools/check-forkable.js.map +1 -0
  59. package/dist/tools/compare-effectiveness.d.ts +23 -0
  60. package/dist/tools/compare-effectiveness.d.ts.map +1 -0
  61. package/dist/tools/compare-effectiveness.js +17 -0
  62. package/dist/tools/compare-effectiveness.js.map +1 -0
  63. package/dist/tools/create-definition.d.ts +107 -0
  64. package/dist/tools/create-definition.d.ts.map +1 -0
  65. package/dist/tools/create-definition.js +30 -0
  66. package/dist/tools/create-definition.js.map +1 -0
  67. package/dist/tools/delete-definition.d.ts +23 -0
  68. package/dist/tools/delete-definition.d.ts.map +1 -0
  69. package/dist/tools/delete-definition.js +17 -0
  70. package/dist/tools/delete-definition.js.map +1 -0
  71. package/dist/tools/deprecate-definition.d.ts +29 -0
  72. package/dist/tools/deprecate-definition.d.ts.map +1 -0
  73. package/dist/tools/deprecate-definition.js +23 -0
  74. package/dist/tools/deprecate-definition.js.map +1 -0
  75. package/dist/tools/diff-versions.d.ts +32 -0
  76. package/dist/tools/diff-versions.d.ts.map +1 -0
  77. package/dist/tools/diff-versions.js +20 -0
  78. package/dist/tools/diff-versions.js.map +1 -0
  79. package/dist/tools/fork-definition.d.ts +29 -0
  80. package/dist/tools/fork-definition.d.ts.map +1 -0
  81. package/dist/tools/fork-definition.js +22 -0
  82. package/dist/tools/fork-definition.js.map +1 -0
  83. package/dist/tools/get-definition.d.ts +35 -0
  84. package/dist/tools/get-definition.d.ts.map +1 -0
  85. package/dist/tools/get-definition.js +32 -0
  86. package/dist/tools/get-definition.js.map +1 -0
  87. package/dist/tools/get-dependencies.d.ts +26 -0
  88. package/dist/tools/get-dependencies.d.ts.map +1 -0
  89. package/dist/tools/get-dependencies.js +23 -0
  90. package/dist/tools/get-dependencies.js.map +1 -0
  91. package/dist/tools/get-dependents.d.ts +23 -0
  92. package/dist/tools/get-dependents.d.ts.map +1 -0
  93. package/dist/tools/get-dependents.js +17 -0
  94. package/dist/tools/get-dependents.js.map +1 -0
  95. package/dist/tools/get-diff-impact.d.ts +26 -0
  96. package/dist/tools/get-diff-impact.d.ts.map +1 -0
  97. package/dist/tools/get-diff-impact.js +18 -0
  98. package/dist/tools/get-diff-impact.js.map +1 -0
  99. package/dist/tools/get-ecosystem-overview.d.ts +11 -0
  100. package/dist/tools/get-ecosystem-overview.d.ts.map +1 -0
  101. package/dist/tools/get-ecosystem-overview.js +12 -0
  102. package/dist/tools/get-ecosystem-overview.js.map +1 -0
  103. package/dist/tools/get-effectiveness.d.ts +23 -0
  104. package/dist/tools/get-effectiveness.d.ts.map +1 -0
  105. package/dist/tools/get-effectiveness.js +17 -0
  106. package/dist/tools/get-effectiveness.js.map +1 -0
  107. package/dist/tools/get-evolution.d.ts +20 -0
  108. package/dist/tools/get-evolution.d.ts.map +1 -0
  109. package/dist/tools/get-evolution.js +16 -0
  110. package/dist/tools/get-evolution.js.map +1 -0
  111. package/dist/tools/get-execution-stats.d.ts +26 -0
  112. package/dist/tools/get-execution-stats.d.ts.map +1 -0
  113. package/dist/tools/get-execution-stats.js +18 -0
  114. package/dist/tools/get-execution-stats.js.map +1 -0
  115. package/dist/tools/get-fork-lineage.d.ts +23 -0
  116. package/dist/tools/get-fork-lineage.d.ts.map +1 -0
  117. package/dist/tools/get-fork-lineage.js +17 -0
  118. package/dist/tools/get-fork-lineage.js.map +1 -0
  119. package/dist/tools/get-health.d.ts +23 -0
  120. package/dist/tools/get-health.d.ts.map +1 -0
  121. package/dist/tools/get-health.js +17 -0
  122. package/dist/tools/get-health.js.map +1 -0
  123. package/dist/tools/get-language.d.ts +17 -0
  124. package/dist/tools/get-language.d.ts.map +1 -0
  125. package/dist/tools/get-language.js +14 -0
  126. package/dist/tools/get-language.js.map +1 -0
  127. package/dist/tools/get-lineage.d.ts +20 -0
  128. package/dist/tools/get-lineage.d.ts.map +1 -0
  129. package/dist/tools/get-lineage.js +16 -0
  130. package/dist/tools/get-lineage.js.map +1 -0
  131. package/dist/tools/get-model.d.ts +20 -0
  132. package/dist/tools/get-model.d.ts.map +1 -0
  133. package/dist/tools/get-model.js +15 -0
  134. package/dist/tools/get-model.js.map +1 -0
  135. package/dist/tools/get-translation-analytics.d.ts +20 -0
  136. package/dist/tools/get-translation-analytics.d.ts.map +1 -0
  137. package/dist/tools/get-translation-analytics.js +16 -0
  138. package/dist/tools/get-translation-analytics.js.map +1 -0
  139. package/dist/tools/get-translator-version.d.ts +11 -0
  140. package/dist/tools/get-translator-version.d.ts.map +1 -0
  141. package/dist/tools/get-translator-version.js +12 -0
  142. package/dist/tools/get-translator-version.js.map +1 -0
  143. package/dist/tools/get-user.d.ts +17 -0
  144. package/dist/tools/get-user.d.ts.map +1 -0
  145. package/dist/tools/get-user.js +14 -0
  146. package/dist/tools/get-user.js.map +1 -0
  147. package/dist/tools/index.d.ts +12 -0
  148. package/dist/tools/index.d.ts.map +1 -0
  149. package/dist/tools/index.js +136 -0
  150. package/dist/tools/index.js.map +1 -0
  151. package/dist/tools/list-aliases.d.ts +11 -0
  152. package/dist/tools/list-aliases.d.ts.map +1 -0
  153. package/dist/tools/list-aliases.js +12 -0
  154. package/dist/tools/list-aliases.js.map +1 -0
  155. package/dist/tools/list-definitions.d.ts +53 -0
  156. package/dist/tools/list-definitions.d.ts.map +1 -0
  157. package/dist/tools/list-definitions.js +56 -0
  158. package/dist/tools/list-definitions.js.map +1 -0
  159. package/dist/tools/list-forks.d.ts +23 -0
  160. package/dist/tools/list-forks.d.ts.map +1 -0
  161. package/dist/tools/list-forks.js +17 -0
  162. package/dist/tools/list-forks.js.map +1 -0
  163. package/dist/tools/list-languages.d.ts +11 -0
  164. package/dist/tools/list-languages.d.ts.map +1 -0
  165. package/dist/tools/list-languages.js +12 -0
  166. package/dist/tools/list-languages.js.map +1 -0
  167. package/dist/tools/list-models.d.ts +23 -0
  168. package/dist/tools/list-models.d.ts.map +1 -0
  169. package/dist/tools/list-models.js +17 -0
  170. package/dist/tools/list-models.js.map +1 -0
  171. package/dist/tools/list-providers.d.ts +11 -0
  172. package/dist/tools/list-providers.d.ts.map +1 -0
  173. package/dist/tools/list-providers.js +12 -0
  174. package/dist/tools/list-providers.js.map +1 -0
  175. package/dist/tools/list-versions.d.ts +26 -0
  176. package/dist/tools/list-versions.d.ts.map +1 -0
  177. package/dist/tools/list-versions.js +21 -0
  178. package/dist/tools/list-versions.js.map +1 -0
  179. package/dist/tools/publish-definition.d.ts +23 -0
  180. package/dist/tools/publish-definition.d.ts.map +1 -0
  181. package/dist/tools/publish-definition.js +26 -0
  182. package/dist/tools/publish-definition.js.map +1 -0
  183. package/dist/tools/record-execution.d.ts +29 -0
  184. package/dist/tools/record-execution.d.ts.map +1 -0
  185. package/dist/tools/record-execution.js +22 -0
  186. package/dist/tools/record-execution.js.map +1 -0
  187. package/dist/tools/render-definition.d.ts +33 -0
  188. package/dist/tools/render-definition.d.ts.map +1 -0
  189. package/dist/tools/render-definition.js +97 -0
  190. package/dist/tools/render-definition.js.map +1 -0
  191. package/dist/tools/resolve-alias.d.ts +17 -0
  192. package/dist/tools/resolve-alias.d.ts.map +1 -0
  193. package/dist/tools/resolve-alias.js +14 -0
  194. package/dist/tools/resolve-alias.js.map +1 -0
  195. package/dist/tools/retranslate-definition.d.ts +26 -0
  196. package/dist/tools/retranslate-definition.d.ts.map +1 -0
  197. package/dist/tools/retranslate-definition.js +23 -0
  198. package/dist/tools/retranslate-definition.js.map +1 -0
  199. package/dist/tools/search-definitions.d.ts +44 -0
  200. package/dist/tools/search-definitions.d.ts.map +1 -0
  201. package/dist/tools/search-definitions.js +35 -0
  202. package/dist/tools/search-definitions.js.map +1 -0
  203. package/dist/tools/set-default-type.d.ts +10 -0
  204. package/dist/tools/set-default-type.d.ts.map +1 -0
  205. package/dist/tools/set-default-type.js +31 -0
  206. package/dist/tools/set-default-type.js.map +1 -0
  207. package/dist/tools/sync-models.d.ts +12 -0
  208. package/dist/tools/sync-models.d.ts.map +1 -0
  209. package/dist/tools/sync-models.js +32 -0
  210. package/dist/tools/sync-models.js.map +1 -0
  211. package/dist/tools/update-and-publish.d.ts +44 -0
  212. package/dist/tools/update-and-publish.d.ts.map +1 -0
  213. package/dist/tools/update-and-publish.js +111 -0
  214. package/dist/tools/update-and-publish.js.map +1 -0
  215. package/dist/tools/update-definition.d.ts +129 -0
  216. package/dist/tools/update-definition.d.ts.map +1 -0
  217. package/dist/tools/update-definition.js +85 -0
  218. package/dist/tools/update-definition.js.map +1 -0
  219. package/dist/tools/upgrade-definition.d.ts +27 -0
  220. package/dist/tools/upgrade-definition.d.ts.map +1 -0
  221. package/dist/tools/upgrade-definition.js +22 -0
  222. package/dist/tools/upgrade-definition.js.map +1 -0
  223. package/dist/tools/validate-definition.d.ts +24 -0
  224. package/dist/tools/validate-definition.d.ts.map +1 -0
  225. package/dist/tools/validate-definition.js +21 -0
  226. package/dist/tools/validate-definition.js.map +1 -0
  227. package/dist/types/config.d.ts +40 -0
  228. package/dist/types/config.d.ts.map +1 -0
  229. package/dist/types/config.js +5 -0
  230. package/dist/types/config.js.map +1 -0
  231. package/dist/types/index.d.ts +9 -0
  232. package/dist/types/index.d.ts.map +1 -0
  233. package/dist/types/index.js +7 -0
  234. package/dist/types/index.js.map +1 -0
  235. package/dist/types/mcp.d.ts +21 -0
  236. package/dist/types/mcp.d.ts.map +1 -0
  237. package/dist/types/mcp.js +34 -0
  238. package/dist/types/mcp.js.map +1 -0
  239. package/dist/types/schemas.d.ts +113 -0
  240. package/dist/types/schemas.d.ts.map +1 -0
  241. package/dist/types/schemas.js +65 -0
  242. package/dist/types/schemas.js.map +1 -0
  243. package/dist/types/server.d.ts +29 -0
  244. package/dist/types/server.d.ts.map +1 -0
  245. package/dist/types/server.js +5 -0
  246. package/dist/types/server.js.map +1 -0
  247. package/dist/utils/logger.d.ts +19 -0
  248. package/dist/utils/logger.d.ts.map +1 -0
  249. package/dist/utils/logger.js +94 -0
  250. package/dist/utils/logger.js.map +1 -0
  251. package/dist/utils/normalize-keys.d.ts +11 -0
  252. package/dist/utils/normalize-keys.d.ts.map +1 -0
  253. package/dist/utils/normalize-keys.js +41 -0
  254. package/dist/utils/normalize-keys.js.map +1 -0
  255. package/dist/utils/read-yaml-file.d.ts +27 -0
  256. package/dist/utils/read-yaml-file.d.ts.map +1 -0
  257. package/dist/utils/read-yaml-file.js +89 -0
  258. package/dist/utils/read-yaml-file.js.map +1 -0
  259. package/dist/utils/session-state.d.ts +20 -0
  260. package/dist/utils/session-state.d.ts.map +1 -0
  261. package/dist/utils/session-state.js +21 -0
  262. package/dist/utils/session-state.js.map +1 -0
  263. package/dist/utils/tool-handler.d.ts +61 -0
  264. package/dist/utils/tool-handler.d.ts.map +1 -0
  265. package/dist/utils/tool-handler.js +184 -0
  266. package/dist/utils/tool-handler.js.map +1 -0
  267. package/dist/utils/trim-definition.d.ts +13 -0
  268. package/dist/utils/trim-definition.d.ts.map +1 -0
  269. package/dist/utils/trim-definition.js +28 -0
  270. package/dist/utils/trim-definition.js.map +1 -0
  271. package/package.json +83 -0
  272. package/tool-policies.json +66 -0
@@ -0,0 +1,65 @@
1
+ /**
2
+ * Shared Zod schemas for MCP input validation
3
+ *
4
+ * These define the enum values accepted by registry tools.
5
+ * MCP uses snake_case field names; normalizeKeys converts to camelCase for the SDK.
6
+ */
7
+ import { z } from 'zod';
8
+ /** Registry definition types: agent, command, workflow, or pipeline. */
9
+ export const DefinitionTypeSchema = z.enum(['agent', 'command', 'workflow', 'pipeline']);
10
+ /** Lifecycle statuses for definitions. */
11
+ export const DefinitionStatusSchema = z.enum(['draft', 'published', 'deprecated', 'archived']);
12
+ /** Knowledge domain categories for definitions. */
13
+ export const DomainSchema = z.enum([
14
+ 'software',
15
+ 'security',
16
+ 'compliance',
17
+ 'legal',
18
+ 'medical',
19
+ 'financial',
20
+ 'scientific',
21
+ 'content',
22
+ 'general',
23
+ 'cognitive-lens',
24
+ ]);
25
+ /** Agent behavioral subtypes. */
26
+ export const AgentTypeSchema = z.enum(['validator', 'executor', 'analyst', 'generator', 'explorer', 'forecaster']);
27
+ /** Access control levels for definitions. */
28
+ export const VisibilitySchema = z.enum(['private', 'unlisted', 'public']);
29
+ /** Sortable fields for list queries. */
30
+ export const SortFieldSchema = z.enum(['name', 'createdAt', 'updatedAt', 'executionCount']);
31
+ /** Sort direction. */
32
+ export const SortOrderSchema = z.enum(['asc', 'desc']);
33
+ /** AI model pricing/capability tiers. */
34
+ export const ModelTierSchema = z.enum(['budget', 'standard', 'premium', 'reasoning']);
35
+ /** AI model availability statuses. */
36
+ export const ModelStatusSchema = z.enum(['available', 'preview', 'deprecated']);
37
+ /** Quality/provenance tiers for definitions. */
38
+ export const TierSchema = z.enum(['user', 'org', 'pro']);
39
+ /** Subscription tiers for content gating. */
40
+ export const SubscriptionTierSchema = z.enum(['free', 'hobbyist', 'plus', 'pro', 'enterprise']);
41
+ /** Semantic version change types for definition updates. */
42
+ export const ChangeTypeSchema = z.enum(['major', 'minor', 'patch']);
43
+ /** Authorship provenance classification. */
44
+ export const AuthorshipTypeSchema = z.enum(['human', 'agent', 'collaborative', 'automated']);
45
+ /** Contributor role in definition authorship. */
46
+ export const ContributorRoleSchema = z.enum(['author', 'optimizer', 'reviewer', 'editor', 'publisher']);
47
+ /** Actor type — human or agent. */
48
+ export const ActorTypeSchema = z.enum(['human', 'agent']);
49
+ /** A single contributor to a definition's authorship. */
50
+ export const ContributorSchema = z.object({
51
+ id: z.string().min(1).max(100),
52
+ role: ContributorRoleSchema,
53
+ type: ActorTypeSchema,
54
+ name: z.string().max(200).optional(),
55
+ agent_name: z.string().max(200).optional(),
56
+ contributed_at: z.string().optional(),
57
+ });
58
+ /** Full provenance record for a definition. */
59
+ export const ProvenanceInputSchema = z.object({
60
+ authorship_type: AuthorshipTypeSchema,
61
+ contributors: z.array(ContributorSchema).min(1).max(50),
62
+ dialectic_rounds: z.number().int().nonnegative().optional(),
63
+ optimization_run_id: z.string().max(100).optional(),
64
+ });
65
+ //# sourceMappingURL=schemas.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"schemas.js","sourceRoot":"","sources":["../../src/types/schemas.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,wEAAwE;AACxE,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC,CAAC,IAAI,CAAC,CAAC,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,UAAU,CAAC,CAAC,CAAC;AAEzF,0CAA0C;AAC1C,MAAM,CAAC,MAAM,sBAAsB,GAAG,CAAC,CAAC,IAAI,CAAC,CAAC,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,UAAU,CAAC,CAAC,CAAC;AAE/F,mDAAmD;AACnD,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC,CAAC,IAAI,CAAC;IACjC,UAAU;IACV,UAAU;IACV,YAAY;IACZ,OAAO;IACP,SAAS;IACT,WAAW;IACX,YAAY;IACZ,SAAS;IACT,SAAS;IACT,gBAAgB;CACjB,CAAC,CAAC;AAEH,iCAAiC;AACjC,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,CAAC,IAAI,CAAC,CAAC,WAAW,EAAE,UAAU,E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AAG,CAAC,CAAC,QAAQ,EAAE;CACpD,CAAC,CAAC"}
@@ -0,0 +1,29 @@
1
+ /**
2
+ * MCP Server interface types
3
+ */
4
+ import type { ZodRawShape } from 'zod';
5
+ import type { McpToolResponse } from './mcp.js';
6
+ export type ToolHandler = (args: unknown) => Promise<McpToolResponse>;
7
+ export interface ResourceContent {
8
+ uri: string;
9
+ mimeType?: string;
10
+ text?: string;
11
+ blob?: string;
12
+ }
13
+ export interface ResourceResponse {
14
+ contents: ResourceContent[];
15
+ }
16
+ export type ResourceHandler = () => Promise<ResourceResponse>;
17
+ export interface ResourceMetadata {
18
+ description?: string;
19
+ mimeType?: string;
20
+ }
21
+ export interface McpServerToolRegistration {
22
+ tool: (name: string, description: string, schema: ZodRawShape, handler: ToolHandler) => void;
23
+ }
24
+ export interface McpServerResourceRegistration {
25
+ resource: (name: string, uri: string, metadataOrHandler: ResourceMetadata | ResourceHandler, handler?: ResourceHandler) => void;
26
+ }
27
+ export interface McpServer extends McpServerToolRegistration, McpServerResourceRegistration {
28
+ }
29
+ //# sourceMappingURL=server.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../../src/types/server.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,KAAK,CAAC;AACvC,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AAEhD,MAAM,MAAM,WAAW,GAAG,CAAC,IAAI,EAAE,OAAO,KAAK,OAAO,CAAC,eAAe,CAAC,CAAC;AAEtE,MAAM,WAAW,eAAe;IAC9B,GAAG,EAAE,MAAM,CAAC;IACZ,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,EAAE,eAAe,EAAE,CAAC;CAC7B;AAED,MAAM,MAAM,eAAe,GAAG,MAAM,OAAO,CAAC,gBAAgB,CAAC,CAAC;AAE9D,MAAM,WAAW,gBAAgB;IAC/B,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,yBAAyB;IACxC,IAAI,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,EAAE,MAAM,EAAE,WAAW,EAAE,OAAO,EAAE,WAAW,KAAK,IAAI,CAAC;CAC9F;AAED,MAAM,WAAW,6BAA6B;IAC5C,QAAQ,EAAE,CACR,IAAI,EAAE,MAAM,EACZ,GAAG,EAAE,MAAM,EACX,iBAAiB,EAAE,gBAAgB,GAAG,eAAe,EACrD,OAAO,CAAC,EAAE,eAAe,KACtB,IAAI,CAAC;CACX;AAED,MAAM,WAAW,SAAU,SAAQ,yBAAyB,EAAE,6BAA6B;CAAG"}
@@ -0,0 +1,5 @@
1
+ /**
2
+ * MCP Server interface types
3
+ */
4
+ export {};
5
+ //# sourceMappingURL=server.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"server.js","sourceRoot":"","sources":["../../src/types/server.ts"],"names":[],"mappings":"AAAA;;GAEG"}
@@ -0,0 +1,19 @@
1
+ /**
2
+ * Structured logger with optional file output
3
+ *
4
+ * Logs to stderr (for MCP compatibility) and optionally to files.
5
+ */
6
+ import type { LogLevel } from '../types/index.js';
7
+ export interface LoggerConfig {
8
+ level: LogLevel;
9
+ enableFileLogging?: boolean;
10
+ logDir?: string;
11
+ }
12
+ export interface Logger {
13
+ debug: (message: string, context?: Record<string, unknown>) => void;
14
+ info: (message: string, context?: Record<string, unknown>) => void;
15
+ warn: (message: string, context?: Record<string, unknown>) => void;
16
+ error: (message: string, context?: Record<string, unknown>) => void;
17
+ }
18
+ export declare function createLogger(config: LoggerConfig | LogLevel): Logger;
19
+ //# sourceMappingURL=logger.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"logger.d.ts","sourceRoot":"","sources":["../../src/utils/logger.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAIH,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAElD,MAAM,WAAW,YAAY;IAC3B,KAAK,EAAE,QAAQ,CAAC;IAChB,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,MAAM;IACrB,KAAK,EAAE,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAAK,IAAI,CAAC;IACpE,IAAI,EAAE,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAAK,IAAI,CAAC;IACnE,IAAI,EAAE,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAAK,IAAI,CAAC;IACnE,KAAK,EAAE,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAAK,IAAI,CAAC;CACrE;AAsDD,wBAAgB,YAAY,CAAC,MAAM,EAAE,YAAY,GAAG,QAAQ,GAAG,MAAM,CAmDpE"}
@@ -0,0 +1,94 @@
1
+ /**
2
+ * Structured logger with optional file output
3
+ *
4
+ * Logs to stderr (for MCP compatibility) and optionally to files.
5
+ */
6
+ import { appendFileSync, mkdirSync, existsSync } from 'node:fs';
7
+ import { join, resolve, isAbsolute } from 'node:path';
8
+ const LOG_LEVELS = {
9
+ debug: 0,
10
+ info: 1,
11
+ warn: 2,
12
+ error: 3,
13
+ };
14
+ function formatLogEntry(level, message, context) {
15
+ const entry = {
16
+ timestamp: new Date().toISOString(),
17
+ level: level.toUpperCase(),
18
+ message,
19
+ ...(context && Object.keys(context).length > 0 ? { context } : {}),
20
+ };
21
+ return JSON.stringify(entry);
22
+ }
23
+ function getLogFilePath(logDir) {
24
+ const date = new Date().toISOString().split('T')[0] ?? 'unknown';
25
+ return join(logDir, `registry-mcp-${date}.log`);
26
+ }
27
+ /**
28
+ * Validate that a log directory path is safe to write to.
29
+ * Rejects paths containing traversal sequences or pointing outside the working tree.
30
+ */
31
+ function validateLogDir(logDir) {
32
+ const resolved = resolve(logDir);
33
+ const cwd = process.cwd();
34
+ // Reject path traversal patterns
35
+ if (logDir.includes('..')) {
36
+ throw new Error(`LOG_DIR must not contain path traversal sequences: ${logDir}`);
37
+ }
38
+ // Absolute paths must be under cwd or a well-known logs location
39
+ if (isAbsolute(logDir) && !resolved.startsWith(cwd) && !resolved.startsWith('/tmp/')) {
40
+ throw new Error(`LOG_DIR absolute path must be under the working directory or /tmp/: ${logDir}`);
41
+ }
42
+ return resolved;
43
+ }
44
+ function ensureLogDir(logDir) {
45
+ if (!existsSync(logDir)) {
46
+ mkdirSync(logDir, { recursive: true });
47
+ }
48
+ }
49
+ export function createLogger(config) {
50
+ const resolvedConfig = typeof config === 'string' ? { level: config } : config;
51
+ const { level, enableFileLogging = false, logDir } = resolvedConfig;
52
+ const minLevel = LOG_LEVELS[level];
53
+ const rawLogDir = logDir ?? join(process.cwd(), 'logs');
54
+ const resolvedLogDir = enableFileLogging ? validateLogDir(rawLogDir) : rawLogDir;
55
+ if (enableFileLogging) {
56
+ ensureLogDir(resolvedLogDir);
57
+ }
58
+ let fileLoggingFailed = false;
59
+ const log = (logLevel, message, context) => {
60
+ if (LOG_LEVELS[logLevel] < minLevel) {
61
+ return;
62
+ }
63
+ const formatted = formatLogEntry(logLevel, message, context);
64
+ console.error(formatted);
65
+ if (enableFileLogging) {
66
+ try {
67
+ const filePath = getLogFilePath(resolvedLogDir);
68
+ appendFileSync(filePath, formatted + '\n', 'utf-8');
69
+ }
70
+ catch (fileError) {
71
+ if (!fileLoggingFailed) {
72
+ fileLoggingFailed = true;
73
+ const detail = fileError instanceof Error ? fileError.message : String(fileError);
74
+ console.error(formatLogEntry('warn', `File logging failed: ${detail}. Further file log errors suppressed`));
75
+ }
76
+ }
77
+ }
78
+ };
79
+ return {
80
+ debug: (message, context) => {
81
+ log('debug', message, context);
82
+ },
83
+ info: (message, context) => {
84
+ log('info', message, context);
85
+ },
86
+ warn: (message, context) => {
87
+ log('warn', message, context);
88
+ },
89
+ error: (message, context) => {
90
+ log('error', message, context);
91
+ },
92
+ };
93
+ }
94
+ //# sourceMappingURL=logger.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"logger.js","sourceRoot":"","sources":["../../src/utils/logger.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,cAAc,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAChE,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AAgBtD,MAAM,UAAU,GAA6B;IAC3C,KAAK,EAAE,CAAC;IACR,IAAI,EAAE,CAAC;IACP,IAAI,EAAE,CAAC;IACP,KAAK,EAAE,CAAC;CACT,CAAC;AAEF,SAAS,cAAc,CACrB,KAAe,EACf,OAAe,EACf,OAAiC;IAEjC,MAAM,KAAK,GAAG;QACZ,SAAS,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;QACnC,KAAK,EAAE,KAAK,CAAC,WAAW,EAAE;QAC1B,OAAO;QACP,GAAG,CAAC,OAAO,IAAI,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;KACnE,CAAC;IACF,OAAO,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC;AAC/B,CAAC;AAED,SAAS,cAAc,CAAC,MAAc;IACpC,MAAM,IAAI,GAAG,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE,CAAC,KAAK,CAAC,GAAG,CAAC,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AAO,EAAE,OAAO,CAAC,CAAC;QACjC,CAAC;QACD,IAAI,EAAE,CAAC,OAAe,EAAE,OAAiC,EAAQ,EAAE;YACjE,GAAG,CAAC,MAAM,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC;QAChC,CAAC;QACD,IAAI,EAAE,CAAC,OAAe,EAAE,OAAiC,EAAQ,EAAE;YACjE,GAAG,CAAC,MAAM,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC;QAChC,CAAC;QACD,KAAK,EAAE,CAAC,OAAe,EAAE,OAAiC,EAAQ,EAAE;YAClE,GAAG,CAAC,OAAO,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC;QACjC,CAAC;KACF,CAAC;AACJ,CAAC"}
@@ -0,0 +1,11 @@
1
+ /**
2
+ * Key normalization utilities for snake_case -> camelCase conversion
3
+ *
4
+ * MCP tool inputs use snake_case (matching the MCP protocol convention).
5
+ * The SDK expects camelCase. This module provides recursive conversion.
6
+ */
7
+ /**
8
+ * Recursively convert all object keys from snake_case to camelCase.
9
+ */
10
+ export declare function normalizeKeys(input: unknown, depth?: number): unknown;
11
+ //# sourceMappingURL=normalize-keys.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"normalize-keys.d.ts","sourceRoot":"","sources":["../../src/utils/normalize-keys.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAWH;;GAEG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,OAAO,EAAE,KAAK,SAAI,GAAG,OAAO,CAuBhE"}
@@ -0,0 +1,41 @@
1
+ /**
2
+ * Key normalization utilities for snake_case -> camelCase conversion
3
+ *
4
+ * MCP tool inputs use snake_case (matching the MCP protocol convention).
5
+ * The SDK expects camelCase. This module provides recursive conversion.
6
+ */
7
+ /**
8
+ * Convert a single snake_case string to camelCase
9
+ */
10
+ function toCamelCase(str) {
11
+ return str.replace(/_([a-z0-9])/g, (_, c) => c.toUpperCase());
12
+ }
13
+ const MAX_DEPTH = 20;
14
+ /**
15
+ * Recursively convert all object keys from snake_case to camelCase.
16
+ */
17
+ export function normalizeKeys(input, depth = 0) {
18
+ if (depth > MAX_DEPTH) {
19
+ // Safety limit to prevent infinite recursion on circular references.
20
+ // MCP tool inputs are shallow objects (typically 1-3 levels deep).
21
+ return input;
22
+ }
23
+ if (Array.isArray(input)) {
24
+ return input.map((item) => normalizeKeys(item, depth + 1));
25
+ }
26
+ if (input !== null && typeof input === 'object') {
27
+ const result = {};
28
+ // SAFETY: Non-null object is guaranteed by the guard above. Object.entries requires
29
+ // Record<string, unknown> cast since `input` is typed as `object` (no index signature).
30
+ for (const [key, value] of Object.entries(input)) {
31
+ const camelKey = toCamelCase(key);
32
+ if (camelKey === '__proto__' || camelKey === 'constructor' || camelKey === 'prototype') {
33
+ continue;
34
+ }
35
+ result[camelKey] = normalizeKeys(value, depth + 1);
36
+ }
37
+ return result;
38
+ }
39
+ return input;
40
+ }
41
+ //# sourceMappingURL=normalize-keys.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"normalize-keys.js","sourceRoot":"","sources":["../../src/utils/normalize-keys.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH;;GAEG;AACH,SAAS,WAAW,CAAC,GAAW;IAC9B,OAAO,GAAG,CAAC,OAAO,CAAC,cAAc,EAAE,CAAC,CAAC,EAAE,CAAS,EAAE,EAAE,CAAC,CAAC,CAAC,WAAW,EAAE,CAAC,CAAC;AACxE,CAAC;AAED,MAAM,SAAS,GAAG,EAAE,CAAC;AAErB;;GAEG;AACH,MAAM,UAAU,aAAa,CAAC,KAAc,EAAE,KAAK,GAAG,CAAC;IACrD,IAAI,KAAK,GAAG,SAAS,EAAE,CAAC;QACtB,qEAAqE;QACrE,mEAAmE;QACnE,OAAO,KAAK,CAAC;IACf,CAAC;IACD,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC;QACzB,OAAO,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,aAAa,CAAC,IAAI,EAAE,KAAK,GAAG,CAAC,CAAC,CAAC,CAAC;IAC7D,CAAC;IACD,IAAI,KAAK,KAAK,IAAI,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;QAChD,MAAM,MAAM,GAA4B,EAAE,CAAC;QAC3C,oFAAoF;QACpF,wFAAwF;QACxF,KAAK,MAAM,CAAC,GAAG,EAAE,KAAK,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,KAAgC,CAAC,EAAE,CAAC;YAC5E,MAAM,QAAQ,GAAG,WAAW,CAAC,GAAG,CAAC,CAAC;YAClC,IAAI,QAAQ,KAAK,WAAW,IAAI,QAAQ,KAAK,aAAa,IAAI,QAAQ,KAAK,WAAW,EAAE,CAAC;gBACvF,SAAS;YACX,CAAC;YACD,MAAM,CAAC,QAAQ,CAAC,GAAG,aAAa,CAAC,KAAK,EAAE,KAAK,GAAG,CAAC,CAAC,CAAC;QACrD,CAAC;QACD,OAAO,MAAM,CAAC;IAChB,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC"}
@@ -0,0 +1,27 @@
1
+ /**
2
+ * Read YAML file from disk (sync) and resolve yaml/file_path input.
3
+ *
4
+ * Used by tools that accept `file_path` as an alternative to inline `yaml`.
5
+ * Sync because `preProcess` callbacks are synchronous by contract.
6
+ */
7
+ import { type McpToolResponse } from '../types/mcp.js';
8
+ /**
9
+ * Read a YAML file from disk synchronously.
10
+ * @param filePath - Absolute or relative path to a .yaml/.yml file.
11
+ * @returns The raw file contents as a UTF-8 string.
12
+ * @throws If the path escapes WORKSPACE_DIR, has an invalid extension, does not exist, or is unreadable.
13
+ */
14
+ export declare function readYamlFile(filePath: string): string;
15
+ /**
16
+ * Resolve yaml/file_path mutual exclusion for tool preProcess hooks.
17
+ * @param input - Parsed tool input containing optional `yaml` and/or `file_path`.
18
+ * @param options - `{ required: true }` if at least one must be provided (create/validate), `false` for update.
19
+ * @returns The input with `yaml` populated from file (if file_path given), or an McpToolResponse error.
20
+ */
21
+ export declare function resolveYamlInput<T extends {
22
+ yaml?: string;
23
+ file_path?: string;
24
+ }>(input: T, options: {
25
+ required: boolean;
26
+ }): T | McpToolResponse;
27
+ //# sourceMappingURL=read-yaml-file.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"read-yaml-file.d.ts","sourceRoot":"","sources":["../../src/utils/read-yaml-file.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAIH,OAAO,EAAuB,KAAK,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAe5E;;;;;GAKG;AACH,wBAAgB,YAAY,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAsDrD;AAED;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAAC,CAAC,SAAS;IAAE,IAAI,CAAC,EAAE,MAAM,CAAC;IAAC,SAAS,CAAC,EAAE,MAAM,CAAA;CAAE,EAC9E,KAAK,EAAE,CAAC,EACR,OAAO,EAAE;IAAE,QAAQ,EAAE,OAAO,CAAA;CAAE,GAC7B,CAAC,GAAG,eAAe,CAWrB"}
@@ -0,0 +1,89 @@
1
+ /**
2
+ * Read YAML file from disk (sync) and resolve yaml/file_path input.
3
+ *
4
+ * Used by tools that accept `file_path` as an alternative to inline `yaml`.
5
+ * Sync because `preProcess` callbacks are synchronous by contract.
6
+ */
7
+ import { readFileSync, realpathSync, statSync } from 'node:fs';
8
+ import { resolve, extname } from 'node:path';
9
+ import { createErrorResponse } from '../types/mcp.js';
10
+ const ALLOWED_EXTENSIONS = new Set(['.yaml', '.yml']);
11
+ const MAX_FILE_SIZE_BYTES = 5 * 1024 * 1024; // 5 MB
12
+ /**
13
+ * Get the base directory for file_path containment.
14
+ * Resolved paths must start with this directory to prevent path traversal (CWE-22).
15
+ * Defaults to cwd if WORKSPACE_DIR is not set.
16
+ * Evaluated per-call so env var changes (e.g., in tests) take effect.
17
+ */
18
+ function getWorkspaceDir() {
19
+ return resolve(process.env['WORKSPACE_DIR'] ?? process.cwd());
20
+ }
21
+ /**
22
+ * Read a YAML file from disk synchronously.
23
+ * @param filePath - Absolute or relative path to a .yaml/.yml file.
24
+ * @returns The raw file contents as a UTF-8 string.
25
+ * @throws If the path escapes WORKSPACE_DIR, has an invalid extension, does not exist, or is unreadable.
26
+ */
27
+ export function readYamlFile(filePath) {
28
+ const resolved = resolve(filePath);
29
+ const workspaceDir = realpathSync(getWorkspaceDir());
30
+ // First check: catch obvious traversal before touching the filesystem
31
+ if (!resolved.startsWith(workspaceDir + '/') && resolved !== workspaceDir) {
32
+ throw new Error(`file_path must resolve within ${workspaceDir} — got ${resolved}`);
33
+ }
34
+ // Second check: dereference symlinks to prevent symlink traversal (CWE-59)
35
+ let real;
36
+ try {
37
+ real = realpathSync(resolved);
38
+ }
39
+ catch {
40
+ // File doesn't exist — let readFileSync below produce the ENOENT error
41
+ real = resolved;
42
+ }
43
+ if (!real.startsWith(workspaceDir + '/') && real !== workspaceDir) {
44
+ throw new Error(`file_path resolves outside workspace via symlink — got ${real}`);
45
+ }
46
+ const ext = extname(resolved).toLowerCase();
47
+ if (!ALLOWED_EXTENSIONS.has(ext)) {
48
+ throw new Error(`Invalid file extension "${ext}". Only .yaml and .yml files are accepted.`);
49
+ }
50
+ const stat = statSync(resolved, { throwIfNoEntry: false });
51
+ if (stat && stat.size > MAX_FILE_SIZE_BYTES) {
52
+ throw new Error(`File too large: ${resolved} (${String(stat.size)} bytes, max ${String(MAX_FILE_SIZE_BYTES)})`);
53
+ }
54
+ try {
55
+ return readFileSync(resolved, 'utf-8');
56
+ }
57
+ catch (error) {
58
+ if (error instanceof Error && 'code' in error) {
59
+ const fsError = error;
60
+ if (fsError.code === 'ENOENT') {
61
+ throw new Error(`File not found: ${resolved}`);
62
+ }
63
+ if (fsError.code === 'EACCES') {
64
+ throw new Error(`Permission denied: ${resolved}`);
65
+ }
66
+ throw new Error(`Failed to read file: ${resolved} (${fsError.code ?? 'unknown'})`);
67
+ }
68
+ throw new Error(`Failed to read file: ${resolved}`);
69
+ }
70
+ }
71
+ /**
72
+ * Resolve yaml/file_path mutual exclusion for tool preProcess hooks.
73
+ * @param input - Parsed tool input containing optional `yaml` and/or `file_path`.
74
+ * @param options - `{ required: true }` if at least one must be provided (create/validate), `false` for update.
75
+ * @returns The input with `yaml` populated from file (if file_path given), or an McpToolResponse error.
76
+ */
77
+ export function resolveYamlInput(input, options) {
78
+ if (options.required && input.yaml === undefined && input.file_path === undefined) {
79
+ return createErrorResponse('Provide either yaml or file_path');
80
+ }
81
+ if (input.yaml !== undefined && input.file_path !== undefined) {
82
+ return createErrorResponse('Provide only one of yaml or file_path, not both');
83
+ }
84
+ if (input.file_path !== undefined) {
85
+ return { ...input, yaml: readYamlFile(input.file_path) };
86
+ }
87
+ return input;
88
+ }
89
+ //# sourceMappingURL=read-yaml-file.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"read-yaml-file.js","sourceRoot":"","sources":["../../src/utils/read-yaml-file.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAC/D,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAC7C,OAAO,EAAE,mBAAmB,EAAwB,MAAM,iBAAiB,CAAC;AAE5E,MAAM,kBAAkB,GAAG,IAAI,GAAG,CAAC,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC,CAAC;AACtD,MAAM,mBAAmB,GAAG,CAAC,GAAG,IAAI,GAAG,IAAI,CAAC,CAAC,OAAO;AAEpD;;;;;GAKG;AACH,SAAS,eAAe;IACtB,OAAO,OAAO,CAAC,OAAO,CAAC,GAAG,CAAC,eAAe,CAAC,IAAI,OAAO,CAAC,GAAG,EAAE,CAAC,CAAC;AAChE,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,YAAY,CAAC,QAAgB;IAC3C,MAAM,QAAQ,GAAG,OAAO,CAAC,QAAQ,CAAC,CAAC;IACnC,MAAM,YAAY,GAAG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+ *
4
+ * Safe to use in-memory because StdioTransport creates a 1:1 relationship
5
+ * between client and server process — there is exactly one session per process.
6
+ * No multi-tenant concerns.
7
+ */
8
+ import type { z } from 'zod';
9
+ import type { DefinitionTypeSchema } from '../types/index.js';
10
+ type DefinitionType = z.infer<typeof DefinitionTypeSchema>;
11
+ /** Get the session-level default definition type. */
12
+ export declare function getDefaultType(): DefinitionType | undefined;
13
+ /** Set or clear the session-level default definition type. Pass undefined to clear. */
14
+ export declare function setDefaultType(type: DefinitionType | undefined): void;
15
+ /** Get the full session state (for returning to callers). */
16
+ export declare function getSessionState(): {
17
+ defaultType: DefinitionType | undefined;
18
+ };
19
+ export {};
20
+ //# sourceMappingURL=session-state.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"session-state.d.ts","sourceRoot":"","sources":["../../src/utils/session-state.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAC7B,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAC;AAE9D,KAAK,cAAc,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAC;AAI3D,qDAAqD;AACrD,wBAAgB,cAAc,IAAI,cAAc,GAAG,SAAS,CAE3D;AAED,uFAAuF;AACvF,wBAAgB,cAAc,CAAC,IAAI,EAAE,cAAc,GAAG,SAAS,GAAG,IAAI,CAErE;AAED,6DAA6D;AAC7D,wBAAgB,eAAe,IAAI;IAAE,WAAW,EAAE,cAAc,GAAG,SAAS,CAAA;CAAE,CAE7E"}
@@ -0,0 +1,21 @@
1
+ /**
2
+ * Session-level state for the MCP server.
3
+ *
4
+ * Safe to use in-memory because StdioTransport creates a 1:1 relationship
5
+ * between client and server process — there is exactly one session per process.
6
+ * No multi-tenant concerns.
7
+ */
8
+ let defaultType;
9
+ /** Get the session-level default definition type. */
10
+ export function getDefaultType() {
11
+ return defaultType;
12
+ }
13
+ /** Set or clear the session-level default definition type. Pass undefined to clear. */
14
+ export function setDefaultType(type) {
15
+ defaultType = type;
16
+ }
17
+ /** Get the full session state (for returning to callers). */
18
+ export function getSessionState() {
19
+ return { defaultType };
20
+ }
21
+ //# sourceMappingURL=session-state.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"session-state.js","sourceRoot":"","sources":["../../src/utils/session-state.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAOH,IAAI,WAAuC,CAAC;AAE5C,qDAAqD;AACrD,MAAM,UAAU,cAAc;IAC5B,OAAO,WAAW,CAAC;AACrB,CAAC;AAED,uFAAuF;AACvF,MAAM,UAAU,cAAc,CAAC,IAAgC;IAC7D,WAAW,GAAG,IAAI,CAAC;AACrB,CAAC;AAED,6DAA6D;AAC7D,MAAM,UAAU,eAAe;IAC7B,OAAO,EAAE,WAAW,EAAE,CAAC;AACzB,CAAC"}
@@ -0,0 +1,61 @@
1
+ /**
2
+ * Tool handler factory
3
+ *
4
+ * Creates standardized MCP tool handlers with consistent error handling.
5
+ * Eliminates boilerplate across tool implementations.
6
+ */
7
+ import { z } from 'zod';
8
+ import { type McpToolResponse } from '../types/index.js';
9
+ /**
10
+ * Normalized input after snake_case→camelCase key transformation.
11
+ *
12
+ * Uses `any` deliberately — Zod validates structure before normalizeKeys() runs,
13
+ * but TypeScript cannot statically track the snake_case→camelCase key renaming.
14
+ * Callers access fields positionally (e.g. `n.type`, `n.name`) which are
15
+ * guaranteed valid by the preceding Zod parse. `Record<string, unknown>` was
16
+ * evaluated but rejected: it requires explicit casts in all 31 tool callbacks
17
+ * for SDK methods expecting specific types (string, number, enum literals).
18
+ *
19
+ * @see normalizeKeys in normalize-keys.ts
20
+ */
21
+ type NormalizedInput = any;
22
+ /**
23
+ * Creates a standardized tool handler with Zod validation, key normalization,
24
+ * and SDK error mapping.
25
+ *
26
+ * All handlers follow the same flow:
27
+ * 1. Parse input with Zod schema (validates snake_case MCP input)
28
+ * 2. Normalize keys from snake_case -> camelCase for SDK
29
+ * 3. Call SDK method with normalized input
30
+ * 4. Return success response or mapped error
31
+ *
32
+ * Timeout enforcement is handled by the RegistryClient SDK (configured via
33
+ * ULUOPS_REGISTRY_TIMEOUT env var, default 30s). No additional timeout is
34
+ * needed at this layer.
35
+ */
36
+ export declare function createToolHandler<TInput extends Record<string, unknown>>(schema: z.ZodSchema<TInput>, sdkCall: (normalized: NormalizedInput) => Promise<unknown>, options?: {
37
+ /** Transform parsed input before normalization. Must be synchronous (MCP SDK constraint). Return McpToolResponse to short-circuit. */
38
+ preProcess?: (input: TInput) => TInput | McpToolResponse;
39
+ /** Transform SDK result before wrapping in success response. Use to trim large fields. */
40
+ postProcess?: (result: unknown) => unknown;
41
+ }): (args: unknown) => Promise<McpToolResponse>;
42
+ /**
43
+ * Inject session-level default type into args if not explicitly provided.
44
+ * Safe for blanket injection — Zod strips unknown keys from tools that don't declare `type`.
45
+ */
46
+ export declare function injectSessionType(args: unknown): unknown;
47
+ /**
48
+ * Extract the `fields` meta-parameter from raw args before Zod validation.
49
+ * Removes it from the args so Zod doesn't reject it as an unknown key.
50
+ */
51
+ export declare function extractFieldsParam(args: unknown): {
52
+ cleanArgs: unknown;
53
+ fields: string[] | undefined;
54
+ };
55
+ /**
56
+ * Filter response fields to only include requested properties.
57
+ * Preserves pagination metadata. For array properties, picks fields from each item.
58
+ */
59
+ export declare function filterResponseFields(data: unknown, fields: string[]): unknown;
60
+ export {};
61
+ //# sourceMappingURL=tool-handler.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tool-handler.d.ts","sourceRoot":"","sources":["../../src/utils/tool-handler.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,OAAO,EAAyB,KAAK,eAAe,EAAE,MAAM,mBAAmB,CAAC;AA+ChF;;;;;;;;;;;GAWG;AACH,KAAK,eAAe,GAAG,GAAG,CAAC;AAE3B;;;;;;;;;;;;;GAaG;AACH,wBAAgB,iBAAiB,CAAC,MAAM,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EACtE,MAAM,EAAE,CAAC,CAAC,SAAS,CAAC,MAAM,CAAC,EAC3B,OAAO,EAAE,CAIP,UAAU,EAAE,eAAe,KACxB,OAAO,CAAC,OAAO,CAAC,EACrB,OAAO,CAAC,EAAE;IACR,sIAAsI;IACtI,UAAU,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,MAAM,GAAG,eAAe,CAAC;IACzD,0FAA0F;IAC1F,WAAW,CAAC,EAAE,CAAC,MAAM,EAAE,OAAO,KAAK,OAAO,CAAC;CAC5C,GACA,CAAC,IAAI,EAAE,OAAO,KAAK,OAAO,CAAC,eAAe,CAAC,CA8C7C;AAED;;;GAGG;AACH,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,OAAO,GAAG,OAAO,CAWxD;AAED;;;GAGG;AACH,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,OAAO,GAAG;IACjD,SAAS,EAAE,OAAO,CAAC;IACnB,MAAM,EAAE,MAAM,EAAE,GAAG,SAAS,CAAC;CAC9B,CAiBA;AAKD;;;GAGG;AACH,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,GAAG,OAAO,CA+B7E"}