npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@sempervirens-labs/apple-mail-mcp

v1.6.1

Published

MCP server for Apple Mail - list accounts, mailboxes, search emails, and send messages

Readme

Apple Mail MCP

Native Agent Skill Available: This MCP is also available as a native Agent Skill compatible with Claude Code, Cursor, Gemini CLI, and Codex. You can find it here: Marketplace.

An MCP (Model Context Protocol) server for Apple Mail on macOS. Allows AI assistants like Claude to read, search, and send emails through Apple Mail.

Features

  • List Accounts - Get all configured email accounts
  • List Mailboxes - Get all mailboxes/folders for any account
  • Get Emails - Retrieve recent emails from any mailbox
  • Search Emails - Search by subject, sender, or content
  • Unread Count - Get unread email counts
  • Send Email - Compose and send emails with CC/BCC support
  • Archive Email - Move emails to the Archive mailbox
  • Delete Email - Move emails to Trash
  • Mark as Read/Unread - Change read status of emails
  • Create Draft - Create new draft emails
  • Create Draft Reply - Create draft replies to existing emails

Requirements

  • macOS (uses AppleScript to communicate with Apple Mail)
  • Bun runtime
  • Apple Mail app configured with at least one email account

Installation

From npm (Recommended)

# Install globally
bun add -g @sempervirens-labs/apple-mail-mcp

# Or run directly without installation
bunx @sempervirens-labs/apple-mail-mcp

From Source

git clone https://github.com/rbouschery/apple-mail-mcp.git
cd apple-mail-mcp
bun install

Configuration

Claude Code

Add to your ~/.claude/settings.json:

{
  "mcpServers": {
    "apple-mail": {
      "command": "bunx",
      "args": ["@sempervirens-labs/apple-mail-mcp"]
    }
  }
}

Or if running from source:

{
  "mcpServers": {
    "apple-mail": {
      "command": "bun",
      "args": ["run", "/path/to/apple-mail-mcp/src/index.ts"]
    }
  }
}

After adding the configuration, restart Claude Code for the changes to take effect.

Cursor

Add to your Cursor MCP settings (Settings > MCP Servers):

{
  "mcpServers": {
    "apple-mail": {
      "command": "bunx",
      "args": ["@sempervirens-labs/apple-mail-mcp"]
    }
  }
}

Or via Cursor's settings UI:

  1. Open Cursor Settings (Cmd + ,)
  2. Search for "MCP" or navigate to Extensions > MCP Servers
  3. Click "Add Server"
  4. Enter:
    • Name: apple-mail
    • Command: bunx
    • Arguments: @sempervirens-labs/apple-mail-mcp

Claude Desktop

Add to your ~/Library/Application Support/Claude/claude_desktop_config.json:

{
  "mcpServers": {
    "apple-mail": {
      "command": "bunx",
      "args": ["@sempervirens-labs/apple-mail-mcp"]
    }
  }
}

Available Tools

mail_list_accounts

List all email accounts configured in Apple Mail.

No parameters required

Example response:

{
  "accounts": ["[email protected]", "iCloud", "[email protected]"]
}

mail_list_mailboxes

List all mailboxes for a specific account or all accounts.

| Parameter | Type | Required | Description | |-----------|------|----------|-------------| | account | string | No | Account name to list mailboxes for |

Example response:

{
  "mailboxes": [
    {
      "account": "iCloud",
      "mailboxes": ["INBOX", "Drafts", "Sent Messages", "Archive", "Junk"]
    }
  ]
}

mail_get_emails

Get recent emails from a mailbox.

| Parameter | Type | Required | Default | Description | |-----------|------|----------|---------|-------------| | account | string | No | - | Account name | | mailbox | string | No | "INBOX" | Mailbox name | | limit | number | No | 10 | Max emails to retrieve | | includeContent | boolean | No | false | Include email body | | unreadOnly | boolean | No | false | Only return unread emails |

Example response:

{
  "emails": [
    {
      "id": 12345,
      "subject": "Meeting tomorrow",
      "sender": "John Doe <[email protected]>",
      "to": ["[email protected]", "[email protected]"],
      "cc": ["[email protected]"],
      "bcc": [],
      "dateSent": "Monday, 10. January 2025 at 09:30:00",
      "isRead": false
    }
  ],
  "count": 1
}

mail_get_emails_by_ids

Get specific emails by their IDs. Useful for retrieving full details of specific emails after browsing with mail_get_emails (with includeContent: false).

| Parameter | Type | Required | Default | Description | |-----------|------|----------|---------|-------------| | ids | number[] | Yes | - | Array of email IDs to retrieve | | account | string | No | - | Account name (helps optimize search) | | mailbox | string | No | "INBOX" | Mailbox name (helps optimize search) | | includeContent | boolean | No | true | Include email body |

Example usage:

{
  "ids": [12345, 67890],
  "includeContent": true
}

Example response:

