@utaba/ucm-mcp-server 6.5.0 → 6.6.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.
- package/dist/clients/UcmLocalApiClient.d.ts +175 -2
- package/dist/clients/UcmLocalApiClient.js +203 -3
- package/dist/index.js +1 -1
- package/dist/mcp-server/clients/UcmLocalApiClient.d.ts +399 -0
- package/dist/mcp-server/clients/UcmLocalApiClient.js +719 -0
- package/dist/mcp-server/index.d.ts +3 -0
- package/dist/mcp-server/index.js +68 -0
- package/dist/mcp-server/interfaces/ILogger.d.ts +8 -0
- package/dist/mcp-server/interfaces/ILogger.js +4 -0
- package/dist/mcp-server/interfaces/IMcpTool.d.ts +7 -0
- package/dist/mcp-server/interfaces/IMcpTool.js +3 -0
- package/dist/mcp-server/logging/ConsoleLogger.d.ts +16 -0
- package/dist/mcp-server/logging/ConsoleLogger.js +45 -0
- package/dist/mcp-server/logging/LoggerFactory.d.ts +9 -0
- package/dist/mcp-server/logging/LoggerFactory.js +12 -0
- package/dist/mcp-server/server/McpConfig.d.ts +26 -0
- package/dist/mcp-server/server/McpConfig.js +90 -0
- package/dist/mcp-server/server/McpHandler.d.ts +12 -0
- package/dist/mcp-server/server/McpHandler.js +84 -0
- package/dist/mcp-server/server/McpServer.d.ts +15 -0
- package/dist/mcp-server/server/McpServer.js +49 -0
- package/dist/mcp-server/server/ToolRegistry.d.ts +23 -0
- package/dist/mcp-server/server/ToolRegistry.js +169 -0
- package/dist/mcp-server/tools/authorization/ListAuthorizationsTool.d.ts +21 -0
- package/dist/mcp-server/tools/authorization/ListAuthorizationsTool.js +146 -0
- package/dist/mcp-server/tools/authorization/SignOutTool.d.ts +23 -0
- package/dist/mcp-server/tools/authorization/SignOutTool.js +128 -0
- package/dist/mcp-server/tools/base/BaseToolController.d.ts +19 -0
- package/dist/mcp-server/tools/base/BaseToolController.js +58 -0
- package/dist/mcp-server/tools/connections/AccessConnectionTool.d.ts +21 -0
- package/dist/mcp-server/tools/connections/AccessConnectionTool.js +107 -0
- package/dist/mcp-server/tools/connections/CallRemoteToolTool.d.ts +22 -0
- package/dist/mcp-server/tools/connections/CallRemoteToolTool.js +124 -0
- package/dist/mcp-server/tools/core/DeleteArtifactTool.d.ts +11 -0
- package/dist/mcp-server/tools/core/DeleteArtifactTool.js +83 -0
- package/dist/mcp-server/tools/core/EditArtifactMetadataTool.d.ts +12 -0
- package/dist/mcp-server/tools/core/EditArtifactMetadataTool.js +173 -0
- package/dist/mcp-server/tools/core/GetArtifactTool.d.ts +13 -0
- package/dist/mcp-server/tools/core/GetArtifactTool.js +124 -0
- package/dist/mcp-server/tools/core/GetArtifactVersionsTool.d.ts +11 -0
- package/dist/mcp-server/tools/core/GetArtifactVersionsTool.js +63 -0
- package/dist/mcp-server/tools/core/GetChunkTool.d.ts +11 -0
- package/dist/mcp-server/tools/core/GetChunkTool.js +56 -0
- package/dist/mcp-server/tools/core/ListArtifactsTool.d.ts +11 -0
- package/dist/mcp-server/tools/core/ListArtifactsTool.js +84 -0
- package/dist/mcp-server/tools/core/MoveArtifactTool.d.ts +12 -0
- package/dist/mcp-server/tools/core/MoveArtifactTool.js +104 -0
- package/dist/mcp-server/tools/core/PublishArtifactFromFileTool.d.ts +15 -0
- package/dist/mcp-server/tools/core/PublishArtifactFromFileTool.js +277 -0
- package/dist/mcp-server/tools/core/PublishArtifactTool.d.ts +13 -0
- package/dist/mcp-server/tools/core/PublishArtifactTool.js +218 -0
- package/dist/mcp-server/tools/core/SearchArtifactsTool.d.ts +11 -0
- package/dist/mcp-server/tools/core/SearchArtifactsTool.js +137 -0
- package/dist/mcp-server/tools/list/ListNamespaceController.d.ts +1 -0
- package/dist/mcp-server/tools/list/ListNamespaceController.js +8 -0
- package/dist/mcp-server/tools/memory-graph/GraphCreateEntitiesTool.d.ts +14 -0
- package/dist/mcp-server/tools/memory-graph/GraphCreateEntitiesTool.js +58 -0
- package/dist/mcp-server/tools/memory-graph/GraphCreateRelationshipsTool.d.ts +14 -0
- package/dist/mcp-server/tools/memory-graph/GraphCreateRelationshipsTool.js +57 -0
- package/dist/mcp-server/tools/memory-graph/GraphCreateTool.d.ts +14 -0
- package/dist/mcp-server/tools/memory-graph/GraphCreateTool.js +64 -0
- package/dist/mcp-server/tools/memory-graph/GraphDeleteEntitiesTool.d.ts +14 -0
- package/dist/mcp-server/tools/memory-graph/GraphDeleteEntitiesTool.js +45 -0
- package/dist/mcp-server/tools/memory-graph/GraphDeleteRelationshipsTool.d.ts +14 -0
- package/dist/mcp-server/tools/memory-graph/GraphDeleteRelationshipsTool.js +45 -0
- package/dist/mcp-server/tools/memory-graph/GraphExploreTool.d.ts +14 -0
- package/dist/mcp-server/tools/memory-graph/GraphExploreTool.js +73 -0
- package/dist/mcp-server/tools/memory-graph/GraphFindEntitiesTool.d.ts +14 -0
- package/dist/mcp-server/tools/memory-graph/GraphFindEntitiesTool.js +68 -0
- package/dist/mcp-server/tools/memory-graph/GraphFindPathsTool.d.ts +14 -0
- package/dist/mcp-server/tools/memory-graph/GraphFindPathsTool.js +62 -0
- package/dist/mcp-server/tools/memory-graph/GraphGetEntityTool.d.ts +14 -0
- package/dist/mcp-server/tools/memory-graph/GraphGetEntityTool.js +49 -0
- package/dist/mcp-server/tools/memory-graph/GraphGetRelationshipsTool.d.ts +14 -0
- package/dist/mcp-server/tools/memory-graph/GraphGetRelationshipsTool.js +62 -0
- package/dist/mcp-server/tools/memory-graph/GraphListTemplatesTool.d.ts +14 -0
- package/dist/mcp-server/tools/memory-graph/GraphListTemplatesTool.js +34 -0
- package/dist/mcp-server/tools/memory-graph/GraphListTool.d.ts +14 -0
- package/dist/mcp-server/tools/memory-graph/GraphListTool.js +45 -0
- package/dist/mcp-server/tools/memory-graph/GraphOpenTool.d.ts +15 -0
- package/dist/mcp-server/tools/memory-graph/GraphOpenTool.js +50 -0
- package/dist/mcp-server/tools/memory-graph/GraphProposeVocabularyTool.d.ts +14 -0
- package/dist/mcp-server/tools/memory-graph/GraphProposeVocabularyTool.js +108 -0
- package/dist/mcp-server/tools/memory-graph/GraphSearchTool.d.ts +14 -0
- package/dist/mcp-server/tools/memory-graph/GraphSearchTool.js +94 -0
- package/dist/mcp-server/tools/memory-graph/GraphTraverseTool.d.ts +14 -0
- package/dist/mcp-server/tools/memory-graph/GraphTraverseTool.js +114 -0
- package/dist/mcp-server/tools/memory-graph/GraphUpdateEntitiesTool.d.ts +14 -0
- package/dist/mcp-server/tools/memory-graph/GraphUpdateEntitiesTool.js +58 -0
- package/dist/mcp-server/tools/memory-graph/KnowledgeSetListTool.d.ts +14 -0
- package/dist/mcp-server/tools/memory-graph/KnowledgeSetListTool.js +25 -0
- package/dist/mcp-server/tools/memory-graph/KnowledgeSetOpenTool.d.ts +14 -0
- package/dist/mcp-server/tools/memory-graph/KnowledgeSetOpenTool.js +31 -0
- package/dist/mcp-server/tools/repository/CreateRepositoryTool.d.ts +12 -0
- package/dist/mcp-server/tools/repository/CreateRepositoryTool.js +116 -0
- package/dist/mcp-server/tools/repository/GetRepositoryTool.d.ts +12 -0
- package/dist/mcp-server/tools/repository/GetRepositoryTool.js +85 -0
- package/dist/mcp-server/tools/repository/UpdateRepositoryTool.d.ts +12 -0
- package/dist/mcp-server/tools/repository/UpdateRepositoryTool.js +115 -0
- package/dist/mcp-server/tools/sharepoint/SharePointListConnectionsTool.d.ts +19 -0
- package/dist/mcp-server/tools/sharepoint/SharePointListConnectionsTool.js +90 -0
- package/dist/mcp-server/tools/sharepoint/SharePointListFoldersTool.d.ts +21 -0
- package/dist/mcp-server/tools/sharepoint/SharePointListFoldersTool.js +133 -0
- package/dist/mcp-server/tools/sharepoint/SharePointReadFileTool.d.ts +22 -0
- package/dist/mcp-server/tools/sharepoint/SharePointReadFileTool.js +146 -0
- package/dist/mcp-server/tools/sharepoint/SharePointReadRelatedFileTool.d.ts +18 -0
- package/dist/mcp-server/tools/sharepoint/SharePointReadRelatedFileTool.js +108 -0
- package/dist/mcp-server/tools/sharepoint/SharePointSearchTool.d.ts +22 -0
- package/dist/mcp-server/tools/sharepoint/SharePointSearchTool.js +125 -0
- package/dist/mcp-server/tools/utility/AuthorIndexTool.d.ts +11 -0
- package/dist/mcp-server/tools/utility/AuthorIndexTool.js +49 -0
- package/dist/mcp-server/tools/utility/AuthorRecentsTool.d.ts +11 -0
- package/dist/mcp-server/tools/utility/AuthorRecentsTool.js +49 -0
- package/dist/mcp-server/tools/utility/ListRepositoriesTool.d.ts +11 -0
- package/dist/mcp-server/tools/utility/ListRepositoriesTool.js +68 -0
- package/dist/mcp-server/tools/utility/QuickstartTool.d.ts +11 -0
- package/dist/mcp-server/tools/utility/QuickstartTool.js +36 -0
- package/dist/mcp-server/types/UcmApiTypes.d.ts +40 -0
- package/dist/mcp-server/types/UcmApiTypes.js +4 -0
- package/dist/mcp-server/utils/McpErrorHandler.d.ts +25 -0
- package/dist/mcp-server/utils/McpErrorHandler.js +67 -0
- package/dist/mcp-server/utils/PathUtils.d.ts +61 -0
- package/dist/mcp-server/utils/PathUtils.js +178 -0
- package/dist/mcp-server/utils/ResponseChunker.d.ts +25 -0
- package/dist/mcp-server/utils/ResponseChunker.js +79 -0
- package/dist/mcp-server/utils/SharePointErrorHandler.d.ts +34 -0
- package/dist/mcp-server/utils/SharePointErrorHandler.js +55 -0
- package/dist/schemas/memory-graph-tool-schemas.d.ts +789 -0
- package/dist/schemas/memory-graph-tool-schemas.js +181 -0
- package/dist/server/ToolRegistry.js +42 -8
- package/dist/tools/authorization/ListAuthorizationsTool.js +2 -2
- package/dist/tools/authorization/SignOutTool.js +2 -2
- package/dist/tools/connections/AccessConnectionTool.js +8 -6
- package/dist/tools/connections/CallRemoteToolTool.js +4 -4
- package/dist/tools/core/DeleteArtifactTool.js +5 -4
- package/dist/tools/core/EditArtifactMetadataTool.js +1 -1
- package/dist/tools/core/GetArtifactTool.js +1 -1
- package/dist/tools/core/GetArtifactVersionsTool.js +1 -1
- package/dist/tools/core/GetChunkTool.js +1 -1
- package/dist/tools/core/ListArtifactsTool.js +1 -1
- package/dist/tools/core/MoveArtifactTool.js +1 -1
- package/dist/tools/core/PublishArtifactFromFileTool.js +1 -1
- package/dist/tools/core/PublishArtifactTool.js +2 -2
- package/dist/tools/core/SearchArtifactsTool.js +7 -6
- package/dist/tools/memory-graph/GraphCreateEntitiesTool.d.ts +11 -0
- package/dist/tools/memory-graph/GraphCreateEntitiesTool.js +56 -0
- package/dist/tools/memory-graph/GraphCreateRelationshipsTool.d.ts +11 -0
- package/dist/tools/memory-graph/GraphCreateRelationshipsTool.js +55 -0
- package/dist/tools/memory-graph/GraphCreateTool.d.ts +11 -0
- package/dist/tools/memory-graph/GraphCreateTool.js +62 -0
- package/dist/tools/memory-graph/GraphDeleteEntitiesTool.d.ts +11 -0
- package/dist/tools/memory-graph/GraphDeleteEntitiesTool.js +43 -0
- package/dist/tools/memory-graph/GraphDeleteRelationshipsTool.d.ts +11 -0
- package/dist/tools/memory-graph/GraphDeleteRelationshipsTool.js +43 -0
- package/dist/tools/memory-graph/GraphExploreTool.d.ts +11 -0
- package/dist/tools/memory-graph/GraphExploreTool.js +71 -0
- package/dist/tools/memory-graph/GraphFindEntitiesTool.d.ts +11 -0
- package/dist/tools/memory-graph/GraphFindEntitiesTool.js +66 -0
- package/dist/tools/memory-graph/GraphFindPathsTool.d.ts +11 -0
- package/dist/tools/memory-graph/GraphFindPathsTool.js +60 -0
- package/dist/tools/memory-graph/GraphGetEntityTool.d.ts +11 -0
- package/dist/tools/memory-graph/GraphGetEntityTool.js +47 -0
- package/dist/tools/memory-graph/GraphGetRelationshipsTool.d.ts +11 -0
- package/dist/tools/memory-graph/GraphGetRelationshipsTool.js +60 -0
- package/dist/tools/memory-graph/GraphGetStatsTool.d.ts +11 -0
- package/dist/tools/memory-graph/GraphGetStatsTool.js +42 -0
- package/dist/tools/memory-graph/GraphListTemplatesTool.d.ts +11 -0
- package/dist/tools/memory-graph/GraphListTemplatesTool.js +32 -0
- package/dist/tools/memory-graph/GraphListTool.d.ts +11 -0
- package/dist/tools/memory-graph/GraphListTool.js +43 -0
- package/dist/tools/memory-graph/GraphOpenTool.d.ts +12 -0
- package/dist/tools/memory-graph/GraphOpenTool.js +48 -0
- package/dist/tools/memory-graph/GraphProposeVocabularyTool.d.ts +11 -0
- package/dist/tools/memory-graph/GraphProposeVocabularyTool.js +104 -0
- package/dist/tools/memory-graph/GraphRemoveRelationshipsTool.d.ts +11 -0
- package/dist/tools/memory-graph/GraphRemoveRelationshipsTool.js +47 -0
- package/dist/tools/memory-graph/GraphSearchTool.d.ts +11 -0
- package/dist/tools/memory-graph/GraphSearchTool.js +92 -0
- package/dist/tools/memory-graph/GraphTraverseTool.d.ts +11 -0
- package/dist/tools/memory-graph/GraphTraverseTool.js +112 -0
- package/dist/tools/memory-graph/GraphUpdateEntitiesTool.d.ts +11 -0
- package/dist/tools/memory-graph/GraphUpdateEntitiesTool.js +56 -0
- package/dist/tools/memory-graph/KnowledgeSetListTool.d.ts +11 -0
- package/dist/tools/memory-graph/KnowledgeSetListTool.js +23 -0
- package/dist/tools/memory-graph/KnowledgeSetOpenTool.d.ts +11 -0
- package/dist/tools/memory-graph/KnowledgeSetOpenTool.js +29 -0
- package/dist/tools/repository/CreateRepositoryTool.js +10 -9
- package/dist/tools/repository/GetRepositoryTool.js +15 -15
- package/dist/tools/repository/UpdateRepositoryTool.js +10 -9
- package/dist/tools/sharepoint/SharePointListConnectionsTool.js +1 -1
- package/dist/tools/sharepoint/SharePointListFoldersTool.js +1 -1
- package/dist/tools/utility/AuthorIndexTool.js +6 -5
- package/dist/tools/utility/AuthorRecentsTool.js +6 -5
- package/dist/tools/utility/HealthCheckController.js +1 -1
- package/dist/tools/utility/ListRepositoriesTool.js +5 -4
- package/dist/utils/McpErrorHandler.js +1 -1
- package/package.json +1 -1
- package/package.json.backup +1 -1
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
import { BaseToolController } from '../base/BaseToolController.js';
|
|
2
|
+
import { ResponseChunker } from '../../utils/ResponseChunker.js';
|
|
3
|
+
import { parsePath } from '../../utils/PathUtils.js';
|
|
4
|
+
export class GetArtifactTool extends BaseToolController {
|
|
5
|
+
trustedAuthors;
|
|
6
|
+
constructor(ucmClient, logger, publishingAuthorId, trustedAuthors = []) {
|
|
7
|
+
super(ucmClient, logger, publishingAuthorId);
|
|
8
|
+
this.trustedAuthors = trustedAuthors;
|
|
9
|
+
}
|
|
10
|
+
get name() {
|
|
11
|
+
return 'ucm_artifact_get';
|
|
12
|
+
}
|
|
13
|
+
get description() {
|
|
14
|
+
return 'Retrieve UCM artifact content with metadata. Large files are automatically chunked.';
|
|
15
|
+
}
|
|
16
|
+
get inputSchema() {
|
|
17
|
+
return {
|
|
18
|
+
type: 'object',
|
|
19
|
+
properties: {
|
|
20
|
+
path: {
|
|
21
|
+
type: 'string',
|
|
22
|
+
description: `Full artifact path with optional version (e.g., "${this.publishingAuthorId || '1234567890'}/main/commands/user/CreateUserCommand.ts" or "${this.publishingAuthorId || '1234567890'}/main/commands/user/CreateUserCommand.ts@1.0.0")`,
|
|
23
|
+
minLength: 1,
|
|
24
|
+
maxLength: 200
|
|
25
|
+
},
|
|
26
|
+
includeMetadata: {
|
|
27
|
+
type: 'boolean',
|
|
28
|
+
description: 'Include artifact metadata in response',
|
|
29
|
+
default: true
|
|
30
|
+
}
|
|
31
|
+
},
|
|
32
|
+
required: ['path']
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
async handleExecute(params) {
|
|
36
|
+
let { path, includeMetadata = true } = params;
|
|
37
|
+
this.logger.debug('GetArtifactTool', `Retrieving artifact: ${path}`);
|
|
38
|
+
try {
|
|
39
|
+
// Parse the path to extract components
|
|
40
|
+
if (!path)
|
|
41
|
+
path = "";
|
|
42
|
+
const pathComponents = parsePath(path);
|
|
43
|
+
// Validate that path contains all required components including repository
|
|
44
|
+
if (!pathComponents.author || !pathComponents.repository || !pathComponents.category || !pathComponents.subcategory || !pathComponents.filename) {
|
|
45
|
+
throw new Error(`Path must include all components: author/repository/category/subcategory/filename.ext. Expected format: "author/repository/category/subcategory/filename.ext" or "author/repository/category/subcategory/filename.ext@version". Received: "${path}"`);
|
|
46
|
+
}
|
|
47
|
+
// Get artifact from API
|
|
48
|
+
const artifact = await this.ucmClient.getArtifact(pathComponents.author, pathComponents.repository, pathComponents.category, pathComponents.subcategory, pathComponents.filename, pathComponents.version);
|
|
49
|
+
// Extract content - it should always be a string in the API response
|
|
50
|
+
if (!artifact.content) {
|
|
51
|
+
throw new Error('Artifact has no content');
|
|
52
|
+
}
|
|
53
|
+
const content = artifact.content;
|
|
54
|
+
// Check if author is trusted
|
|
55
|
+
const author = artifact.metadata?.author || pathComponents.author;
|
|
56
|
+
const isTrusted = this.trustedAuthors.includes(author);
|
|
57
|
+
// Build response
|
|
58
|
+
const response = {
|
|
59
|
+
content,
|
|
60
|
+
path: artifact.path || path,
|
|
61
|
+
filename: pathComponents.filename // filename comes from parsed path
|
|
62
|
+
};
|
|
63
|
+
// Add security warning for untrusted authors
|
|
64
|
+
if (!isTrusted && this.publishingAuthorId && this.publishingAuthorId != pathComponents.author) {
|
|
65
|
+
response.securityWarning = `⚠️ SECURITY WARNING: This artifact is from author '${author}' who is not in your trusted authors list. Please review the code carefully before using it.`;
|
|
66
|
+
}
|
|
67
|
+
// Add metadata if requested
|
|
68
|
+
if (includeMetadata) {
|
|
69
|
+
response.metadata = {
|
|
70
|
+
id: artifact.id,
|
|
71
|
+
version: artifact.metadata?.version || pathComponents.version || 'latest',
|
|
72
|
+
description: artifact.metadata?.description,
|
|
73
|
+
author: author,
|
|
74
|
+
repository: pathComponents.repository,
|
|
75
|
+
category: artifact.metadata?.category || pathComponents.category,
|
|
76
|
+
subcategory: artifact.metadata?.subcategory || pathComponents.subcategory,
|
|
77
|
+
technology: artifact.metadata?.technology,
|
|
78
|
+
tags: artifact.metadata?.tags || [],
|
|
79
|
+
contractVersion: artifact.metadata?.contractVersion,
|
|
80
|
+
size: content.length,
|
|
81
|
+
mimeType: this.detectMimeType(pathComponents.filename),
|
|
82
|
+
lastUpdated: artifact.lastUpdated,
|
|
83
|
+
publishedAt: artifact.publishedAt,
|
|
84
|
+
};
|
|
85
|
+
}
|
|
86
|
+
// Apply chunking if needed
|
|
87
|
+
const chunkedResponse = ResponseChunker.chunk(response);
|
|
88
|
+
this.logger.info('GetArtifactTool', `Artifact retrieved: ${path}`, '', {
|
|
89
|
+
size: content.length,
|
|
90
|
+
chunked: chunkedResponse.chunk ? true : false
|
|
91
|
+
});
|
|
92
|
+
return chunkedResponse;
|
|
93
|
+
}
|
|
94
|
+
catch (error) {
|
|
95
|
+
this.logger.error('GetArtifactTool', `Failed to retrieve artifact: ${path}`, '', error);
|
|
96
|
+
throw error;
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
detectMimeType(filename) {
|
|
100
|
+
const ext = filename.split('.').pop()?.toLowerCase();
|
|
101
|
+
const mimeTypes = {
|
|
102
|
+
'ts': 'application/typescript',
|
|
103
|
+
'js': 'application/javascript',
|
|
104
|
+
'json': 'application/json',
|
|
105
|
+
'md': 'text/markdown',
|
|
106
|
+
'txt': 'text/plain',
|
|
107
|
+
'yaml': 'text/yaml',
|
|
108
|
+
'yml': 'text/yaml',
|
|
109
|
+
'html': 'text/html',
|
|
110
|
+
'css': 'text/css',
|
|
111
|
+
'py': 'text/x-python',
|
|
112
|
+
'java': 'text/x-java',
|
|
113
|
+
'cs': 'text/x-csharp',
|
|
114
|
+
'go': 'text/x-go',
|
|
115
|
+
'rs': 'text/x-rust',
|
|
116
|
+
'cpp': 'text/x-c++',
|
|
117
|
+
'c': 'text/x-c',
|
|
118
|
+
'sh': 'text/x-shellscript',
|
|
119
|
+
'xml': 'application/xml'
|
|
120
|
+
};
|
|
121
|
+
return mimeTypes[ext || ''] || 'text/plain';
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
//# sourceMappingURL=GetArtifactTool.js.map
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { BaseToolController } from '../base/BaseToolController.js';
|
|
2
|
+
import { UcmLocalApiClient } from '../../clients/UcmLocalApiClient.js';
|
|
3
|
+
import { ILogger } from '../../interfaces/ILogger.js';
|
|
4
|
+
export declare class GetArtifactVersionsTool extends BaseToolController {
|
|
5
|
+
constructor(ucmClient: UcmLocalApiClient, logger: ILogger, publishingAuthorId?: string);
|
|
6
|
+
get name(): string;
|
|
7
|
+
get description(): string;
|
|
8
|
+
get inputSchema(): any;
|
|
9
|
+
protected handleExecute(params: any): Promise<any>;
|
|
10
|
+
}
|
|
11
|
+
//# sourceMappingURL=GetArtifactVersionsTool.d.ts.map
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { BaseToolController } from '../base/BaseToolController.js';
|
|
2
|
+
import { parsePath } from '../../utils/PathUtils.js';
|
|
3
|
+
export class GetArtifactVersionsTool extends BaseToolController {
|
|
4
|
+
constructor(ucmClient, logger, publishingAuthorId) {
|
|
5
|
+
super(ucmClient, logger, publishingAuthorId);
|
|
6
|
+
}
|
|
7
|
+
get name() {
|
|
8
|
+
return 'ucm_artifact_get_versions';
|
|
9
|
+
}
|
|
10
|
+
get description() {
|
|
11
|
+
return 'Get all available versions of a specific UCM artifact';
|
|
12
|
+
}
|
|
13
|
+
get inputSchema() {
|
|
14
|
+
return {
|
|
15
|
+
type: 'object',
|
|
16
|
+
properties: {
|
|
17
|
+
path: {
|
|
18
|
+
type: 'string',
|
|
19
|
+
description: `Full artifact path without version (e.g., "${this.publishingAuthorId || '01234567890'}/main/commands/user/CreateUserCommand.ts")`,
|
|
20
|
+
minLength: 1,
|
|
21
|
+
maxLength: 200
|
|
22
|
+
}
|
|
23
|
+
},
|
|
24
|
+
required: ['path']
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
async handleExecute(params) {
|
|
28
|
+
let { path } = params;
|
|
29
|
+
this.logger.debug('GetArtifactVersionsTool', `Retrieving versions for artifact: ${path}`);
|
|
30
|
+
try {
|
|
31
|
+
// Parse the path to extract components
|
|
32
|
+
if (!path)
|
|
33
|
+
path = "";
|
|
34
|
+
const pathComponents = parsePath(path);
|
|
35
|
+
// Validate that path contains all required components including repository
|
|
36
|
+
if (!pathComponents.author || !pathComponents.repository || !pathComponents.category ||
|
|
37
|
+
!pathComponents.subcategory || !pathComponents.filename) {
|
|
38
|
+
throw new Error(`Invalid artifact path. Expected format: {author}/{repository}/{category}/{subcategory}/{filename}. ` +
|
|
39
|
+
`Received: ${path}`);
|
|
40
|
+
}
|
|
41
|
+
// Get versions from API
|
|
42
|
+
const versions = await this.ucmClient.getArtifactVersions(pathComponents.author, pathComponents.repository, pathComponents.category, pathComponents.subcategory, pathComponents.filename);
|
|
43
|
+
// Return the versions data
|
|
44
|
+
return {
|
|
45
|
+
path,
|
|
46
|
+
author: pathComponents.author,
|
|
47
|
+
repository: pathComponents.repository,
|
|
48
|
+
category: pathComponents.category,
|
|
49
|
+
subcategory: pathComponents.subcategory,
|
|
50
|
+
filename: pathComponents.filename,
|
|
51
|
+
versions: versions
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
catch (error) {
|
|
55
|
+
this.logger.error('GetArtifactVersionsTool', 'Failed to retrieve artifact versions', error);
|
|
56
|
+
if (error.message?.includes('404') || error.message?.includes('not found')) {
|
|
57
|
+
throw new Error(`Artifact not found: ${path}`);
|
|
58
|
+
}
|
|
59
|
+
throw new Error(`Failed to retrieve artifact versions: ${error.message || 'Unknown error'}`);
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
//# sourceMappingURL=GetArtifactVersionsTool.js.map
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { BaseToolController } from '../base/BaseToolController.js';
|
|
2
|
+
import { UcmLocalApiClient } from '../../clients/UcmLocalApiClient.js';
|
|
3
|
+
import { ILogger } from '../../interfaces/ILogger.js';
|
|
4
|
+
export declare class GetChunkTool extends BaseToolController {
|
|
5
|
+
constructor(ucmClient: UcmLocalApiClient, logger: ILogger, publishingAuthorId?: string);
|
|
6
|
+
get name(): string;
|
|
7
|
+
get description(): string;
|
|
8
|
+
get inputSchema(): any;
|
|
9
|
+
protected handleExecute(params: any): Promise<any>;
|
|
10
|
+
}
|
|
11
|
+
//# sourceMappingURL=GetChunkTool.d.ts.map
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { BaseToolController } from '../base/BaseToolController.js';
|
|
2
|
+
import { ResponseChunker } from '../../utils/ResponseChunker.js';
|
|
3
|
+
import { McpError, McpErrorCode } from '../../utils/McpErrorHandler.js';
|
|
4
|
+
export class GetChunkTool extends BaseToolController {
|
|
5
|
+
constructor(ucmClient, logger, publishingAuthorId) {
|
|
6
|
+
super(ucmClient, logger, publishingAuthorId);
|
|
7
|
+
}
|
|
8
|
+
get name() {
|
|
9
|
+
return 'ucm_artifact_get_chunk';
|
|
10
|
+
}
|
|
11
|
+
get description() {
|
|
12
|
+
return 'Retrieve the next chunk of a large UCM artifact response';
|
|
13
|
+
}
|
|
14
|
+
get inputSchema() {
|
|
15
|
+
return {
|
|
16
|
+
type: 'object',
|
|
17
|
+
properties: {
|
|
18
|
+
chunkId: {
|
|
19
|
+
type: 'string',
|
|
20
|
+
description: 'The chunk ID to retrieve',
|
|
21
|
+
minLength: 1
|
|
22
|
+
},
|
|
23
|
+
sequence: {
|
|
24
|
+
type: 'number',
|
|
25
|
+
description: 'The sequence number of the chunk to retrieve',
|
|
26
|
+
minimum: 0
|
|
27
|
+
}
|
|
28
|
+
},
|
|
29
|
+
required: ['chunkId', 'sequence']
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
async handleExecute(params) {
|
|
33
|
+
const { chunkId, sequence } = params;
|
|
34
|
+
this.logger.debug('GetChunkTool', `Retrieving chunk: ${chunkId} sequence ${sequence}`);
|
|
35
|
+
// Get chunk info first
|
|
36
|
+
const chunkInfo = ResponseChunker.getChunkInfo(chunkId);
|
|
37
|
+
if (!chunkInfo.exists) {
|
|
38
|
+
throw new McpError(McpErrorCode.InvalidParams, `Chunk with ID '${chunkId}' not found. It may have expired.`);
|
|
39
|
+
}
|
|
40
|
+
// Validate sequence range
|
|
41
|
+
if (sequence < 0 || (chunkInfo.total && sequence >= chunkInfo.total)) {
|
|
42
|
+
throw new McpError(McpErrorCode.InvalidParams, `Sequence ${sequence} is out of range. Valid range is 0-${(chunkInfo.total || 1) - 1}`);
|
|
43
|
+
}
|
|
44
|
+
// Get the chunk
|
|
45
|
+
const nextChunk = ResponseChunker.getNextChunk(chunkId, sequence);
|
|
46
|
+
if (!nextChunk) {
|
|
47
|
+
throw new McpError(McpErrorCode.InternalError, 'Failed to retrieve chunk');
|
|
48
|
+
}
|
|
49
|
+
this.logger.info('GetChunkTool', `Chunk retrieved: ${chunkId} sequence ${sequence}`, '', {
|
|
50
|
+
hasMore: nextChunk.hasMore,
|
|
51
|
+
total: nextChunk.chunk.total
|
|
52
|
+
});
|
|
53
|
+
return nextChunk;
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
//# sourceMappingURL=GetChunkTool.js.map
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { BaseToolController } from '../base/BaseToolController.js';
|
|
2
|
+
import { UcmLocalApiClient } from '../../clients/UcmLocalApiClient.js';
|
|
3
|
+
import { ILogger } from '../../interfaces/ILogger.js';
|
|
4
|
+
export declare class ListArtifactsTool extends BaseToolController {
|
|
5
|
+
constructor(ucmClient: UcmLocalApiClient, logger: ILogger, publishingAuthorId?: string);
|
|
6
|
+
get name(): string;
|
|
7
|
+
get description(): string;
|
|
8
|
+
get inputSchema(): any;
|
|
9
|
+
protected handleExecute(params: any): Promise<any>;
|
|
10
|
+
}
|
|
11
|
+
//# sourceMappingURL=ListArtifactsTool.d.ts.map
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import { BaseToolController } from '../base/BaseToolController.js';
|
|
2
|
+
import { parsePath } from '../../utils/PathUtils.js';
|
|
3
|
+
export class ListArtifactsTool extends BaseToolController {
|
|
4
|
+
constructor(ucmClient, logger, publishingAuthorId) {
|
|
5
|
+
super(ucmClient, logger, publishingAuthorId);
|
|
6
|
+
}
|
|
7
|
+
get name() {
|
|
8
|
+
return 'ucm_artifact_list';
|
|
9
|
+
}
|
|
10
|
+
get description() {
|
|
11
|
+
return `List artifacts with exploratory browsing support. Can list authors, repositories, categories, subcategories, or artifacts depending on path depth. ${this.publishingAuthorId ? "Your author value is '" + this.publishingAuthorId + "'" : ''}`;
|
|
12
|
+
}
|
|
13
|
+
get inputSchema() {
|
|
14
|
+
return {
|
|
15
|
+
type: 'object',
|
|
16
|
+
properties: {
|
|
17
|
+
path: {
|
|
18
|
+
type: 'string',
|
|
19
|
+
description: `Exploratory path: empty string or omit for authors, "{author}" for repositories, "{author}/{repository}" for categories, "{author}/{repository}/{category}" for subcategories, or "{author}/{repository}/{category}/{subcategory}" for artifacts. Eg; ${this.publishingAuthorId}/main/commands/user`,
|
|
20
|
+
minLength: 0,
|
|
21
|
+
maxLength: 200
|
|
22
|
+
},
|
|
23
|
+
offset: {
|
|
24
|
+
type: 'number',
|
|
25
|
+
description: 'Number of items to skip for pagination (default: 0)',
|
|
26
|
+
minimum: 0
|
|
27
|
+
},
|
|
28
|
+
limit: {
|
|
29
|
+
type: 'number',
|
|
30
|
+
description: 'Maximum number of items to return (default: 20, max: 100)',
|
|
31
|
+
minimum: 1,
|
|
32
|
+
maximum: 100
|
|
33
|
+
}
|
|
34
|
+
},
|
|
35
|
+
required: []
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
async handleExecute(params) {
|
|
39
|
+
let { path, offset, limit } = params;
|
|
40
|
+
if (!path)
|
|
41
|
+
path = "";
|
|
42
|
+
this.logger.debug('ListArtifactsTool', `Exploring path: ${path} (offset: ${offset || 0}, limit: ${limit || 'default'})`);
|
|
43
|
+
try {
|
|
44
|
+
// Parse the path to extract components
|
|
45
|
+
const pathComponents = parsePath(path);
|
|
46
|
+
const pathSegments = path.split('/').filter(Boolean);
|
|
47
|
+
// Call API based on path depth for exploratory browsing
|
|
48
|
+
const response = await this.ucmClient.listArtifacts(pathComponents.author, pathComponents.repository, pathComponents.category, pathComponents.subcategory, offset, limit);
|
|
49
|
+
// Determine what we're listing based on path depth (4-level structure)
|
|
50
|
+
let listingType = 'artifacts';
|
|
51
|
+
if (pathSegments.length == 0) {
|
|
52
|
+
listingType = 'authors';
|
|
53
|
+
}
|
|
54
|
+
else if (pathSegments.length === 1) {
|
|
55
|
+
listingType = 'repositories';
|
|
56
|
+
}
|
|
57
|
+
else if (pathSegments.length === 2) {
|
|
58
|
+
listingType = 'categories';
|
|
59
|
+
}
|
|
60
|
+
else if (pathSegments.length === 3) {
|
|
61
|
+
listingType = 'subcategories';
|
|
62
|
+
}
|
|
63
|
+
// For MVP, validate repository is 'main' if provided
|
|
64
|
+
// if (pathSegments.length >= 2 && pathComponents.repository && pathComponents.repository !== 'main') {
|
|
65
|
+
// throw new Error(`Repository must be 'main' for MVP. Received: "${pathComponents.repository}"`);
|
|
66
|
+
// }
|
|
67
|
+
this.logger.info('ListArtifactsTool', `Listed ${response.data.length} ${listingType} in: ${path}`);
|
|
68
|
+
// Return the full response with pagination metadata and context
|
|
69
|
+
return {
|
|
70
|
+
path,
|
|
71
|
+
listingType,
|
|
72
|
+
data: response.data,
|
|
73
|
+
pagination: response.pagination,
|
|
74
|
+
hasMore: response.pagination.offset + response.pagination.limit < response.pagination.total,
|
|
75
|
+
_links: response._links
|
|
76
|
+
};
|
|
77
|
+
}
|
|
78
|
+
catch (error) {
|
|
79
|
+
this.logger.error('ListArtifactsTool', `Failed to explore path: ${path}`, '', error);
|
|
80
|
+
throw error;
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
//# sourceMappingURL=ListArtifactsTool.js.map
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { BaseToolController } from '../base/BaseToolController.js';
|
|
2
|
+
import { UcmLocalApiClient } from '../../clients/UcmLocalApiClient.js';
|
|
3
|
+
import { ILogger } from '../../interfaces/ILogger.js';
|
|
4
|
+
export declare class MoveArtifactTool extends BaseToolController {
|
|
5
|
+
constructor(ucmClient: UcmLocalApiClient, logger: ILogger, publishingAuthorId?: string);
|
|
6
|
+
get name(): string;
|
|
7
|
+
get description(): string;
|
|
8
|
+
get inputSchema(): Record<string, unknown>;
|
|
9
|
+
protected handleExecute(params: Record<string, unknown>): Promise<string>;
|
|
10
|
+
protected validateParams(params: Record<string, unknown>): void;
|
|
11
|
+
}
|
|
12
|
+
//# sourceMappingURL=MoveArtifactTool.d.ts.map
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
import { BaseToolController } from '../base/BaseToolController.js';
|
|
2
|
+
import { parsePath } from '../../utils/PathUtils.js';
|
|
3
|
+
import { McpError, McpErrorCode } from '../../utils/McpErrorHandler.js';
|
|
4
|
+
export class MoveArtifactTool extends BaseToolController {
|
|
5
|
+
constructor(ucmClient, logger, publishingAuthorId) {
|
|
6
|
+
super(ucmClient, logger, publishingAuthorId);
|
|
7
|
+
}
|
|
8
|
+
get name() {
|
|
9
|
+
return 'ucm_artifact_move';
|
|
10
|
+
}
|
|
11
|
+
get description() {
|
|
12
|
+
return 'Move an artifact from one namespace location to another. All versions are moved. Requires read access on source and write access on destination.';
|
|
13
|
+
}
|
|
14
|
+
get inputSchema() {
|
|
15
|
+
return {
|
|
16
|
+
type: 'object',
|
|
17
|
+
properties: {
|
|
18
|
+
sourcePath: {
|
|
19
|
+
type: 'string',
|
|
20
|
+
description: `Full source artifact path (e.g., "${this.publishingAuthorId || '1234567890'}/main/commands/user/CreateUserCommand.ts")`,
|
|
21
|
+
minLength: 1,
|
|
22
|
+
maxLength: 250
|
|
23
|
+
},
|
|
24
|
+
destinationPath: {
|
|
25
|
+
type: 'string',
|
|
26
|
+
description: `Full destination artifact path (e.g., "${this.publishingAuthorId || '1234567890'}/main/services/user/UserService.ts")`,
|
|
27
|
+
minLength: 1,
|
|
28
|
+
maxLength: 250
|
|
29
|
+
}
|
|
30
|
+
},
|
|
31
|
+
required: ['sourcePath', 'destinationPath'],
|
|
32
|
+
additionalProperties: false
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
async handleExecute(params) {
|
|
36
|
+
const { sourcePath, destinationPath } = params;
|
|
37
|
+
this.logger.debug('MoveArtifactTool', `Moving artifact: ${sourcePath} → ${destinationPath}`);
|
|
38
|
+
try {
|
|
39
|
+
const source = parsePath(sourcePath);
|
|
40
|
+
const dest = parsePath(destinationPath);
|
|
41
|
+
// Build destination namespace (author/repository/category/subcategory)
|
|
42
|
+
const destNamespace = `${dest.author}/${dest.repository}/${dest.category}/${dest.subcategory}`;
|
|
43
|
+
const result = await this.ucmClient.editArtifactMetadata(source.author, source.repository, source.category, source.subcategory, source.filename, {
|
|
44
|
+
updateNamespace: destNamespace,
|
|
45
|
+
updateFilename: dest.filename
|
|
46
|
+
});
|
|
47
|
+
const responseData = result.data || result;
|
|
48
|
+
const response = {
|
|
49
|
+
success: true,
|
|
50
|
+
operation: 'move',
|
|
51
|
+
artifact: {
|
|
52
|
+
originalPath: sourcePath,
|
|
53
|
+
newPath: destinationPath,
|
|
54
|
+
affectedVersions: responseData.affectedVersions || 'all'
|
|
55
|
+
},
|
|
56
|
+
details: responseData.details || `Artifact moved from ${sourcePath} to ${destinationPath}`,
|
|
57
|
+
_links: responseData._links || {}
|
|
58
|
+
};
|
|
59
|
+
this.logger.info('MoveArtifactTool', `Artifact moved successfully: ${sourcePath} → ${destinationPath}`);
|
|
60
|
+
return JSON.stringify(response);
|
|
61
|
+
}
|
|
62
|
+
catch (error) {
|
|
63
|
+
this.logger.error('MoveArtifactTool', `Failed to move artifact: ${sourcePath} → ${destinationPath}`, '', error);
|
|
64
|
+
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
65
|
+
if (errorMessage?.includes('not found')) {
|
|
66
|
+
throw new McpError(McpErrorCode.InvalidParams, `Artifact not found at path: ${sourcePath}. Please verify the path is correct and the artifact exists.`);
|
|
67
|
+
}
|
|
68
|
+
if (errorMessage?.includes('permission') || errorMessage?.includes('unauthorized')) {
|
|
69
|
+
throw new McpError(McpErrorCode.InvalidParams, `Insufficient permissions. You need read access on the source and write access on the destination namespace.`);
|
|
70
|
+
}
|
|
71
|
+
if (errorMessage?.includes('destination already exists')) {
|
|
72
|
+
throw new McpError(McpErrorCode.InvalidParams, `An artifact already exists at: ${destinationPath}. Choose a different destination.`);
|
|
73
|
+
}
|
|
74
|
+
if (errorMessage?.includes('Author not found')) {
|
|
75
|
+
throw new McpError(McpErrorCode.InvalidParams, `Author not found. Ensure both source and destination paths use valid author identifiers.`);
|
|
76
|
+
}
|
|
77
|
+
throw error;
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
validateParams(params) {
|
|
81
|
+
super.validateParams(params);
|
|
82
|
+
const { sourcePath, destinationPath } = params;
|
|
83
|
+
// Validate source path
|
|
84
|
+
const sourceParts = sourcePath.split('/');
|
|
85
|
+
if (sourceParts.length < 5) {
|
|
86
|
+
throw new McpError(McpErrorCode.InvalidParams, 'sourcePath must contain author/repository/category/subcategory/filename');
|
|
87
|
+
}
|
|
88
|
+
// Validate destination path
|
|
89
|
+
const destParts = destinationPath.split('/');
|
|
90
|
+
if (destParts.length < 5) {
|
|
91
|
+
throw new McpError(McpErrorCode.InvalidParams, 'destinationPath must contain author/repository/category/subcategory/filename');
|
|
92
|
+
}
|
|
93
|
+
// Validate destination filename
|
|
94
|
+
const destFilename = destParts[destParts.length - 1];
|
|
95
|
+
if (!/^[^\/\\:*?"<>|]+\.[a-zA-Z0-9]+$/.test(destFilename)) {
|
|
96
|
+
throw new McpError(McpErrorCode.InvalidParams, 'destinationPath filename must be valid with an extension (e.g., "UserService.ts")');
|
|
97
|
+
}
|
|
98
|
+
// Source and destination must differ
|
|
99
|
+
if (sourcePath === destinationPath) {
|
|
100
|
+
throw new McpError(McpErrorCode.InvalidParams, 'sourcePath and destinationPath must be different');
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
//# sourceMappingURL=MoveArtifactTool.js.map
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { BaseToolController } from '../base/BaseToolController.js';
|
|
2
|
+
import { UcmLocalApiClient } from '../../clients/UcmLocalApiClient.js';
|
|
3
|
+
import { ILogger } from '../../interfaces/ILogger.js';
|
|
4
|
+
export declare class PublishArtifactFromFileTool extends BaseToolController {
|
|
5
|
+
constructor(ucmClient: UcmLocalApiClient, logger: ILogger, publishingAuthorId?: string);
|
|
6
|
+
get name(): string;
|
|
7
|
+
get description(): string;
|
|
8
|
+
get inputSchema(): any;
|
|
9
|
+
protected handleExecute(params: any): Promise<any>;
|
|
10
|
+
protected validateParams(params: any): void;
|
|
11
|
+
private parseFileUri;
|
|
12
|
+
private readFileContent;
|
|
13
|
+
private detectMimeType;
|
|
14
|
+
}
|
|
15
|
+
//# sourceMappingURL=PublishArtifactFromFileTool.d.ts.map
|