- Fixed reply threading — auto-resolves In-Reply-To and References headers so email replies land in the correct thread instead of creating orphaned messages (upstream PR 91, still pending) - Send-as alias support — optional from parameter for multi-identity email management (send from any configured Gmail alias) - Reply-all tool — replyall automatically fetches the original email, builds To/CC rec
Add this skill
npx mdskills install ArtyMcLabin/gmail-mcp-serverComprehensive Gmail MCP server with excellent security hardening, granular OAuth scoping, and robust threading/attachment support
1# Gmail AutoAuth MCP Server (Actively Maintained Fork)23[](https://github.com/ArtyMcLabin/Gmail-MCP-Server/actions/workflows/ci.yml)45> **This is an actively maintained fork of [GongRzhe/Gmail-MCP-Server](https://github.com/GongRzhe/Gmail-MCP-Server).**6>7> The original repository has been unmaintained since August 2025 — 7+ months with zero maintainer activity and 72+ unmerged pull requests. I use this MCP server daily as part of my Claude Code workflow and depend on it working correctly, so I picked it up.8>9> **Pull requests are welcome.** If you've been sitting on fixes or features with nowhere to submit them, this is the place.1011### What this fork adds1213- **Fixed reply threading** — auto-resolves `In-Reply-To` and `References` headers so email replies land in the correct thread instead of creating orphaned messages ([upstream PR #91](https://github.com/GongRzhe/Gmail-MCP-Server/pull/91), still pending)14- **Send-as alias support** — optional `from` parameter for multi-identity email management (send from any configured Gmail alias)15- **Reply-all tool** — `reply_all` automatically fetches the original email, builds To/CC recipient lists (excluding yourself), and sets proper threading headers ([PR #3](https://github.com/ArtyMcLabin/Gmail-MCP-Server/pull/3) by [@MaxGhenis](https://github.com/MaxGhenis))16- **Fixed `list_filters`** — was returning empty array due to wrong response property name ([PR #4](https://github.com/ArtyMcLabin/Gmail-MCP-Server/pull/4) by [@nicholas-anthony-ai](https://github.com/nicholas-anthony-ai))17- **Custom OAuth2 scoping** — `--scopes` flag to request only the permissions you need, with automatic tool filtering ([PR #6](https://github.com/ArtyMcLabin/Gmail-MCP-Server/pull/6) by [@tansanDOTeth](https://github.com/tansanDOTeth))18- **CI/CD hardening** — fixed shell injection vector in GitHub Actions workflow, added least-privilege permissions scope ([PR #9](https://github.com/ArtyMcLabin/Gmail-MCP-Server/pull/9) by [@JF10R](https://github.com/JF10R))19- **Security hardening** — fixed path traversal in attachment download, restricted OAuth credential file permissions ([PR #10](https://github.com/ArtyMcLabin/Gmail-MCP-Server/pull/10) by [@JF10R](https://github.com/JF10R))20- **Dependency security** — upgraded MCP SDK to v1.27.1 (3 CVE fixes), upgraded nodemailer (DoS + routing fix), moved dev-only packages out of production deps ([PR #11](https://github.com/ArtyMcLabin/Gmail-MCP-Server/pull/11) by [@JF10R](https://github.com/JF10R))2122All features are production-tested in daily use.2324---2526A 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.2728293031## Features3233- Send emails with subject, content, **attachments**, and recipients34- **Full attachment support** - send and receive file attachments35- **Download email attachments** to local filesystem36- Support for HTML emails and multipart messages with both HTML and plain text versions37- Full support for international characters in subject lines and email content38- Read email messages by ID with advanced MIME structure handling39- **Enhanced attachment display** showing filenames, types, sizes, and download IDs40- 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 labels44- Mark emails as read/unread45- Move emails to different labels/folders46- Delete emails47- **Batch operations for efficiently processing multiple emails at once**48- Full integration with Gmail API49- Simple OAuth2 authentication flow with auto browser launch50- Support for both Desktop and Web application credentials51- Global credential storage for convenience5253## Installation & Authentication5455### Installing Manually561. Create a Google Cloud Project and obtain credentials:5758 a. Create a Google Cloud Project:59 - Go to [Google Cloud Console](https://console.cloud.google.com/)60 - Create a new project or select an existing one61 - Enable the Gmail API for your project6263 b. Create OAuth 2.0 Credentials:64 - Go to "APIs & Services" > "Credentials"65 - Click "Create Credentials" > "OAuth client ID"66 - Choose either "Desktop app" or "Web application" as application type67 - Give it a name and click "Create"68 - For Web application, add `http://localhost:3000/oauth2callback` to the authorized redirect URIs69 - Download the JSON file of your client's OAuth keys70 - Rename the key file to `gcp-oauth.keys.json`71722. Run Authentication:7374 You can authenticate in two ways:7576 a. Global Authentication (Recommended):77 ```bash78 # First time: Place gcp-oauth.keys.json in your home directory's .gmail-mcp folder79 mkdir -p ~/.gmail-mcp80 mv gcp-oauth.keys.json ~/.gmail-mcp/8182 # Run authentication from anywhere83 npx @gongrzhe/server-gmail-autoauth-mcp auth84 ```8586 b. Local Authentication:87 ```bash88 # Place gcp-oauth.keys.json in your current directory89 # The file will be automatically copied to global config90 npx @gongrzhe/server-gmail-autoauth-mcp auth91 ```9293 The authentication process will:94 - Look for `gcp-oauth.keys.json` in the current directory or `~/.gmail-mcp/`95 - If found in current directory, copy it to `~/.gmail-mcp/`96 - Open your default browser for Google authentication97 - Save credentials as `~/.gmail-mcp/credentials.json`9899 > **Note**:100 > - After successful authentication, credentials are stored globally in `~/.gmail-mcp/` and can be used from any directory101 > - Both Desktop app and Web application credentials are supported102 > - For Web application credentials, make sure to add `http://localhost:3000/oauth2callback` to your authorized redirect URIs1031043. Configure in Claude Desktop:105106```json107{108 "mcpServers": {109 "gmail": {110 "command": "npx",111 "args": [112 "@gongrzhe/server-gmail-autoauth-mcp"113 ]114 }115 }116}117```118119### Docker Support120121If you prefer using Docker:1221231. Authentication:124```bash125docker run -i --rm \126 --mount type=bind,source=/path/to/gcp-oauth.keys.json,target=/gcp-oauth.keys.json \127 -v mcp-gmail:/gmail-server \128 -e GMAIL_OAUTH_PATH=/gcp-oauth.keys.json \129 -e "GMAIL_CREDENTIALS_PATH=/gmail-server/credentials.json" \130 -p 3000:3000 \131 mcp/gmail auth132```1331342. Usage:135```json136{137 "mcpServers": {138 "gmail": {139 "command": "docker",140 "args": [141 "run",142 "-i",143 "--rm",144 "-v",145 "mcp-gmail:/gmail-server",146 "-e",147 "GMAIL_CREDENTIALS_PATH=/gmail-server/credentials.json",148 "mcp/gmail"149 ]150 }151 }152}153```154155### Cloud Server Authentication156157For cloud server environments (like n8n), you can specify a custom callback URL during authentication:158159```bash160npx @gongrzhe/server-gmail-autoauth-mcp auth https://gmail.gongrzhe.com/oauth2callback161```162163#### Setup Instructions for Cloud Environment1641651. **Configure Reverse Proxy:**166 - Set up your n8n container to expose a port for authentication167 - Configure a reverse proxy to forward traffic from your domain (e.g., `gmail.gongrzhe.com`) to this port1681692. **DNS Configuration:**170 - Add an A record in your DNS settings to resolve your domain to your cloud server's IP address1711723. **Google Cloud Platform Setup:**173 - In your Google Cloud Console, add your custom domain callback URL (e.g., `https://gmail.gongrzhe.com/oauth2callback`) to the authorized redirect URIs list1741754. **Run Authentication:**176 ```bash177 npx @gongrzhe/server-gmail-autoauth-mcp auth https://gmail.gongrzhe.com/oauth2callback178 ```1791805. **Configure in your application:**181 ```json182 {183 "mcpServers": {184 "gmail": {185 "command": "npx",186 "args": [187 "@gongrzhe/server-gmail-autoauth-mcp"188 ]189 }190 }191 }192 ```193194This approach allows authentication flows to work properly in environments where localhost isn't accessible, such as containerized applications or cloud servers.195196## OAuth Scopes197198You can limit the server's Gmail access by specifying OAuth scopes during authentication. This controls which tools are available to the LLM, reducing the attack surface for sensitive operations.199200### Available Scopes201202| Scope | Description |203|-------|-------------|204| `gmail.readonly` | Read-only access to emails (search, read, download attachments) |205| `gmail.modify` | Full read/write access to emails (superset of `readonly` - includes sending, modifying, deleting) |206| `gmail.compose` | Create drafts and send emails only |207| `gmail.send` | Send emails only |208| `gmail.labels` | Manage labels only |209| `gmail.settings.basic` | Manage filters and settings |210211> **Note**: `gmail.modify` is a superset that includes all read capabilities. You don't need `gmail.readonly` if you have `gmail.modify`.212213### Authenticating with Specific Scopes214215Use the `--scopes` flag to request only the permissions you need:216217```bash218# Read-only access (recommended for safe browsing)219npx @gongrzhe/server-gmail-autoauth-mcp auth --scopes=gmail.readonly220221# Read-only with filter management222npx @gongrzhe/server-gmail-autoauth-mcp auth --scopes=gmail.readonly,gmail.settings.basic223224# Full access (default behavior)225npx @gongrzhe/server-gmail-autoauth-mcp auth --scopes=gmail.modify,gmail.settings.basic226```227228If no `--scopes` flag is provided, the server defaults to `gmail.modify,gmail.settings.basic` for full functionality.229230### Scope-to-Tool Mapping231232The server automatically filters available tools based on your authorized scopes:233234| Tools | Required Scope (any) |235|-------|---------------------|236| `read_email`, `search_emails`, `download_attachment` | `gmail.readonly` or `gmail.modify` |237| `list_email_labels` | `gmail.readonly`, `gmail.modify`, or `gmail.labels` |238| `send_email`, `draft_email`, `reply_all` | `gmail.modify`, `gmail.compose`, or `gmail.send` |239| `modify_email`, `delete_email`, `batch_modify_emails`, `batch_delete_emails` | `gmail.modify` |240| `create_label`, `update_label`, `delete_label`, `get_or_create_label` | `gmail.modify` or `gmail.labels` |241| `list_filters`, `get_filter`, `create_filter`, `delete_filter`, `create_filter_from_template` | `gmail.settings.basic` |242243### Re-authenticating244245To change your scopes, simply run the auth command again with different scopes. This will replace your existing credentials.246247## Claude Code CLI Configuration248249To use this MCP server with [Claude Code](https://docs.anthropic.com/en/docs/claude-code), add it to your MCP settings.250251### Read-Only Configuration (Recommended for Safe Browsing)252253First, authenticate with read-only scope:254255```bash256npx @gongrzhe/server-gmail-autoauth-mcp auth --scopes=gmail.readonly257```258259Then add to your Claude Code MCP settings (`~/.claude/mcp_settings.json` or project-level `.mcp.json`):260261```json262{263 "mcpServers": {264 "gmail": {265 "command": "npx",266 "args": ["@gongrzhe/server-gmail-autoauth-mcp"]267 }268 }269}270```271272With read-only scopes, only these 4 tools will be available to Claude:273- `read_email` - Read email content274- `search_emails` - Search your inbox275- `list_email_labels` - List available labels276- `download_attachment` - Download attachments277278### Full Access Configuration279280For full Gmail management capabilities:281282```bash283npx @gongrzhe/server-gmail-autoauth-mcp auth --scopes=gmail.modify,gmail.settings.basic284```285286```json287{288 "mcpServers": {289 "gmail": {290 "command": "npx",291 "args": ["@gongrzhe/server-gmail-autoauth-mcp"]292 }293 }294}295```296297This enables all 20 tools including sending emails, managing labels, creating filters, reply-all, and batch operations.298299## Available Tools300301The server provides the following tools that can be used through Claude Desktop:302303### 1. Send Email (`send_email`)304305Sends a new email immediately. Supports plain text, HTML, or multipart emails **with optional file attachments**.306307Basic Email:308```json309{310 "to": ["recipient@example.com"],311 "subject": "Meeting Tomorrow",312 "body": "Hi,\n\nJust a reminder about our meeting tomorrow at 10 AM.\n\nBest regards",313 "cc": ["cc@example.com"],314 "bcc": ["bcc@example.com"],315 "mimeType": "text/plain"316}317```318319**Email with Attachments:**320```json321{322 "to": ["recipient@example.com"],323 "subject": "Project Files",324 "body": "Hi,\n\nPlease find the project files attached.\n\nBest regards",325 "attachments": [326 "/path/to/document.pdf",327 "/path/to/spreadsheet.xlsx",328 "/path/to/presentation.pptx"329 ]330}331```332333HTML Email Example:334```json335{336 "to": ["recipient@example.com"],337 "subject": "Meeting Tomorrow",338 "mimeType": "text/html",339 "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>"340}341```342343Multipart Email Example (HTML + Plain Text):344```json345{346 "to": ["recipient@example.com"],347 "subject": "Meeting Tomorrow",348 "mimeType": "multipart/alternative",349 "body": "Hi,\n\nJust a reminder about our meeting tomorrow at 10 AM.\n\nBest regards",350 "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>"351}352```353354### 2. Draft Email (`draft_email`)355Creates a draft email without sending it. **Also supports attachments**.356357```json358{359 "to": ["recipient@example.com"],360 "subject": "Draft Report",361 "body": "Here's the draft report for your review.",362 "cc": ["manager@example.com"],363 "attachments": ["/path/to/draft_report.docx"]364}365```366367### 3. Read Email (`read_email`)368Retrieves the content of a specific email by its ID. **Now shows enhanced attachment information**.369370```json371{372 "messageId": "182ab45cd67ef"373}374```375376**Enhanced Response includes attachment details:**377```378Subject: Project Files379From: sender@example.com380To: recipient@example.com381Date: Thu, 19 Jun 2025 10:30:00 -0400382383Email body content here...384385Attachments (2):386- document.pdf (application/pdf, 245 KB, ID: ANGjdJ9fkTs-i3GCQo5o97f_itG...)387- spreadsheet.xlsx (application/vnd.openxmlformats-officedocument.spreadsheetml.sheet, 89 KB, ID: BWHkeL8gkUt-j4HDRp6o98g_juI...)388```389390### 4. **Download Attachment (`download_attachment`)**391**NEW**: Downloads email attachments to your local filesystem.392393```json394{395 "messageId": "182ab45cd67ef",396 "attachmentId": "ANGjdJ9fkTs-i3GCQo5o97f_itG...",397 "savePath": "/path/to/downloads",398 "filename": "downloaded_document.pdf"399}400```401402Parameters:403- `messageId`: The ID of the email containing the attachment404- `attachmentId`: The attachment ID (shown in enhanced email display)405- `savePath`: Directory to save the file (optional, defaults to current directory)406- `filename`: Custom filename (optional, uses original filename if not provided)407408### 5. Search Emails (`search_emails`)409Searches for emails using Gmail search syntax.410411```json412{413 "query": "from:sender@example.com after:2024/01/01 has:attachment",414 "maxResults": 10415}416```417418### 6. Modify Email (`modify_email`)419Adds or removes labels from emails (move to different folders, archive, etc.).420421```json422{423 "messageId": "182ab45cd67ef",424 "addLabelIds": ["IMPORTANT"],425 "removeLabelIds": ["INBOX"]426}427```428429### 7. Delete Email (`delete_email`)430Permanently deletes an email.431432```json433{434 "messageId": "182ab45cd67ef"435}436```437438### 8. List Email Labels (`list_email_labels`)439Retrieves all available Gmail labels.440441```json442{}443```444445### 9. Create Label (`create_label`)446Creates a new Gmail label.447448```json449{450 "name": "Important Projects",451 "messageListVisibility": "show",452 "labelListVisibility": "labelShow"453}454```455456### 10. Update Label (`update_label`)457Updates an existing Gmail label.458459```json460{461 "id": "Label_1234567890",462 "name": "Urgent Projects",463 "messageListVisibility": "show",464 "labelListVisibility": "labelShow"465}466```467468### 11. Delete Label (`delete_label`)469Deletes a Gmail label.470471```json472{473 "id": "Label_1234567890"474}475```476477### 12. Get or Create Label (`get_or_create_label`)478Gets an existing label by name or creates it if it doesn't exist.479480```json481{482 "name": "Project XYZ",483 "messageListVisibility": "show",484 "labelListVisibility": "labelShow"485}486```487488### 13. Batch Modify Emails (`batch_modify_emails`)489Modifies labels for multiple emails in efficient batches.490491```json492{493 "messageIds": ["182ab45cd67ef", "182ab45cd67eg", "182ab45cd67eh"],494 "addLabelIds": ["IMPORTANT"],495 "removeLabelIds": ["INBOX"],496 "batchSize": 50497}498```499500### 14. Batch Delete Emails (`batch_delete_emails`)501Permanently deletes multiple emails in efficient batches.502503```json504{505 "messageIds": ["182ab45cd67ef", "182ab45cd67eg", "182ab45cd67eh"],506 "batchSize": 50507}508```509510### 15. Create Filter (`create_filter`)511Creates a new Gmail filter with custom criteria and actions.512513```json514{515 "criteria": {516 "from": "newsletter@company.com",517 "hasAttachment": false518 },519 "action": {520 "addLabelIds": ["Label_Newsletter"],521 "removeLabelIds": ["INBOX"]522 }523}524```525526### 16. List Filters (`list_filters`)527Retrieves all Gmail filters.528529```json530{}531```532533### 17. Get Filter (`get_filter`)534Gets details of a specific Gmail filter.535536```json537{538 "filterId": "ANe1Bmj1234567890"539}540```541542### 18. Delete Filter (`delete_filter`)543Deletes a Gmail filter.544545```json546{547 "filterId": "ANe1Bmj1234567890"548}549```550551### 19. Create Filter from Template (`create_filter_from_template`)552Creates a filter using pre-defined templates for common scenarios.553554```json555{556 "template": "fromSender",557 "parameters": {558 "senderEmail": "notifications@github.com",559 "labelIds": ["Label_GitHub"],560 "archive": true561 }562}563```564565### 20. Reply All (`reply_all`)566Replies to all recipients of an email. Automatically fetches the original email to build the recipient list and sets proper threading headers (`In-Reply-To`, `References`, `threadId`).567568**How it works:**5691. Fetches the original email by `messageId`5702. Builds **To** from the original sender (From header)5713. Builds **CC** from original To + CC, excluding your own email5724. Sets threading headers so the reply lands in the correct thread5735. Sends via the existing `send_email` pipeline (supports attachments, HTML, multipart)574575```json576{577 "messageId": "182ab45cd67ef",578 "body": "Thanks for the update, everyone. I'll review and get back to you.",579 "mimeType": "text/plain"580}581```582583**With HTML and attachments:**584```json585{586 "messageId": "182ab45cd67ef",587 "body": "Plain text fallback",588 "htmlBody": "<p>Thanks for the update. See attached notes.</p>",589 "mimeType": "multipart/alternative",590 "attachments": ["/path/to/notes.pdf"]591}592```593594Parameters:595- `messageId` (required): ID of the email to reply to596- `body` (required): Reply body (plain text, or fallback when using multipart)597- `htmlBody` (optional): HTML version of the reply body598- `mimeType` (optional): `text/plain` (default), `text/html`, or `multipart/alternative`599- `attachments` (optional): Array of file paths to attach600601## Filter Management Features602603### Filter Criteria604605You can create filters based on various criteria:606607| Criteria | Example | Description |608|----------|---------|-------------|609| `from` | `"sender@example.com"` | Emails from a specific sender |610| `to` | `"recipient@example.com"` | Emails sent to a specific recipient |611| `subject` | `"Meeting"` | Emails with specific text in subject |612| `query` | `"has:attachment"` | Gmail search query syntax |613| `negatedQuery` | `"spam"` | Text that must NOT be present |614| `hasAttachment` | `true` | Emails with attachments |615| `size` | `10485760` | Email size in bytes |616| `sizeComparison` | `"larger"` | Size comparison (`larger`, `smaller`) |617618### Filter Actions619620Filters can perform the following actions:621622| Action | Example | Description |623|--------|---------|-------------|624| `addLabelIds` | `["IMPORTANT", "Label_Work"]` | Add labels to matching emails |625| `removeLabelIds` | `["INBOX", "UNREAD"]` | Remove labels from matching emails |626| `forward` | `"backup@example.com"` | Forward emails to another address |627628### Filter Templates629630The server includes pre-built templates for common filtering scenarios:631632#### 1. From Sender Template (`fromSender`)633Filters emails from a specific sender and optionally archives them.634635```json636{637 "template": "fromSender",638 "parameters": {639 "senderEmail": "newsletter@company.com",640 "labelIds": ["Label_Newsletter"],641 "archive": true642 }643}644```645646#### 2. Subject Filter Template (`withSubject`)647Filters emails with specific subject text and optionally marks as read.648649```json650{651 "template": "withSubject",652 "parameters": {653 "subjectText": "[URGENT]",654 "labelIds": ["Label_Urgent"],655 "markAsRead": false656 }657}658```659660#### 3. Attachment Filter Template (`withAttachments`)661Filters all emails with attachments.662663```json664{665 "template": "withAttachments",666 "parameters": {667 "labelIds": ["Label_Attachments"]668 }669}670```671672#### 4. Large Email Template (`largeEmails`)673Filters emails larger than a specified size.674675```json676{677 "template": "largeEmails",678 "parameters": {679 "sizeInBytes": 10485760,680 "labelIds": ["Label_Large"]681 }682}683```684685#### 5. Content Filter Template (`containingText`)686Filters emails containing specific text and optionally marks as important.687688```json689{690 "template": "containingText",691 "parameters": {692 "searchText": "invoice",693 "labelIds": ["Label_Finance"],694 "markImportant": true695 }696}697```698699#### 6. Mailing List Template (`mailingList`)700Filters mailing list emails and optionally archives them.701702```json703{704 "template": "mailingList",705 "parameters": {706 "listIdentifier": "dev-team",707 "labelIds": ["Label_DevTeam"],708 "archive": true709 }710}711```712713### Common Filter Examples714715Here are some practical filter examples:716717**Auto-organize newsletters:**718```json719{720 "criteria": {721 "from": "newsletter@company.com"722 },723 "action": {724 "addLabelIds": ["Label_Newsletter"],725 "removeLabelIds": ["INBOX"]726 }727}728```729730**Handle promotional emails:**731```json732{733 "criteria": {734 "query": "unsubscribe OR promotional"735 },736 "action": {737 "addLabelIds": ["Label_Promotions"],738 "removeLabelIds": ["INBOX", "UNREAD"]739 }740}741```742743**Priority emails from boss:**744```json745{746 "criteria": {747 "from": "boss@company.com"748 },749 "action": {750 "addLabelIds": ["IMPORTANT", "Label_Boss"]751 }752}753```754755**Large attachments:**756```json757{758 "criteria": {759 "size": 10485760,760 "sizeComparison": "larger",761 "hasAttachment": true762 },763 "action": {764 "addLabelIds": ["Label_LargeFiles"]765 }766}767```768769## Advanced Search Syntax770771The `search_emails` tool supports Gmail's powerful search operators:772773| Operator | Example | Description |774|----------|---------|-------------|775| `from:` | `from:john@example.com` | Emails from a specific sender |776| `to:` | `to:mary@example.com` | Emails sent to a specific recipient |777| `subject:` | `subject:"meeting notes"` | Emails with specific text in the subject |778| `has:attachment` | `has:attachment` | Emails with attachments |779| `after:` | `after:2024/01/01` | Emails received after a date |780| `before:` | `before:2024/02/01` | Emails received before a date |781| `is:` | `is:unread` | Emails with a specific state |782| `label:` | `label:work` | Emails with a specific label |783784You can combine multiple operators: `from:john@example.com after:2024/01/01 has:attachment`785786## Advanced Features787788### **Email Attachment Support**789790The server provides comprehensive attachment functionality:791792- **Sending Attachments**: Include file paths in the `attachments` array when sending or drafting emails793- **Attachment Detection**: Automatically detects MIME types and file sizes794- **Download Capability**: Download any email attachment to your local filesystem795- **Enhanced Display**: View detailed attachment information including filenames, types, sizes, and download IDs796- **Multiple Formats**: Support for all common file types (documents, images, archives, etc.)797- **RFC822 Compliance**: Uses Nodemailer for proper MIME message formatting798799**Supported File Types**: All standard file types including PDF, DOCX, XLSX, PPTX, images (PNG, JPG, GIF), archives (ZIP, RAR), and more.800801### Email Content Extraction802803The server intelligently extracts email content from complex MIME structures:804805- Prioritizes plain text content when available806- Falls back to HTML content if plain text is not available807- Handles multi-part MIME messages with nested parts808- **Processes attachments information (filename, type, size, download ID)**809- Preserves original email headers (From, To, Subject, Date)810811### International Character Support812813The server fully supports non-ASCII characters in email subjects and content, including:814- Turkish, Chinese, Japanese, Korean, and other non-Latin alphabets815- Special characters and symbols816- Proper encoding ensures correct display in email clients817818### Comprehensive Label Management819820The server provides a complete set of tools for managing Gmail labels:821822- **Create Labels**: Create new labels with customizable visibility settings823- **Update Labels**: Rename labels or change their visibility settings824- **Delete Labels**: Remove user-created labels (system labels are protected)825- **Find or Create**: Get a label by name or automatically create it if not found826- **List All Labels**: View all system and user labels with detailed information827- **Label Visibility Options**: Control how labels appear in message and label lists828829Label visibility settings include:830- `messageListVisibility`: Controls whether the label appears in the message list (`show` or `hide`)831- `labelListVisibility`: Controls how the label appears in the label list (`labelShow`, `labelShowIfUnread`, or `labelHide`)832833These label management features enable sophisticated organization of emails directly through Claude, without needing to switch to the Gmail interface.834835### Batch Operations836837The server includes efficient batch processing capabilities:838839- Process up to 50 emails at once (configurable batch size)840- Automatic chunking of large email sets to avoid API limits841- Detailed success/failure reporting for each operation842- Graceful error handling with individual retries843- Perfect for bulk inbox management and organization tasks844845## Security Notes846847- OAuth credentials are stored securely in your local environment (`~/.gmail-mcp/`)848- The server uses offline access to maintain persistent authentication849- Never share or commit your credentials to version control850- Regularly review and revoke unused access in your Google Account settings851- Credentials are stored globally but are only accessible by the current user852- **Attachment files are processed locally and never stored permanently by the server**853854## Troubleshooting8558561. **OAuth Keys Not Found**857 - Make sure `gcp-oauth.keys.json` is in either your current directory or `~/.gmail-mcp/`858 - Check file permissions8598602. **Invalid Credentials Format**861 - Ensure your OAuth keys file contains either `web` or `installed` credentials862 - For web applications, verify the redirect URI is correctly configured8638643. **Port Already in Use**865 - If port 3000 is already in use, please free it up before running authentication866 - You can find and stop the process using that port8678684. **Batch Operation Failures**869 - If batch operations fail, they automatically retry individual items870 - Check the detailed error messages for specific failures871 - Consider reducing the batch size if you encounter rate limiting8728735. **Attachment Issues**874 - **File Not Found**: Ensure attachment file paths are correct and accessible875 - **Permission Errors**: Check that the server has read access to attachment files876 - **Size Limits**: Gmail has a 25MB attachment size limit per email877 - **Download Failures**: Verify you have write permissions to the download directory878879## Contributing880881Contributions are welcome! Please feel free to submit a Pull Request.882883**CI requires README updates** — every push to `main` and every PR must include a README.md change (even a version bump or changelog entry). This ensures documentation stays current as the codebase evolves.884885To bypass for commits that genuinely don't need a docs update (dependency bumps, CI config changes), include `[skip-readme]` or `[no-readme]` in your commit message or PR title.886887888## Running evals889890The 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).891892```bash893OPENAI_API_KEY=your-key npx mcp-eval src/evals/evals.ts src/index.ts894```895896## License897898MIT899900## Support901902If you encounter any issues or have questions, please [file an issue](https://github.com/ArtyMcLabin/Gmail-MCP-Server/issues).903
Full transparency — inspect the skill content before installing.