@utaba/ucm-mcp-server 6.6.0 → 6.7.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 (215) hide show
  1. package/dist/clients/UcmLocalApiClient.d.ts +48 -1
  2. package/dist/clients/UcmLocalApiClient.js +8 -0
  3. package/dist/index.js +1 -1
  4. package/dist/interfaces/IMcpTool.d.ts +2 -2
  5. package/dist/server/ToolRegistry.js +2 -0
  6. package/dist/tools/base/BaseToolController.d.ts +7 -4
  7. package/dist/tools/base/BaseToolController.js +28 -11
  8. package/dist/tools/core/MoveArtifactTool.d.ts +1 -1
  9. package/dist/tools/core/MoveArtifactTool.js +1 -1
  10. package/dist/tools/memory-graph/GraphCreateEntitiesTool.d.ts +5 -2
  11. package/dist/tools/memory-graph/GraphCreateEntitiesTool.js +2 -0
  12. package/dist/tools/memory-graph/GraphCreateRelationshipsTool.d.ts +5 -2
  13. package/dist/tools/memory-graph/GraphCreateRelationshipsTool.js +2 -0
  14. package/dist/tools/memory-graph/GraphCreateTool.d.ts +5 -2
  15. package/dist/tools/memory-graph/GraphCreateTool.js +2 -0
  16. package/dist/tools/memory-graph/GraphDeleteEntitiesTool.d.ts +5 -2
  17. package/dist/tools/memory-graph/GraphDeleteEntitiesTool.js +2 -0
  18. package/dist/tools/memory-graph/GraphDeleteRelationshipsTool.d.ts +5 -2
  19. package/dist/tools/memory-graph/GraphDeleteRelationshipsTool.js +2 -0
  20. package/dist/tools/memory-graph/GraphExploreTool.d.ts +5 -2
  21. package/dist/tools/memory-graph/GraphExploreTool.js +2 -0
  22. package/dist/tools/memory-graph/GraphFindEntitiesTool.d.ts +5 -2
  23. package/dist/tools/memory-graph/GraphFindEntitiesTool.js +2 -0
  24. package/dist/tools/memory-graph/GraphFindPathsTool.d.ts +5 -2
  25. package/dist/tools/memory-graph/GraphFindPathsTool.js +2 -0
  26. package/dist/tools/memory-graph/GraphGetEntityTool.d.ts +5 -2
  27. package/dist/tools/memory-graph/GraphGetEntityTool.js +2 -0
  28. package/dist/tools/memory-graph/GraphGetRelationshipsTool.d.ts +5 -2
  29. package/dist/tools/memory-graph/GraphGetRelationshipsTool.js +2 -0
  30. package/dist/tools/memory-graph/GraphListTemplatesTool.d.ts +5 -2
  31. package/dist/tools/memory-graph/GraphListTemplatesTool.js +2 -0
  32. package/dist/tools/memory-graph/GraphListTool.d.ts +5 -2
  33. package/dist/tools/memory-graph/GraphListTool.js +2 -0
  34. package/dist/tools/memory-graph/GraphOpenTool.d.ts +5 -2
  35. package/dist/tools/memory-graph/GraphOpenTool.js +3 -1
  36. package/dist/tools/memory-graph/GraphProposeVocabularyTool.d.ts +5 -2
  37. package/dist/tools/memory-graph/GraphProposeVocabularyTool.js +51 -6
  38. package/dist/tools/memory-graph/GraphSearchTool.d.ts +5 -2
  39. package/dist/tools/memory-graph/GraphSearchTool.js +2 -0
  40. package/dist/tools/memory-graph/GraphTraverseTool.d.ts +5 -2
  41. package/dist/tools/memory-graph/GraphTraverseTool.js +2 -0
  42. package/dist/tools/memory-graph/GraphUpdateEntitiesTool.d.ts +5 -2
  43. package/dist/tools/memory-graph/GraphUpdateEntitiesTool.js +2 -0
  44. package/dist/{mcp-server/tools/memory-graph/GraphSearchTool.d.ts → tools/memory-graph/GraphUpdateTool.d.ts} +4 -4
  45. package/dist/tools/memory-graph/GraphUpdateTool.js +59 -0
  46. package/dist/tools/memory-graph/KnowledgeSetListTool.d.ts +5 -2
  47. package/dist/tools/memory-graph/KnowledgeSetListTool.js +2 -0
  48. package/dist/tools/memory-graph/KnowledgeSetOpenTool.d.ts +5 -2
  49. package/dist/tools/memory-graph/KnowledgeSetOpenTool.js +2 -0
  50. package/package.json +1 -1
  51. package/package.json.backup +1 -1
  52. package/dist/clients/UcmApiClient.d.ts +0 -157
  53. package/dist/clients/UcmApiClient.js +0 -443
  54. package/dist/mcp-server/clients/UcmLocalApiClient.d.ts +0 -399
  55. package/dist/mcp-server/clients/UcmLocalApiClient.js +0 -719
  56. package/dist/mcp-server/index.d.ts +0 -3
  57. package/dist/mcp-server/index.js +0 -68
  58. package/dist/mcp-server/interfaces/ILogger.d.ts +0 -8
  59. package/dist/mcp-server/interfaces/ILogger.js +0 -4
  60. package/dist/mcp-server/interfaces/IMcpTool.d.ts +0 -7
  61. package/dist/mcp-server/interfaces/IMcpTool.js +0 -3
  62. package/dist/mcp-server/logging/ConsoleLogger.d.ts +0 -16
  63. package/dist/mcp-server/logging/ConsoleLogger.js +0 -45
  64. package/dist/mcp-server/logging/LoggerFactory.d.ts +0 -9
  65. package/dist/mcp-server/logging/LoggerFactory.js +0 -12
  66. package/dist/mcp-server/server/McpConfig.d.ts +0 -26
  67. package/dist/mcp-server/server/McpConfig.js +0 -90
  68. package/dist/mcp-server/server/McpHandler.d.ts +0 -12
  69. package/dist/mcp-server/server/McpHandler.js +0 -84
  70. package/dist/mcp-server/server/McpServer.d.ts +0 -15
  71. package/dist/mcp-server/server/McpServer.js +0 -49
  72. package/dist/mcp-server/server/ToolRegistry.d.ts +0 -23
  73. package/dist/mcp-server/server/ToolRegistry.js +0 -169
  74. package/dist/mcp-server/tools/authorization/ListAuthorizationsTool.d.ts +0 -21
  75. package/dist/mcp-server/tools/authorization/ListAuthorizationsTool.js +0 -146
  76. package/dist/mcp-server/tools/authorization/SignOutTool.d.ts +0 -23
  77. package/dist/mcp-server/tools/authorization/SignOutTool.js +0 -128
  78. package/dist/mcp-server/tools/base/BaseToolController.d.ts +0 -19
  79. package/dist/mcp-server/tools/base/BaseToolController.js +0 -58
  80. package/dist/mcp-server/tools/connections/AccessConnectionTool.d.ts +0 -21
  81. package/dist/mcp-server/tools/connections/AccessConnectionTool.js +0 -107
  82. package/dist/mcp-server/tools/connections/CallRemoteToolTool.d.ts +0 -22
  83. package/dist/mcp-server/tools/connections/CallRemoteToolTool.js +0 -124
  84. package/dist/mcp-server/tools/core/DeleteArtifactTool.d.ts +0 -11
  85. package/dist/mcp-server/tools/core/DeleteArtifactTool.js +0 -83
  86. package/dist/mcp-server/tools/core/EditArtifactMetadataTool.d.ts +0 -12
  87. package/dist/mcp-server/tools/core/EditArtifactMetadataTool.js +0 -173
  88. package/dist/mcp-server/tools/core/GetArtifactTool.d.ts +0 -13
  89. package/dist/mcp-server/tools/core/GetArtifactTool.js +0 -124
  90. package/dist/mcp-server/tools/core/GetArtifactVersionsTool.d.ts +0 -11
  91. package/dist/mcp-server/tools/core/GetArtifactVersionsTool.js +0 -63
  92. package/dist/mcp-server/tools/core/GetChunkTool.d.ts +0 -11
  93. package/dist/mcp-server/tools/core/GetChunkTool.js +0 -56
  94. package/dist/mcp-server/tools/core/ListArtifactsTool.d.ts +0 -11
  95. package/dist/mcp-server/tools/core/ListArtifactsTool.js +0 -84
  96. package/dist/mcp-server/tools/core/MoveArtifactTool.d.ts +0 -12
  97. package/dist/mcp-server/tools/core/MoveArtifactTool.js +0 -104
  98. package/dist/mcp-server/tools/core/PublishArtifactFromFileTool.d.ts +0 -15
  99. package/dist/mcp-server/tools/core/PublishArtifactFromFileTool.js +0 -277
  100. package/dist/mcp-server/tools/core/PublishArtifactTool.d.ts +0 -13
  101. package/dist/mcp-server/tools/core/PublishArtifactTool.js +0 -218
  102. package/dist/mcp-server/tools/core/SearchArtifactsTool.d.ts +0 -11
  103. package/dist/mcp-server/tools/core/SearchArtifactsTool.js +0 -137
  104. package/dist/mcp-server/tools/list/ListNamespaceController.d.ts +0 -1
  105. package/dist/mcp-server/tools/list/ListNamespaceController.js +0 -8
  106. package/dist/mcp-server/tools/memory-graph/GraphCreateEntitiesTool.d.ts +0 -14
  107. package/dist/mcp-server/tools/memory-graph/GraphCreateEntitiesTool.js +0 -58
  108. package/dist/mcp-server/tools/memory-graph/GraphCreateRelationshipsTool.d.ts +0 -14
  109. package/dist/mcp-server/tools/memory-graph/GraphCreateRelationshipsTool.js +0 -57
  110. package/dist/mcp-server/tools/memory-graph/GraphCreateTool.d.ts +0 -14
  111. package/dist/mcp-server/tools/memory-graph/GraphCreateTool.js +0 -64
  112. package/dist/mcp-server/tools/memory-graph/GraphDeleteEntitiesTool.d.ts +0 -14
  113. package/dist/mcp-server/tools/memory-graph/GraphDeleteEntitiesTool.js +0 -45
  114. package/dist/mcp-server/tools/memory-graph/GraphDeleteRelationshipsTool.d.ts +0 -14
  115. package/dist/mcp-server/tools/memory-graph/GraphDeleteRelationshipsTool.js +0 -45
  116. package/dist/mcp-server/tools/memory-graph/GraphExploreTool.d.ts +0 -14
  117. package/dist/mcp-server/tools/memory-graph/GraphExploreTool.js +0 -73
  118. package/dist/mcp-server/tools/memory-graph/GraphFindEntitiesTool.d.ts +0 -14
  119. package/dist/mcp-server/tools/memory-graph/GraphFindEntitiesTool.js +0 -68
  120. package/dist/mcp-server/tools/memory-graph/GraphFindPathsTool.d.ts +0 -14
  121. package/dist/mcp-server/tools/memory-graph/GraphFindPathsTool.js +0 -62
  122. package/dist/mcp-server/tools/memory-graph/GraphGetEntityTool.d.ts +0 -14
  123. package/dist/mcp-server/tools/memory-graph/GraphGetEntityTool.js +0 -49
  124. package/dist/mcp-server/tools/memory-graph/GraphGetRelationshipsTool.d.ts +0 -14
  125. package/dist/mcp-server/tools/memory-graph/GraphGetRelationshipsTool.js +0 -62
  126. package/dist/mcp-server/tools/memory-graph/GraphListTemplatesTool.d.ts +0 -14
  127. package/dist/mcp-server/tools/memory-graph/GraphListTemplatesTool.js +0 -34
  128. package/dist/mcp-server/tools/memory-graph/GraphListTool.d.ts +0 -14
  129. package/dist/mcp-server/tools/memory-graph/GraphListTool.js +0 -45
  130. package/dist/mcp-server/tools/memory-graph/GraphOpenTool.d.ts +0 -15
  131. package/dist/mcp-server/tools/memory-graph/GraphOpenTool.js +0 -50
  132. package/dist/mcp-server/tools/memory-graph/GraphProposeVocabularyTool.d.ts +0 -14
  133. package/dist/mcp-server/tools/memory-graph/GraphProposeVocabularyTool.js +0 -108
  134. package/dist/mcp-server/tools/memory-graph/GraphSearchTool.js +0 -94
  135. package/dist/mcp-server/tools/memory-graph/GraphTraverseTool.d.ts +0 -14
  136. package/dist/mcp-server/tools/memory-graph/GraphTraverseTool.js +0 -114
  137. package/dist/mcp-server/tools/memory-graph/GraphUpdateEntitiesTool.d.ts +0 -14
  138. package/dist/mcp-server/tools/memory-graph/GraphUpdateEntitiesTool.js +0 -58
  139. package/dist/mcp-server/tools/memory-graph/KnowledgeSetListTool.d.ts +0 -14
  140. package/dist/mcp-server/tools/memory-graph/KnowledgeSetListTool.js +0 -25
  141. package/dist/mcp-server/tools/memory-graph/KnowledgeSetOpenTool.d.ts +0 -14
  142. package/dist/mcp-server/tools/memory-graph/KnowledgeSetOpenTool.js +0 -31
  143. package/dist/mcp-server/tools/repository/CreateRepositoryTool.d.ts +0 -12
  144. package/dist/mcp-server/tools/repository/CreateRepositoryTool.js +0 -116
  145. package/dist/mcp-server/tools/repository/GetRepositoryTool.d.ts +0 -12
  146. package/dist/mcp-server/tools/repository/GetRepositoryTool.js +0 -85
  147. package/dist/mcp-server/tools/repository/UpdateRepositoryTool.d.ts +0 -12
  148. package/dist/mcp-server/tools/repository/UpdateRepositoryTool.js +0 -115
  149. package/dist/mcp-server/tools/sharepoint/SharePointListConnectionsTool.d.ts +0 -19
  150. package/dist/mcp-server/tools/sharepoint/SharePointListConnectionsTool.js +0 -90
  151. package/dist/mcp-server/tools/sharepoint/SharePointListFoldersTool.d.ts +0 -21
  152. package/dist/mcp-server/tools/sharepoint/SharePointListFoldersTool.js +0 -133
  153. package/dist/mcp-server/tools/sharepoint/SharePointReadFileTool.d.ts +0 -22
  154. package/dist/mcp-server/tools/sharepoint/SharePointReadFileTool.js +0 -146
  155. package/dist/mcp-server/tools/sharepoint/SharePointReadRelatedFileTool.d.ts +0 -18
  156. package/dist/mcp-server/tools/sharepoint/SharePointReadRelatedFileTool.js +0 -108
  157. package/dist/mcp-server/tools/sharepoint/SharePointSearchTool.d.ts +0 -22
  158. package/dist/mcp-server/tools/sharepoint/SharePointSearchTool.js +0 -125
  159. package/dist/mcp-server/tools/utility/AuthorIndexTool.d.ts +0 -11
  160. package/dist/mcp-server/tools/utility/AuthorIndexTool.js +0 -49
  161. package/dist/mcp-server/tools/utility/AuthorRecentsTool.d.ts +0 -11
  162. package/dist/mcp-server/tools/utility/AuthorRecentsTool.js +0 -49
  163. package/dist/mcp-server/tools/utility/ListRepositoriesTool.d.ts +0 -11
  164. package/dist/mcp-server/tools/utility/ListRepositoriesTool.js +0 -68
  165. package/dist/mcp-server/tools/utility/QuickstartTool.d.ts +0 -11
  166. package/dist/mcp-server/tools/utility/QuickstartTool.js +0 -36
  167. package/dist/mcp-server/types/UcmApiTypes.d.ts +0 -40
  168. package/dist/mcp-server/types/UcmApiTypes.js +0 -4
  169. package/dist/mcp-server/utils/McpErrorHandler.d.ts +0 -25
  170. package/dist/mcp-server/utils/McpErrorHandler.js +0 -67
  171. package/dist/mcp-server/utils/PathUtils.d.ts +0 -61
  172. package/dist/mcp-server/utils/PathUtils.js +0 -178
  173. package/dist/mcp-server/utils/ResponseChunker.d.ts +0 -25
  174. package/dist/mcp-server/utils/ResponseChunker.js +0 -79
  175. package/dist/mcp-server/utils/SharePointErrorHandler.d.ts +0 -34
  176. package/dist/mcp-server/utils/SharePointErrorHandler.js +0 -55
  177. package/dist/publish/package.json +0 -37
  178. package/dist/schemas/memory-graph-tool-schemas.d.ts +0 -789
  179. package/dist/schemas/memory-graph-tool-schemas.js +0 -181
  180. package/dist/tools/artifacts/GetArtifactController.d.ts +0 -34
  181. package/dist/tools/artifacts/GetArtifactController.js +0 -397
  182. package/dist/tools/artifacts/GetLatestController.d.ts +0 -39
  183. package/dist/tools/artifacts/GetLatestController.js +0 -469
  184. package/dist/tools/artifacts/ListVersionsController.d.ts +0 -43
  185. package/dist/tools/artifacts/ListVersionsController.js +0 -530
  186. package/dist/tools/artifacts/PublishArtifactController.d.ts +0 -37
  187. package/dist/tools/artifacts/PublishArtifactController.js +0 -605
  188. package/dist/tools/discovery/BrowseCategoriesController.d.ts +0 -25
  189. package/dist/tools/discovery/BrowseCategoriesController.js +0 -400
  190. package/dist/tools/discovery/FindByPurposeController.d.ts +0 -12
  191. package/dist/tools/discovery/FindByPurposeController.js +0 -131
  192. package/dist/tools/discovery/ListAuthorsController.d.ts +0 -20
  193. package/dist/tools/discovery/ListAuthorsController.js +0 -274
  194. package/dist/tools/discovery/SearchArtifactsController.d.ts +0 -14
  195. package/dist/tools/discovery/SearchArtifactsController.js +0 -226
  196. package/dist/tools/memory-graph/GraphGetStatsTool.d.ts +0 -11
  197. package/dist/tools/memory-graph/GraphGetStatsTool.js +0 -42
  198. package/dist/tools/memory-graph/GraphRemoveRelationshipsTool.d.ts +0 -11
  199. package/dist/tools/memory-graph/GraphRemoveRelationshipsTool.js +0 -47
  200. package/dist/tools/navigation/ExploreNamespaceController.d.ts +0 -35
  201. package/dist/tools/navigation/ExploreNamespaceController.js +0 -548
  202. package/dist/tools/repository/DeleteRepositoryGuidanceTool.d.ts +0 -13
  203. package/dist/tools/repository/DeleteRepositoryGuidanceTool.js +0 -93
  204. package/dist/tools/sharepoint/SharePointSignOutTool.d.ts +0 -22
  205. package/dist/tools/sharepoint/SharePointSignOutTool.js +0 -114
  206. package/dist/tools/utility/HealthCheckController.d.ts +0 -11
  207. package/dist/tools/utility/HealthCheckController.js +0 -60
  208. package/dist/tools/utility/SubmitFeedbackTool.d.ts +0 -16
  209. package/dist/tools/utility/SubmitFeedbackTool.js +0 -68
  210. package/dist/tools/utility/ValidatePathController.d.ts +0 -30
  211. package/dist/tools/utility/ValidatePathController.js +0 -465
  212. package/dist/utils/HttpsAgentFactory.d.ts +0 -21
  213. package/dist/utils/HttpsAgentFactory.js +0 -50
  214. package/dist/utils/ValidationUtils.d.ts +0 -10
  215. package/dist/utils/ValidationUtils.js +0 -50
