@utaba/ucm-mcp-server 4.3.0 → 4.3.2
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/server/McpConfig.js +1 -1
- package/dist/tools/base/BaseToolController.js +10 -1
- package/dist/tools/sharepoint/SharePointListConnectionsTool.js +7 -1
- package/dist/tools/sharepoint/SharePointListFoldersTool.js +1 -8
- package/dist/tools/sharepoint/SharePointReadRelatedFileTool.js +7 -1
- package/dist/tools/sharepoint/SharePointSearchTool.js +1 -10
- package/dist/tools/sharepoint/SharePointSignOutTool.js +7 -1
- package/dist/utils/SharePointErrorHandler.d.ts +6 -0
- package/dist/utils/SharePointErrorHandler.js +13 -5
- package/package.json +2 -2
- package/package.json.backup +2 -2
package/dist/server/McpConfig.js
CHANGED
|
@@ -11,7 +11,7 @@ export class McpConfig {
|
|
|
11
11
|
authToken: authToken,
|
|
12
12
|
authorId: options.authorId || authorId,
|
|
13
13
|
logLevel: options.logLevel || this.getEnvVar('MCP_LOG_LEVEL', 'ERROR'),
|
|
14
|
-
requestTimeout: options.requestTimeout || parseInt(this.getEnvVar('MCP_REQUEST_TIMEOUT', '
|
|
14
|
+
requestTimeout: options.requestTimeout || parseInt(this.getEnvVar('MCP_REQUEST_TIMEOUT', '300000')),
|
|
15
15
|
trustedAuthors: options.trustedAuthors || this.parseTrustedAuthors(this.getEnvVar('MCP_TRUSTED_AUTHORS', ''))
|
|
16
16
|
};
|
|
17
17
|
this.validateConfig();
|
|
@@ -14,7 +14,16 @@ export class BaseToolController {
|
|
|
14
14
|
return await this.handleExecute(params);
|
|
15
15
|
}
|
|
16
16
|
catch (error) {
|
|
17
|
-
|
|
17
|
+
// Sanitize error for logging to avoid circular reference issues with axios errors
|
|
18
|
+
const sanitizedError = {
|
|
19
|
+
message: error?.message,
|
|
20
|
+
name: error?.name,
|
|
21
|
+
status: error?.response?.status,
|
|
22
|
+
statusText: error?.response?.statusText,
|
|
23
|
+
data: error?.response?.data,
|
|
24
|
+
url: error?.config?.url
|
|
25
|
+
};
|
|
26
|
+
this.logger.error('BaseToolController', `Tool ${this.name} execution failed`, '', sanitizedError);
|
|
18
27
|
throw error;
|
|
19
28
|
}
|
|
20
29
|
}
|
|
@@ -64,7 +64,13 @@ export class SharePointListConnectionsTool extends BaseToolController {
|
|
|
64
64
|
return result;
|
|
65
65
|
}
|
|
66
66
|
catch (error) {
|
|
67
|
-
|
|
67
|
+
// Sanitize error for logging to avoid circular reference issues
|
|
68
|
+
const sanitizedError = {
|
|
69
|
+
message: error?.message,
|
|
70
|
+
status: error?.response?.status,
|
|
71
|
+
data: error?.response?.data
|
|
72
|
+
};
|
|
73
|
+
this.logger.error('SharePointListConnectionsTool', 'Failed to list connections', '', sanitizedError);
|
|
68
74
|
if (error instanceof McpError) {
|
|
69
75
|
throw error;
|
|
70
76
|
}
|
|
@@ -114,14 +114,7 @@ export class SharePointListFoldersTool extends BaseToolController {
|
|
|
114
114
|
createdDateTime: folder.createdDateTime,
|
|
115
115
|
lastModifiedDateTime: folder.lastModifiedDateTime
|
|
116
116
|
})) || [],
|
|
117
|
-
files: result.files
|
|
118
|
-
name: file.name,
|
|
119
|
-
webUrl: file.webUrl,
|
|
120
|
-
size: file.size,
|
|
121
|
-
mimeType: file.mimeType,
|
|
122
|
-
createdDateTime: file.createdDateTime,
|
|
123
|
-
lastModifiedDateTime: file.lastModifiedDateTime
|
|
124
|
-
})) || []
|
|
117
|
+
files: result.files || []
|
|
125
118
|
};
|
|
126
119
|
return {
|
|
127
120
|
content: [
|
|
@@ -84,7 +84,13 @@ export class SharePointReadRelatedFileTool extends BaseToolController {
|
|
|
84
84
|
};
|
|
85
85
|
}
|
|
86
86
|
catch (error) {
|
|
87
|
-
|
|
87
|
+
// Sanitize error for logging to avoid circular reference issues
|
|
88
|
+
const sanitizedError = {
|
|
89
|
+
message: error?.message,
|
|
90
|
+
status: error?.response?.status,
|
|
91
|
+
data: error?.response?.data
|
|
92
|
+
};
|
|
93
|
+
this.logger.error('SharePointReadRelatedFileTool', 'Read related file operation failed', '', sanitizedError);
|
|
88
94
|
// Format error response
|
|
89
95
|
if (error?.response?.status === 404) {
|
|
90
96
|
throw new McpError(McpErrorCode.InvalidParams, 'Related file not found. File may no longer be available. Re-read the parent document to access related files.');
|
|
@@ -111,16 +111,7 @@ export class SharePointSearchTool extends BaseToolController {
|
|
|
111
111
|
limit: params.limit,
|
|
112
112
|
offset: params.offset,
|
|
113
113
|
fileType: params.fileType,
|
|
114
|
-
files: result.files
|
|
115
|
-
id: file.id,
|
|
116
|
-
name: file.name,
|
|
117
|
-
webUrl: file.webUrl,
|
|
118
|
-
size: file.size,
|
|
119
|
-
mimeType: file.mimeType,
|
|
120
|
-
createdDateTime: file.createdDateTime,
|
|
121
|
-
lastModifiedDateTime: file.lastModifiedDateTime,
|
|
122
|
-
folder: file.folder
|
|
123
|
-
})) || []
|
|
114
|
+
files: result.files || []
|
|
124
115
|
}, null, 2)
|
|
125
116
|
}
|
|
126
117
|
]
|
|
@@ -52,7 +52,13 @@ export class SharePointSignOutTool extends BaseToolController {
|
|
|
52
52
|
return markdown;
|
|
53
53
|
}
|
|
54
54
|
catch (error) {
|
|
55
|
-
|
|
55
|
+
// Sanitize error for logging to avoid circular reference issues
|
|
56
|
+
const sanitizedError = {
|
|
57
|
+
message: error?.message,
|
|
58
|
+
status: error?.response?.status,
|
|
59
|
+
data: error?.response?.data
|
|
60
|
+
};
|
|
61
|
+
this.logger.error('SharePointSignOutTool', 'Failed to revoke authorization', '', sanitizedError);
|
|
56
62
|
if (error instanceof McpError) {
|
|
57
63
|
throw error;
|
|
58
64
|
}
|
|
@@ -12,12 +12,21 @@ export class SharePointErrorHandler {
|
|
|
12
12
|
* @returns ToolResult for authentication errors, throws McpError for others
|
|
13
13
|
*/
|
|
14
14
|
static handle(error, logger, toolName) {
|
|
15
|
-
|
|
15
|
+
// Extract only serializable error details for logging to avoid circular reference issues
|
|
16
|
+
const sanitizedError = {
|
|
17
|
+
message: error?.message,
|
|
18
|
+
status: error?.response?.status,
|
|
19
|
+
statusText: error?.response?.statusText,
|
|
20
|
+
data: error?.response?.data,
|
|
21
|
+
url: error?.config?.url
|
|
22
|
+
};
|
|
23
|
+
logger.error(toolName, 'SharePoint operation failed', '', sanitizedError);
|
|
16
24
|
const serverError = error?.response?.data;
|
|
17
25
|
// Handle SharePoint authentication required (OnBehalfOf flow)
|
|
18
26
|
if (error?.response?.status === 401 && serverError?.error === 'SHAREPOINT_LOGIN_REQUIRED') {
|
|
19
27
|
const userMessage = serverError.message || 'To access SharePoint, please login then continue your conversation.';
|
|
20
|
-
|
|
28
|
+
// loginUrl can be in serverError directly or in details (check both)
|
|
29
|
+
const loginUrl = serverError.loginUrl || serverError.details?.loginUrl;
|
|
21
30
|
return {
|
|
22
31
|
content: [
|
|
23
32
|
{
|
|
@@ -25,9 +34,8 @@ export class SharePointErrorHandler {
|
|
|
25
34
|
text: userMessage
|
|
26
35
|
},
|
|
27
36
|
{
|
|
28
|
-
type: '
|
|
29
|
-
|
|
30
|
-
mimeType: 'text/html'
|
|
37
|
+
type: 'text',
|
|
38
|
+
text: loginUrl
|
|
31
39
|
}
|
|
32
40
|
]
|
|
33
41
|
};
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@utaba/ucm-mcp-server",
|
|
3
|
-
"version": "4.3.
|
|
4
|
-
"description": "Universal Context Manager MCP Server - AI
|
|
3
|
+
"version": "4.3.2",
|
|
4
|
+
"description": "Universal Context Manager MCP Server - AI Productivity Platform",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"bin": {
|
package/package.json.backup
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ucm-mcp-server",
|
|
3
|
-
"version": "4.3.
|
|
4
|
-
"description": "Universal Context Manager MCP Server - AI
|
|
3
|
+
"version": "4.3.2",
|
|
4
|
+
"description": "Universal Context Manager MCP Server - AI Productivity Platform",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"bin": {
|