@utaba/ucm-mcp-server 6.5.1 → 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 +174 -2
- package/dist/clients/UcmLocalApiClient.js +203 -3
- 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 +2 -2
- package/dist/tools/connections/CallRemoteToolTool.js +3 -3
- 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/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,125 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* SharePointSearchTool
|
|
3
|
+
* Search SharePoint documents with text query
|
|
4
|
+
*/
|
|
5
|
+
import { BaseToolController } from '../base/BaseToolController.js';
|
|
6
|
+
import { McpError, McpErrorCode } from '../../utils/McpErrorHandler.js';
|
|
7
|
+
import { SharePointErrorHandler } from '../../utils/SharePointErrorHandler.js';
|
|
8
|
+
export class SharePointSearchTool extends BaseToolController {
|
|
9
|
+
constructor(ucmClient, logger, publishingAuthorId) {
|
|
10
|
+
super(ucmClient, logger, publishingAuthorId);
|
|
11
|
+
}
|
|
12
|
+
get name() {
|
|
13
|
+
return 'ucm_sharepoint_search_documents';
|
|
14
|
+
}
|
|
15
|
+
get description() {
|
|
16
|
+
return 'Search SharePoint documents with text query using Microsoft Search API. Returns document metadata with snippets. Supports pagination and file type filtering via KQL.';
|
|
17
|
+
}
|
|
18
|
+
get inputSchema() {
|
|
19
|
+
return {
|
|
20
|
+
type: 'object',
|
|
21
|
+
properties: {
|
|
22
|
+
connectionId: {
|
|
23
|
+
type: 'string',
|
|
24
|
+
description: 'SharePoint connection ID to use for searching (get this from list_connections)',
|
|
25
|
+
minLength: 36,
|
|
26
|
+
maxLength: 36
|
|
27
|
+
},
|
|
28
|
+
query: {
|
|
29
|
+
type: 'string',
|
|
30
|
+
description: 'Search query text (optional, defaults to * for all documents)',
|
|
31
|
+
maxLength: 500
|
|
32
|
+
},
|
|
33
|
+
limit: {
|
|
34
|
+
type: 'number',
|
|
35
|
+
description: 'Maximum number of results to return (default: 20, max: 100)',
|
|
36
|
+
minimum: 1,
|
|
37
|
+
maximum: 100
|
|
38
|
+
},
|
|
39
|
+
offset: {
|
|
40
|
+
type: 'number',
|
|
41
|
+
description: 'Number of results to skip for pagination (default: 0)',
|
|
42
|
+
minimum: 0
|
|
43
|
+
},
|
|
44
|
+
fileType: {
|
|
45
|
+
type: 'string',
|
|
46
|
+
description: 'Filter by file extension (e.g., "docx", "pdf", "xlsx") - uses Microsoft Search KQL filtering',
|
|
47
|
+
maxLength: 10
|
|
48
|
+
}
|
|
49
|
+
},
|
|
50
|
+
required: ['connectionId'],
|
|
51
|
+
additionalProperties: false
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
validateParams(params) {
|
|
55
|
+
super.validateParams(params);
|
|
56
|
+
// Validate connectionId is UUID format
|
|
57
|
+
const uuidPattern = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
|
|
58
|
+
if (!uuidPattern.test(params.connectionId)) {
|
|
59
|
+
throw new McpError(McpErrorCode.InvalidParams, 'Connection ID must be a valid UUID');
|
|
60
|
+
}
|
|
61
|
+
// Validate query
|
|
62
|
+
if (!params.query || typeof params.query !== 'string' || params.query.trim() === '') {
|
|
63
|
+
params.query = '*';
|
|
64
|
+
}
|
|
65
|
+
// Validate and set default limit
|
|
66
|
+
if (params.limit !== undefined) {
|
|
67
|
+
if (typeof params.limit !== 'number' || params.limit < 1 || params.limit > 100) {
|
|
68
|
+
throw new McpError(McpErrorCode.InvalidParams, 'Limit must be between 1 and 100');
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
else {
|
|
72
|
+
params.limit = 20;
|
|
73
|
+
}
|
|
74
|
+
// Validate and set default offset
|
|
75
|
+
if (params.offset !== undefined) {
|
|
76
|
+
if (typeof params.offset !== 'number' || params.offset < 0) {
|
|
77
|
+
throw new McpError(McpErrorCode.InvalidParams, 'Offset must be 0 or greater');
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
else {
|
|
81
|
+
params.offset = 0;
|
|
82
|
+
}
|
|
83
|
+
// Validate file type if provided (now supported via Microsoft Search API KQL)
|
|
84
|
+
if (params.fileType && !/^[a-zA-Z0-9]{1,10}$/.test(params.fileType)) {
|
|
85
|
+
throw new McpError(McpErrorCode.InvalidParams, 'File type must be alphanumeric and no more than 10 characters');
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
async handleExecute(params) {
|
|
89
|
+
this.logger.info('SharePointSearchTool', `Searching SharePoint with query: "${params.query}"`);
|
|
90
|
+
try {
|
|
91
|
+
// Call the API to search SharePoint documents
|
|
92
|
+
const searchParams = {
|
|
93
|
+
query: params.query,
|
|
94
|
+
limit: params.limit,
|
|
95
|
+
offset: params.offset,
|
|
96
|
+
fileType: params.fileType
|
|
97
|
+
};
|
|
98
|
+
// Make API call via UCM client
|
|
99
|
+
const result = await this.ucmClient.sharePointSearch(params.connectionId, searchParams);
|
|
100
|
+
this.logger.info('SharePointSearchTool', `Search completed, found ${result.totalCount} results`);
|
|
101
|
+
return {
|
|
102
|
+
content: [
|
|
103
|
+
{
|
|
104
|
+
type: 'text',
|
|
105
|
+
text: JSON.stringify({
|
|
106
|
+
success: true,
|
|
107
|
+
query: params.query,
|
|
108
|
+
totalCount: result.totalCount,
|
|
109
|
+
returnedCount: result.files?.length || 0,
|
|
110
|
+
hasMore: result.hasMore,
|
|
111
|
+
limit: params.limit,
|
|
112
|
+
offset: params.offset,
|
|
113
|
+
fileType: params.fileType,
|
|
114
|
+
files: result.files || []
|
|
115
|
+
}, null, 2)
|
|
116
|
+
}
|
|
117
|
+
]
|
|
118
|
+
};
|
|
119
|
+
}
|
|
120
|
+
catch (error) {
|
|
121
|
+
return SharePointErrorHandler.handle(error, this.logger, 'SharePointSearchTool');
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
//# sourceMappingURL=SharePointSearchTool.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 AuthorIndexTool 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=AuthorIndexTool.d.ts.map
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { BaseToolController } from '../base/BaseToolController.js';
|
|
2
|
+
export class AuthorIndexTool extends BaseToolController {
|
|
3
|
+
constructor(ucmClient, logger, publishingAuthorId) {
|
|
4
|
+
super(ucmClient, logger, publishingAuthorId);
|
|
5
|
+
}
|
|
6
|
+
get name() {
|
|
7
|
+
return 'ucm_workspace_get_index';
|
|
8
|
+
}
|
|
9
|
+
get description() {
|
|
10
|
+
return 'Discover a dynamic markdown index guide for AI assistants working with a workspace\'s content.';
|
|
11
|
+
}
|
|
12
|
+
get inputSchema() {
|
|
13
|
+
return {
|
|
14
|
+
type: 'object',
|
|
15
|
+
properties: {
|
|
16
|
+
workspace: {
|
|
17
|
+
type: 'string',
|
|
18
|
+
description: `Workspace identifier: ${this.publishingAuthorId || '1234567890'}`
|
|
19
|
+
}
|
|
20
|
+
},
|
|
21
|
+
required: ['workspace']
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
async handleExecute(params) {
|
|
25
|
+
const { workspace } = params;
|
|
26
|
+
const author = workspace;
|
|
27
|
+
this.logger.debug('AuthorIndexTool', `Retrieving author index for: ${author}`);
|
|
28
|
+
try {
|
|
29
|
+
// Get author index content from API (author-level index, not repository-specific)
|
|
30
|
+
const authorIndexContent = await this.ucmClient.getAuthorIndex(author);
|
|
31
|
+
this.logger.info('AuthorIndexTool', 'Author index retrieved successfully', '', {
|
|
32
|
+
author,
|
|
33
|
+
contentLength: authorIndexContent.length,
|
|
34
|
+
source: `UCM API /api/v1/authors/${author}/index`
|
|
35
|
+
});
|
|
36
|
+
return authorIndexContent;
|
|
37
|
+
}
|
|
38
|
+
catch (error) {
|
|
39
|
+
let errorMessage = `Failed to retrieve author index for ${author}.`;
|
|
40
|
+
if (this.publishingAuthorId && author != this.publishingAuthorId) {
|
|
41
|
+
errorMessage += ` did you mean '${this.publishingAuthorId}'`;
|
|
42
|
+
error.message = error.message += ` did you mean '${this.publishingAuthorId}'`;
|
|
43
|
+
}
|
|
44
|
+
this.logger.error('AuthorIndexTool', `${errorMessage}`, '', error);
|
|
45
|
+
throw error;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
//# sourceMappingURL=AuthorIndexTool.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 AuthorRecentsTool 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=AuthorRecentsTool.d.ts.map
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { BaseToolController } from '../base/BaseToolController.js';
|
|
2
|
+
export class AuthorRecentsTool extends BaseToolController {
|
|
3
|
+
constructor(ucmClient, logger, publishingAuthorId) {
|
|
4
|
+
super(ucmClient, logger, publishingAuthorId);
|
|
5
|
+
}
|
|
6
|
+
get name() {
|
|
7
|
+
return 'ucm_workspace_get_recents';
|
|
8
|
+
}
|
|
9
|
+
get description() {
|
|
10
|
+
return 'Generate workspace activity tracking showing the 20 most recently modified artifacts within a workspace.';
|
|
11
|
+
}
|
|
12
|
+
get inputSchema() {
|
|
13
|
+
return {
|
|
14
|
+
type: 'object',
|
|
15
|
+
properties: {
|
|
16
|
+
workspace: {
|
|
17
|
+
type: 'string',
|
|
18
|
+
description: `Workspace identifier: ${this.publishingAuthorId || '1234567890'}`
|
|
19
|
+
}
|
|
20
|
+
},
|
|
21
|
+
required: ['workspace']
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
async handleExecute(params) {
|
|
25
|
+
const { workspace } = params;
|
|
26
|
+
const author = workspace;
|
|
27
|
+
this.logger.debug('AuthorRecentsTool', `Retrieving author recents for: ${author}`);
|
|
28
|
+
try {
|
|
29
|
+
// Get author recent activity content from API
|
|
30
|
+
const authorRecentsContent = await this.ucmClient.getAuthorRecents(author);
|
|
31
|
+
this.logger.info('AuthorRecentsTool', 'Author recents retrieved successfully', '', {
|
|
32
|
+
author,
|
|
33
|
+
contentLength: authorRecentsContent.length,
|
|
34
|
+
source: `UCM API /api/v1/resources/author/${author}/recents`
|
|
35
|
+
});
|
|
36
|
+
return authorRecentsContent;
|
|
37
|
+
}
|
|
38
|
+
catch (error) {
|
|
39
|
+
let errorMessage = `Failed to retrieve author recents for ${author}.`;
|
|
40
|
+
if (this.publishingAuthorId && author != this.publishingAuthorId) {
|
|
41
|
+
errorMessage += ` did you mean '${this.publishingAuthorId}'?`;
|
|
42
|
+
error.message = error.message += ` did you mean '${this.publishingAuthorId}'?`;
|
|
43
|
+
}
|
|
44
|
+
this.logger.error('AuthorRecentsTool', `${errorMessage}`, '', error);
|
|
45
|
+
throw error;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
//# sourceMappingURL=AuthorRecentsTool.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 ListRepositoriesTool 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=ListRepositoriesTool.d.ts.map
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { BaseToolController } from '../base/BaseToolController.js';
|
|
2
|
+
export class ListRepositoriesTool extends BaseToolController {
|
|
3
|
+
constructor(ucmClient, logger, publishingAuthorId) {
|
|
4
|
+
super(ucmClient, logger, publishingAuthorId);
|
|
5
|
+
}
|
|
6
|
+
get name() {
|
|
7
|
+
return 'ucm_workspace_list_repos';
|
|
8
|
+
}
|
|
9
|
+
get description() {
|
|
10
|
+
return 'List all repositories for a specific workspace with pagination and statistics';
|
|
11
|
+
}
|
|
12
|
+
get inputSchema() {
|
|
13
|
+
return {
|
|
14
|
+
type: 'object',
|
|
15
|
+
properties: {
|
|
16
|
+
workspace: {
|
|
17
|
+
type: 'string',
|
|
18
|
+
description: `Workspace identifier (e.g., "${this.publishingAuthorId || '1234567890'}")`,
|
|
19
|
+
minLength: 1,
|
|
20
|
+
maxLength: 50
|
|
21
|
+
},
|
|
22
|
+
offset: {
|
|
23
|
+
type: 'number',
|
|
24
|
+
description: 'Number of items to skip for pagination (default: 0)',
|
|
25
|
+
minimum: 0
|
|
26
|
+
},
|
|
27
|
+
limit: {
|
|
28
|
+
type: 'number',
|
|
29
|
+
description: 'Maximum number of items to return (default: 20, max: 100)',
|
|
30
|
+
minimum: 1,
|
|
31
|
+
maximum: 100
|
|
32
|
+
}
|
|
33
|
+
},
|
|
34
|
+
required: ['workspace']
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
async handleExecute(params) {
|
|
38
|
+
const { workspace, offset, limit } = params;
|
|
39
|
+
const author = workspace;
|
|
40
|
+
this.logger.debug('ListRepositoriesTool', `Listing repositories for author: ${author}`, '', {
|
|
41
|
+
offset: offset || 0,
|
|
42
|
+
limit: limit || 'default'
|
|
43
|
+
});
|
|
44
|
+
try {
|
|
45
|
+
// Use listRepositories to get repositories for the author
|
|
46
|
+
const response = await this.ucmClient.listRepositories(author, offset, limit);
|
|
47
|
+
this.logger.info('ListRepositoriesTool', `Listed ${response.data.length} repositories for author: ${author}`, '', {
|
|
48
|
+
total: response.pagination?.total,
|
|
49
|
+
offset: response.pagination?.offset,
|
|
50
|
+
limit: response.pagination?.limit
|
|
51
|
+
});
|
|
52
|
+
// Return the full response with pagination metadata and context
|
|
53
|
+
return {
|
|
54
|
+
author,
|
|
55
|
+
listingType: 'repositories',
|
|
56
|
+
data: response.data,
|
|
57
|
+
pagination: response.pagination,
|
|
58
|
+
hasMore: response.pagination.offset + response.pagination.limit < response.pagination.total,
|
|
59
|
+
_links: response._links
|
|
60
|
+
};
|
|
61
|
+
}
|
|
62
|
+
catch (error) {
|
|
63
|
+
this.logger.error('ListRepositoriesTool', `Failed to list repositories for author: ${author}`, '', error);
|
|
64
|
+
throw error;
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
//# sourceMappingURL=ListRepositoriesTool.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 QuickstartTool 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=QuickstartTool.d.ts.map
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { BaseToolController } from '../base/BaseToolController.js';
|
|
2
|
+
export class QuickstartTool extends BaseToolController {
|
|
3
|
+
constructor(ucmClient, logger, publishingAuthorId) {
|
|
4
|
+
super(ucmClient, logger, publishingAuthorId);
|
|
5
|
+
}
|
|
6
|
+
get name() {
|
|
7
|
+
return 'ucm_connect';
|
|
8
|
+
}
|
|
9
|
+
get description() {
|
|
10
|
+
return 'Connect to UCM and initialise operational context for the conversation. Call this tool FIRST at the start of every conversation — it loads your personalized account information, workspace IDs, repositories, policies, and connected services. Required for conversation initialisation before using any other UCM tools.';
|
|
11
|
+
}
|
|
12
|
+
get inputSchema() {
|
|
13
|
+
return {
|
|
14
|
+
type: 'object',
|
|
15
|
+
properties: {},
|
|
16
|
+
required: []
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
async handleExecute(params) {
|
|
20
|
+
this.logger.debug('QuickstartTool', 'Retrieving UCM quickstart guide');
|
|
21
|
+
try {
|
|
22
|
+
// Get quickstart content from API
|
|
23
|
+
const quickstartContent = await this.ucmClient.getQuickstart();
|
|
24
|
+
this.logger.info('QuickstartTool', 'Quickstart guide retrieved successfully', '', {
|
|
25
|
+
contentLength: quickstartContent.length,
|
|
26
|
+
source: 'UCM API /api/v1/quickstart'
|
|
27
|
+
});
|
|
28
|
+
return quickstartContent;
|
|
29
|
+
}
|
|
30
|
+
catch (error) {
|
|
31
|
+
this.logger.error('QuickstartTool', 'Failed to retrieve quickstart guide', '', error);
|
|
32
|
+
throw error;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
//# sourceMappingURL=QuickstartTool.js.map
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
export interface ArtifactMetadata {
|
|
2
|
+
name: string;
|
|
3
|
+
description: string;
|
|
4
|
+
version: string;
|
|
5
|
+
contractVersion?: string;
|
|
6
|
+
author: string;
|
|
7
|
+
repository: string;
|
|
8
|
+
category: string;
|
|
9
|
+
subcategory: string;
|
|
10
|
+
technology?: string;
|
|
11
|
+
tags?: string[];
|
|
12
|
+
dependencies?: {
|
|
13
|
+
services?: string[];
|
|
14
|
+
commands?: string[];
|
|
15
|
+
external?: Record<string, string>;
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
export interface ArtifactData {
|
|
19
|
+
id: string;
|
|
20
|
+
path: string;
|
|
21
|
+
metadata: ArtifactMetadata;
|
|
22
|
+
content?: string;
|
|
23
|
+
examples?: any[];
|
|
24
|
+
lastUpdated: string;
|
|
25
|
+
publishedAt: string;
|
|
26
|
+
}
|
|
27
|
+
export interface AuthorData {
|
|
28
|
+
id: string;
|
|
29
|
+
name: string;
|
|
30
|
+
email?: string;
|
|
31
|
+
createdAt: string;
|
|
32
|
+
artifactCount?: number;
|
|
33
|
+
}
|
|
34
|
+
export interface UcmApiResponse<T = any> {
|
|
35
|
+
data: T;
|
|
36
|
+
success: boolean;
|
|
37
|
+
message?: string;
|
|
38
|
+
error?: string;
|
|
39
|
+
}
|
|
40
|
+
//# sourceMappingURL=UcmApiTypes.d.ts.map
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
export declare enum McpErrorCode {
|
|
2
|
+
ParseError = -32700,// Invalid JSON received
|
|
3
|
+
InvalidRequest = -32600,// Request is not valid MCP
|
|
4
|
+
MethodNotFound = -32601,// Method does not exist
|
|
5
|
+
InvalidParams = -32602,// Invalid method parameters
|
|
6
|
+
InternalError = -32603,// Internal server error
|
|
7
|
+
ExternalServiceUnavailable = -32001
|
|
8
|
+
}
|
|
9
|
+
export interface McpErrorResponse {
|
|
10
|
+
error: {
|
|
11
|
+
code: McpErrorCode;
|
|
12
|
+
message: string;
|
|
13
|
+
data?: any;
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
export declare class McpError extends Error {
|
|
17
|
+
code: McpErrorCode;
|
|
18
|
+
data?: any | undefined;
|
|
19
|
+
constructor(code: McpErrorCode, message: string, data?: any | undefined);
|
|
20
|
+
toResponse(): McpErrorResponse;
|
|
21
|
+
}
|
|
22
|
+
export declare class McpErrorHandler {
|
|
23
|
+
static formatError(error: any): McpError;
|
|
24
|
+
}
|
|
25
|
+
//# sourceMappingURL=McpErrorHandler.d.ts.map
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
// MCP-specific error handling following MCP standards
|
|
2
|
+
export var McpErrorCode;
|
|
3
|
+
(function (McpErrorCode) {
|
|
4
|
+
McpErrorCode[McpErrorCode["ParseError"] = -32700] = "ParseError";
|
|
5
|
+
McpErrorCode[McpErrorCode["InvalidRequest"] = -32600] = "InvalidRequest";
|
|
6
|
+
McpErrorCode[McpErrorCode["MethodNotFound"] = -32601] = "MethodNotFound";
|
|
7
|
+
McpErrorCode[McpErrorCode["InvalidParams"] = -32602] = "InvalidParams";
|
|
8
|
+
McpErrorCode[McpErrorCode["InternalError"] = -32603] = "InternalError";
|
|
9
|
+
McpErrorCode[McpErrorCode["ExternalServiceUnavailable"] = -32001] = "ExternalServiceUnavailable"; // External resource offline/unavailable
|
|
10
|
+
})(McpErrorCode || (McpErrorCode = {}));
|
|
11
|
+
export class McpError extends Error {
|
|
12
|
+
code;
|
|
13
|
+
data;
|
|
14
|
+
constructor(code, message, data) {
|
|
15
|
+
super(message);
|
|
16
|
+
this.code = code;
|
|
17
|
+
this.data = data;
|
|
18
|
+
this.name = 'McpError';
|
|
19
|
+
}
|
|
20
|
+
toResponse() {
|
|
21
|
+
return {
|
|
22
|
+
error: {
|
|
23
|
+
code: this.code,
|
|
24
|
+
message: this.message,
|
|
25
|
+
data: this.data
|
|
26
|
+
}
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
export class McpErrorHandler {
|
|
31
|
+
static formatError(error) {
|
|
32
|
+
if (error instanceof McpError) {
|
|
33
|
+
return error;
|
|
34
|
+
}
|
|
35
|
+
if (error.error) {
|
|
36
|
+
error = error.error;
|
|
37
|
+
}
|
|
38
|
+
if (error instanceof McpError) {
|
|
39
|
+
return error;
|
|
40
|
+
}
|
|
41
|
+
// Extract error message from various sources
|
|
42
|
+
let message = error.message || error.toString();
|
|
43
|
+
if (!message) {
|
|
44
|
+
message = JSON.stringify(error);
|
|
45
|
+
}
|
|
46
|
+
// Map common errors to MCP error codes
|
|
47
|
+
if (message?.includes('not found')) {
|
|
48
|
+
return new McpError(McpErrorCode.InvalidParams, message, { originalError: error });
|
|
49
|
+
}
|
|
50
|
+
if (message?.includes('validation')) {
|
|
51
|
+
return new McpError(McpErrorCode.InvalidParams, 'Parameter validation failed', { originalError: error });
|
|
52
|
+
}
|
|
53
|
+
if (message?.includes('ECONNREFUSED')) {
|
|
54
|
+
return new McpError(McpErrorCode.ExternalServiceUnavailable, 'External API is unavailable, try ucm_connect to verify your connection', { originalError: error });
|
|
55
|
+
}
|
|
56
|
+
if (message?.includes('validation') || message?.includes('invalid') ||
|
|
57
|
+
message?.includes('required') || message?.includes('must be')) {
|
|
58
|
+
return new McpError(McpErrorCode.InvalidParams, message, { originalError: error });
|
|
59
|
+
}
|
|
60
|
+
if (message?.includes('UCM API server error')) {
|
|
61
|
+
return new McpError(McpErrorCode.InternalError, message, { originalError: error });
|
|
62
|
+
}
|
|
63
|
+
// Don't leak internal errors
|
|
64
|
+
return new McpError(McpErrorCode.InternalError, message || 'An internal error occurred');
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
//# sourceMappingURL=McpErrorHandler.js.map
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Utility functions for parsing UCM paths into component parts
|
|
3
|
+
*/
|
|
4
|
+
export interface ParsedPath {
|
|
5
|
+
author?: string | undefined;
|
|
6
|
+
repository?: string | undefined;
|
|
7
|
+
category?: string | undefined;
|
|
8
|
+
subcategory?: string | undefined;
|
|
9
|
+
filename?: string;
|
|
10
|
+
version?: string;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Parse a UCM path into its component parts
|
|
14
|
+
* Supports formats like:
|
|
15
|
+
* - "utaba/main/commands/user" (namespace only)
|
|
16
|
+
* - "utaba/main/commands/user/CreateUserCommand.ts" (with filename)
|
|
17
|
+
* - "utaba/main/commands/user/CreateUserCommand.ts@1.0.0" (with version)
|
|
18
|
+
*/
|
|
19
|
+
export declare function parsePath(path: string): ParsedPath;
|
|
20
|
+
/**
|
|
21
|
+
* Build a namespace path from components (author/repository/category/subcategory)
|
|
22
|
+
*/
|
|
23
|
+
export declare function buildNamespacePath(author: string, repository: string, category: string, subcategory: string): string;
|
|
24
|
+
/**
|
|
25
|
+
* Build a full path with filename and optional version
|
|
26
|
+
*/
|
|
27
|
+
export declare function buildFullPath(author: string, repository: string, category: string, subcategory: string, filename?: string, version?: string): string;
|
|
28
|
+
/**
|
|
29
|
+
* Extract namespace from a full path
|
|
30
|
+
*/
|
|
31
|
+
export declare function extractNamespace(path: string): string;
|
|
32
|
+
/**
|
|
33
|
+
* Validate if a path follows UCM naming conventions
|
|
34
|
+
*/
|
|
35
|
+
export declare function validatePath(path: string): {
|
|
36
|
+
isValid: boolean;
|
|
37
|
+
errors: string[];
|
|
38
|
+
};
|
|
39
|
+
/**
|
|
40
|
+
* Compare two semantic versions
|
|
41
|
+
* Returns: -1 if version1 < version2, 0 if equal, 1 if version1 > version2
|
|
42
|
+
*/
|
|
43
|
+
export declare function compareVersions(version1: string, version2: string): number;
|
|
44
|
+
/**
|
|
45
|
+
* Check if a version is greater than another version
|
|
46
|
+
*/
|
|
47
|
+
export declare function isVersionGreater(version1: string, version2: string): boolean;
|
|
48
|
+
/**
|
|
49
|
+
* Check if a version is less than another version
|
|
50
|
+
*/
|
|
51
|
+
export declare function isVersionLess(version1: string, version2: string): boolean;
|
|
52
|
+
/**
|
|
53
|
+
* Check if two versions are equal
|
|
54
|
+
*/
|
|
55
|
+
export declare function isVersionEqual(version1: string, version2: string): boolean;
|
|
56
|
+
/**
|
|
57
|
+
* Increment the patch version of a semantic version
|
|
58
|
+
* Examples: 1.0.0 -> 1.0.1, 2.1.5 -> 2.1.6
|
|
59
|
+
*/
|
|
60
|
+
export declare function incrementPatchVersion(version: string): string;
|
|
61
|
+
//# sourceMappingURL=PathUtils.d.ts.map
|