MCP server
Plug myagentmail into Claude Desktop, Cursor, Windsurf, Cline, or any MCP-compatible client. Your AI assistant gets a full set of email tools instantly.
What is MCP?
The Model Context Protocol is an open standard from Anthropic for connecting AI assistants to external tools and data sources. An MCP server runs as a subprocess (or remote service) and exposes a list of tools the LLM can call. We ship one for myagentmail at myagentmail-mcp.
Authentication
Every tool call acts as a MyAgentMail API key. Which key you use decides what the agent can see:
tk_— tenant master: every inbox and workspace in your account. Fine for your own Claude Desktop / Cursor.wk_— workspace: one workspace only (reseller / per-customer isolation).ak_— single inbox: the narrowest scope. Use this when handing an inbox to an employee or a deployed agent — search, list, and every other tool are constrained to that one inbox, and regenerating the key instantly revokes access.
Get a key from the dashboard → API Keys (tenant/workspace keys) or from an inbox's Settings → Agent API key (its ak_ key; shown once — regenerate if lost).
There are two ways to hand the key to an MCP client:
- OAuth (remote connector — Claude.ai web/mobile, Claude Desktop connectors): add
https://mcp.myagentmail.com/mcpas a connector, click Connect, and sign in to MyAgentMail in the browser (no key to paste). You can optionally confine the connector to a single inbox on the consent screen. The client receives a scoped access token; nothing sensitive is stored in the client. - API key in config (local
npxserver — Cursor, Windsurf, Claude Code, any stdio host): setMYAGENTMAIL_KEYin the client's env block, as in the examples below. Never put the key in a query string or a shared file.
Install
myagentmail-mcp is published on npm. Use npx -y myagentmail-mcp@latest — no global install needed, and the @latest tag means each host restart picks up the newest version (a bare package name can pin you to a stale npx cache). Each MCP client has its own config file. Below is the setup for the most common ones; the format is identical because MCP is standardized.
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 — try "create a new inbox and send a hello to me at you@example.com" and Claude will call create_inbox followed by send_message automatically.
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
One command; --scope user registers it for every project (drop it to enable for the current project only):
claude mcp add myagentmail --scope user \
--env MYAGENTMAIL_KEY=tk_your_key_here \
-- npx -y myagentmail-mcp@latest
Restart Claude Code (or start a new session). Optional but recommended, install the playbook so the agent knows how to use the tools, not just that they exist: npx myagentmail-mcp install-skill --global.
Claude.ai and Claude Desktop — remote connector (OAuth)
The npx setup runs a local subprocess, which claude.ai's web and mobile apps can't do. For those — and as a no-install option in Claude Desktop — add MyAgentMail as a custom connector:
- Settings → Connectors → Add custom connector.
- URL:
https://mcp.myagentmail.com/mcp. Leave the auth fields blank — the server implements the MCP Authorization spec (discovery, Dynamic Client Registration, PKCE, refresh tokens), so the client self-registers and handles OAuth for you. - Click Connect. Your browser opens MyAgentMail — sign in if needed, optionally choose a single inbox to limit access to, and click Allow. No API key is typed anywhere.
- Back in Claude, the tools appear. Everything above works identically to the local server.
Any spec-compliant MCP client works the same way, including Claude Code — claude mcp add myagentmail https://mcp.myagentmail.com/mcp opens the browser consent screen with no key pasted anywhere in config. If a client can't do OAuth, it may send the key directly as a bearer token: Authorization: Bearer tk_… — same scoping rules apply.
Tools exposed
92 tools, all thin wrappers over the REST API. Every read/write is a separate tool, annotated read-only or destructive so the LLM can label safe vs. dangerous actions.
- Inboxes —
create_inbox,list_inboxes,get_inbox,delete_inbox - Messages —
search_messages(full-text across every inbox the key can see, with participant/date/attachment filters; returns lightweight hits + a match-centred 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(viewparam:metadata/snippet/full/raw— htmlBody only onraw) - Drafts —
create_draft,update_draft,send_draft,list_drafts,delete_draft - Attachments —
list_attachments,download_attachment(send/reply/forward/draft tools also acceptattachments) - 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 CalDAV 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 + utility —
get_metrics,verify_email - Cadences (server-side outreach sequences) —
cadence_create,cadence_list,cadence_get,cadence_update,cadence_replace_steps,cadence_delete,cadence_enroll_lead,cadence_list_enrollments,cadence_bulk_relink_enrollments,cadence_run_now,enrollment_get,enrollment_patch - LinkedIn — sessions & outreach —
linkedin_login,linkedin_verify_pin,linkedin_poll_mobile_approval,linkedin_import_session,linkedin_list_sessions,linkedin_get_session,linkedin_revoke_session,linkedin_sessions_utilization,linkedin_lookup_profile,linkedin_send_connection_request,linkedin_list_connections,linkedin_list_sent_invitations,linkedin_send_message,linkedin_list_conversations,linkedin_read_conversation - LinkedIn — posts —
linkedin_create_post,linkedin_list_posts_by_author,linkedin_list_post_comments,linkedin_list_post_reactions - LinkedIn — search —
linkedin_search_content,linkedin_search_history,linkedin_search_history_list,linkedin_search_history_get - LinkedIn — intent signals —
linkedin_signal_create,linkedin_signal_create_engagement,linkedin_signal_create_watchlist,linkedin_signal_list,linkedin_signal_get,linkedin_signal_update,linkedin_signal_delete,linkedin_signal_run,linkedin_signal_matches,linkedin_signal_deliveries,linkedin_signal_test_webhook,linkedin_signal_watchlist_list,linkedin_signal_watchlist_add,linkedin_signal_watchlist_remove
Troubleshooting
- "No API key found" in the client's logs — the
envblock is missing or the key isn't namedMYAGENTMAIL_KEY. Fix the config and fully quit + reopen the host (Claude Desktop hides stderr; the first tool call also surfaces the error). - 401 / "Invalid tenant key" on the first tool call — the key is wrong, was regenerated, or was pasted with a trailing space. Repeated 401s from one machine lock the IP out for 15 minutes, so fix the key rather than retrying.
- A tool you expect isn't listed — you're on a stale version. Make sure the config says
myagentmail-mcp@latest(a bare package name letsnpxreuse an old cache), then restart the host. Force a refresh withnpx clear-npx-cache. The remote connector is always current. - The connector's Connect button loops or errors — the redirect must return to a Claude host; if you're behind a corporate proxy that rewrites redirects, use the local
npxsetup instead. - An
ak_key sees fewer inboxes than expected — that's the design: inbox-scoped keys are constrained to their own inbox on every tool, includingsearch_messagesandlist_inboxes. Use atk_orwk_key for cross-inbox work.
Source
The server is published as myagentmail-mcp on npm. It's a thin wrapper — every tool just fetches the matching REST endpoint and returns the JSON, so anything you can do here you can do with the REST API directly.
Paired with our agent skill, an MCP-equipped client gets both the tool definitions (from MCP) and the prose documentation (from the skill). Use both for the best experience.