@lengelhard/imap-email-mcp 1.0.2 → 1.0.3

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 +4 -3
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -856,11 +856,12 @@ server.setRequestHandler(CallToolRequestSchema, async (request) => {
856
856
  return { content: [{ type: 'text', text: `Part ${partID} not found in message` }] };
857
857
  }
858
858
 
859
- // The body content may already be base64 or need encoding
859
+ // IMAP attachment parts are already base64-encoded by the mail server.
860
+ // Return the raw content as-is — do NOT re-encode, which would double-encode.
860
861
  const rawContent = partData.body;
861
862
  const base64Content = Buffer.isBuffer(rawContent)
862
- ? rawContent.toString('base64')
863
- : Buffer.from(rawContent, 'binary').toString('base64');
863
+ ? rawContent.toString('ascii').replace(/\s/g, '') // buffer → clean base64 string
864
+ : rawContent.replace(/\s/g, ''); // string → strip whitespace/newlines
864
865
 
865
866
  // Get filename from struct for reference
866
867
  const attachmentParts = findAttachmentParts(msg.attributes.struct || []);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lengelhard/imap-email-mcp",
3
- "version": "1.0.2",
3
+ "version": "1.0.3",
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",