@softeria/ms-365-mcp-server 0.19.2 → 0.20.1
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/generated/client.js +40 -18
- package/dist/graph-client.js +55 -5
- package/dist/graph-tools.js +26 -1
- package/package.json +1 -1
package/dist/generated/client.js
CHANGED
|
@@ -870,17 +870,39 @@ const microsoft_graph_workbookPivotTable = z.lazy(
|
|
|
870
870
|
}).strict()
|
|
871
871
|
);
|
|
872
872
|
const microsoft_graph_workbookWorksheetProtectionOptions = z.object({
|
|
873
|
-
allowAutoFilter: z.boolean().describe(
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
873
|
+
allowAutoFilter: z.boolean().describe(
|
|
874
|
+
"Indicates whether the worksheet protection option to allow the use of the autofilter feature is enabled."
|
|
875
|
+
).optional(),
|
|
876
|
+
allowDeleteColumns: z.boolean().describe(
|
|
877
|
+
"Indicates whether the worksheet protection option to allow deleting columns is enabled."
|
|
878
|
+
).optional(),
|
|
879
|
+
allowDeleteRows: z.boolean().describe(
|
|
880
|
+
"Indicates whether the worksheet protection option to allow deleting rows is enabled."
|
|
881
|
+
).optional(),
|
|
882
|
+
allowFormatCells: z.boolean().describe(
|
|
883
|
+
"Indicates whether the worksheet protection option to allow formatting cells is enabled."
|
|
884
|
+
).optional(),
|
|
885
|
+
allowFormatColumns: z.boolean().describe(
|
|
886
|
+
"Indicates whether the worksheet protection option to allow formatting columns is enabled."
|
|
887
|
+
).optional(),
|
|
888
|
+
allowFormatRows: z.boolean().describe(
|
|
889
|
+
"Indicates whether the worksheet protection option to allow formatting rows is enabled."
|
|
890
|
+
).optional(),
|
|
891
|
+
allowInsertColumns: z.boolean().describe(
|
|
892
|
+
"Indicates whether the worksheet protection option to allow inserting columns is enabled."
|
|
893
|
+
).optional(),
|
|
894
|
+
allowInsertHyperlinks: z.boolean().describe(
|
|
895
|
+
"Indicates whether the worksheet protection option to allow inserting hyperlinks is enabled."
|
|
896
|
+
).optional(),
|
|
897
|
+
allowInsertRows: z.boolean().describe(
|
|
898
|
+
"Indicates whether the worksheet protection option to allow inserting rows is enabled."
|
|
899
|
+
).optional(),
|
|
900
|
+
allowPivotTables: z.boolean().describe(
|
|
901
|
+
"Indicates whether the worksheet protection option to allow the use of the pivot table feature is enabled."
|
|
902
|
+
).optional(),
|
|
903
|
+
allowSort: z.boolean().describe(
|
|
904
|
+
"Indicates whether the worksheet protection option to allow the use of the sort feature is enabled."
|
|
905
|
+
).optional()
|
|
884
906
|
}).strict();
|
|
885
907
|
const microsoft_graph_workbookWorksheetProtection = z.object({
|
|
886
908
|
id: z.string().describe("The unique identifier for an entity. Read-only.").optional(),
|
|
@@ -6326,7 +6348,7 @@ open extensions or extended properties, and how to specify extended properties.`
|
|
|
6326
6348
|
method: "delete",
|
|
6327
6349
|
path: "/me/messages/:messageId",
|
|
6328
6350
|
alias: "delete-mail-message",
|
|
6329
|
-
description: `Delete
|
|
6351
|
+
description: `Delete eventMessage.`,
|
|
6330
6352
|
requestFormat: "json",
|
|
6331
6353
|
parameters: [
|
|
6332
6354
|
{
|
|
@@ -6420,9 +6442,8 @@ open extensions or extended properties, and how to specify extended properties.`
|
|
|
6420
6442
|
method: "post",
|
|
6421
6443
|
path: "/me/messages/:messageId/attachments",
|
|
6422
6444
|
alias: "add-mail-attachment",
|
|
6423
|
-
description: `Use this API to
|
|
6424
|
-
resource
|
|
6425
|
-
add an attachment to a message that is being created and sent on the fly. This operation limits the size of the attachment you can add to under 3 MB.`,
|
|
6445
|
+
description: `Use this API to create a new Attachment. An attachment can be one of the following types: All these types of attachment resources are derived from the attachment
|
|
6446
|
+
resource.`,
|
|
6426
6447
|
requestFormat: "json",
|
|
6427
6448
|
parameters: [
|
|
6428
6449
|
{
|
|
@@ -7785,7 +7806,8 @@ add an attachment to a message that is being created and sent on the fly. This o
|
|
|
7785
7806
|
method: "get",
|
|
7786
7807
|
path: "/sites",
|
|
7787
7808
|
alias: "search-sharepoint-sites",
|
|
7788
|
-
description: `
|
|
7809
|
+
description: `List all available sites in an organization. Specific filter criteria and query options are also supported and described below: In addition, you can use a $search query against the /sites collection to find sites matching given keywords.
|
|
7810
|
+
If you want to list all sites across all geographies, refer to getAllSites. For more guidance about building applications that use site discovery for scanning purposes, see Best practices for discovering files and detecting changes at scale.`,
|
|
7789
7811
|
requestFormat: "json",
|
|
7790
7812
|
parameters: [
|
|
7791
7813
|
{
|
|
@@ -8724,7 +8746,7 @@ To monitor future changes, call the delta API by using the @odata.deltaLink in t
|
|
|
8724
8746
|
method: "post",
|
|
8725
8747
|
path: "/teams/:teamId/channels/:channelId/messages",
|
|
8726
8748
|
alias: "send-channel-message",
|
|
8727
|
-
description: `Send a new chatMessage in the specified channel
|
|
8749
|
+
description: `Send a new chatMessage in the specified channel.`,
|
|
8728
8750
|
requestFormat: "json",
|
|
8729
8751
|
parameters: [
|
|
8730
8752
|
{
|
|
@@ -8861,7 +8883,7 @@ To monitor future changes, call the delta API by using the @odata.deltaLink in t
|
|
|
8861
8883
|
method: "get",
|
|
8862
8884
|
path: "/users",
|
|
8863
8885
|
alias: "list-users",
|
|
8864
|
-
description: `
|
|
8886
|
+
description: `List properties and relationships of the user objects.`,
|
|
8865
8887
|
requestFormat: "json",
|
|
8866
8888
|
parameters: [
|
|
8867
8889
|
{
|
package/dist/graph-client.js
CHANGED
|
@@ -43,14 +43,26 @@ class GraphClient {
|
|
|
43
43
|
);
|
|
44
44
|
}
|
|
45
45
|
const text = await response.text();
|
|
46
|
+
let result;
|
|
46
47
|
if (text === "") {
|
|
47
|
-
|
|
48
|
+
result = { message: "OK!" };
|
|
49
|
+
} else {
|
|
50
|
+
try {
|
|
51
|
+
result = JSON.parse(text);
|
|
52
|
+
} catch {
|
|
53
|
+
result = { message: "OK!", rawResponse: text };
|
|
54
|
+
}
|
|
48
55
|
}
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
56
|
+
if (options.includeHeaders) {
|
|
57
|
+
const etag = response.headers.get("ETag") || response.headers.get("etag");
|
|
58
|
+
if (result && typeof result === "object" && !Array.isArray(result)) {
|
|
59
|
+
return {
|
|
60
|
+
...result,
|
|
61
|
+
_etag: etag || "no-etag-found"
|
|
62
|
+
};
|
|
63
|
+
}
|
|
53
64
|
}
|
|
65
|
+
return result;
|
|
54
66
|
} catch (error) {
|
|
55
67
|
logger.error("Microsoft Graph API request failed:", error);
|
|
56
68
|
throw error;
|
|
@@ -96,6 +108,44 @@ class GraphClient {
|
|
|
96
108
|
}
|
|
97
109
|
}
|
|
98
110
|
formatJsonResponse(data, rawResponse = false) {
|
|
111
|
+
if (data && typeof data === "object" && "_headers" in data) {
|
|
112
|
+
const responseData = data;
|
|
113
|
+
const meta = {};
|
|
114
|
+
if (responseData._etag) {
|
|
115
|
+
meta.etag = responseData._etag;
|
|
116
|
+
}
|
|
117
|
+
if (responseData._headers) {
|
|
118
|
+
meta.headers = responseData._headers;
|
|
119
|
+
}
|
|
120
|
+
if (rawResponse) {
|
|
121
|
+
return {
|
|
122
|
+
content: [{ type: "text", text: JSON.stringify(responseData.data) }],
|
|
123
|
+
_meta: meta
|
|
124
|
+
};
|
|
125
|
+
}
|
|
126
|
+
if (responseData.data === null || responseData.data === void 0) {
|
|
127
|
+
return {
|
|
128
|
+
content: [{ type: "text", text: JSON.stringify({ success: true }) }],
|
|
129
|
+
_meta: meta
|
|
130
|
+
};
|
|
131
|
+
}
|
|
132
|
+
const removeODataProps2 = (obj) => {
|
|
133
|
+
if (typeof obj === "object" && obj !== null) {
|
|
134
|
+
Object.keys(obj).forEach((key) => {
|
|
135
|
+
if (key.startsWith("@odata.")) {
|
|
136
|
+
delete obj[key];
|
|
137
|
+
} else if (typeof obj[key] === "object") {
|
|
138
|
+
removeODataProps2(obj[key]);
|
|
139
|
+
}
|
|
140
|
+
});
|
|
141
|
+
}
|
|
142
|
+
};
|
|
143
|
+
removeODataProps2(responseData.data);
|
|
144
|
+
return {
|
|
145
|
+
content: [{ type: "text", text: JSON.stringify(responseData.data, null, 2) }],
|
|
146
|
+
_meta: meta
|
|
147
|
+
};
|
|
148
|
+
}
|
|
99
149
|
if (rawResponse) {
|
|
100
150
|
return {
|
|
101
151
|
content: [{ type: "text", text: JSON.stringify(data) }]
|
package/dist/graph-tools.js
CHANGED
|
@@ -42,6 +42,7 @@ function registerGraphTools(server, graphClient, readOnly = false, enabledToolsP
|
|
|
42
42
|
if (tool.method.toUpperCase() === "GET" && tool.path.includes("/")) {
|
|
43
43
|
paramSchema["fetchAllPages"] = z.boolean().describe("Automatically fetch all pages of results").optional();
|
|
44
44
|
}
|
|
45
|
+
paramSchema["includeHeaders"] = z.boolean().describe("Include response headers (including ETag) in the response metadata").optional();
|
|
45
46
|
server.tool(
|
|
46
47
|
tool.alias,
|
|
47
48
|
tool.description || `Execute ${tool.method.toUpperCase()} request to ${tool.path}`,
|
|
@@ -63,6 +64,9 @@ function registerGraphTools(server, graphClient, readOnly = false, enabledToolsP
|
|
|
63
64
|
if (paramName === "fetchAllPages") {
|
|
64
65
|
continue;
|
|
65
66
|
}
|
|
67
|
+
if (paramName === "includeHeaders") {
|
|
68
|
+
continue;
|
|
69
|
+
}
|
|
66
70
|
const odataParams = [
|
|
67
71
|
"filter",
|
|
68
72
|
"select",
|
|
@@ -85,7 +89,25 @@ function registerGraphTools(server, graphClient, readOnly = false, enabledToolsP
|
|
|
85
89
|
queryParams[fixedParamName] = `${paramValue}`;
|
|
86
90
|
break;
|
|
87
91
|
case "Body":
|
|
88
|
-
|
|
92
|
+
if (paramDef.schema) {
|
|
93
|
+
const parseResult = paramDef.schema.safeParse(paramValue);
|
|
94
|
+
if (!parseResult.success) {
|
|
95
|
+
const wrapped = { [paramName]: paramValue };
|
|
96
|
+
const wrappedResult = paramDef.schema.safeParse(wrapped);
|
|
97
|
+
if (wrappedResult.success) {
|
|
98
|
+
logger.info(
|
|
99
|
+
`Auto-corrected parameter '${paramName}': AI passed nested field directly, wrapped it as {${paramName}: ...}`
|
|
100
|
+
);
|
|
101
|
+
body = wrapped;
|
|
102
|
+
} else {
|
|
103
|
+
body = paramValue;
|
|
104
|
+
}
|
|
105
|
+
} else {
|
|
106
|
+
body = paramValue;
|
|
107
|
+
}
|
|
108
|
+
} else {
|
|
109
|
+
body = paramValue;
|
|
110
|
+
}
|
|
89
111
|
break;
|
|
90
112
|
case "Header":
|
|
91
113
|
headers[fixedParamName] = `${paramValue}`;
|
|
@@ -111,6 +133,9 @@ function registerGraphTools(server, graphClient, readOnly = false, enabledToolsP
|
|
|
111
133
|
if (isProbablyMediaContent) {
|
|
112
134
|
options.rawResponse = true;
|
|
113
135
|
}
|
|
136
|
+
if (params.includeHeaders === true) {
|
|
137
|
+
options.includeHeaders = true;
|
|
138
|
+
}
|
|
114
139
|
logger.info(`Making graph request to ${path2} with options: ${JSON.stringify(options)}`);
|
|
115
140
|
let response = await graphClient.graphRequest(path2, options);
|
|
116
141
|
const fetchAllPages = params.fetchAllPages === true;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@softeria/ms-365-mcp-server",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.20.1",
|
|
4
4
|
"description": " A Model Context Protocol (MCP) server for interacting with Microsoft 365 and Office services through the Graph API",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|