@mbanucu/server-gmail-autoauth-mcp 0.0.0-stage → 1.1.12

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 CHANGED
@@ -1,3 +1,767 @@
1
- # Temporary Holding Version
1
+ # Gmail AutoAuth MCP Server
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ > **Maintained fork — v1.1.12.** The upstream project
4
+ > [`GongRZhe/Gmail-MCP-Server`](https://github.com/GongRZhe/Gmail-MCP-Server) was archived on
5
+ > 2025-08-06 and is read-only; `@gongrzhe/server-gmail-autoauth-mcp` has not been published since
6
+ > then and still ships the bug described below.
7
+ >
8
+ > This fork fixes it and is published as
9
+ > **[`@mbanucu/server-gmail-autoauth-mcp`](https://www.npmjs.com/package/@mbanucu/server-gmail-autoauth-mcp)**:
10
+ >
11
+ > ```bash
12
+ > npx -y @mbanucu/server-gmail-autoauth-mcp auth
13
+ > # then in .agents/mcp.json / claude_desktop_config.json:
14
+ > # "command": "npx", "args": ["-y", "@mbanucu/server-gmail-autoauth-mcp"]
15
+ > ```
16
+ >
17
+ > **Fixed in 1.1.12:** `list_filters` always answered `No filters found.` The Gmail API returns
18
+ > the collection as `ListFiltersResponse.filter` (singular), but `listFilters()` read
19
+ > `response.data.filters`, which is always `undefined`. `get_filter` was unaffected, so filters
20
+ > could be created and fetched individually but never listed. Diff:
21
+ > [`src/filter-manager.ts`](https://github.com/MBanucu/Gmail-MCP-Server/commit/) — one line,
22
+ > `response.data.filter || response.data.filters || []`.
23
+
24
+
25
+ A Model Context Protocol (MCP) server for Gmail integration in Claude Desktop with auto authentication support. This server enables AI assistants to manage Gmail through natural language interactions.
26
+
27
+ ![](https://badge.mcpx.dev?type=server 'MCP Server')
28
+ [![smithery badge](https://smithery.ai/badge/@gongrzhe/server-gmail-autoauth-mcp)](https://smithery.ai/server/@gongrzhe/server-gmail-autoauth-mcp)
29
+
30
+
31
+ ## Features
32
+
33
+ - Send emails with subject, content, **attachments**, and recipients
34
+ - **Full attachment support** - send and receive file attachments
35
+ - **Download email attachments** to local filesystem
36
+ - Support for HTML emails and multipart messages with both HTML and plain text versions
37
+ - Full support for international characters in subject lines and email content
38
+ - Read email messages by ID with advanced MIME structure handling
39
+ - **Enhanced attachment display** showing filenames, types, sizes, and download IDs
40
+ - Search emails with various criteria (subject, sender, date range)
41
+ - **Comprehensive label management with ability to create, update, delete and list labels**
42
+ - List all available Gmail labels (system and user-defined)
43
+ - List emails in inbox, sent, or custom labels
44
+ - Mark emails as read/unread
45
+ - Move emails to different labels/folders
46
+ - Delete emails
47
+ - **Batch operations for efficiently processing multiple emails at once**
48
+ - Full integration with Gmail API
49
+ - Simple OAuth2 authentication flow with auto browser launch
50
+ - Support for both Desktop and Web application credentials
51
+ - Global credential storage for convenience
52
+
53
+ ## Installation & Authentication
54
+
55
+ ### Installing via Smithery
56
+
57
+ To install Gmail AutoAuth for Claude Desktop automatically via [Smithery](https://smithery.ai/server/@gongrzhe/server-gmail-autoauth-mcp):
58
+
59
+ ```bash
60
+ npx -y @smithery/cli install @gongrzhe/server-gmail-autoauth-mcp --client claude
61
+ ```
62
+
63
+ ### Installing Manually
64
+ 1. Create a Google Cloud Project and obtain credentials:
65
+
66
+ a. Create a Google Cloud Project:
67
+ - Go to [Google Cloud Console](https://console.cloud.google.com/)
68
+ - Create a new project or select an existing one
69
+ - Enable the Gmail API for your project
70
+
71
+ b. Create OAuth 2.0 Credentials:
72
+ - Go to "APIs & Services" > "Credentials"
73
+ - Click "Create Credentials" > "OAuth client ID"
74
+ - Choose either "Desktop app" or "Web application" as application type
75
+ - Give it a name and click "Create"
76
+ - For Web application, add `http://localhost:3000/oauth2callback` to the authorized redirect URIs
77
+ - Download the JSON file of your client's OAuth keys
78
+ - Rename the key file to `gcp-oauth.keys.json`
79
+
80
+ 2. Run Authentication:
81
+
82
+ You can authenticate in two ways:
83
+
84
+ a. Global Authentication (Recommended):
85
+ ```bash
86
+ # First time: Place gcp-oauth.keys.json in your home directory's .gmail-mcp folder
87
+ mkdir -p ~/.gmail-mcp
88
+ mv gcp-oauth.keys.json ~/.gmail-mcp/
89
+
90
+ # Run authentication from anywhere
91
+ npx @gongrzhe/server-gmail-autoauth-mcp auth
92
+ ```
93
+
94
+ b. Local Authentication:
95
+ ```bash
96
+ # Place gcp-oauth.keys.json in your current directory
97
+ # The file will be automatically copied to global config
98
+ npx @gongrzhe/server-gmail-autoauth-mcp auth
99
+ ```
100
+
101
+ The authentication process will:
102
+ - Look for `gcp-oauth.keys.json` in the current directory or `~/.gmail-mcp/`
103
+ - If found in current directory, copy it to `~/.gmail-mcp/`
104
+ - Open your default browser for Google authentication
105
+ - Save credentials as `~/.gmail-mcp/credentials.json`
106
+
107
+ > **Note**:
108
+ > - After successful authentication, credentials are stored globally in `~/.gmail-mcp/` and can be used from any directory
109
+ > - Both Desktop app and Web application credentials are supported
110
+ > - For Web application credentials, make sure to add `http://localhost:3000/oauth2callback` to your authorized redirect URIs
111
+
112
+ 3. Configure in Claude Desktop:
113
+
114
+ ```json
115
+ {
116
+ "mcpServers": {
117
+ "gmail": {
118
+ "command": "npx",
119
+ "args": [
120
+ "@gongrzhe/server-gmail-autoauth-mcp"
121
+ ]
122
+ }
123
+ }
124
+ }
125
+ ```
126
+
127
+ ### Docker Support
128
+
129
+ If you prefer using Docker:
130
+
131
+ 1. Authentication:
132
+ ```bash
133
+ docker run -i --rm \
134
+ --mount type=bind,source=/path/to/gcp-oauth.keys.json,target=/gcp-oauth.keys.json \
135
+ -v mcp-gmail:/gmail-server \
136
+ -e GMAIL_OAUTH_PATH=/gcp-oauth.keys.json \
137
+ -e "GMAIL_CREDENTIALS_PATH=/gmail-server/credentials.json" \
138
+ -p 3000:3000 \
139
+ mcp/gmail auth
140
+ ```
141
+
142
+ 2. Usage:
143
+ ```json
144
+ {
145
+ "mcpServers": {
146
+ "gmail": {
147
+ "command": "docker",
148
+ "args": [
149
+ "run",
150
+ "-i",
151
+ "--rm",
152
+ "-v",
153
+ "mcp-gmail:/gmail-server",
154
+ "-e",
155
+ "GMAIL_CREDENTIALS_PATH=/gmail-server/credentials.json",
156
+ "mcp/gmail"
157
+ ]
158
+ }
159
+ }
160
+ }
161
+ ```
162
+
163
+ ### Cloud Server Authentication
164
+
165
+ For cloud server environments (like n8n), you can specify a custom callback URL during authentication:
166
+
167
+ ```bash
168
+ npx @gongrzhe/server-gmail-autoauth-mcp auth https://gmail.gongrzhe.com/oauth2callback
169
+ ```
170
+
171
+ #### Setup Instructions for Cloud Environment
172
+
173
+ 1. **Configure Reverse Proxy:**
174
+ - Set up your n8n container to expose a port for authentication
175
+ - Configure a reverse proxy to forward traffic from your domain (e.g., `gmail.gongrzhe.com`) to this port
176
+
177
+ 2. **DNS Configuration:**
178
+ - Add an A record in your DNS settings to resolve your domain to your cloud server's IP address
179
+
180
+ 3. **Google Cloud Platform Setup:**
181
+ - In your Google Cloud Console, add your custom domain callback URL (e.g., `https://gmail.gongrzhe.com/oauth2callback`) to the authorized redirect URIs list
182
+
183
+ 4. **Run Authentication:**
184
+ ```bash
185
+ npx @gongrzhe/server-gmail-autoauth-mcp auth https://gmail.gongrzhe.com/oauth2callback
186
+ ```
187
+
188
+ 5. **Configure in your application:**
189
+ ```json
190
+ {
191
+ "mcpServers": {
192
+ "gmail": {
193
+ "command": "npx",
194
+ "args": [
195
+ "@gongrzhe/server-gmail-autoauth-mcp"
196
+ ]
197
+ }
198
+ }
199
+ }
200
+ ```
201
+
202
+ This approach allows authentication flows to work properly in environments where localhost isn't accessible, such as containerized applications or cloud servers.
203
+
204
+ ## Available Tools
205
+
206
+ The server provides the following tools that can be used through Claude Desktop:
207
+
208
+ ### 1. Send Email (`send_email`)
209
+
210
+ Sends a new email immediately. Supports plain text, HTML, or multipart emails **with optional file attachments**.
211
+
212
+ Basic Email:
213
+ ```json
214
+ {
215
+ "to": ["recipient@example.com"],
216
+ "subject": "Meeting Tomorrow",
217
+ "body": "Hi,\n\nJust a reminder about our meeting tomorrow at 10 AM.\n\nBest regards",
218
+ "cc": ["cc@example.com"],
219
+ "bcc": ["bcc@example.com"],
220
+ "mimeType": "text/plain"
221
+ }
222
+ ```
223
+
224
+ **Email with Attachments:**
225
+ ```json
226
+ {
227
+ "to": ["recipient@example.com"],
228
+ "subject": "Project Files",
229
+ "body": "Hi,\n\nPlease find the project files attached.\n\nBest regards",
230
+ "attachments": [
231
+ "/path/to/document.pdf",
232
+ "/path/to/spreadsheet.xlsx",
233
+ "/path/to/presentation.pptx"
234
+ ]
235
+ }
236
+ ```
237
+
238
+ HTML Email Example:
239
+ ```json
240
+ {
241
+ "to": ["recipient@example.com"],
242
+ "subject": "Meeting Tomorrow",
243
+ "mimeType": "text/html",
244
+ "body": "<html><body><h1>Meeting Reminder</h1><p>Just a reminder about our <b>meeting tomorrow</b> at 10 AM.</p><p>Best regards</p></body></html>"
245
+ }
246
+ ```
247
+
248
+ Multipart Email Example (HTML + Plain Text):
249
+ ```json
250
+ {
251
+ "to": ["recipient@example.com"],
252
+ "subject": "Meeting Tomorrow",
253
+ "mimeType": "multipart/alternative",
254
+ "body": "Hi,\n\nJust a reminder about our meeting tomorrow at 10 AM.\n\nBest regards",
255
+ "htmlBody": "<html><body><h1>Meeting Reminder</h1><p>Just a reminder about our <b>meeting tomorrow</b> at 10 AM.</p><p>Best regards</p></body></html>"
256
+ }
257
+ ```
258
+
259
+ ### 2. Draft Email (`draft_email`)
260
+ Creates a draft email without sending it. **Also supports attachments**.
261
+
262
+ ```json
263
+ {
264
+ "to": ["recipient@example.com"],
265
+ "subject": "Draft Report",
266
+ "body": "Here's the draft report for your review.",
267
+ "cc": ["manager@example.com"],
268
+ "attachments": ["/path/to/draft_report.docx"]
269
+ }
270
+ ```
271
+
272
+ ### 3. Read Email (`read_email`)
273
+ Retrieves the content of a specific email by its ID. **Now shows enhanced attachment information**.
274
+
275
+ ```json
276
+ {
277
+ "messageId": "182ab45cd67ef"
278
+ }
279
+ ```
280
+
281
+ **Enhanced Response includes attachment details:**
282
+ ```
283
+ Subject: Project Files
284
+ From: sender@example.com
285
+ To: recipient@example.com
286
+ Date: Thu, 19 Jun 2025 10:30:00 -0400
287
+
288
+ Email body content here...
289
+
290
+ Attachments (2):
291
+ - document.pdf (application/pdf, 245 KB, ID: ANGjdJ9fkTs-i3GCQo5o97f_itG...)
292
+ - spreadsheet.xlsx (application/vnd.openxmlformats-officedocument.spreadsheetml.sheet, 89 KB, ID: BWHkeL8gkUt-j4HDRp6o98g_juI...)
293
+ ```
294
+
295
+ ### 4. **Download Attachment (`download_attachment`)**
296
+ **NEW**: Downloads email attachments to your local filesystem.
297
+
298
+ ```json
299
+ {
300
+ "messageId": "182ab45cd67ef",
301
+ "attachmentId": "ANGjdJ9fkTs-i3GCQo5o97f_itG...",
302
+ "savePath": "/path/to/downloads",
303
+ "filename": "downloaded_document.pdf"
304
+ }
305
+ ```
306
+
307
+ Parameters:
308
+ - `messageId`: The ID of the email containing the attachment
309
+ - `attachmentId`: The attachment ID (shown in enhanced email display)
310
+ - `savePath`: Directory to save the file (optional, defaults to current directory)
311
+ - `filename`: Custom filename (optional, uses original filename if not provided)
312
+
313
+ ### 5. Search Emails (`search_emails`)
314
+ Searches for emails using Gmail search syntax.
315
+
316
+ ```json
317
+ {
318
+ "query": "from:sender@example.com after:2024/01/01 has:attachment",
319
+ "maxResults": 10
320
+ }
321
+ ```
322
+
323
+ ### 6. Modify Email (`modify_email`)
324
+ Adds or removes labels from emails (move to different folders, archive, etc.).
325
+
326
+ ```json
327
+ {
328
+ "messageId": "182ab45cd67ef",
329
+ "addLabelIds": ["IMPORTANT"],
330
+ "removeLabelIds": ["INBOX"]
331
+ }
332
+ ```
333
+
334
+ ### 7. Delete Email (`delete_email`)
335
+ Permanently deletes an email.
336
+
337
+ ```json
338
+ {
339
+ "messageId": "182ab45cd67ef"
340
+ }
341
+ ```
342
+
343
+ ### 8. List Email Labels (`list_email_labels`)
344
+ Retrieves all available Gmail labels.
345
+
346
+ ```json
347
+ {}
348
+ ```
349
+
350
+ ### 9. Create Label (`create_label`)
351
+ Creates a new Gmail label.
352
+
353
+ ```json
354
+ {
355
+ "name": "Important Projects",
356
+ "messageListVisibility": "show",
357
+ "labelListVisibility": "labelShow"
358
+ }
359
+ ```
360
+
361
+ ### 10. Update Label (`update_label`)
362
+ Updates an existing Gmail label.
363
+
364
+ ```json
365
+ {
366
+ "id": "Label_1234567890",
367
+ "name": "Urgent Projects",
368
+ "messageListVisibility": "show",
369
+ "labelListVisibility": "labelShow"
370
+ }
371
+ ```
372
+
373
+ ### 11. Delete Label (`delete_label`)
374
+ Deletes a Gmail label.
375
+
376
+ ```json
377
+ {
378
+ "id": "Label_1234567890"
379
+ }
380
+ ```
381
+
382
+ ### 12. Get or Create Label (`get_or_create_label`)
383
+ Gets an existing label by name or creates it if it doesn't exist.
384
+
385
+ ```json
386
+ {
387
+ "name": "Project XYZ",
388
+ "messageListVisibility": "show",
389
+ "labelListVisibility": "labelShow"
390
+ }
391
+ ```
392
+
393
+ ### 13. Batch Modify Emails (`batch_modify_emails`)
394
+ Modifies labels for multiple emails in efficient batches.
395
+
396
+ ```json
397
+ {
398
+ "messageIds": ["182ab45cd67ef", "182ab45cd67eg", "182ab45cd67eh"],
399
+ "addLabelIds": ["IMPORTANT"],
400
+ "removeLabelIds": ["INBOX"],
401
+ "batchSize": 50
402
+ }
403
+ ```
404
+
405
+ ### 14. Batch Delete Emails (`batch_delete_emails`)
406
+ Permanently deletes multiple emails in efficient batches.
407
+
408
+ ```json
409
+ {
410
+ "messageIds": ["182ab45cd67ef", "182ab45cd67eg", "182ab45cd67eh"],
411
+ "batchSize": 50
412
+ }
413
+ ```
414
+
415
+ ### 14. Create Filter (`create_filter`)
416
+ Creates a new Gmail filter with custom criteria and actions.
417
+
418
+ ```json
419
+ {
420
+ "criteria": {
421
+ "from": "newsletter@company.com",
422
+ "hasAttachment": false
423
+ },
424
+ "action": {
425
+ "addLabelIds": ["Label_Newsletter"],
426
+ "removeLabelIds": ["INBOX"]
427
+ }
428
+ }
429
+ ```
430
+
431
+ ### 15. List Filters (`list_filters`)
432
+ Retrieves all Gmail filters.
433
+
434
+ ```json
435
+ {}
436
+ ```
437
+
438
+ ### 16. Get Filter (`get_filter`)
439
+ Gets details of a specific Gmail filter.
440
+
441
+ ```json
442
+ {
443
+ "filterId": "ANe1Bmj1234567890"
444
+ }
445
+ ```
446
+
447
+ ### 17. Delete Filter (`delete_filter`)
448
+ Deletes a Gmail filter.
449
+
450
+ ```json
451
+ {
452
+ "filterId": "ANe1Bmj1234567890"
453
+ }
454
+ ```
455
+
456
+ ### 18. Create Filter from Template (`create_filter_from_template`)
457
+ Creates a filter using pre-defined templates for common scenarios.
458
+
459
+ ```json
460
+ {
461
+ "template": "fromSender",
462
+ "parameters": {
463
+ "senderEmail": "notifications@github.com",
464
+ "labelIds": ["Label_GitHub"],
465
+ "archive": true
466
+ }
467
+ }
468
+ ```
469
+
470
+ ## Filter Management Features
471
+
472
+ ### Filter Criteria
473
+
474
+ You can create filters based on various criteria:
475
+
476
+ | Criteria | Example | Description |
477
+ |----------|---------|-------------|
478
+ | `from` | `"sender@example.com"` | Emails from a specific sender |
479
+ | `to` | `"recipient@example.com"` | Emails sent to a specific recipient |
480
+ | `subject` | `"Meeting"` | Emails with specific text in subject |
481
+ | `query` | `"has:attachment"` | Gmail search query syntax |
482
+ | `negatedQuery` | `"spam"` | Text that must NOT be present |
483
+ | `hasAttachment` | `true` | Emails with attachments |
484
+ | `size` | `10485760` | Email size in bytes |
485
+ | `sizeComparison` | `"larger"` | Size comparison (`larger`, `smaller`) |
486
+
487
+ ### Filter Actions
488
+
489
+ Filters can perform the following actions:
490
+
491
+ | Action | Example | Description |
492
+ |--------|---------|-------------|
493
+ | `addLabelIds` | `["IMPORTANT", "Label_Work"]` | Add labels to matching emails |
494
+ | `removeLabelIds` | `["INBOX", "UNREAD"]` | Remove labels from matching emails |
495
+ | `forward` | `"backup@example.com"` | Forward emails to another address |
496
+
497
+ ### Filter Templates
498
+
499
+ The server includes pre-built templates for common filtering scenarios:
500
+
501
+ #### 1. From Sender Template (`fromSender`)
502
+ Filters emails from a specific sender and optionally archives them.
503
+
504
+ ```json
505
+ {
506
+ "template": "fromSender",
507
+ "parameters": {
508
+ "senderEmail": "newsletter@company.com",
509
+ "labelIds": ["Label_Newsletter"],
510
+ "archive": true
511
+ }
512
+ }
513
+ ```
514
+
515
+ #### 2. Subject Filter Template (`withSubject`)
516
+ Filters emails with specific subject text and optionally marks as read.
517
+
518
+ ```json
519
+ {
520
+ "template": "withSubject",
521
+ "parameters": {
522
+ "subjectText": "[URGENT]",
523
+ "labelIds": ["Label_Urgent"],
524
+ "markAsRead": false
525
+ }
526
+ }
527
+ ```
528
+
529
+ #### 3. Attachment Filter Template (`withAttachments`)
530
+ Filters all emails with attachments.
531
+
532
+ ```json
533
+ {
534
+ "template": "withAttachments",
535
+ "parameters": {
536
+ "labelIds": ["Label_Attachments"]
537
+ }
538
+ }
539
+ ```
540
+
541
+ #### 4. Large Email Template (`largeEmails`)
542
+ Filters emails larger than a specified size.
543
+
544
+ ```json
545
+ {
546
+ "template": "largeEmails",
547
+ "parameters": {
548
+ "sizeInBytes": 10485760,
549
+ "labelIds": ["Label_Large"]
550
+ }
551
+ }
552
+ ```
553
+
554
+ #### 5. Content Filter Template (`containingText`)
555
+ Filters emails containing specific text and optionally marks as important.
556
+
557
+ ```json
558
+ {
559
+ "template": "containingText",
560
+ "parameters": {
561
+ "searchText": "invoice",
562
+ "labelIds": ["Label_Finance"],
563
+ "markImportant": true
564
+ }
565
+ }
566
+ ```
567
+
568
+ #### 6. Mailing List Template (`mailingList`)
569
+ Filters mailing list emails and optionally archives them.
570
+
571
+ ```json
572
+ {
573
+ "template": "mailingList",
574
+ "parameters": {
575
+ "listIdentifier": "dev-team",
576
+ "labelIds": ["Label_DevTeam"],
577
+ "archive": true
578
+ }
579
+ }
580
+ ```
581
+
582
+ ### Common Filter Examples
583
+
584
+ Here are some practical filter examples:
585
+
586
+ **Auto-organize newsletters:**
587
+ ```json
588
+ {
589
+ "criteria": {
590
+ "from": "newsletter@company.com"
591
+ },
592
+ "action": {
593
+ "addLabelIds": ["Label_Newsletter"],
594
+ "removeLabelIds": ["INBOX"]
595
+ }
596
+ }
597
+ ```
598
+
599
+ **Handle promotional emails:**
600
+ ```json
601
+ {
602
+ "criteria": {
603
+ "query": "unsubscribe OR promotional"
604
+ },
605
+ "action": {
606
+ "addLabelIds": ["Label_Promotions"],
607
+ "removeLabelIds": ["INBOX", "UNREAD"]
608
+ }
609
+ }
610
+ ```
611
+
612
+ **Priority emails from boss:**
613
+ ```json
614
+ {
615
+ "criteria": {
616
+ "from": "boss@company.com"
617
+ },
618
+ "action": {
619
+ "addLabelIds": ["IMPORTANT", "Label_Boss"]
620
+ }
621
+ }
622
+ ```
623
+
624
+ **Large attachments:**
625
+ ```json
626
+ {
627
+ "criteria": {
628
+ "size": 10485760,
629
+ "sizeComparison": "larger",
630
+ "hasAttachment": true
631
+ },
632
+ "action": {
633
+ "addLabelIds": ["Label_LargeFiles"]
634
+ }
635
+ }
636
+ ```
637
+
638
+ ## Advanced Search Syntax
639
+
640
+ The `search_emails` tool supports Gmail's powerful search operators:
641
+
642
+ | Operator | Example | Description |
643
+ |----------|---------|-------------|
644
+ | `from:` | `from:john@example.com` | Emails from a specific sender |
645
+ | `to:` | `to:mary@example.com` | Emails sent to a specific recipient |
646
+ | `subject:` | `subject:"meeting notes"` | Emails with specific text in the subject |
647
+ | `has:attachment` | `has:attachment` | Emails with attachments |
648
+ | `after:` | `after:2024/01/01` | Emails received after a date |
649
+ | `before:` | `before:2024/02/01` | Emails received before a date |
650
+ | `is:` | `is:unread` | Emails with a specific state |
651
+ | `label:` | `label:work` | Emails with a specific label |
652
+
653
+ You can combine multiple operators: `from:john@example.com after:2024/01/01 has:attachment`
654
+
655
+ ## Advanced Features
656
+
657
+ ### **Email Attachment Support**
658
+
659
+ The server provides comprehensive attachment functionality:
660
+
661
+ - **Sending Attachments**: Include file paths in the `attachments` array when sending or drafting emails
662
+ - **Attachment Detection**: Automatically detects MIME types and file sizes
663
+ - **Download Capability**: Download any email attachment to your local filesystem
664
+ - **Enhanced Display**: View detailed attachment information including filenames, types, sizes, and download IDs
665
+ - **Multiple Formats**: Support for all common file types (documents, images, archives, etc.)
666
+ - **RFC822 Compliance**: Uses Nodemailer for proper MIME message formatting
667
+
668
+ **Supported File Types**: All standard file types including PDF, DOCX, XLSX, PPTX, images (PNG, JPG, GIF), archives (ZIP, RAR), and more.
669
+
670
+ ### Email Content Extraction
671
+
672
+ The server intelligently extracts email content from complex MIME structures:
673
+
674
+ - Prioritizes plain text content when available
675
+ - Falls back to HTML content if plain text is not available
676
+ - Handles multi-part MIME messages with nested parts
677
+ - **Processes attachments information (filename, type, size, download ID)**
678
+ - Preserves original email headers (From, To, Subject, Date)
679
+
680
+ ### International Character Support
681
+
682
+ The server fully supports non-ASCII characters in email subjects and content, including:
683
+ - Turkish, Chinese, Japanese, Korean, and other non-Latin alphabets
684
+ - Special characters and symbols
685
+ - Proper encoding ensures correct display in email clients
686
+
687
+ ### Comprehensive Label Management
688
+
689
+ The server provides a complete set of tools for managing Gmail labels:
690
+
691
+ - **Create Labels**: Create new labels with customizable visibility settings
692
+ - **Update Labels**: Rename labels or change their visibility settings
693
+ - **Delete Labels**: Remove user-created labels (system labels are protected)
694
+ - **Find or Create**: Get a label by name or automatically create it if not found
695
+ - **List All Labels**: View all system and user labels with detailed information
696
+ - **Label Visibility Options**: Control how labels appear in message and label lists
697
+
698
+ Label visibility settings include:
699
+ - `messageListVisibility`: Controls whether the label appears in the message list (`show` or `hide`)
700
+ - `labelListVisibility`: Controls how the label appears in the label list (`labelShow`, `labelShowIfUnread`, or `labelHide`)
701
+
702
+ These label management features enable sophisticated organization of emails directly through Claude, without needing to switch to the Gmail interface.
703
+
704
+ ### Batch Operations
705
+
706
+ The server includes efficient batch processing capabilities:
707
+
708
+ - Process up to 50 emails at once (configurable batch size)
709
+ - Automatic chunking of large email sets to avoid API limits
710
+ - Detailed success/failure reporting for each operation
711
+ - Graceful error handling with individual retries
712
+ - Perfect for bulk inbox management and organization tasks
713
+
714
+ ## Security Notes
715
+
716
+ - OAuth credentials are stored securely in your local environment (`~/.gmail-mcp/`)
717
+ - The server uses offline access to maintain persistent authentication
718
+ - Never share or commit your credentials to version control
719
+ - Regularly review and revoke unused access in your Google Account settings
720
+ - Credentials are stored globally but are only accessible by the current user
721
+ - **Attachment files are processed locally and never stored permanently by the server**
722
+
723
+ ## Troubleshooting
724
+
725
+ 1. **OAuth Keys Not Found**
726
+ - Make sure `gcp-oauth.keys.json` is in either your current directory or `~/.gmail-mcp/`
727
+ - Check file permissions
728
+
729
+ 2. **Invalid Credentials Format**
730
+ - Ensure your OAuth keys file contains either `web` or `installed` credentials
731
+ - For web applications, verify the redirect URI is correctly configured
732
+
733
+ 3. **Port Already in Use**
734
+ - If port 3000 is already in use, please free it up before running authentication
735
+ - You can find and stop the process using that port
736
+
737
+ 4. **Batch Operation Failures**
738
+ - If batch operations fail, they automatically retry individual items
739
+ - Check the detailed error messages for specific failures
740
+ - Consider reducing the batch size if you encounter rate limiting
741
+
742
+ 5. **Attachment Issues**
743
+ - **File Not Found**: Ensure attachment file paths are correct and accessible
744
+ - **Permission Errors**: Check that the server has read access to attachment files
745
+ - **Size Limits**: Gmail has a 25MB attachment size limit per email
746
+ - **Download Failures**: Verify you have write permissions to the download directory
747
+
748
+ ## Contributing
749
+
750
+ Contributions are welcome! Please feel free to submit a Pull Request.
751
+
752
+
753
+ ## Running evals
754
+
755
+ The evals package loads an mcp client that then runs the index.ts file, so there is no need to rebuild between tests. You can load environment variables by prefixing the npx command. Full documentation can be found [here](https://www.mcpevals.io/docs).
756
+
757
+ ```bash
758
+ OPENAI_API_KEY=your-key npx mcp-eval src/evals/evals.ts src/index.ts
759
+ ```
760
+
761
+ ## License
762
+
763
+ MIT
764
+
765
+ ## Support
766
+
767
+ If you encounter any issues or have questions, please file an issue on the GitHub repository.