@@ -1,465 +0,0 @@
1
- import { BaseToolController } from '../base/BaseToolController.js';
2
- import { ValidationUtils } from '../../utils/ValidationUtils.js';
3
- import { parsePath } from '../../utils/PathUtils.js';
4
- export class ValidatePathController extends BaseToolController {
5
- constructor(ucmClient, logger) {
6
- super(ucmClient, logger);
7
- }
8
- get name() {
9
- return 'mcp_ucm_validate_path';
10
- }
11
- get description() {
12
- return 'Validate UCM artifact path format and optionally check for existence in the repository';
13
- }
14
- get inputSchema() {
15
- return {
16
- type: 'object',
17
- properties: {
18
- path: {
19
- type: 'string',
20
- description: 'Artifact path to validate (e.g., "utaba/commands/create-user/typescript/1.0.0")',
21
- minLength: 1,
22
- maxLength: 200
23
- },
24
- checkExistence: {
25
- type: 'boolean',
26
- default: false,
27
- description: 'Check if the artifact actually exists in the repository'
28
- },
29
- validateComponents: {
30
- type: 'boolean',
31
- default: true,
32
- description: 'Validate individual path components (author, category, etc.)'
33
- },
34
- suggestCorrections: {
35
- type: 'boolean',
36
- default: true,
37
- description: 'Provide suggestions for fixing invalid paths'
38
- },
39
- checkSimilar: {
40
- type: 'boolean',
41
- default: false,
42
- description: 'Find similar existing paths if validation fails'
43
- },
44
- strictMode: {
45
- type: 'boolean',
46
- default: false,
47
- description: 'Enable strict validation rules (more restrictive)'
48
- }
49
- },
50
- required: ['path']
51
- };
52
- }
53
- async handleExecute(params) {
54
- const { path, checkExistence = false, validateComponents = true, suggestCorrections = true, checkSimilar = false, strictMode = false } = params;
55
- this.logger.debug('ValidatePathController', `Validating path: ${path}`);
56
- try {
57
- // Perform comprehensive validation
58
- const validationResult = await this.performPathValidation(path, {
59
- checkExistence,
60
- validateComponents,
61
- suggestCorrections,
62
- checkSimilar,
63
- strictMode
64
- });
65
- this.logger.info('ValidatePathController', `Path validation completed: ${validationResult.isValid ? 'VALID' : 'INVALID'}`);
66
- return validationResult;
67
- }
68
- catch (error) {
69
- this.logger.error('ValidatePathController', `Path validation failed for: ${path}`, '', error);
70
- throw error;
71
- }
72
- }
73
- async performPathValidation(path, options) {
74
- const result = {
75
- path,
76
- isValid: true,
77
- errors: [],
78
- warnings: [],
79
- suggestions: [],
80
- pathAnalysis: {},
81
- existence: null,
82
- similar: [],
83
- metadata: {
84
- timestamp: new Date().toISOString(),
85
- validationType: options.strictMode ? 'strict' : 'standard',
86
- checksPerformed: []
87
- }
88
- };
89
- // 1. Basic format validation
90
- await this.validateBasicFormat(path, result, options);
91
- // 2. Component validation
92
- if (options.validateComponents && result.pathAnalysis.components) {
93
- await this.validateComponents(result.pathAnalysis.components, result, options);
94
- }
95
- // 3. Semantic validation
96
- await this.validateSemantics(path, result, options);
97
- // 4. Existence check
98
- if (options.checkExistence) {
99
- await this.checkPathExistence(path, result);
100
- }
101
- // 5. Find similar paths if invalid and requested
102
- if (!result.isValid && options.checkSimilar) {
103
- await this.findSimilarPaths(path, result);
104
- }
105
- // 6. Generate suggestions if requested
106
- if (options.suggestCorrections && (!result.isValid || result.warnings.length > 0)) {
107
- await this.generateSuggestions(path, result, options);
108
- }
109
- // Set overall validity
110
- result.isValid = result.errors.length === 0;
111
- return result;
112
- }
113
- async validateBasicFormat(path, result, options) {
114
- result.metadata.checksPerformed.push('basic-format');
115
- // Basic checks
116
- if (!path || typeof path !== 'string') {
117
- result.errors.push('Path must be a non-empty string');
118
- return;
119
- }
120
- if (path.trim() !== path) {
121
- result.errors.push('Path cannot have leading or trailing whitespace');
122
- }
123
- if (path.includes('//')) {
124
- result.errors.push('Path cannot contain double slashes');
125
- }
126
- if (path.includes('..')) {
127
- result.errors.push('Path cannot contain relative path components (..)');
128
- }
129
- if (path.startsWith('/') || path.endsWith('/')) {
130
- result.errors.push('Path cannot start or end with forward slash');
131
- }
132
- // Character validation
133
- const validCharPattern = /^[a-zA-Z0-9\-_.\/]+$/;
134
- if (!validCharPattern.test(path)) {
135
- result.errors.push('Path contains invalid characters. Only alphanumeric, hyphens, underscores, dots, and forward slashes are allowed');
136
- }
137
- // Parse path components
138
- const components = path.split('/');
139
- result.pathAnalysis = {
140
- components: this.parsePathComponents(components),
141
- componentCount: components.length,
142
- pathType: this.determinePathType(components),
143
- isVersioned: this.isVersionedPath(components)
144
- };
145
- // Length validation
146
- if (path.length > 200) {
147
- result.errors.push('Path exceeds maximum length of 200 characters');
148
- }
149
- if (components.length < 3) {
150
- result.errors.push('Path must have at least 3 components (author/category/subcategory)');
151
- }
152
- if (components.length > 5) {
153
- result.errors.push('Path has too many components. Maximum is 5 (author/category/subcategory/technology/version)');
154
- }
155
- // Strict mode additional checks
156
- if (options.strictMode) {
157
- this.applyStrictModeValidation(path, components, result);
158
- }
159
- }
160
- parsePathComponents(components) {
161
- const parsed = {
162
- author: components[0] || null,
163
- category: components[1] || null,
164
- subcategory: components[2] || null,
165
- technology: null,
166
- version: null
167
- };
168
- if (components.length === 4) {
169
- // Could be either technology-agnostic (author/category/subcategory/version)
170
- // or missing version (author/category/subcategory/technology)
171
- if (this.looksLikeVersion(components[3])) {
172
- parsed.version = components[3];
173
- }
174
- else {
175
- parsed.technology = components[3];
176
- }
177
- }
178
- else if (components.length === 5) {
179
- // author/category/subcategory/technology/version
180
- parsed.technology = components[3];
181
- parsed.version = components[4];
182
- }
183
- return parsed;
184
- }
185
- determinePathType(components) {
186
- if (components.length === 4 && this.looksLikeVersion(components[3])) {
187
- return 'technology-agnostic-versioned';
188
- }
189
- else if (components.length === 4) {
190
- return 'technology-specific-unversioned';
191
- }
192
- else if (components.length === 5) {
193
- return 'technology-specific-versioned';
194
- }
195
- else if (components.length === 3) {
196
- return 'subcategory-level';
197
- }
198
- else if (components.length === 2) {
199
- return 'category-level';
200
- }
201
- else if (components.length === 1) {
202
- return 'author-level';
203
- }
204
- return 'unknown';
205
- }
206
- isVersionedPath(components) {
207
- const lastComponent = components[components.length - 1];
208
- return this.looksLikeVersion(lastComponent);
209
- }
210
- looksLikeVersion(component) {
211
- return /^[0-9]+\.[0-9]+\.[0-9]+/.test(component);
212
- }
213
- async validateComponents(components, result, options) {
214
- result.metadata.checksPerformed.push('component-validation');
215
- // Validate author
216
- if (components.author) {
217
- if (!this.isValidAuthorId(components.author)) {
218
- result.errors.push(`Invalid author ID format: ${components.author}`);
219
- }
220
- }
221
- // Validate category
222
- if (components.category) {
223
- try {
224
- ValidationUtils.validateCategory(components.category);
225
- }
226
- catch (error) {
227
- result.errors.push(`Invalid category: ${components.category}`);
228
- }
229
- }
230
- // Validate subcategory
231
- if (components.subcategory) {
232
- if (!this.isValidSubcategory(components.subcategory)) {
233
- result.errors.push(`Invalid subcategory format: ${components.subcategory}`);
234
- }
235
- }
236
- // Validate technology
237
- if (components.technology) {
238
- if (!this.isValidTechnology(components.technology)) {
239
- result.errors.push(`Invalid technology identifier: ${components.technology}`);
240
- }
241
- }
242
- // Validate version
243
- if (components.version) {
244
- try {
245
- ValidationUtils.validateVersion(components.version);
246
- }
247
- catch (error) {
248
- result.errors.push(`Invalid version format: ${components.version}`);
249
- }
250
- }
251
- // Component consistency checks
252
- this.validateComponentConsistency(components, result);
253
- }
254
- async validateSemantics(path, result, options) {
255
- result.metadata.checksPerformed.push('semantic-validation');
256
- const components = result.pathAnalysis.components;
257
- // Check for common naming patterns and best practices
258
- if (components.subcategory) {
259
- if (components.subcategory.includes('_') && components.subcategory.includes('-')) {
260
- result.warnings.push('Subcategory uses both underscores and hyphens - consider consistent naming');
261
- }
262
- if (components.subcategory.length > 50) {
263
- result.warnings.push('Subcategory name is very long - consider shortening for better usability');
264
- }
265
- }
266
- // Technology-specific validations
267
- if (components.technology) {
268
- const knownTechnologies = [
269
- 'typescript', 'javascript', 'python', 'java', 'csharp', 'go', 'rust',
270
- 'nextjs', 'react', 'vue', 'angular', 'nodejs', 'deno'
271
- ];
272
- if (!knownTechnologies.includes(components.technology.toLowerCase())) {
273
- result.warnings.push(`Technology '${components.technology}' is not in the list of commonly used technologies`);
274
- }
275
- }
276
- // Version semantic checks
277
- if (components.version) {
278
- if (components.version.startsWith('0.')) {
279
- result.warnings.push('Version indicates pre-release (0.x.x) - ensure this is intentional');
280
- }
281
- if (components.version.includes('alpha') || components.version.includes('beta')) {
282
- result.warnings.push('Version indicates pre-release software');
283
- }
284
- }
285
- // Path semantics
286
- if (result.pathAnalysis.pathType === 'technology-specific-unversioned') {
287
- result.warnings.push('Path appears to specify technology but no version - consider adding version');
288
- }
289
- }
290
- async checkPathExistence(path, result) {
291
- result.metadata.checksPerformed.push('existence-check');
292
- try {
293
- const parsed = parsePath(path);
294
- if (!parsed.filename) {
295
- throw new Error('Filename is required to check artifact existence');
296
- }
297
- const artifact = await this.ucmClient.getArtifact(parsed.author, parsed.category, parsed.subcategory, parsed.filename, parsed.version);
298
- result.existence = {
299
- exists: true,
300
- artifact: {
301
- id: artifact.id,
302
- name: artifact.metadata?.name,
303
- lastUpdated: artifact.lastUpdated,
304
- publishedAt: artifact.publishedAt
305
- }
306
- };
307
- }
308
- catch (error) {
309
- result.existence = {
310
- exists: false,
311
- error: error instanceof Error ? error.message : String(error)
312
- };
313
- if (result.pathAnalysis.isVersioned) {
314
- // Try to check if a non-versioned path exists
315
- await this.checkParentPathExistence(path, result);
316
- }
317
- }
318
- }
319
- async checkParentPathExistence(path, result) {
320
- try {
321
- const pathParts = path.split('/');
322
- const parentPath = pathParts.slice(0, -1).join('/');
323
- if (parentPath) {
324
- const parsed = parsePath(parentPath);
325
- const versions = await this.ucmClient.getArtifactVersions(parsed.author, parsed.category, parsed.subcategory);
326
- if (versions && versions.length > 0) {
327
- result.existence.parentExists = true;
328
- result.existence.availableVersions = versions.map(v => v.metadata?.version).filter(Boolean);
329
- result.suggestions.push(`Artifact exists but not this version. Available versions: ${result.existence.availableVersions.join(', ')}`);
330
- }
331
- }
332
- }
333
- catch (error) {
334
- // Parent doesn't exist either
335
- result.existence.parentExists = false;
336
- }
337
- }
338
- async findSimilarPaths(path, result) {
339
- result.metadata.checksPerformed.push('similar-paths');
340
- try {
341
- // Extract search terms from the path
342
- const components = result.pathAnalysis.components;
343
- const searchTerms = [
344
- components.author,
345
- components.category,
346
- components.subcategory
347
- ].filter(Boolean).join(' ');
348
- if (searchTerms) {
349
- const searchResults = await this.ucmClient.searchArtifacts({
350
- category: components.category,
351
- subcategory: components.subcategory,
352
- limit: 5
353
- });
354
- result.similar = searchResults.map(artifact => ({
355
- path: artifact.path,
356
- name: artifact.metadata?.name,
357
- similarity: this.calculatePathSimilarity(path, artifact.path),
358
- reason: this.generateSimilarityReason(path, artifact.path)
359
- })).filter(item => item.similarity > 0.3)
360
- .sort((a, b) => b.similarity - a.similarity);
361
- }
362
- }
363
- catch (error) {
364
- result.similar = [];
365
- this.logger.debug('ValidatePathController', 'Could not find similar paths', '', error instanceof Error ? error.message : String(error));
366
- }
367
- }
368
- async generateSuggestions(path, result, options) {
369
- const suggestions = result.suggestions;
370
- // Format-based suggestions
371
- if (result.errors.some((e) => e.includes('invalid characters'))) {
372
- suggestions.push('Remove special characters and use only alphanumeric, hyphens, underscores, and dots');
373
- }
374
- if (result.errors.some((e) => e.includes('double slashes'))) {
375
- suggestions.push('Remove double slashes from the path');
376
- }
377
- // Component-based suggestions
378
- const components = result.pathAnalysis.components;
379
- if (components.author && !this.isValidAuthorId(components.author)) {
380
- suggestions.push('Author ID should be lowercase alphanumeric with hyphens/underscores only');
381
- }
382
- if (result.pathAnalysis.pathType === 'technology-specific-unversioned') {
383
- suggestions.push('Consider adding a version number as the last component');
384
- }
385
- // Existence-based suggestions
386
- if (result.existence && !result.existence.exists && result.existence.availableVersions) {
387
- const versions = result.existence.availableVersions;
388
- if (versions.length > 0) {
389
- suggestions.push(`Try one of these existing versions: ${versions.slice(0, 3).join(', ')}`);
390
- }
391
- }
392
- // Similar path suggestions
393
- if (result.similar && result.similar.length > 0) {
394
- const topSimilar = result.similar[0];
395
- suggestions.push(`Did you mean: ${topSimilar.path}? (${topSimilar.reason})`);
396
- }
397
- }
398
- applyStrictModeValidation(path, components, result) {
399
- // Strict mode rules
400
- for (const component of components) {
401
- if (component.length < 2) {
402
- result.errors.push('In strict mode, all path components must be at least 2 characters long');
403
- }
404
- if (component.includes('_') && component.includes('-')) {
405
- result.errors.push('In strict mode, components cannot mix underscores and hyphens');
406
- }
407
- if (!/^[a-z0-9\-_\.]+$/.test(component)) {
408
- result.errors.push('In strict mode, components must be lowercase');
409
- }
410
- }
411
- // Must be versioned in strict mode
412
- if (!result.pathAnalysis.isVersioned) {
413
- result.errors.push('In strict mode, paths must include a version number');
414
- }
415
- }
416
- validateComponentConsistency(components, result) {
417
- // Check for naming consistency
418
- if (components.subcategory && components.technology) {
419
- if (components.subcategory.toLowerCase().includes(components.technology.toLowerCase())) {
420
- result.warnings.push('Subcategory name includes technology - this may be redundant');
421
- }
422
- }
423
- // Check for reasonable relationships
424
- if (components.category === 'commands' && components.technology === 'html') {
425
- result.warnings.push('HTML technology unusual for commands category');
426
- }
427
- }
428
- // Helper validation methods
429
- isValidAuthorId(authorId) {
430
- return /^[a-zA-Z0-9\-_]+$/.test(authorId) && authorId.length >= 2 && authorId.length <= 50;
431
- }
432
- isValidSubcategory(subcategory) {
433
- return /^[a-zA-Z0-9\-_]+$/.test(subcategory) && subcategory.length >= 2 && subcategory.length <= 50;
434
- }
435
- isValidTechnology(technology) {
436
- return /^[a-zA-Z0-9\-_]+$/.test(technology) && technology.length >= 2 && technology.length <= 20;
437
- }
438
- calculatePathSimilarity(path1, path2) {
439
- const components1 = path1.split('/');
440
- const components2 = path2.split('/');
441
- let matches = 0;
442
- const maxLength = Math.max(components1.length, components2.length);
443
- for (let i = 0; i < Math.min(components1.length, components2.length); i++) {
444
- if (components1[i].toLowerCase() === components2[i].toLowerCase()) {
445
- matches++;
446
- }
447
- }
448
- return matches / maxLength;
449
- }
450
- generateSimilarityReason(originalPath, similarPath) {
451
- const orig = originalPath.split('/');
452
- const sim = similarPath.split('/');
453
- if (orig[0] === sim[0]) {
454
- if (orig[1] === sim[1]) {
455
- return 'Same author and category';
456
- }
457
- return 'Same author';
458
- }
459
- if (orig[1] === sim[1]) {
460
- return 'Same category';
461
- }
462
- return 'Similar structure';
463
- }
464
- }
465
- //# sourceMappingURL=ValidatePathController.js.map
@@ -1,21 +0,0 @@
1
- import https from 'https';
2
- import { ILogger } from '../interfaces/ILogger.js';
3
- export interface HttpsAgentOptions {
4
- caCertPath?: string;
5
- }
6
- /**
7
- * Factory for creating HTTPS agents with custom CA certificate support
8
- * Enables secure connections to self-signed certificate environments
9
- */
10
- export declare class HttpsAgentFactory {
11
- /**
12
- * Create an HTTPS agent with optional custom CA certificate
13
- *
14
- * @param options - Configuration options for the HTTPS agent
15
- * @param logger - Logger instance for diagnostic messages
16
- * @returns https.Agent configured with custom CA if provided, otherwise undefined
17
- * @throws Error if certificate file cannot be read or is invalid
18
- */
19
- static createAgent(options: HttpsAgentOptions, logger?: ILogger): https.Agent | undefined;
20
- }
21
- //# sourceMappingURL=HttpsAgentFactory.d.ts.map
@@ -1,50 +0,0 @@
1
- import https from 'https';
2
- import fs from 'fs';
3
- /**
4
- * Factory for creating HTTPS agents with custom CA certificate support
5
- * Enables secure connections to self-signed certificate environments
6
- */
7
- export class HttpsAgentFactory {
8
- /**
9
- * Create an HTTPS agent with optional custom CA certificate
10
- *
11
- * @param options - Configuration options for the HTTPS agent
12
- * @param logger - Logger instance for diagnostic messages
13
- * @returns https.Agent configured with custom CA if provided, otherwise undefined
14
- * @throws Error if certificate file cannot be read or is invalid
15
- */
16
- static createAgent(options, logger) {
17
- // If no CA certificate path provided, return undefined to use default behavior
18
- if (!options.caCertPath) {
19
- return undefined;
20
- }
21
- try {
22
- // Load the CA certificate from file
23
- const caCert = fs.readFileSync(options.caCertPath, 'utf-8');
24
- // Create HTTPS agent with custom CA certificate
25
- // rejectUnauthorized: true ensures full certificate validation is maintained
26
- const agent = new https.Agent({
27
- ca: caCert
28
- });
29
- if (logger) {
30
- logger.info('HttpsAgentFactory', `✓ Loaded CA certificate from: ${options.caCertPath}`);
31
- }
32
- return agent;
33
- }
34
- catch (error) {
35
- const errorMessage = error instanceof Error ? error.message : 'Unknown error';
36
- const detailedMessage = `Failed to load CA certificate from ${options.caCertPath}: ${errorMessage}`;
37
- if (logger) {
38
- logger.warn('HttpsAgentFactory', detailedMessage);
39
- logger.warn('HttpsAgentFactory', 'Continuing without custom CA certificate - using default certificate validation');
40
- }
41
- else {
42
- console.warn(`⚠️ ${detailedMessage}`);
43
- console.warn('⚠️ Continuing without custom CA certificate - using default certificate validation');
44
- }
45
- // Return undefined to fall back to default behavior instead of crashing
46
- return undefined;
47
- }
48
- }
49
- }
50
- //# sourceMappingURL=HttpsAgentFactory.js.map
@@ -1,10 +0,0 @@
1
- export declare class ValidationUtils {
2
- static validateArtifactPath(path: string): void;
3
- static sanitizeSearchQuery(query: string): string;
4
- static validateContentSize(content: string, maxSize?: number): void;
5
- static validatePageParams(offset?: number, limit?: number): void;
6
- static validateAuthorId(authorId: string): void;
7
- static validateCategory(category: string): void;
8
- static validateVersion(version: string): void;
9
- }
10
- //# sourceMappingURL=ValidationUtils.d.ts.map
@@ -1,50 +0,0 @@
1
- import { McpError, McpErrorCode } from './McpErrorHandler.js';
2
- export class ValidationUtils {
3
- static validateArtifactPath(path) {
4
- // Prevent path traversal
5
- if (path.includes('..') || path.includes('//')) {
6
- throw new McpError(McpErrorCode.InvalidParams, 'Invalid artifact path');
7
- }
8
- }
9
- static sanitizeSearchQuery(query) {
10
- // Remove potentially dangerous characters
11
- return query.replace(/[<>\"'&]/g, '').trim();
12
- }
13
- static validateContentSize(content, maxSize = 1024 * 1024) {
14
- if (content.length > maxSize) {
15
- throw new McpError(McpErrorCode.InvalidParams, 'Content size exceeds maximum allowed');
16
- }
17
- }
18
- static validatePageParams(offset = 0, limit = 20) {
19
- if (offset < 0) {
20
- throw new McpError(McpErrorCode.InvalidParams, 'Offset must be non-negative');
21
- }
22
- if (limit < 1 || limit > 100) {
23
- throw new McpError(McpErrorCode.InvalidParams, 'Limit must be between 1 and 100');
24
- }
25
- }
26
- static validateAuthorId(authorId) {
27
- if (!authorId || typeof authorId !== 'string') {
28
- throw new McpError(McpErrorCode.InvalidParams, 'Author ID is required and must be a string');
29
- }
30
- // Basic validation - alphanumeric, hyphens, underscores
31
- const authorRegex = /^[a-zA-Z0-9\-_]+$/;
32
- if (!authorRegex.test(authorId)) {
33
- throw new McpError(McpErrorCode.InvalidParams, 'Author ID contains invalid characters');
34
- }
35
- }
36
- static validateCategory(category) {
37
- const validCategories = ['commands', 'services', 'patterns', 'implementations', 'contracts', 'guidance'];
38
- if (!validCategories.includes(category)) {
39
- throw new McpError(McpErrorCode.InvalidParams, `Invalid category. Must be one of: ${validCategories.join(', ')}`);
40
- }
41
- }
42
- static validateVersion(version) {
43
- // Semantic version validation
44
- const versionRegex = /^[0-9]+\.[0-9]+\.[0-9]+(?:-[a-zA-Z0-9\-_]+)?$/;
45
- if (!versionRegex.test(version)) {
46
- throw new McpError(McpErrorCode.InvalidParams, 'Version must follow semantic versioning format');
47
- }
48
- }
49
- }
50
- //# sourceMappingURL=ValidationUtils.js.map