@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,169 @@
|
|
|
1
|
+
import { McpError, McpErrorCode } from '../utils/McpErrorHandler.js';
|
|
2
|
+
// Import utility tools
|
|
3
|
+
import { QuickstartTool } from '../tools/utility/QuickstartTool.js';
|
|
4
|
+
import { AuthorIndexTool } from '../tools/utility/AuthorIndexTool.js';
|
|
5
|
+
import { AuthorRecentsTool } from '../tools/utility/AuthorRecentsTool.js';
|
|
6
|
+
import { ListRepositoriesTool } from '../tools/utility/ListRepositoriesTool.js';
|
|
7
|
+
// Import core tools
|
|
8
|
+
import { GetArtifactTool } from '../tools/core/GetArtifactTool.js';
|
|
9
|
+
import { GetChunkTool } from '../tools/core/GetChunkTool.js';
|
|
10
|
+
import { PublishArtifactTool } from '../tools/core/PublishArtifactTool.js';
|
|
11
|
+
import { PublishArtifactFromFileTool } from '../tools/core/PublishArtifactFromFileTool.js';
|
|
12
|
+
import { ListArtifactsTool } from '../tools/core/ListArtifactsTool.js';
|
|
13
|
+
import { DeleteArtifactTool } from '../tools/core/DeleteArtifactTool.js';
|
|
14
|
+
import { GetArtifactVersionsTool } from '../tools/core/GetArtifactVersionsTool.js';
|
|
15
|
+
import { SearchArtifactsTool } from '../tools/core/SearchArtifactsTool.js';
|
|
16
|
+
import { EditArtifactMetadataTool } from '../tools/core/EditArtifactMetadataTool.js';
|
|
17
|
+
import { MoveArtifactTool } from '../tools/core/MoveArtifactTool.js';
|
|
18
|
+
// Import repository tools
|
|
19
|
+
import { CreateRepositoryTool } from '../tools/repository/CreateRepositoryTool.js';
|
|
20
|
+
import { GetRepositoryTool } from '../tools/repository/GetRepositoryTool.js';
|
|
21
|
+
import { UpdateRepositoryTool } from '../tools/repository/UpdateRepositoryTool.js';
|
|
22
|
+
// Import connection/SharePoint tools
|
|
23
|
+
import { ListConnectionsTool } from '../tools/sharepoint/SharePointListConnectionsTool.js';
|
|
24
|
+
// DEPRECATED: Legacy SharePoint tools - use ucm_connection_call_tool via unified gateway instead
|
|
25
|
+
// Commented out 2026-02-13 - pending confirmation that unified gateway works correctly
|
|
26
|
+
// import { SharePointSearchTool } from '../tools/sharepoint/SharePointSearchTool.js';
|
|
27
|
+
// import { SharePointListFoldersTool } from '../tools/sharepoint/SharePointListFoldersTool.js';
|
|
28
|
+
// import { SharePointReadFileTool } from '../tools/sharepoint/SharePointReadFileTool.js';
|
|
29
|
+
// import { SharePointReadRelatedFileTool } from '../tools/sharepoint/SharePointReadRelatedFileTool.js';
|
|
30
|
+
// Import unified authorization tools
|
|
31
|
+
import { SignOutTool } from '../tools/authorization/SignOutTool.js';
|
|
32
|
+
import { ListAuthorizationsTool } from '../tools/authorization/ListAuthorizationsTool.js';
|
|
33
|
+
// Import connection tools
|
|
34
|
+
import { AccessConnectionTool } from '../tools/connections/AccessConnectionTool.js';
|
|
35
|
+
import { CallRemoteToolTool } from '../tools/connections/CallRemoteToolTool.js';
|
|
36
|
+
// Import memory graph tools
|
|
37
|
+
import { GraphListTool } from '../tools/memory-graph/GraphListTool.js';
|
|
38
|
+
import { GraphCreateTool } from '../tools/memory-graph/GraphCreateTool.js';
|
|
39
|
+
import { GraphListTemplatesTool } from '../tools/memory-graph/GraphListTemplatesTool.js';
|
|
40
|
+
import { KnowledgeSetListTool } from '../tools/memory-graph/KnowledgeSetListTool.js';
|
|
41
|
+
import { KnowledgeSetOpenTool } from '../tools/memory-graph/KnowledgeSetOpenTool.js';
|
|
42
|
+
import { GraphOpenTool } from '../tools/memory-graph/GraphOpenTool.js';
|
|
43
|
+
import { GraphFindEntitiesTool } from '../tools/memory-graph/GraphFindEntitiesTool.js';
|
|
44
|
+
import { GraphGetEntityTool } from '../tools/memory-graph/GraphGetEntityTool.js';
|
|
45
|
+
import { GraphGetRelationshipsTool } from '../tools/memory-graph/GraphGetRelationshipsTool.js';
|
|
46
|
+
import { GraphExploreTool } from '../tools/memory-graph/GraphExploreTool.js';
|
|
47
|
+
import { GraphFindPathsTool } from '../tools/memory-graph/GraphFindPathsTool.js';
|
|
48
|
+
import { GraphTraverseTool } from '../tools/memory-graph/GraphTraverseTool.js';
|
|
49
|
+
import { GraphSearchTool } from '../tools/memory-graph/GraphSearchTool.js';
|
|
50
|
+
import { GraphCreateEntitiesTool } from '../tools/memory-graph/GraphCreateEntitiesTool.js';
|
|
51
|
+
import { GraphUpdateEntitiesTool } from '../tools/memory-graph/GraphUpdateEntitiesTool.js';
|
|
52
|
+
import { GraphDeleteEntitiesTool } from '../tools/memory-graph/GraphDeleteEntitiesTool.js';
|
|
53
|
+
import { GraphCreateRelationshipsTool } from '../tools/memory-graph/GraphCreateRelationshipsTool.js';
|
|
54
|
+
import { GraphDeleteRelationshipsTool } from '../tools/memory-graph/GraphDeleteRelationshipsTool.js';
|
|
55
|
+
import { GraphProposeVocabularyTool } from '../tools/memory-graph/GraphProposeVocabularyTool.js';
|
|
56
|
+
export class ToolRegistry {
|
|
57
|
+
ucmClient;
|
|
58
|
+
logger;
|
|
59
|
+
trustedAuthors;
|
|
60
|
+
authorId;
|
|
61
|
+
baseUrl;
|
|
62
|
+
tools = new Map();
|
|
63
|
+
constructor(ucmClient, logger, trustedAuthors = [], authorId, baseUrl) {
|
|
64
|
+
this.ucmClient = ucmClient;
|
|
65
|
+
this.logger = logger;
|
|
66
|
+
this.trustedAuthors = trustedAuthors;
|
|
67
|
+
this.authorId = authorId;
|
|
68
|
+
this.baseUrl = baseUrl;
|
|
69
|
+
this.registerTools();
|
|
70
|
+
}
|
|
71
|
+
registerTools() {
|
|
72
|
+
// Register utility tools
|
|
73
|
+
this.registerTool(new QuickstartTool(this.ucmClient, this.logger, this.authorId));
|
|
74
|
+
this.registerTool(new AuthorIndexTool(this.ucmClient, this.logger, this.authorId));
|
|
75
|
+
this.registerTool(new AuthorRecentsTool(this.ucmClient, this.logger, this.authorId));
|
|
76
|
+
this.registerTool(new ListRepositoriesTool(this.ucmClient, this.logger, this.authorId));
|
|
77
|
+
// Register core tools
|
|
78
|
+
this.registerTool(new GetArtifactTool(this.ucmClient, this.logger, this.authorId, this.trustedAuthors));
|
|
79
|
+
this.registerTool(new GetChunkTool(this.ucmClient, this.logger, this.authorId));
|
|
80
|
+
this.registerTool(new PublishArtifactFromFileTool(this.ucmClient, this.logger, this.authorId));
|
|
81
|
+
this.registerTool(new PublishArtifactTool(this.ucmClient, this.logger, this.authorId));
|
|
82
|
+
this.registerTool(new ListArtifactsTool(this.ucmClient, this.logger, this.authorId));
|
|
83
|
+
this.registerTool(new DeleteArtifactTool(this.ucmClient, this.logger, this.authorId));
|
|
84
|
+
this.registerTool(new GetArtifactVersionsTool(this.ucmClient, this.logger, this.authorId));
|
|
85
|
+
this.registerTool(new SearchArtifactsTool(this.ucmClient, this.logger, this.authorId));
|
|
86
|
+
this.registerTool(new EditArtifactMetadataTool(this.ucmClient, this.logger, this.authorId));
|
|
87
|
+
this.registerTool(new MoveArtifactTool(this.ucmClient, this.logger, this.authorId));
|
|
88
|
+
// Register repository tools
|
|
89
|
+
this.registerTool(new CreateRepositoryTool(this.ucmClient, this.logger, this.authorId));
|
|
90
|
+
this.registerTool(new GetRepositoryTool(this.ucmClient, this.logger, this.authorId));
|
|
91
|
+
this.registerTool(new UpdateRepositoryTool(this.ucmClient, this.logger, this.authorId));
|
|
92
|
+
// Register connection tools (ListConnectionsTool is unified - lists all connection types)
|
|
93
|
+
this.registerTool(new ListConnectionsTool(this.ucmClient, this.logger, this.authorId));
|
|
94
|
+
// DEPRECATED: Legacy SharePoint tools - use ucm_connection_call_tool via unified gateway instead
|
|
95
|
+
// Commented out 2026-02-13 - pending confirmation that unified gateway works correctly
|
|
96
|
+
// this.registerTool(new SharePointSearchTool(this.ucmClient, this.logger, this.authorId));
|
|
97
|
+
// this.registerTool(new SharePointListFoldersTool(this.ucmClient, this.logger, this.authorId));
|
|
98
|
+
// this.registerTool(new SharePointReadFileTool(this.ucmClient, this.logger, this.authorId));
|
|
99
|
+
// this.registerTool(new SharePointReadRelatedFileTool(this.ucmClient, this.logger, this.authorId));
|
|
100
|
+
// Register connection tools (unified gateway)
|
|
101
|
+
this.registerTool(new AccessConnectionTool(this.ucmClient, this.logger, this.authorId));
|
|
102
|
+
this.registerTool(new CallRemoteToolTool(this.ucmClient, this.logger, this.authorId));
|
|
103
|
+
// Register unified authorization tools
|
|
104
|
+
this.registerTool(new SignOutTool(this.ucmClient, this.logger, this.authorId));
|
|
105
|
+
this.registerTool(new ListAuthorizationsTool(this.ucmClient, this.logger, this.authorId));
|
|
106
|
+
// Register memory graph tools
|
|
107
|
+
this.registerTool(new GraphListTool(this.ucmClient, this.logger, this.authorId));
|
|
108
|
+
this.registerTool(new GraphCreateTool(this.ucmClient, this.logger, this.authorId));
|
|
109
|
+
this.registerTool(new GraphListTemplatesTool(this.ucmClient, this.logger, this.authorId));
|
|
110
|
+
this.registerTool(new KnowledgeSetListTool(this.ucmClient, this.logger, this.authorId));
|
|
111
|
+
this.registerTool(new KnowledgeSetOpenTool(this.ucmClient, this.logger, this.authorId));
|
|
112
|
+
this.registerTool(new GraphOpenTool(this.ucmClient, this.logger, this.authorId));
|
|
113
|
+
this.registerTool(new GraphFindEntitiesTool(this.ucmClient, this.logger, this.authorId));
|
|
114
|
+
this.registerTool(new GraphGetEntityTool(this.ucmClient, this.logger, this.authorId));
|
|
115
|
+
this.registerTool(new GraphGetRelationshipsTool(this.ucmClient, this.logger, this.authorId));
|
|
116
|
+
this.registerTool(new GraphExploreTool(this.ucmClient, this.logger, this.authorId));
|
|
117
|
+
this.registerTool(new GraphFindPathsTool(this.ucmClient, this.logger, this.authorId));
|
|
118
|
+
this.registerTool(new GraphTraverseTool(this.ucmClient, this.logger, this.authorId));
|
|
119
|
+
this.registerTool(new GraphSearchTool(this.ucmClient, this.logger, this.authorId));
|
|
120
|
+
this.registerTool(new GraphCreateEntitiesTool(this.ucmClient, this.logger, this.authorId));
|
|
121
|
+
this.registerTool(new GraphUpdateEntitiesTool(this.ucmClient, this.logger, this.authorId));
|
|
122
|
+
this.registerTool(new GraphDeleteEntitiesTool(this.ucmClient, this.logger, this.authorId));
|
|
123
|
+
this.registerTool(new GraphCreateRelationshipsTool(this.ucmClient, this.logger, this.authorId));
|
|
124
|
+
this.registerTool(new GraphDeleteRelationshipsTool(this.ucmClient, this.logger, this.authorId));
|
|
125
|
+
this.registerTool(new GraphProposeVocabularyTool(this.ucmClient, this.logger, this.authorId));
|
|
126
|
+
this.logger.info('ToolRegistry', `Registered ${this.tools.size} MCP tools`);
|
|
127
|
+
}
|
|
128
|
+
registerTool(tool) {
|
|
129
|
+
if (this.tools.has(tool.name)) {
|
|
130
|
+
this.logger.warn('ToolRegistry', `Tool ${tool.name} already registered, overwriting`);
|
|
131
|
+
}
|
|
132
|
+
this.tools.set(tool.name, tool);
|
|
133
|
+
this.logger.debug('ToolRegistry', `Registered tool: ${tool.name}`);
|
|
134
|
+
}
|
|
135
|
+
async listTools() {
|
|
136
|
+
const toolList = [];
|
|
137
|
+
for (const [, tool] of this.tools) {
|
|
138
|
+
toolList.push({
|
|
139
|
+
name: tool.name,
|
|
140
|
+
description: tool.description,
|
|
141
|
+
inputSchema: tool.inputSchema
|
|
142
|
+
});
|
|
143
|
+
}
|
|
144
|
+
return toolList;
|
|
145
|
+
}
|
|
146
|
+
async executeTool(name, params) {
|
|
147
|
+
const tool = this.tools.get(name);
|
|
148
|
+
if (!tool) {
|
|
149
|
+
throw new McpError(McpErrorCode.MethodNotFound, `Tool '${name}' not found`);
|
|
150
|
+
}
|
|
151
|
+
this.logger.debug('ToolRegistry', `Executing tool: ${name}`);
|
|
152
|
+
try {
|
|
153
|
+
const result = await tool.execute(params);
|
|
154
|
+
this.logger.debug('ToolRegistry', `Tool ${name} completed successfully`);
|
|
155
|
+
return result;
|
|
156
|
+
}
|
|
157
|
+
catch (error) {
|
|
158
|
+
this.logger.error('ToolRegistry', `Tool ${name} execution failed`, '', error);
|
|
159
|
+
throw error;
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
getToolCount() {
|
|
163
|
+
return this.tools.size;
|
|
164
|
+
}
|
|
165
|
+
hasToolnamed(name) {
|
|
166
|
+
return this.tools.has(name);
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
//# sourceMappingURL=ToolRegistry.js.map
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ListAuthorizationsTool - List all user's active OAuth authorizations
|
|
3
|
+
*/
|
|
4
|
+
import { BaseToolController } from '../base/BaseToolController.js';
|
|
5
|
+
import { UcmLocalApiClient } from '../../clients/UcmLocalApiClient.js';
|
|
6
|
+
import { ILogger } from '../../interfaces/ILogger.js';
|
|
7
|
+
export declare class ListAuthorizationsTool extends BaseToolController {
|
|
8
|
+
constructor(ucmClient: UcmLocalApiClient, logger: ILogger, publishingAuthorId?: string);
|
|
9
|
+
get name(): string;
|
|
10
|
+
get description(): string;
|
|
11
|
+
get inputSchema(): any;
|
|
12
|
+
protected validateParams(params: any): void;
|
|
13
|
+
protected handleExecute(params: {
|
|
14
|
+
connectionType?: string;
|
|
15
|
+
}): Promise<any>;
|
|
16
|
+
/**
|
|
17
|
+
* Format authorizations response as markdown
|
|
18
|
+
*/
|
|
19
|
+
private formatAuthorizationsResponse;
|
|
20
|
+
}
|
|
21
|
+
//# sourceMappingURL=ListAuthorizationsTool.d.ts.map
|
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ListAuthorizationsTool - List all user's active OAuth authorizations
|
|
3
|
+
*/
|
|
4
|
+
import { BaseToolController } from '../base/BaseToolController.js';
|
|
5
|
+
import { McpError, McpErrorCode } from '../../utils/McpErrorHandler.js';
|
|
6
|
+
export class ListAuthorizationsTool extends BaseToolController {
|
|
7
|
+
constructor(ucmClient, logger, publishingAuthorId) {
|
|
8
|
+
super(ucmClient, logger, publishingAuthorId);
|
|
9
|
+
}
|
|
10
|
+
get name() {
|
|
11
|
+
return 'ucm_connection_list_auth';
|
|
12
|
+
}
|
|
13
|
+
get description() {
|
|
14
|
+
return 'List all your active OAuth authorizations across connection types. Shows which services you are currently authorized to access, with expiry info and connection details.';
|
|
15
|
+
}
|
|
16
|
+
get inputSchema() {
|
|
17
|
+
return {
|
|
18
|
+
type: 'object',
|
|
19
|
+
properties: {
|
|
20
|
+
connectionType: {
|
|
21
|
+
type: 'string',
|
|
22
|
+
enum: ['sharepoint', 'remote-mcp', 'all'],
|
|
23
|
+
description: 'Filter by connection type. Default: "all"'
|
|
24
|
+
}
|
|
25
|
+
},
|
|
26
|
+
required: []
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
validateParams(params) {
|
|
30
|
+
super.validateParams(params);
|
|
31
|
+
// Validate connectionType if provided
|
|
32
|
+
if (params.connectionType) {
|
|
33
|
+
const validTypes = ['sharepoint', 'remote-mcp', 'all'];
|
|
34
|
+
if (!validTypes.includes(params.connectionType)) {
|
|
35
|
+
throw new McpError(McpErrorCode.InvalidParams, `connectionType must be one of: ${validTypes.join(', ')}`);
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
async handleExecute(params) {
|
|
40
|
+
const filter = params.connectionType || 'all';
|
|
41
|
+
this.logger.info('ListAuthorizationsTool', `Listing authorizations (filter: ${filter})`);
|
|
42
|
+
try {
|
|
43
|
+
// Call API to list authorizations
|
|
44
|
+
const result = await this.ucmClient.listAuthorizations(filter);
|
|
45
|
+
this.logger.info('ListAuthorizationsTool', 'Authorizations retrieved successfully', '', {
|
|
46
|
+
filter,
|
|
47
|
+
count: result.authorizations?.length || 0
|
|
48
|
+
});
|
|
49
|
+
// Return structured markdown response
|
|
50
|
+
const markdown = this.formatAuthorizationsResponse(result, filter);
|
|
51
|
+
return markdown;
|
|
52
|
+
}
|
|
53
|
+
catch (error) {
|
|
54
|
+
const sanitizedError = {
|
|
55
|
+
message: error?.message,
|
|
56
|
+
status: error?.response?.status,
|
|
57
|
+
data: error?.response?.data
|
|
58
|
+
};
|
|
59
|
+
this.logger.error('ListAuthorizationsTool', 'Failed to list authorizations', '', sanitizedError);
|
|
60
|
+
if (error instanceof McpError) {
|
|
61
|
+
throw error;
|
|
62
|
+
}
|
|
63
|
+
if (error.response) {
|
|
64
|
+
const status = error.response.status;
|
|
65
|
+
const errorData = error.response.data;
|
|
66
|
+
if (status === 401 || status === 403) {
|
|
67
|
+
throw new McpError(McpErrorCode.InvalidRequest, `Access denied: ${errorData?.message || 'Not authorized'}`);
|
|
68
|
+
}
|
|
69
|
+
throw new McpError(McpErrorCode.InternalError, `API error: ${errorData?.message || error.message}`);
|
|
70
|
+
}
|
|
71
|
+
throw new McpError(McpErrorCode.InternalError, `Failed to list authorizations: ${error.message}`);
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* Format authorizations response as markdown
|
|
76
|
+
*/
|
|
77
|
+
formatAuthorizationsResponse(result, filter) {
|
|
78
|
+
const lines = [];
|
|
79
|
+
const authorizations = result.authorizations || [];
|
|
80
|
+
lines.push('# Your OAuth Authorizations\n');
|
|
81
|
+
if (authorizations.length === 0) {
|
|
82
|
+
if (filter === 'all') {
|
|
83
|
+
lines.push('You have no active OAuth authorizations.\n');
|
|
84
|
+
lines.push('When you access services that require OAuth (like SharePoint or Remote MCP Servers), you will be prompted to authorize.');
|
|
85
|
+
}
|
|
86
|
+
else {
|
|
87
|
+
lines.push(`You have no active ${filter} authorizations.\n`);
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
else {
|
|
91
|
+
lines.push(`Found ${authorizations.length} active authorization(s)${filter !== 'all' ? ` for ${filter}` : ''}.\n`);
|
|
92
|
+
// Group by connection type
|
|
93
|
+
const grouped = new Map();
|
|
94
|
+
for (const auth of authorizations) {
|
|
95
|
+
const type = auth.connectionType || 'other';
|
|
96
|
+
if (!grouped.has(type)) {
|
|
97
|
+
grouped.set(type, []);
|
|
98
|
+
}
|
|
99
|
+
grouped.get(type).push(auth);
|
|
100
|
+
}
|
|
101
|
+
const typeNames = {
|
|
102
|
+
'sharepoint': 'SharePoint Connections',
|
|
103
|
+
'remote-mcp': 'Remote MCP Servers'
|
|
104
|
+
};
|
|
105
|
+
for (const [type, auths] of grouped) {
|
|
106
|
+
const typeName = typeNames[type] || type;
|
|
107
|
+
lines.push(`## ${typeName}\n`);
|
|
108
|
+
for (const auth of auths) {
|
|
109
|
+
const now = new Date();
|
|
110
|
+
const refreshTokenExpiresAt = auth.refreshTokenExpiresAt ? new Date(auth.refreshTokenExpiresAt) : null;
|
|
111
|
+
const accessTokenExpiresAt = auth.expiresAt ? new Date(auth.expiresAt) : null;
|
|
112
|
+
// Authorization is expired only if refresh token has expired
|
|
113
|
+
// Access token expiry doesn't matter - it will auto-refresh
|
|
114
|
+
const isExpired = refreshTokenExpiresAt ? refreshTokenExpiresAt < now : false;
|
|
115
|
+
const accessTokenExpired = accessTokenExpiresAt ? accessTokenExpiresAt < now : false;
|
|
116
|
+
let status;
|
|
117
|
+
if (isExpired) {
|
|
118
|
+
status = '**Expired** (re-authorization required)';
|
|
119
|
+
}
|
|
120
|
+
else if (refreshTokenExpiresAt) {
|
|
121
|
+
status = `Active (valid until ${refreshTokenExpiresAt.toISOString()} UTC)`;
|
|
122
|
+
}
|
|
123
|
+
else {
|
|
124
|
+
// No refresh token expiry means it doesn't expire (e.g., Google)
|
|
125
|
+
status = 'Active (does not expire)';
|
|
126
|
+
}
|
|
127
|
+
lines.push(`### ${auth.connectionName || auth.connectionId}`);
|
|
128
|
+
lines.push(`- **Connection ID**: ${auth.connectionId}`);
|
|
129
|
+
lines.push(`- **Provider**: ${auth.providerType || type}`);
|
|
130
|
+
lines.push(`- **Status**: ${status}`);
|
|
131
|
+
if (accessTokenExpired && !isExpired) {
|
|
132
|
+
lines.push(`- **Note**: Access token expired but will auto-refresh on next use`);
|
|
133
|
+
}
|
|
134
|
+
if (auth.scopes) {
|
|
135
|
+
lines.push(`- **Scopes**: ${auth.scopes}`);
|
|
136
|
+
}
|
|
137
|
+
lines.push('');
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
lines.push('\n## Actions\n');
|
|
141
|
+
lines.push('To revoke an authorization, use: `ucm_connection_signout` with connectionType and connectionId');
|
|
142
|
+
}
|
|
143
|
+
return lines.join('\n');
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
//# sourceMappingURL=ListAuthorizationsTool.js.map
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* SignOutTool - Unified OAuth sign out for all connection types
|
|
3
|
+
* Replaces SharePointSignOutTool with a unified tool supporting multiple connection types
|
|
4
|
+
*/
|
|
5
|
+
import { BaseToolController } from '../base/BaseToolController.js';
|
|
6
|
+
import { UcmLocalApiClient } from '../../clients/UcmLocalApiClient.js';
|
|
7
|
+
import { ILogger } from '../../interfaces/ILogger.js';
|
|
8
|
+
export declare class SignOutTool extends BaseToolController {
|
|
9
|
+
constructor(ucmClient: UcmLocalApiClient, logger: ILogger, publishingAuthorId?: string);
|
|
10
|
+
get name(): string;
|
|
11
|
+
get description(): string;
|
|
12
|
+
get inputSchema(): any;
|
|
13
|
+
protected validateParams(params: any): void;
|
|
14
|
+
protected handleExecute(params: {
|
|
15
|
+
connectionType: string;
|
|
16
|
+
connectionId: string;
|
|
17
|
+
}): Promise<any>;
|
|
18
|
+
/**
|
|
19
|
+
* Format sign out response as markdown
|
|
20
|
+
*/
|
|
21
|
+
private formatSignOutResponse;
|
|
22
|
+
}
|
|
23
|
+
//# sourceMappingURL=SignOutTool.d.ts.map
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* SignOutTool - Unified OAuth sign out for all connection types
|
|
3
|
+
* Replaces SharePointSignOutTool with a unified tool supporting multiple connection types
|
|
4
|
+
*/
|
|
5
|
+
import { BaseToolController } from '../base/BaseToolController.js';
|
|
6
|
+
import { McpError, McpErrorCode } from '../../utils/McpErrorHandler.js';
|
|
7
|
+
export class SignOutTool extends BaseToolController {
|
|
8
|
+
constructor(ucmClient, logger, publishingAuthorId) {
|
|
9
|
+
super(ucmClient, logger, publishingAuthorId);
|
|
10
|
+
}
|
|
11
|
+
get name() {
|
|
12
|
+
return 'ucm_connection_signout';
|
|
13
|
+
}
|
|
14
|
+
get description() {
|
|
15
|
+
return 'Sign out from an OAuth-authorized connection. Revokes user-delegated permissions by deleting access tokens. Works for SharePoint OnBehalfOf connections and Remote MCP Servers with user-delegated OAuth.';
|
|
16
|
+
}
|
|
17
|
+
get inputSchema() {
|
|
18
|
+
return {
|
|
19
|
+
type: 'object',
|
|
20
|
+
properties: {
|
|
21
|
+
connectionType: {
|
|
22
|
+
type: 'string',
|
|
23
|
+
enum: ['sharepoint', 'remote-mcp'],
|
|
24
|
+
description: 'Type of connection: "sharepoint" or "remote-mcp"'
|
|
25
|
+
},
|
|
26
|
+
connectionId: {
|
|
27
|
+
type: 'string',
|
|
28
|
+
description: 'Connection ID to revoke authorization for (get from ucm_connection_list_auth or ucm_connection_list)',
|
|
29
|
+
minLength: 36,
|
|
30
|
+
maxLength: 36
|
|
31
|
+
}
|
|
32
|
+
},
|
|
33
|
+
required: ['connectionType', 'connectionId']
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
validateParams(params) {
|
|
37
|
+
super.validateParams(params);
|
|
38
|
+
// Validate connectionType
|
|
39
|
+
if (!params.connectionType || typeof params.connectionType !== 'string') {
|
|
40
|
+
throw new McpError(McpErrorCode.InvalidParams, 'connectionType is required and must be a string');
|
|
41
|
+
}
|
|
42
|
+
const validTypes = ['sharepoint', 'remote-mcp'];
|
|
43
|
+
if (!validTypes.includes(params.connectionType)) {
|
|
44
|
+
throw new McpError(McpErrorCode.InvalidParams, `connectionType must be one of: ${validTypes.join(', ')}`);
|
|
45
|
+
}
|
|
46
|
+
// Validate connectionId
|
|
47
|
+
if (!params.connectionId || typeof params.connectionId !== 'string') {
|
|
48
|
+
throw new McpError(McpErrorCode.InvalidParams, 'connectionId is required and must be a string');
|
|
49
|
+
}
|
|
50
|
+
if (params.connectionId.length !== 36) {
|
|
51
|
+
throw new McpError(McpErrorCode.InvalidParams, 'connectionId must be a valid UUID (36 characters)');
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
async handleExecute(params) {
|
|
55
|
+
this.logger.info('SignOutTool', `Revoking ${params.connectionType} authorization for connection ${params.connectionId}`);
|
|
56
|
+
try {
|
|
57
|
+
// Call unified API method
|
|
58
|
+
const result = await this.ucmClient.signOut(params.connectionType, params.connectionId);
|
|
59
|
+
this.logger.info('SignOutTool', 'Authorization revoked successfully', '', {
|
|
60
|
+
connectionType: params.connectionType,
|
|
61
|
+
connectionId: params.connectionId,
|
|
62
|
+
success: result.success
|
|
63
|
+
});
|
|
64
|
+
// Return structured markdown response
|
|
65
|
+
const markdown = this.formatSignOutResponse(params.connectionType, params.connectionId, result);
|
|
66
|
+
return markdown;
|
|
67
|
+
}
|
|
68
|
+
catch (error) {
|
|
69
|
+
// Sanitize error for logging to avoid circular reference issues
|
|
70
|
+
const sanitizedError = {
|
|
71
|
+
message: error?.message,
|
|
72
|
+
status: error?.response?.status,
|
|
73
|
+
data: error?.response?.data
|
|
74
|
+
};
|
|
75
|
+
this.logger.error('SignOutTool', 'Failed to revoke authorization', '', sanitizedError);
|
|
76
|
+
if (error instanceof McpError) {
|
|
77
|
+
throw error;
|
|
78
|
+
}
|
|
79
|
+
// Handle API errors
|
|
80
|
+
if (error.response) {
|
|
81
|
+
const status = error.response.status;
|
|
82
|
+
const errorData = error.response.data;
|
|
83
|
+
if (status === 401 || status === 403) {
|
|
84
|
+
throw new McpError(McpErrorCode.InvalidRequest, `Access denied: ${errorData?.message || 'Not authorized to revoke authorization'}`);
|
|
85
|
+
}
|
|
86
|
+
if (status === 404) {
|
|
87
|
+
throw new McpError(McpErrorCode.InvalidRequest, `Connection not found: ${errorData?.message || 'Connection does not exist'}`);
|
|
88
|
+
}
|
|
89
|
+
if (status === 400 && errorData?.error === 'INVALID_AUTH_TYPE') {
|
|
90
|
+
throw new McpError(McpErrorCode.InvalidRequest, `Invalid operation: This connection does not use user-delegated authentication.`);
|
|
91
|
+
}
|
|
92
|
+
throw new McpError(McpErrorCode.InternalError, `API error: ${errorData?.message || error.message}`);
|
|
93
|
+
}
|
|
94
|
+
throw new McpError(McpErrorCode.InternalError, `Failed to revoke authorization: ${error.message}`);
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
/**
|
|
98
|
+
* Format sign out response as markdown
|
|
99
|
+
*/
|
|
100
|
+
formatSignOutResponse(connectionType, connectionId, result) {
|
|
101
|
+
const lines = [];
|
|
102
|
+
const providerName = connectionType === 'sharepoint' ? 'SharePoint' : 'Remote MCP Server';
|
|
103
|
+
lines.push(`# ${providerName} Authorization Revoked\n`);
|
|
104
|
+
if (result.success) {
|
|
105
|
+
lines.push(`✅ **Status**: ${result.message || 'Authorization successfully revoked'}\n`);
|
|
106
|
+
lines.push(`**Connection ID**: ${result.connectionId || connectionId}\n`);
|
|
107
|
+
if (result.connectionName) {
|
|
108
|
+
lines.push(`**Connection Name**: ${result.connectionName}\n`);
|
|
109
|
+
}
|
|
110
|
+
if (result.revokedAt) {
|
|
111
|
+
lines.push(`**Revoked At**: ${new Date(result.revokedAt).toLocaleString()}\n`);
|
|
112
|
+
}
|
|
113
|
+
lines.push('\n## What This Means\n');
|
|
114
|
+
lines.push('- Your access tokens have been deleted from the system');
|
|
115
|
+
lines.push(`- You are now signed out of this ${providerName} connection`);
|
|
116
|
+
lines.push('- To access this service again, you will be prompted to re-authorize on next use\n');
|
|
117
|
+
}
|
|
118
|
+
else {
|
|
119
|
+
lines.push('⚠️ **Status**: Revocation failed or not needed\n');
|
|
120
|
+
lines.push(`**Message**: ${result.message}\n`);
|
|
121
|
+
if (result.details?.reason) {
|
|
122
|
+
lines.push(`**Reason**: ${result.details.reason}\n`);
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
return lines.join('\n');
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
//# sourceMappingURL=SignOutTool.js.map
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { IMcpTool } from '../../interfaces/IMcpTool.js';
|
|
2
|
+
import { UcmLocalApiClient } from '../../clients/UcmLocalApiClient.js';
|
|
3
|
+
import { ILogger } from '../../interfaces/ILogger.js';
|
|
4
|
+
import { ZodSchema } from 'zod';
|
|
5
|
+
export declare abstract class BaseToolController implements IMcpTool {
|
|
6
|
+
protected ucmClient: UcmLocalApiClient;
|
|
7
|
+
protected logger: ILogger;
|
|
8
|
+
protected publishingAuthorId?: string | undefined;
|
|
9
|
+
constructor(ucmClient: UcmLocalApiClient, logger: ILogger, publishingAuthorId?: string | undefined);
|
|
10
|
+
abstract get name(): string;
|
|
11
|
+
abstract get description(): string;
|
|
12
|
+
abstract get inputSchema(): Record<string, unknown>;
|
|
13
|
+
/** Override to provide a zod schema for runtime validation */
|
|
14
|
+
get schema(): ZodSchema | undefined;
|
|
15
|
+
execute(params: Record<string, unknown>): Promise<string>;
|
|
16
|
+
protected abstract handleExecute(params: Record<string, unknown>): Promise<string>;
|
|
17
|
+
protected validateParams(params: Record<string, unknown>): void;
|
|
18
|
+
}
|
|
19
|
+
//# sourceMappingURL=BaseToolController.d.ts.map
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { McpError, McpErrorCode } from '../../utils/McpErrorHandler.js';
|
|
2
|
+
import { ZodError } from 'zod';
|
|
3
|
+
export class BaseToolController {
|
|
4
|
+
ucmClient;
|
|
5
|
+
logger;
|
|
6
|
+
publishingAuthorId;
|
|
7
|
+
constructor(ucmClient, logger, publishingAuthorId) {
|
|
8
|
+
this.ucmClient = ucmClient;
|
|
9
|
+
this.logger = logger;
|
|
10
|
+
this.publishingAuthorId = publishingAuthorId;
|
|
11
|
+
}
|
|
12
|
+
/** Override to provide a zod schema for runtime validation */
|
|
13
|
+
get schema() { return undefined; }
|
|
14
|
+
async execute(params) {
|
|
15
|
+
try {
|
|
16
|
+
let validated;
|
|
17
|
+
if (this.schema) {
|
|
18
|
+
validated = this.schema.parse(params);
|
|
19
|
+
}
|
|
20
|
+
else {
|
|
21
|
+
this.validateParams(params);
|
|
22
|
+
validated = params;
|
|
23
|
+
}
|
|
24
|
+
return await this.handleExecute(validated);
|
|
25
|
+
}
|
|
26
|
+
catch (error) {
|
|
27
|
+
if (error instanceof ZodError) {
|
|
28
|
+
throw new McpError(McpErrorCode.InvalidParams, `Invalid parameters: ${error.errors.map(e => `${e.path.join('.')}: ${e.message}`).join(', ')}`);
|
|
29
|
+
}
|
|
30
|
+
// Sanitize error for logging to avoid circular reference issues with axios errors
|
|
31
|
+
const err = error;
|
|
32
|
+
const response = err?.response;
|
|
33
|
+
const config = err?.config;
|
|
34
|
+
const sanitizedError = {
|
|
35
|
+
message: err?.message,
|
|
36
|
+
name: err?.name,
|
|
37
|
+
status: response?.status,
|
|
38
|
+
statusText: response?.statusText,
|
|
39
|
+
data: response?.data,
|
|
40
|
+
url: config?.url
|
|
41
|
+
};
|
|
42
|
+
this.logger.error('BaseToolController', `Tool ${this.name} execution failed`, '', sanitizedError);
|
|
43
|
+
throw error;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
validateParams(params) {
|
|
47
|
+
// Legacy validation for tools that haven't adopted zod schemas yet
|
|
48
|
+
const schema = this.inputSchema;
|
|
49
|
+
if (schema.required) {
|
|
50
|
+
for (const field of schema.required) {
|
|
51
|
+
if (params[field] === undefined || params[field] === null) {
|
|
52
|
+
throw new McpError(McpErrorCode.InvalidParams, `Required parameter '${field}' is missing`);
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
//# sourceMappingURL=BaseToolController.js.map
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* AccessConnectionTool
|
|
3
|
+
* Access a specific external connection, check auth status, and return available tool schemas.
|
|
4
|
+
*
|
|
5
|
+
* Phase 2 of Unified Connection Gateway Implementation
|
|
6
|
+
*/
|
|
7
|
+
import { BaseToolController } from '../base/BaseToolController.js';
|
|
8
|
+
import { UcmLocalApiClient } from '../../clients/UcmLocalApiClient.js';
|
|
9
|
+
import { ILogger } from '../../interfaces/ILogger.js';
|
|
10
|
+
export declare class AccessConnectionTool extends BaseToolController {
|
|
11
|
+
constructor(ucmClient: UcmLocalApiClient, logger: ILogger, publishingAuthorId?: string);
|
|
12
|
+
get name(): string;
|
|
13
|
+
get description(): string;
|
|
14
|
+
get inputSchema(): any;
|
|
15
|
+
protected validateParams(params: any): void;
|
|
16
|
+
protected handleExecute(params: {
|
|
17
|
+
connectionId: string;
|
|
18
|
+
toolNames?: string[];
|
|
19
|
+
}): Promise<any>;
|
|
20
|
+
}
|
|
21
|
+
//# sourceMappingURL=AccessConnectionTool.d.ts.map
|