GuideUpdated November 30, 2026

Email in Claude Code, Codex and Cursor: plugin, MCP or Gmail

There are two ways to connect an inbox to Claude Code, Codex or Cursor: install a plugin that brings the mail server along with instructions for the agent, or add a remote MCP server yourself. The manual entry is claude mcp add --transport http in Claude Code, codex mcp add --url followed by codex mcp login in Codex, and an entry in mcp.json in Cursor.[1][2][3] After a one-time sign-in, the agent reads, searches and drafts mail from the terminal or editor where you already work, and sends it if you allow that.

Command Mail is our product, and we use it as the example. The basic setup carries over to other email MCP servers with Streamable HTTP and OAuth; depending on the provider, you may need extra OAuth client credentials or a provider-specific way to connect. Claude Code and Cursor also have their own routes to Gmail and Outlook, covered in each agent's section. Vendor documentation was retrieved on 2026-11-10; menus and flags change between versions.

Updated: Published: Fact-checked: About 16 min readAs Markdown

Contents
  1. What you need before you start
  2. Plugin or MCP entry
  3. Connect email to Claude Code
  4. Connect email to Codex
  5. Connect email to Cursor
  6. When the agent cannot use OAuth: the command line
  7. Test the connection with a first task
  8. Troubleshooting: missing tools and sending
  9. How the three agents compare for email work
  10. Connect Command Mail to your agent
  11. Next steps
  12. Frequently asked questions
  13. Sources

01What you need before you start

You need three things: a current version of the coding agent, an email service with an MCP server, and an account there that you can sign in to in the browser. Command Mail's server runs at https://commandmail.app/mcp and uses OAuth 2.1 with PKCE and dynamic client registration, so you do not create API keys or OAuth clients yourself.[5]

Decide beforehand what the agent may do. On Command Mail's sign-in screen you switch each permission on or off: mail:read for reading, searching and organizing within each mailbox's autonomy level, which includes archive, spam and rules; mail:draft for drafts; mail:send-approved for sending a draft a person approved; mail:send for sending and replying without individual approval and, together with mail:read, forwarding and moving mail to the trash; and mailboxes for connecting addresses. Sending without approval starts switched off.[5] Any change to a retention period needs mail:read and an account default of rules or auto. Switching it on or shortening it also needs mail:send and level auto for the account default and for every mailbox that is not read-only; switching it off or extending it works without mail:send.[15]

The free plan covers one mailbox, with further mailboxes paused but still receiving, and the last 90 days. It reads, searches, sorts and drafts, and it does not send, not even approved drafts. Sending needs Pro, which also brings up to ten mailboxes and full history and costs €19 per month for the first 100 paying Pro accounts, for as long as that subscription runs, and €29 per month after that; there are also yearly prices of €190 or €290, a 7-day Pro trial for €1 and a Team plan at €39 per person per month (prices on 2026-11-10, unchanged on 2026-12-02).[5]

02Plugin or MCP entry

A plugin packages tools and instructions together. The Command Mail plugin ships no executable code. It declares the same server, https://commandmail.app/mcp, and adds four skills: inbox-setup for setting up the account with you, inbox-routine for a recurring pass, inbox-cleanup for clearing a large inbox and mail-workflow for reading, drafting and filing.[7] An MCP entry brings only the tools. Either way, you sign in in the browser on first use and choose the permissions there.[7]

PluginMCP entry
Claude Codethe repository's marketplace, then /plugin install command-mail@commandmailclaude mcp add --transport http
Codexplugin directory in the ChatGPT desktop app, or /plugins in the CLIcodex mcp add --url or Settings → MCP servers
Cursorlocal copy of the repository; not listed in the Marketplace (checked 2026-11-10)url entry in mcp.json

The plugin pays off when the agent should handle recurring mail work in a fixed routine. If you only want the tools in one project, the entry is enough.

03Connect email to Claude Code

Claude Code offers three routes: the plugin, your own MCP entry, or a connector you connected in claude.ai.[1]

Route 1: the plugin from the repository's marketplace

Command Mail is not in Anthropic's official claude-plugins-official marketplace. The plugin repository is a marketplace of its own, which you add once.[6][7]

  1. In a Claude Code session: /plugin marketplace add FYN-Labs/commandmail-plugin.
  2. Then /plugin install command-mail@commandmail. Inside a session the command first opens the plugin's details, where you choose the scope, for example just you or everyone in this repository. From the shell, claude plugin marketplace add and claude plugin install do the same.[6]
  3. Once the plugin is enabled, Claude Code starts its server on its own. /mcp lists it with a marker showing that it comes from a plugin; if it needs sign-in, sign in there.[1]

