macos-mail-draft-mcp

macos-mail-draft-mcp

Creates email drafts in the macOS Mail app using AppleScript, with support for recipients, subject, body, attachments, and sender selection. No email is sent; drafts are saved locally and synced to the mail server by Mail.

Category
Visit Server

README

macos-mail-draft-mcp

An MCP (Model Context Protocol) server that creates email drafts in the macOS Mail app. The server itself runs locally: it drives Mail.app through AppleScript (osascript), opens no network services of its own, and handles no credentials — it never sends an email. Note, however, that Mail owns the draft once it is saved: if the target account is an IMAP, Exchange, or Gmail account (anything other than "On My Mac"), Mail syncs the draft — including its body and attachments — to that account's mail server, just as it would for any draft you create by hand.

Requirements

  • macOS with Mail.app configured with at least one account
  • Node.js >= 24 (runs the TypeScript source directly — there is no build step and no compiled artifacts; erasableSyntaxOnly keeps the source type-strippable)

Setup

npm install

Register with Claude Code

claude mcp add macos-mail-draft -- node /absolute/path/to/macos-mail-draft-mcp/src/index.ts

Register with Claude Desktop

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

{
  "mcpServers": {
    "macos-mail-draft": {
      "command": "node",
      "args": ["/absolute/path/to/macos-mail-draft-mcp/src/index.ts"]
    }
  }
}

Automation permission

The first time a draft is created, macOS asks the host application (your terminal, Claude Desktop, etc.) for permission to control Mail. If a call fails with "Not authorized to send Apple events", grant access under System Settings > Privacy & Security > Automation.

Tool: create_mail_draft

Creates a draft in Mail's Drafts mailbox. No email is sent. If the draft is saved to a synced account (IMAP / Exchange / Gmail), Mail uploads it to that account's Drafts mailbox on the remote server.

Parameter Type Required Description
to array of address strings or {address, name} yes Primary recipients
subject string yes Subject line
body string yes Plain-text body
cc / bcc same shape as to no CC / BCC recipients
attachments array of absolute POSIX paths no Files to attach (a leading ~ is expanded; files must exist)
sender email address no Account address to send from; defaults to Mail's default account
openComposeWindow boolean no Open the draft in a compose window and bring Mail to the front (default on); false saves silently to Drafts. Attachments are only allowed with the compose window open, so the files being attached are visible for review.

Example call:

{
  "to": [{ "address": "someone@example.com", "name": "Someone" }],
  "subject": "Quarterly report",
  "body": "Hi,\n\nDraft attached.\n\nJason",
  "attachments": ["~/Documents/report.pdf"]
}

Development

npm run dev          # run the server from source (tsx)
npm run check        # typecheck + lint + format check + tests
npm run test:watch   # vitest in watch mode

The AppleScript is generated from validated (zod) input, and every interpolated value is escaped for AppleScript string literals, so recipient names, subjects and bodies cannot break out into script code. Attachment paths are checked to be existing regular files before any script runs.

Known Mail quirks

  • Mail silently drops attachments if a draft is saved in the same instant they are added, so the generated script waits one second before saving.
  • After saving, the invisible compose session is closed (close ... saving no) so windows don't accumulate. Mail may still keep an inert entry in its scripting outgoing messages list until it is next restarted; this is harmless and invisible.
  • Rich text (HTML) bodies are not supported in v1: Mail's AppleScript dictionary cannot set HTML content on an outgoing message, and the available workarounds require GUI scripting via the clipboard.

Recommended Servers

playwright-mcp

playwright-mcp

A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.

Official
Featured
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.

Official
Featured
Local
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.

Official
Featured
Local
TypeScript
VeyraX MCP

VeyraX MCP

Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.

Official
Featured
Local
graphlit-mcp-server

graphlit-mcp-server

The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.

Official
Featured
TypeScript
Kagi MCP Server

Kagi MCP Server

An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.

Official
Featured
Python
E2B

E2B

Using MCP to run code via e2b.

Official
Featured
Neon Database

Neon Database

MCP server for interacting with Neon Management API and databases

Official
Featured
Exa Search

Exa Search

A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.

Official
Featured
Qdrant Server

Qdrant Server

This repository is an example of how to create a MCP server for Qdrant, a vector search engine.

Official
Featured