Get the FREE Ultimate OpenClaw Setup Guide →

mail -bridge

Connect macOS Mail to AI through Model Context Protocol

Installation
Run this command in your terminal to add the MCP server to Claude Code.
Run in terminal:
Command
claude mcp add --transport stdio fatbobman-mail-mcp-bridge python3 /path/to/mail-mcp-bridge/src/mail_mcp_server.py \
  --env MAIL_ATTACHMENT_PATH="/tmp"

How to use

Mail MCP Bridge connects macOS Mail to an AI assistant via the Model Context Protocol (MCP). When you copy a Message-ID from Mail and feed it to your MCP-enabled AI, the bridge fetches the corresponding email (and its thread, attachments, and metadata) and exposes a structured representation that the AI can analyze. This enables use cases like summarizing emails, extracting requirements or action items, and inspecting attachments without exporting emails manually. The bridge documents the available MCP tools (such as reading emails, retrieving threads, and extracting attachments) so the AI can request specific data or perform actions such as reading a single email or an entire thread. To use it, configure your MCP client to point to the local mail MCP server (the “mail” server defined in the config), then copy a Message-ID from Mail and paste it into the AI chat to trigger analysis.

How to install

Prerequisites:

  • macOS 12.0+ with Mail.app
  • Python 3.9+ installed on the system
  • MCP-compatible AI assistant (e.g., Claude Desktop or similar)

Install steps:

  1. Clone the repository and install dependencies

    git clone https://github.com/fatbobman/mail-mcp-bridge.git
    cd mail-mcp-bridge
    
    # Install MCP package (example; adjust if your environment differs)
    pip3 install mcp
    
  2. Run the MCP server (local development usage)

    # Example command; update the path to the actual server script
    python3 src/mail_mcp_server.py
    
  3. Configure your MCP client (e.g., Claude Desktop) to use the local server

    • In Claude, locate claude_desktop_config.json and add an entry for the MCP server named "mail" with:
      {
        "mcpServers": {
          "mail": {
            "command": "python3",
            "args": ["/path/to/mail-mcp-bridge/src/mail_mcp_server.py"]
          }
        }
      }
      
    • If you want to enable attachment handling, set the environment variable for the attachment path when configuring the server:
      {
        "mcpServers": {
          "mail": {
            "command": "python3",
            "args": ["/path/to/mail-mcp-bridge/src/mail_mcp_server.py"],
            "env": {
              "MAIL_ATTACHMENT_PATH": "/tmp"
            }
          }
        }
      }
      
  4. Restart Claude Desktop (quit completely and reopen) to pick up the new MCP server configuration.

Notes:

  • Replace "/path/to/mail-mcp-bridge" with your actual installation path.
  • Ensure any required system permissions (e.g., access to Mail data) are granted as needed.

Additional notes

Tips and caveats:

  • The bridge reads Mail content through MCP; ensure the Message-ID you provide includes angle brackets (e.g., message-id@example.com).
  • Attachments are stored temporarily if enabled; clean up may be necessary to avoid filling /tmp.
  • If the MCP server cannot be found by your AI, verify the claude_desktop_config.json path and ensure the server script path is correct.
  • You can customize the attachment directory using MAIL_ATTACHMENT_PATH; if not set, defaults are used.
  • For best performance, run the bridge on a macOS machine with direct access to the Mail database and emlx files.

Related MCP Servers

Sponsor this space

Reach thousands of developers