You remove a plugin's server by uninstalling the plugin; in /mcp you can only switch it off.[1] We ran claude plugin validate (Claude Code 2.1.312) on the marketplace and plugin manifests on 2026-11-10, and it reported nothing. That checks the format, not the sign-in.

Route 2: add the MCP server yourself

  1. Add the server: claude mcp add --transport http commandmail https://commandmail.app/mcp. Without further flags, the entry lands in local scope, meaning your user and the current project. Add --scope user to make it available in every project.
  2. Start claude and type /mcp. Select commandmail and sign in; the browser opens Command Mail's consent screen. Outside a session, claude mcp login commandmail runs the same sign-in from your shell. Without a local browser, for example over SSH, the command prints the URL and you paste the redirect URL back afterwards.[1]
  3. Choose the permissions and confirm. Back in the terminal, /mcp shows the server with its tool count.
  4. Check from the shell: claude mcp list shows ✔ Connected, ! Needs authentication or ✘ Failed to connect for each server.

If your team should get the same server, --scope project writes it to .mcp.json in the repository. Each person then approves the server once when running claude in that folder, and each person signs in with their own account. A cloned repository cannot approve its own servers.[1]

Claude Code loads MCP tools through tool search by default, with exceptions such as older models or ENABLE_TOOL_SEARCH=false. Claude finds the mail tools when a task needs them, so a large tool list does not crowd every request.[1]

Route 3: a connector from claude.ai

If you are signed in to Claude Code with a claude.ai subscription, the connectors from your Claude account are available automatically, and /mcp marks them as coming from claude.ai.[1] According to its llms.txt, Command Mail is listed in the Claude directory as a community connector.[5] Once you have connected it in claude.ai, there is nothing to add in Claude Code. On Team and Enterprise plans only admins add connectors.[1]

The connectors are missing when Claude Code signs in another way, for example through ANTHROPIC_API_KEY, apiKeyHelper, a cloud provider such as Amazon Bedrock, or a token from claude setup-token.[1] If you also add the same server with claude mcp add, your entry takes precedence and /mcp hides the connector.[1] Pick one of the two.

Gmail and Outlook in Claude Code

Anthropic runs its own connectors for Gmail, Google Calendar and Microsoft 365. You cannot sign in to them locally from Claude Code, because the provider only accepts the redirect URL that claude.ai registered. If you add one of these servers with claude mcp add and sign in, Claude Code shows "is Anthropic-hosted and doesn't support local OAuth".[1]

The route goes through claude.ai: remove your local entry with claude mcp remove <name>, connect Gmail or Microsoft 365 in claude.ai, and the connector appears in Claude Code by itself.[1] What the two connectors can do and where they stop is covered in connect Gmail to Claude and connect Outlook to Claude. Google's own Gmail MCP server is compared in Gmail MCP server options.

04Connect email to Codex

Codex also has both routes, the plugin and your own MCP entry. The ChatGPT desktop app, the Codex CLI and the IDE extension share MCP configuration.[2]

The plugin from the plugin directory

ChatGPT and Codex use one shared plugin directory.[8] According to Command Mail's llms.txt, it is listed there as an official plugin; whether you can install and use it depends on your plan, workspace, role and region.[5] In the desktop app, open the Plugins tab; in the Codex CLI, type /plugins. After installing, the tools and skills are available in new chats, and in the CLI you start a new session first.[8] The IDE extension does not support plugins, so use the MCP entry there.[8] How the plugin carries a daily triage is shown in Codex email triage.

Add the MCP server yourself

  1. Add the server: codex mcp add commandmail --url https://commandmail.app/mcp.
  2. Sign in: codex mcp login commandmail. On a machine without a browser, --no-browser prints the authorization URL and waits for you to paste back the redirect URL from the browser where you signed in.[2]
  3. Choose the permissions on the consent screen and confirm.
  4. Check: codex mcp list shows the configured servers; inside the codex TUI, /mcp shows the active ones.

The desktop app needs no terminal: open Settings, select MCP servers and Add server, enter a name, choose Streamable HTTP, enter the URL, save and select Restart. The list then shows which servers need sign-in, and Authenticate starts it. In the IDE extension the same dialog sits in the gear menu under MCP servers.[2]

The entry in ~/.codex/config.toml is short. For a single repository, put the same table in .codex/config.toml in the project; Codex reads it only in trusted projects.[2] The default_tools_approval_mode line is optional and explained in the next section.

