@teamnetwork-nz/m365-mcp-server 1.6.0 → 1.6.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.
@@ -28,7 +28,10 @@ export async function listAttachments(client, email, messageId) {
28
28
  try {
29
29
  const response = await client
30
30
  .api(`/users/${email}/messages/${messageId}/attachments`)
31
- .select('id,name,contentType,size,isInline,previewUrl')
31
+ // Only select properties declared on the base attachment resource.
32
+ // Derived properties such as referenceAttachment.previewUrl make Graph
33
+ // reject this collection query when it validates the $select clause.
34
+ .select('id,name,contentType,size,isInline')
32
35
  .get();
33
36
  return (response.value ?? []).map(normaliseAttachment);
34
37
  }
@@ -38,11 +41,12 @@ export async function listAttachments(client, email, messageId) {
38
41
  }
39
42
  export async function downloadAttachment(client, email, messageId, attachmentId) {
40
43
  try {
41
- // Fetch the full attachment record including contentBytes for file attachments.
42
- // contentBytes is already base64-encoded by the Graph API.
44
+ // Do not use $select here: contentBytes and previewUrl belong to different
45
+ // derived attachment types, while Graph validates $select against the base
46
+ // attachment resource before returning @odata.type. A plain GET returns the
47
+ // concrete record and includes contentBytes for file attachments.
43
48
  const raw = await client
44
49
  .api(`/users/${email}/messages/${messageId}/attachments/${attachmentId}`)
45
- .select('id,name,contentType,isInline,contentBytes,previewUrl,@odata.type')
46
50
  .get();
47
51
  const attachmentType = deriveAttachmentType(raw['@odata.type']);
48
52
  if (attachmentType === 'referenceAttachment') {
package/dist/index.js CHANGED
@@ -18,7 +18,7 @@ async function main() {
18
18
  const createConfiguredServer = () => {
19
19
  const server = new McpServer({
20
20
  name: '@teamnetwork/m365-mcp-server',
21
- version: '1.6.0',
21
+ version: '1.6.1',
22
22
  }, {
23
23
  instructions: `
24
24
  Microsoft 365 MCP server — email, calendar, and To Do via the Microsoft Graph API.
@@ -6,7 +6,7 @@ import { errorResponse } from '../../utils/errors.js';
6
6
  import { logger } from '../../utils/logger.js';
7
7
  import { resolveMailbox } from '../../utils/resolveMailbox.js';
8
8
  export function registerDownloadAttachment(server, config, auth) {
9
- server.tool('download_attachment', 'Download a file attachment from an email message. Returns base64-encoded file content for file attachments, the preview URL for reference attachments (e.g. SharePoint links), or a descriptive message for embedded item attachments. Omit accountId/mailbox to use the first configured account and mailbox.', DownloadAttachmentSchema.shape, async (params) => {
9
+ server.tool('download_attachment', 'Download one attachment using its messageId and attachmentId from list_message_attachments. File attachments return base64 content (images use MCP image content); reference attachments return their preview URL; embedded Outlook items return a description. Omit accountId/mailbox to use the default configured mailbox.', DownloadAttachmentSchema.shape, async (params) => {
10
10
  try {
11
11
  const resolved = resolveMailbox(config, params.accountId, params.mailbox);
12
12
  logger.info('download_attachment', { accountId: resolved.accountId, mailbox: resolved.mailbox });
package/package.json CHANGED
@@ -1,11 +1,11 @@
1
1
  {
2
2
  "name": "@teamnetwork-nz/m365-mcp-server",
3
- "version": "1.6.0",
3
+ "version": "1.6.1",
4
4
  "description": "MCP server for Microsoft 365 — Email, Calendar, To Do, SharePoint document libraries, and Teams — using client credentials (app-only auth). Supports multiple accounts, shared mailboxes, per-mailbox read-only access, and grant-based SharePoint access control.",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
7
7
  "bin": {
8
- "m365-mcp": "./dist/index.js"
8
+ "m365-mcp": "dist/index.js"
9
9
  },
10
10
  "files": [
11
11
  "dist",