@softeria/ms-365-mcp-server 0.185.0 → 0.186.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/README.md +19 -0
- package/dist/apps/file-browser.html +677 -0
- package/dist/cli.js +6 -0
- package/dist/endpoints.json +6 -5
- package/dist/graph-tools.js +4 -1
- package/dist/mcp-apps.js +68 -0
- package/dist/mcp-instructions.js +4 -0
- package/dist/server.js +8 -1
- package/package.json +1 -1
- package/src/apps/file-browser.html +677 -0
- package/src/endpoints.json +6 -5
- package/tsup.config.ts +2 -1
package/dist/endpoints.json
CHANGED
|
@@ -183,7 +183,7 @@
|
|
|
183
183
|
"presets": ["work"],
|
|
184
184
|
"workScopes": ["Mail.ReadWrite.Shared"],
|
|
185
185
|
"appScopes": ["Mail.ReadWrite"],
|
|
186
|
-
"llmTip": "Create a reply draft in a shared mailbox preserving thread metadata (conversationId, In-Reply-To, References). The 'user-id' is the shared mailbox email address (e.g. support@contoso.com). Does not send — use send-shared-mailbox-draft to send afterwards.
|
|
186
|
+
"llmTip": "Create a reply draft in a shared mailbox preserving thread metadata (conversationId, In-Reply-To, References). The 'user-id' is the shared mailbox email address (e.g. support@contoso.com). Does not send — use send-shared-mailbox-draft to send afterwards. Message.body (contentType 'html' for HTML) replaces the whole draft body, dropping the quoted history; 'comment' keeps it. Specifying both 'comment' and Message.body returns 400. Requires delegated access to the shared mailbox."
|
|
187
187
|
},
|
|
188
188
|
{
|
|
189
189
|
"pathPattern": "/users/{user-id}/messages/{message-id}/createReplyAll",
|
|
@@ -192,7 +192,7 @@
|
|
|
192
192
|
"presets": ["work"],
|
|
193
193
|
"workScopes": ["Mail.ReadWrite.Shared"],
|
|
194
194
|
"appScopes": ["Mail.ReadWrite"],
|
|
195
|
-
"llmTip": "Create a reply-all draft in a shared mailbox preserving thread metadata (conversationId, In-Reply-To, References). The 'user-id' is the shared mailbox email address. Does not send — use send-shared-mailbox-draft to send afterwards.
|
|
195
|
+
"llmTip": "Create a reply-all draft in a shared mailbox preserving thread metadata (conversationId, In-Reply-To, References). The 'user-id' is the shared mailbox email address. Does not send — use send-shared-mailbox-draft to send afterwards. Message.body (contentType 'html' for HTML) replaces the whole draft body, dropping the quoted history; 'comment' keeps it. Specifying both 'comment' and Message.body returns 400. Requires delegated access to the shared mailbox."
|
|
196
196
|
},
|
|
197
197
|
{
|
|
198
198
|
"pathPattern": "/users/{user-id}/messages/{message-id}/createForward",
|
|
@@ -396,7 +396,7 @@
|
|
|
396
396
|
"toolName": "create-reply-draft",
|
|
397
397
|
"presets": ["mail", "outlook", "personal"],
|
|
398
398
|
"scopes": ["Mail.ReadWrite"],
|
|
399
|
-
"llmTip": "
|
|
399
|
+
"llmTip": "Message.body (contentType 'html' for HTML) replaces the whole draft body, dropping the quoted history; 'comment' keeps it. Specifying both 'comment' and Message.body returns 400. Signatures are added by the Outlook client only, not via Graph."
|
|
400
400
|
},
|
|
401
401
|
{
|
|
402
402
|
"pathPattern": "/me/messages/{message-id}/createReplyAll",
|
|
@@ -404,7 +404,7 @@
|
|
|
404
404
|
"toolName": "create-reply-all-draft",
|
|
405
405
|
"presets": ["mail", "outlook", "personal"],
|
|
406
406
|
"scopes": ["Mail.ReadWrite"],
|
|
407
|
-
"llmTip": "
|
|
407
|
+
"llmTip": "Message.body (contentType 'html' for HTML) replaces the whole draft body, dropping the quoted history; 'comment' keeps it. Specifying both 'comment' and Message.body returns 400. Signatures are added by the Outlook client only, not via Graph."
|
|
408
408
|
},
|
|
409
409
|
{
|
|
410
410
|
"pathPattern": "/me/messages/{message-id}/send",
|
|
@@ -756,7 +756,8 @@
|
|
|
756
756
|
"toolName": "list-folder-files",
|
|
757
757
|
"presets": ["files", "onedrive", "personal"],
|
|
758
758
|
"scopes": [["Files.Read"], ["Sites.Selected"]],
|
|
759
|
-
"appScopes": [["Files.Read.All"], ["Sites.Read.All"], ["Sites.Selected"]]
|
|
759
|
+
"appScopes": [["Files.Read.All"], ["Sites.Read.All"], ["Sites.Selected"]],
|
|
760
|
+
"mcpApp": "file-browser"
|
|
760
761
|
},
|
|
761
762
|
{
|
|
762
763
|
"pathPattern": "/drives/{drive-id}/items/{driveItem-id}",
|
package/dist/graph-tools.js
CHANGED
|
@@ -93,6 +93,7 @@ import {
|
|
|
93
93
|
userFieldEnforcement
|
|
94
94
|
} from "./lib/user-field-policy.js";
|
|
95
95
|
import logger from "./logger.js";
|
|
96
|
+
import { mcpAppToolMeta } from "./mcp-apps.js";
|
|
96
97
|
import {
|
|
97
98
|
describeError,
|
|
98
99
|
describeShape,
|
|
@@ -2691,6 +2692,7 @@ function registerGraphToolWithMcp(server, tool, endpointConfig, graphClient, opt
|
|
|
2691
2692
|
budget.definitionBudget ?? Number.POSITIVE_INFINITY,
|
|
2692
2693
|
`${budget.schemaFingerprint}|${tool.alias}`
|
|
2693
2694
|
) : void 0;
|
|
2695
|
+
const appMeta = options.mcpApps && endpointConfig?.mcpApp ? mcpAppToolMeta(server, endpointConfig.mcpApp, tool.alias) : void 0;
|
|
2694
2696
|
server.registerTool(
|
|
2695
2697
|
tool.alias,
|
|
2696
2698
|
{
|
|
@@ -2703,7 +2705,8 @@ function registerGraphToolWithMcp(server, tool, endpointConfig, graphClient, opt
|
|
|
2703
2705
|
destructiveHint: destructive,
|
|
2704
2706
|
openWorldHint: true
|
|
2705
2707
|
// All tools call Microsoft Graph API
|
|
2706
|
-
}
|
|
2708
|
+
},
|
|
2709
|
+
...appMeta ? { _meta: appMeta } : {}
|
|
2707
2710
|
},
|
|
2708
2711
|
async (params) => executeGraphTool(tool, endpointConfig, graphClient, params, authManager, userFields)
|
|
2709
2712
|
);
|
package/dist/mcp-apps.js
ADDED
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { readFileSync } from "fs";
|
|
2
|
+
import path from "path";
|
|
3
|
+
import { fileURLToPath } from "url";
|
|
4
|
+
import logger from "./logger.js";
|
|
5
|
+
const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
|
6
|
+
const MCP_APP_MIME_TYPE = "text/html;profile=mcp-app";
|
|
7
|
+
const CONFIG_PLACEHOLDER = "__MCP_APP_CONFIG__";
|
|
8
|
+
const RESOURCE_UI_META = { csp: {}, prefersBorder: true };
|
|
9
|
+
function mcpAppUri(app) {
|
|
10
|
+
return `ui://ms365/${app}.html`;
|
|
11
|
+
}
|
|
12
|
+
function mcpAppHtmlPath(app) {
|
|
13
|
+
return path.join(__dirname, "apps", `${app}.html`);
|
|
14
|
+
}
|
|
15
|
+
const views = /* @__PURE__ */ new Map();
|
|
16
|
+
function loadView(app) {
|
|
17
|
+
let view = views.get(app);
|
|
18
|
+
if (view === void 0) {
|
|
19
|
+
try {
|
|
20
|
+
view = readFileSync(mcpAppHtmlPath(app), "utf8");
|
|
21
|
+
if (!view.includes(CONFIG_PLACEHOLDER)) {
|
|
22
|
+
view = new Error(`${app}.html has no ${CONFIG_PLACEHOLDER}`);
|
|
23
|
+
}
|
|
24
|
+
} catch (error) {
|
|
25
|
+
view = error;
|
|
26
|
+
}
|
|
27
|
+
if (view instanceof Error) logger.error(`MCP app ${app} left out: ${view.message}`);
|
|
28
|
+
views.set(app, view);
|
|
29
|
+
}
|
|
30
|
+
return view;
|
|
31
|
+
}
|
|
32
|
+
const registered = /* @__PURE__ */ new WeakMap();
|
|
33
|
+
function mcpAppToolMeta(server, app, toolName) {
|
|
34
|
+
const uri = mcpAppUri(app);
|
|
35
|
+
let apps = registered.get(server);
|
|
36
|
+
if (!apps) {
|
|
37
|
+
apps = /* @__PURE__ */ new Set();
|
|
38
|
+
registered.set(server, apps);
|
|
39
|
+
}
|
|
40
|
+
if (!apps.has(app)) {
|
|
41
|
+
const view = loadView(app);
|
|
42
|
+
if (view instanceof Error) return void 0;
|
|
43
|
+
const config = JSON.stringify({ toolName }).replace(/</g, "\\u003c");
|
|
44
|
+
const html = view.replace(CONFIG_PLACEHOLDER, () => config);
|
|
45
|
+
server.registerResource(
|
|
46
|
+
app,
|
|
47
|
+
uri,
|
|
48
|
+
{
|
|
49
|
+
description: `MCP Apps view for ${toolName}`,
|
|
50
|
+
mimeType: MCP_APP_MIME_TYPE,
|
|
51
|
+
_meta: { ui: RESOURCE_UI_META }
|
|
52
|
+
},
|
|
53
|
+
async () => ({
|
|
54
|
+
contents: [
|
|
55
|
+
{ uri, mimeType: MCP_APP_MIME_TYPE, text: html, _meta: { ui: RESOURCE_UI_META } }
|
|
56
|
+
]
|
|
57
|
+
})
|
|
58
|
+
);
|
|
59
|
+
apps.add(app);
|
|
60
|
+
}
|
|
61
|
+
return { ui: { resourceUri: uri }, "ui/resourceUri": uri };
|
|
62
|
+
}
|
|
63
|
+
export {
|
|
64
|
+
MCP_APP_MIME_TYPE,
|
|
65
|
+
mcpAppHtmlPath,
|
|
66
|
+
mcpAppToolMeta,
|
|
67
|
+
mcpAppUri
|
|
68
|
+
};
|
package/dist/mcp-instructions.js
CHANGED
|
@@ -15,6 +15,10 @@ function buildGeneralMcpInstructions(opts) {
|
|
|
15
15
|
"App mode: there is no signed-in user, so /me paths do not work. Name the user in /users/{user-id} paths with a UPN or object id."
|
|
16
16
|
);
|
|
17
17
|
if (opts.readOnly) parts.push("This server is read-only; write operations are disabled.");
|
|
18
|
+
else
|
|
19
|
+
parts.push(
|
|
20
|
+
"Mail reply, reply-all and forward tools (including their drafts and shared mailboxes): Graph puts comment into an HTML body, so plain-text line breaks are usually lost; use <br> for line breaks or <p> for paragraphs."
|
|
21
|
+
);
|
|
18
22
|
if (opts.multiAccount)
|
|
19
23
|
parts.push("Multiple accounts: pass the account parameter when required (see list-accounts).");
|
|
20
24
|
if (!opts.orgMode)
|
package/dist/server.js
CHANGED
|
@@ -249,7 +249,9 @@ class MicrosoftGraphServer {
|
|
|
249
249
|
accountNames: this.accountNames,
|
|
250
250
|
allowedScopes: this.options.allowedScopes,
|
|
251
251
|
httpMode: this.hidesStdioOnlyTools(),
|
|
252
|
-
userFields: this.options.userFields
|
|
252
|
+
userFields: this.options.userFields,
|
|
253
|
+
// The views parse the tool results as JSON
|
|
254
|
+
mcpApps: Boolean(this.options.enableMcpApps && !this.options.toon)
|
|
253
255
|
};
|
|
254
256
|
if (this.options.discovery) {
|
|
255
257
|
registerDiscoveryTools(server, this.graphClient, registrationOptions);
|
|
@@ -311,6 +313,11 @@ class MicrosoftGraphServer {
|
|
|
311
313
|
"--http-local-file-tools has no effect in stdio mode, where the local file tools need no flag."
|
|
312
314
|
);
|
|
313
315
|
}
|
|
316
|
+
if (this.options.enableMcpApps && this.options.toon) {
|
|
317
|
+
logger.warn(
|
|
318
|
+
"--enable-mcp-apps has no effect with --toon: the MCP Apps views read JSON tool results."
|
|
319
|
+
);
|
|
320
|
+
}
|
|
314
321
|
if (this.options.obo) {
|
|
315
322
|
if (!this.options.http) {
|
|
316
323
|
throw new Error("--obo requires --http (On-Behalf-Of flow only works in HTTP mode).");
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@softeria/ms-365-mcp-server",
|
|
3
3
|
"mcpName": "io.github.Softeria/ms-365-mcp-server",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.186.0",
|
|
5
5
|
"description": " A Model Context Protocol (MCP) server for interacting with Microsoft 365 and Office services through the Graph API",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"main": "dist/index.js",
|