[mcp_servers.commandmail]
url = "https://commandmail.app/mcp"
default_tools_approval_mode = "writes"

Ask before every change

With default_tools_approval_mode = "writes", Codex by default asks before any tool from this server that is not marked read-only; you can set individual tools differently with tools.<tool>.approval_mode.[2] According to Command Mail's app code, reading tools such as capabilities and mail_changes carry the read-only marker, while changing tools such as save_agent_draft, move_to_folder and reply do not. Without such overrides, Codex therefore reads without asking and asks before it files, drafts or sends. For the plugin, set the same key under plugins.<plugin>.mcp_servers.<server>.[2]

Two more keys help with mail: enabled_tools limits which tools Codex may call, and tool_timeout_sec (default 60 seconds) gives slow searches across a large inbox more time.[2] The prompt is a layer inside Codex. What the agent can technically do is still set by the permissions you grant at sign-in.

Without a scope setting of its own, Codex requests the scopes the server names in its authorization challenge or metadata when the OAuth login starts.[2] Command Mail's server names all five permissions there (our own check on 2026-11-10). The decision therefore happens on Command Mail's authorization page, where you pick only the permissions the agent needs.[15]

05Connect email to Cursor

Cursor reads MCP servers from mcp.json: ~/.cursor/mcp.json applies to every project, .cursor/mcp.json to one project. If the same server name appears in both files, the project file wins.[3][4]

  1. Open or create ~/.cursor/mcp.json and add:
{
  "mcpServers": {
    "commandmail": {
      "url": "https://commandmail.app/mcp"
    }
  }
}
  1. Save the file and restart Cursor.
  2. Cursor shows the server under Customize → MCPs. Follow the sign-in prompt and choose the permissions on the consent screen.[4]
  3. In an Agent chat, the mail tools appear in the tools list. Switching off send_message alone does not stop sending, because reply and forward_message send too; leave mail:send off on the consent screen instead.

Cursor uses dynamic client registration when the server supports it. Cursor intends static credentials with CLIENT_ID for providers that issue a fixed client ID, require a pre-registered redirect URL or do not support dynamic registration.[3] You do not need them for Command Mail.

Cursor's documentation says the agent asks for approval before MCP tools by default, and that MCP follows the same Run Modes as terminal commands.[3] Since version 3.6, Auto-review is the recommended default: allowlisted tools run immediately and a classifier reviews the rest. Cursor states plainly that Auto-review is not a security boundary. The setting lives under Settings → Agents → Approvals & Execution. Cloud Agents never ask, because they run on a dedicated machine.[13] Check this before you give a Cursor agent a sending permission.

Command Mail as a Cursor plugin

The Command Mail plugin repository also contains a Cursor manifest. When we checked the Cursor Marketplace on 2026-11-10, Command Mail was not listed.[7][14] You can try the plugin locally: clone the repository into ~/.cursor/plugins/local/command-mail, run Developer: Reload Window and check under Customize that its skills and server appear.[7][9] The server then shows as plugin-command-mail-commandmail, and Cursor opens the sign-in on first use.[7] On Enterprise teams, loading local plugins is off by default; an admin turns it on with Allow Local Plugin Imports.[9] If you only need the tools, stay with the mcp.json entry.

Gmail and Outlook in Cursor

The Cursor Marketplace lists Gmail and Outlook plugins published by Cursor itself.[14] You install them from Customize[9] or with /add-plugin gmail or /add-plugin outlook in chat, then sign in with Google or Microsoft.[10][11]

  • Gmail: the plugin connects Cursor to the https://gmailmcp.googleapis.com/mcp/v1 endpoint of Google's Gmail MCP server.[10] Google lists search, reading, drafts, labels and filters, trash and spam, and sending, replying and forwarding for that server. Before sensitive actions such as sending, the server by default requests approval in the client through MCP form elicitation; persistent user approvals or administrator rules can remove that prompt[16]. Google points clients without that support to a limited endpoint.[12] The plugin's README does not say whether Cursor shows these approval dialogs.[10]
  • Outlook: this plugin uses an MCP server run by Cursor at api.cursor.com. It searches mail folders, reads messages, sends email and looks up contacts, and it needs Cursor 3.19 or later.[11]

The Marketplace also lists other mail plugins, for example from AgentMail and Superhuman.[14] Cursor's two plugins each connect the signed-in Google or Microsoft account; their READMEs do not describe one inbox across several addresses.[10][11] That is the job of a service like Command Mail.

06When the agent cannot use OAuth: the command line