{
  "emails": [
    {
      "id": 12345,
      "subject": "Meeting tomorrow",
      "sender": "John Doe <[email protected]>",
      "to": ["[email protected]"],
      "cc": [],
      "bcc": [],
      "dateSent": "Monday, 10. January 2025 at 09:30:00",
      "isRead": false,
      "content": "Let's meet at 2pm to discuss the project..."
    },
    {
      "id": 67890,
      "subject": "Project update",
      "sender": "Jane Smith <[email protected]>",
      "to": ["[email protected]"],
      "cc": [],
      "bcc": [],
      "dateSent": "Tuesday, 11. January 2025 at 14:15:00",
      "isRead": true,
      "content": "The project is progressing well..."
    }
  ],
  "count": 2,
  "requestedIds": [12345, 67890]
}

mail_search

Search emails by subject, sender, or content.

| Parameter | Type | Required | Default | Description | |-----------|------|----------|---------|-------------| | query | string | Yes | - | Search query | | account | string | No | - | Limit search to account | | mailbox | string | No | - | Limit search to mailbox | | limit | number | No | 10 | Max results |

mail_get_unread_count

Get the count of unread emails.

| Parameter | Type | Required | Description | |-----------|------|----------|-------------| | account | string | No | Account name | | mailbox | string | No | Mailbox name |

Example response:

{
  "unreadCount": 42
}

mail_send

Send an email using Apple Mail.

| Parameter | Type | Required | Description | |-----------|------|----------|-------------| | to | string or string[] | Yes | Recipient email(s) | | subject | string | Yes | Email subject | | body | string | Yes | Email body | | cc | string or string[] | No | CC recipient(s) | | bcc | string or string[] | No | BCC recipient(s) | | from | string | No | Sender (must be configured account) |

Example response:

{
  "success": true,
  "message": "Message sent successfully"
}

mail_archive

Archive an email by moving it to the Archive mailbox.

| Parameter | Type | Required | Default | Description | |-----------|------|----------|---------|-------------| | messageId | number | Yes | - | Email ID (from mail_get_emails or mail_search) | | account | string | No | - | Account name | | mailbox | string | No | "INBOX" | Current mailbox of the email | | archiveMailbox | string | No | auto-detect | Name of the archive folder (auto-detects "Archive", "Archives", or "All Mail") |

Example response:

{
  "success": true,
  "message": "Message archived successfully"
}

mail_delete

Delete an email by moving it to Trash.

| Parameter | Type | Required | Default | Description | |-----------|------|----------|---------|-------------| | messageId | number | Yes | - | Email ID (from mail_get_emails or mail_search) | | account | string | No | - | Account name | | mailbox | string | No | "INBOX" | Current mailbox of the email |

Example response:

{
  "success": true,
  "message": "Message deleted successfully"
}

mail_mark_read

Mark an email as read.

| Parameter | Type | Required | Default | Description | |-----------|------|----------|---------|-------------| | messageId | number | Yes | - | Email ID (from mail_get_emails or mail_search) | | account | string | No | - | Account name | | mailbox | string | No | "INBOX" | Mailbox where the email is located |

Example response:

{
  "success": true,
  "message": "Message marked as read"
}

mail_mark_unread

Mark an email as unread.

| Parameter | Type | Required | Default | Description | |-----------|------|----------|---------|-------------| | messageId | number | Yes | - | Email ID (from mail_get_emails or mail_search) | | account | string | No | - | Account name | | mailbox | string | No | "INBOX" | Mailbox where the email is located |

Example response:

{
  "success": true,
  "message": "Message marked as unread"
}

mail_create_draft

Create a new draft email.

| Parameter | Type | Required | Description | |-----------|------|----------|-------------| | to | string or string[] | No | Recipient email(s) | | subject | string | Yes | Email subject | | body | string | Yes | Email body | | cc | string or string[] | No | CC recipient(s) | | bcc | string or string[] | No | BCC recipient(s) | | from | string | No | Sender (must be configured account) |

Example response:

{
  "success": true,
  "message": "Draft created successfully"
}

mail_create_draft_reply

Create a draft reply to an existing email.

| Parameter | Type | Required | Default | Description | |-----------|------|----------|---------|-------------| | messageId | number | Yes | - | Email ID to reply to (from mail_get_emails or mail_search) | | body | string | Yes | - | Reply body content | | replyAll | boolean | No | false | Reply to all recipients | | account | string | No | - | Account name | | mailbox | string | No | "INBOX" | Mailbox where the original email is located |

Example response:

{
  "success": true,
  "message": "Draft reply created successfully"
}

Permissions

On first use, macOS will prompt you to grant permissions:

  1. Automation - Allow the terminal/app to control Apple Mail
  2. Mail Access - Allow access to your email data

You can manage these in System Settings > Privacy & Security > Automation.

Development

# Install dependencies
bun install

# Run in development mode
bun run dev

# Run the server
bun run start

Troubleshooting

"No accounts found"

  • Ensure Apple Mail is running and has at least one account configured
  • Check that automation permissions are granted in System Settings

"Operation not permitted"

  • Grant automation permissions: System Settings > Privacy & Security > Automation
  • Ensure the terminal/app running the MCP server has permission to control Mail

Server not connecting

  • Restart your AI client (Claude Code, Cursor, etc.) after adding the MCP configuration
  • Verify the path to the server is correct in your configuration
  • Check that Bun is installed and accessible from your PATH

License

MIT

Credits

Built as an alternative to apple-mcp with working mail operations using direct AppleScript execution.