MCP server

SDKs & integrations

Plug MyAgentMail into Claude, ChatGPT, Codex, Cursor, Windsurf, Cline, or any MCP-compatible client. Your AI assistant gets email, drafts, attachments and calendar tools instantly.

What is MCP?

The Model Context Protocol is an open standard for connecting AI assistants to external tools. MyAgentMail offers it two ways:

  • Remote connector (recommended): https://mcp.myagentmail.com/mcp. Nothing to install. You sign in to MyAgentMail and click Allow; no API key is copied anywhere. Works in claude.ai, Claude Desktop, Claude mobile, Claude Code, ChatGPT and Codex. Step-by-step setup: Connect MyAgentMail to Claude and ChatGPT.
  • Local server: npx -y myagentmail-mcp@latest, authenticated with an API key. Use it for clients that only launch local subprocesses, or when you want to scope the agent to one workspace or one inbox with a narrower key.

Remote connector

Add https://mcp.myagentmail.com/mcp as a custom connector and click Connect. The server implements the MCP authorization spec (OAuth discovery, dynamic client registration, PKCE, refresh tokens), so the client sets itself up. In Claude Code:

claude mcp add --transport http myagentmail https://mcp.myagentmail.com/mcp

A connection has access to every workspace and inbox in your account. Each one gets its own key, listed under Dashboard → API Keys → Connected apps, where you can disconnect it at any time.

Local server

Every tool call acts as the MyAgentMail API key you configure, and the key decides what the agent can see:

  • tk_: tenant master, every inbox and workspace in your account. Fine for your own machine.
  • wk_: workspace, one workspace only (reseller or per-customer isolation).
  • ak_: single inbox, the narrowest scope. Use it when handing an inbox to an employee or a deployed agent. Search, list and every other tool are confined to that inbox, and regenerating the key revokes access instantly.

Get a key from Dashboard → API Keys (tenant and workspace keys) or from an inbox's Settings → Agent API key (its ak_ key, shown once). Set it as MYAGENTMAIL_KEY in the client's env block. Never put a key in a query string or a shared file.

Use npx -y myagentmail-mcp@latest. The @latest tag makes each host restart pick up the newest version; a bare package name can pin you to a stale npx cache.

Claude Desktop

Edit ~/Library/Application Support/Claude/claude_desktop_config.json on macOS, or %APPDATA%\Claude\claude_desktop_config.json on Windows:

{
  "mcpServers": {
    "myagentmail": {
      "command": "npx",
      "args": ["-y", "myagentmail-mcp@latest"],
      "env": {
        "MYAGENTMAIL_KEY": "tk_your_key_here"
      }
    }
  }
}

Restart Claude Desktop. The MyAgentMail tools appear in the tool picker.

Cursor

Edit ~/.cursor/mcp.json (or your project's .cursor/mcp.json):

{
  "mcpServers": {
    "myagentmail": {
      "command": "npx",
      "args": ["-y", "myagentmail-mcp@latest"],
      "env": { "MYAGENTMAIL_KEY": "tk_your_key_here" }
    }
  }
}

Windsurf

Edit ~/.codeium/windsurf/mcp_config.json with the same shape.

Claude Code with a key

claude mcp add myagentmail --scope user \
  --env MYAGENTMAIL_KEY=ak_your_inbox_key \
  -- npx -y myagentmail-mcp@latest

Optionally install the playbook so the agent knows how to use the tools: npx myagentmail-mcp install-skill --global.

Tools exposed

43 tools, all thin wrappers over the REST API. Each is annotated read-only or destructive so the client can ask before sending or deleting anything.

  • Inboxes: create_inbox, list_inboxes, get_inbox, delete_inbox
  • Messages: search_messages (full-text across every inbox the connection can see, with participant, date and attachment filters; returns lightweight hits with a snippet, never full HTML), send_message, reply_to_message, reply_all_to_message, forward_message, list_messages, get_message, mark_message_read, delete_message
  • Threads: list_threads, get_thread (view param: metadata, snippet, full or raw; htmlBody only on raw)
  • Drafts: create_draft, update_draft, send_draft, list_drafts, delete_draft
  • Attachments: list_attachments, download_attachment (send, reply, forward and draft tools also accept attachments)
  • Calendar: create_calendar_event, update_calendar_event, list_calendar_events, list_all_calendar_events, get_calendar_event, rsvp_calendar_event, delete_calendar_event, get_calendar_free_busy (every inbox has a calendar; external attendees get an .ics invite by email)
  • Custom domains: register_domain, verify_domain, list_domains, delete_domain, add_inbox_address
  • Workspaces: list_workspaces, create_workspace, issue_workspace_key
  • Webhooks: create_webhook, list_webhooks, delete_webhook
  • Metrics and utility: get_metrics, verify_email

Read only: all list_* and get_* tools, search_messages, download_attachment and verify_email. Destructive: every send, reply, forward and delete tool, plus send_draft, update_draft and the calendar create, update and RSVP tools, since those email attendees.

Troubleshooting

  • "No API key found" in the client's logs (local server): the env block is missing or the key isn't named MYAGENTMAIL_KEY. Fix the config and fully quit and reopen the host.
  • 401 on the first tool call (local server): the key is wrong, was regenerated, or has a trailing space. Repeated 401s from one machine lock the IP out for 15 minutes, so fix the key rather than retrying.
  • "Invalid or disconnected connector key" (remote connector): the connection was disconnected in the dashboard. Remove the connector in your AI app and connect again.
  • A tool you expect isn't listed: on the local server, make sure the config says myagentmail-mcp@latest, then restart the host (npx clear-npx-cache forces a refresh). The remote connector is always current.
  • An ak_ key sees fewer inboxes than expected: that's by design. Inbox keys are confined to their own inbox on every tool. Use a tk_ or wk_ key, or the remote connector, for cross-inbox work.

Source

The local server is published as myagentmail-mcp on npm, and the remote connector is listed in the official MCP Registry as com.myagentmail/myagentmail. Every tool calls the matching REST endpoint, so anything you can do here you can do with the REST API directly.