Some setups cannot open a browser, for example a remote container or a CI job. Command Mail also has a command-line tool: curl -fsSL https://commandmail.app/install.sh | sh, then commandmail login.[5] The coding agent can call the CLI directly, and commandmail mcp starts a local MCP server for agents that only speak stdio.

07Test the connection with a first task

The first call in every session should be capabilities. It returns the account owner, the granted permissions, each mailbox with its autonomy level, the allowed operations and the limits.[5] Ask the agent: "Call capabilities on commandmail and tell me what you are allowed to do." If the answer matches what you chose on the consent screen, the connection works.

A good second task is read-only: "Search my inbox for invoices from the last 30 days and list sender, date and amount." That tests reading and search without changing anything. Only then try a draft, and approve it yourself before anything is sent.

Command Mail marks message content as untrusted data and flags suspected prompt injection. That matters more in a coding agent than in a chat app, because the same session may also run shell commands. Treat instructions inside an email as text to read, never as a task.[5]

08Troubleshooting: missing tools and sending

These symptoms are quick to narrow down.

Claude Code shows "Needs authentication". The server is configured but nobody has signed in yet, or the sign-in has expired. Open /mcp, select the server and sign in again, or run claude mcp login commandmail in your shell. /mcp reconnect all retries every server that failed or needs authentication; in the interactive terminal that needs Claude Code v2.1.284 or later.[1]

A claude.ai connector is missing in Claude Code. /status shows which sign-in method is active. If Claude Code runs on an API key, apiKeyHelper or a profile, remove that setting and choose your claude.ai account with /login.[1]

Claude Code shows "is Anthropic-hosted and doesn't support local OAuth". You added Gmail, Google Calendar or Microsoft 365 as a local entry. Remove it with claude mcp remove and connect the service in claude.ai.[1]

A project server in Claude Code stays at "Pending approval". Servers from a repository's .mcp.json need your approval. Run claude in the folder and accept the workspace trust dialog and the server.[1]

Codex lists the server but calls fail. Codex can connect to a server without credentials if no sign-in was completed.[2] Run codex mcp login commandmail or select Authenticate in the desktop app, then start a new session.

Cursor shows no tools after editing the file. Cursor reads mcp.json at startup, so restart it. Check that the JSON is valid and that the key is url, not command.[4] A local plugin only appears after a restart or Developer: Reload Window.[9]

The agent says it cannot send. With Command Mail, check the plan first and the permission second. All sending needs Pro. With mail:send-approved, the agent sends only a draft revision that you approved in Command Mail, and not from a mailbox on level read. The direct tools send_message and reply exist only with mail:send; they also need a mailbox that can send, autonomy level auto and remaining room in the daily limit.[5] For direct sending without your approval, the server refuses replies to messages that Command Mail has recognized as automated, for example from mailing lists or no-reply addresses. Detection relies on headers, address patterns and subject lines and does not catch every automated message; the daily limit caps this direct agent sending. Drafts you approved are exempt from the automated-sender check and the daily limit.[15]

To give an agent different permissions, disconnect it under connected apps in Command Mail's settings and connect it again, then pick only what it needs on the authorization page. Disconnecting revokes every token that app holds for your account.[15] Start the new sign-in in Claude Code with Clear authentication in /mcp and signing in again, and in Codex with codex mcp login commandmail; in Cursor, remove the server under Customize and add it again.[1][2][4]

09How the three agents compare for email work

The three tools differ less in what they can do with mail than in where configuration lives and who approves tool calls.

Claude CodeCodexCursor
Add a remote serverclaude mcp add --transport httpcodex mcp add --url or Settings → MCP serversurl entry in mcp.json
Sign in/mcp or claude mcp logincodex mcp login or Authenticateprompt in Customize → MCPs
Pluginown marketplace, then /plugin installplugin directory, /plugins in the CLIMarketplace, or locally in ~/.cursor/plugins/local
Gmail and Outlookconnectors from claude.aiGmail plugin in the plugin directoryGmail and Outlook plugins in the Marketplace
Personal configuration~/.claude.json (local or user scope)~/.codex/config.toml~/.cursor/mcp.json
Project configuration.mcp.json.codex/config.toml (trusted projects).cursor/mcp.json
Status checkclaude mcp list, /mcpcodex mcp list, /mcpCustomize → MCPs

Sources: vendor documentation and the Cursor Marketplace, retrieved on 2026-11-10.[1][2][3][4][6][8][9][14]

Whichever agent you choose, the mail-side permissions stay the same, because the email service enforces them on the server. Claude Code, Codex and Cursor each add their own approval layer on top.

