@lengelhard/imap-email-mcp 1.0.5 → 1.1.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.
Files changed (2) hide show
  1. package/index.js +160 -0
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -365,6 +365,75 @@ server.setRequestHandler(ListToolsRequestSchema, async () => {
365
365
  },
366
366
  required: ['uid']
367
367
  }
368
+ },
369
+ {
370
+ name: 'move_email',
371
+ description: 'Move an email from one folder to another (e.g. Inbox → Action, Waiting, Delegated, Hold)',
372
+ inputSchema: {
373
+ type: 'object',
374
+ properties: {
375
+ uid: {
376
+ type: 'number',
377
+ description: 'Email UID to move'
378
+ },
379
+ from_folder: {
380
+ type: 'string',
381
+ description: 'Source folder name (default: INBOX)',
382
+ default: 'INBOX'
383
+ },
384
+ to_folder: {
385
+ type: 'string',
386
+ description: 'Destination folder name (e.g. Action, Waiting, Delegated, Hold, Archive)'
387
+ }
388
+ },
389
+ required: ['uid', 'to_folder']
390
+ }
391
+ },
392
+ {
393
+ name: 'flag_email',
394
+ description: 'Add or remove the \\Flagged flag on an email (star/unstar). Used to manage the /Flagged urgency overlay.',
395
+ inputSchema: {
396
+ type: 'object',
397
+ properties: {
398
+ uid: {
399
+ type: 'number',
400
+ description: 'Email UID'
401
+ },
402
+ folder: {
403
+ type: 'string',
404
+ description: 'Folder containing the email (default: INBOX)',
405
+ default: 'INBOX'
406
+ },
407
+ flagged: {
408
+ type: 'boolean',
409
+ description: 'true to add the flag (star), false to remove it (unstar)'
410
+ }
411
+ },
412
+ required: ['uid', 'flagged']
413
+ }
414
+ },
415
+ {
416
+ name: 'mark_seen',
417
+ description: 'Mark an email as read (seen) or unread (unseen). Used to signal triage state via the \\Seen flag.',
418
+ inputSchema: {
419
+ type: 'object',
420
+ properties: {
421
+ uid: {
422
+ type: 'number',
423
+ description: 'Email UID'
424
+ },
425
+ folder: {
426
+ type: 'string',
427
+ description: 'Folder containing the email (default: INBOX)',
428
+ default: 'INBOX'
429
+ },
430
+ seen: {
431
+ type: 'boolean',
432
+ description: 'true to mark as read, false to mark as unread'
433
+ }
434
+ },
435
+ required: ['uid', 'seen']
436
+ }
368
437
  }
369
438
  ]
370
439
  };
@@ -846,6 +915,97 @@ server.setRequestHandler(CallToolRequestSchema, async (request) => {
846
915
  }
847
916
  }
848
917
 
918
+ case 'move_email': {
919
+ const fromFolder = args.from_folder || 'INBOX';
920
+ const toFolder = args.to_folder;
921
+ const connection = await connectIMAP();
922
+
923
+ try {
924
+ await connection.openBox(fromFolder);
925
+
926
+ // node-imap exposes move() on the underlying imap object.
927
+ // We wrap it in a Promise so it fits the async/await flow.
928
+ await new Promise((resolve, reject) => {
929
+ connection.imap.move(args.uid, toFolder, (err) => {
930
+ if (err) reject(err);
931
+ else resolve();
932
+ });
933
+ });
934
+
935
+ return {
936
+ content: [{
937
+ type: 'text',
938
+ text: JSON.stringify({
939
+ success: true,
940
+ uid: args.uid,
941
+ from: fromFolder,
942
+ to: toFolder
943
+ }, null, 2)
944
+ }]
945
+ };
946
+ } finally {
947
+ connection.end();
948
+ }
949
+ }
950
+
951
+ case 'flag_email': {
952
+ const folder = args.folder || 'INBOX';
953
+ const connection = await connectIMAP();
954
+
955
+ try {
956
+ await connection.openBox(folder);
957
+
958
+ if (args.flagged) {
959
+ await connection.addFlags(args.uid, ['\\Flagged']);
960
+ } else {
961
+ await connection.delFlags(args.uid, ['\\Flagged']);
962
+ }
963
+
964
+ return {
965
+ content: [{
966
+ type: 'text',
967
+ text: JSON.stringify({
968
+ success: true,
969
+ uid: args.uid,
970
+ folder,
971
+ flagged: args.flagged
972
+ }, null, 2)
973
+ }]
974
+ };
975
+ } finally {
976
+ connection.end();
977
+ }
978
+ }
979
+
980
+ case 'mark_seen': {
981
+ const folder = args.folder || 'INBOX';
982
+ const connection = await connectIMAP();
983
+
984
+ try {
985
+ await connection.openBox(folder);
986
+
987
+ if (args.seen) {
988
+ await connection.addFlags(args.uid, ['\\Seen']);
989
+ } else {
990
+ await connection.delFlags(args.uid, ['\\Seen']);
991
+ }
992
+
993
+ return {
994
+ content: [{
995
+ type: 'text',
996
+ text: JSON.stringify({
997
+ success: true,
998
+ uid: args.uid,
999
+ folder,
1000
+ seen: args.seen
1001
+ }, null, 2)
1002
+ }]
1003
+ };
1004
+ } finally {
1005
+ connection.end();
1006
+ }
1007
+ }
1008
+
849
1009
  default:
850
1010
  return { content: [{ type: 'text', text: `Unknown tool: ${name}` }] };
851
1011
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lengelhard/imap-email-mcp",
3
- "version": "1.0.5",
3
+ "version": "1.1.0",
4
4
  "description": "MCP server for Claude Code that provides email capabilities through IMAP/SMTP. Read, search, compose, and manage emails from any IMAP provider.",
5
5
  "type": "module",
6
6
  "main": "index.js",