@softeria/ms-365-mcp-server 0.23.0 → 0.24.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/bin/modules/generate-mcp-tools.mjs +6 -0
- package/dist/auth.js +20 -2
- package/dist/generated/client.js +1 -1
- package/dist/index.js +1 -1
- package/dist/server.js +2 -2
- package/package.json +1 -1
|
@@ -27,6 +27,12 @@ export function generateMcpTools(openApiSpec, outputDir) {
|
|
|
27
27
|
|
|
28
28
|
let clientCode = fs.readFileSync(clientFilePath, 'utf-8');
|
|
29
29
|
clientCode = clientCode.replace(/'@zodios\/core';/, "'./hack.js';");
|
|
30
|
+
|
|
31
|
+
clientCode = clientCode.replace(
|
|
32
|
+
/const microsoft_graph_attachment = z\s+\.object\({[\s\S]*?}\)\s+\.strict\(\);/,
|
|
33
|
+
(match) => match.replace(/\.strict\(\);/, '.passthrough();')
|
|
34
|
+
);
|
|
35
|
+
|
|
30
36
|
fs.writeFileSync(clientFilePath, clientCode);
|
|
31
37
|
|
|
32
38
|
return true;
|
package/dist/auth.js
CHANGED
|
@@ -31,9 +31,23 @@ const SCOPE_HIERARCHY = {
|
|
|
31
31
|
"Tasks.ReadWrite": ["Tasks.Read"],
|
|
32
32
|
"Contacts.ReadWrite": ["Contacts.Read"]
|
|
33
33
|
};
|
|
34
|
-
function buildScopesFromEndpoints(includeWorkAccountScopes = false) {
|
|
34
|
+
function buildScopesFromEndpoints(includeWorkAccountScopes = false, enabledToolsPattern) {
|
|
35
35
|
const scopesSet = /* @__PURE__ */ new Set();
|
|
36
|
+
let enabledToolsRegex;
|
|
37
|
+
if (enabledToolsPattern) {
|
|
38
|
+
try {
|
|
39
|
+
enabledToolsRegex = new RegExp(enabledToolsPattern, "i");
|
|
40
|
+
logger.info(`Building scopes with tool filter pattern: ${enabledToolsPattern}`);
|
|
41
|
+
} catch (error) {
|
|
42
|
+
logger.error(
|
|
43
|
+
`Invalid tool filter regex pattern: ${enabledToolsPattern}. Building scopes without filter.`
|
|
44
|
+
);
|
|
45
|
+
}
|
|
46
|
+
}
|
|
36
47
|
endpoints.default.forEach((endpoint) => {
|
|
48
|
+
if (enabledToolsRegex && !enabledToolsRegex.test(endpoint.toolName)) {
|
|
49
|
+
return;
|
|
50
|
+
}
|
|
37
51
|
if (!includeWorkAccountScopes && !endpoint.scopes && endpoint.workScopes) {
|
|
38
52
|
return;
|
|
39
53
|
}
|
|
@@ -50,7 +64,11 @@ function buildScopesFromEndpoints(includeWorkAccountScopes = false) {
|
|
|
50
64
|
scopesSet.add(higherScope);
|
|
51
65
|
}
|
|
52
66
|
});
|
|
53
|
-
|
|
67
|
+
const scopes = Array.from(scopesSet);
|
|
68
|
+
if (enabledToolsPattern) {
|
|
69
|
+
logger.info(`Built ${scopes.length} scopes for filtered tools: ${scopes.join(", ")}`);
|
|
70
|
+
}
|
|
71
|
+
return scopes;
|
|
54
72
|
}
|
|
55
73
|
class AuthManager {
|
|
56
74
|
constructor(config = DEFAULT_CONFIG, scopes = buildScopesFromEndpoints()) {
|
package/dist/generated/client.js
CHANGED
|
@@ -1198,7 +1198,7 @@ const microsoft_graph_attachment = z.object({
|
|
|
1198
1198
|
).nullish(),
|
|
1199
1199
|
name: z.string().describe("The attachment's file name.").nullish(),
|
|
1200
1200
|
size: z.number().gte(-2147483648).lte(2147483647).describe("The length of the attachment in bytes.").optional()
|
|
1201
|
-
}).
|
|
1201
|
+
}).passthrough();
|
|
1202
1202
|
const microsoft_graph_attendeeType = z.enum(["required", "optional", "resource"]);
|
|
1203
1203
|
const microsoft_graph_dateTimeTimeZone = z.object({
|
|
1204
1204
|
dateTime: z.string().describe(
|
package/dist/index.js
CHANGED
|
@@ -12,7 +12,7 @@ async function main() {
|
|
|
12
12
|
if (includeWorkScopes) {
|
|
13
13
|
logger.info("Organization mode enabled - including work account scopes");
|
|
14
14
|
}
|
|
15
|
-
const scopes = buildScopesFromEndpoints(includeWorkScopes);
|
|
15
|
+
const scopes = buildScopesFromEndpoints(includeWorkScopes, args.enabledTools);
|
|
16
16
|
const authManager = new AuthManager(void 0, scopes);
|
|
17
17
|
await authManager.loadTokenCache();
|
|
18
18
|
if (args.login) {
|
package/dist/server.js
CHANGED
|
@@ -78,7 +78,7 @@ class MicrosoftGraphServer {
|
|
|
78
78
|
app.get("/.well-known/oauth-authorization-server", async (req, res) => {
|
|
79
79
|
const protocol = req.secure ? "https" : "http";
|
|
80
80
|
const url = new URL(`${protocol}://${req.get("host")}`);
|
|
81
|
-
const scopes = buildScopesFromEndpoints(this.options.orgMode);
|
|
81
|
+
const scopes = buildScopesFromEndpoints(this.options.orgMode, this.options.enabledTools);
|
|
82
82
|
res.json({
|
|
83
83
|
issuer: url.origin,
|
|
84
84
|
authorization_endpoint: `${url.origin}/authorize`,
|
|
@@ -95,7 +95,7 @@ class MicrosoftGraphServer {
|
|
|
95
95
|
app.get("/.well-known/oauth-protected-resource", async (req, res) => {
|
|
96
96
|
const protocol = req.secure ? "https" : "http";
|
|
97
97
|
const url = new URL(`${protocol}://${req.get("host")}`);
|
|
98
|
-
const scopes = buildScopesFromEndpoints(this.options.orgMode);
|
|
98
|
+
const scopes = buildScopesFromEndpoints(this.options.orgMode, this.options.enabledTools);
|
|
99
99
|
res.json({
|
|
100
100
|
resource: `${url.origin}/mcp`,
|
|
101
101
|
authorization_servers: [url.origin],
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@softeria/ms-365-mcp-server",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.24.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",
|