10Connect Command Mail to your agent

Command Mail connects to Claude Code, Codex, Cursor and other clients with remote MCP, and you choose your agent's permissions yourself when you sign in[5]:

  • Plugin or connector: in Claude Code through the plugin repository's marketplace[7]; according to llms.txt, in ChatGPT and Codex as an official plugin from the plugin directory, depending on plan, workspace, role and region, and in Claude as a community connector from the directory[5].
  • MCP URL: https://commandmail.app/mcp, sign-in with OAuth 2.1 and PKCE, no API key[5].
  • Permissions instead of full access: reading and sorting need only mail:read, drafts add mail:draft. Sending without your approval (mail:send) is switched off at sign-in[5].

11Next steps

If you work with several addresses, read using multiple email accounts with one AI agent. How connectors, plugins and MCP URLs differ in Claude is explained in Claude connector, plugin or MCP URL. For the permission model in detail, see permissions and autonomy. If you are still choosing a server, the email MCP server comparison lists the options. Hermes Agent and OpenClaw have their own guides: Connect Hermes Agent to email and Connect OpenClaw to email.

Start Command Mail free and connect your coding agent with mail:read only at first.

Frequently asked questions

How do I add an email MCP server to Claude Code?

Run claude mcp add --transport http <name> <url>, for example claude mcp add --transport http commandmail https://commandmail.app/mcp. Then open /mcp in a session, or run claude mcp login commandmail in your shell, and sign in. claude mcp list shows whether the server is connected or still needs authentication. You can also install the Command Mail plugin from the marketplace in its repository.

How do I add a remote MCP server to Codex?

In the CLI, run codex mcp add <name> --url <url>, then codex mcp login <name> for servers that use OAuth. In the ChatGPT desktop app, use Settings, MCP servers and Add server. Codex stores the entry in ~/.codex/config.toml, and the CLI, the IDE extension and the desktop app share that configuration.

Where does Cursor store MCP servers?

In mcp.json: ~/.cursor/mcp.json for all projects or .cursor/mcp.json inside one project. A remote server needs a url field; Cursor handles OAuth for servers that require it.

How do I connect Gmail to Claude Code or Cursor?

For Claude Code, connect Gmail in claude.ai. The connector then shows up in Claude Code automatically when you are signed in there with your claude.ai subscription; Claude Code refuses a local sign-in through claude mcp add for Anthropic's Gmail connector. In Cursor, install the Gmail plugin from the Marketplace. It uses Google's Gmail MCP server, which Google says can also send, reply and forward, and which by default requests approval in the client before sensitive actions such as sending.

Why does my coding agent not see a send tool?

With Command Mail, the server builds its tool list from the permissions granted at sign-in. The direct sending tools send_message and reply only appear with mail:send, which is off by default; forward_message also needs mail:read. Agents with mail:draft and mail:send-approved work through drafts that a person approves, and every kind of sending needs the Pro plan.

Can a coding agent send email without asking me?

Only if you allow it. In Command Mail that needs the mail:send permission, a Pro plan, a mailbox that can send and is on autonomy level auto, and remaining room in the daily limit; each message goes to at most 20 recipients. Claude Code, Codex and Cursor also have their own approval settings for tool calls.

Sources

  1. Anthropic: Connect Claude Code to tools via MCP code.claude.com, accessed
  2. OpenAI: Model Context Protocol in ChatGPT and Codex learn.chatgpt.com, accessed
  3. Cursor: Model Context Protocol (MCP) cursor.com, accessed
  4. Cursor Help: MCP cursor.com, accessed
  5. Command Mail: llms.txt with plans, scopes and connection options commandmail.app, accessed
  6. Anthropic: Install plugins in Claude Code code.claude.com, accessed
  7. FYN Labs: Command Mail plugin (README, manifests for Claude Code and Cursor) github.com, accessed
  8. OpenAI: Plugins in ChatGPT and Codex learn.chatgpt.com, accessed
  9. Cursor: Plugins, Marketplace and local plugins cursor.com, accessed
  10. Cursor: Gmail plugin (README and mcp.json) github.com, accessed
  11. Cursor: Outlook plugin (README and mcp.json) github.com, accessed
  12. Google: Configure the Gmail MCP server (prerequisites and tool reference) developers.google.com, accessed
  13. Cursor: Run Modes and Auto-review cursor.com, accessed
  14. Cursor Marketplace cursor.com, accessed
  15. Command Mail: Permissions and autonomy commandmail.app, accessed
  16. Google: Handle user approvals with form elicitation developers.google.com, accessed
EN