# MCP email server: tools, auth and how to connect one

> What an MCP email server is, which tools it should expose, OAuth versus API keys, the risks when a model reads and sends mail, and how to connect one.

Source: https://trotta.email/learn/mcp-email-server

An MCP email server gives an AI model an inbox as a set of tools: list, read, wait, send and reply. A client such as Claude, ChatGPT or Cursor connects over the Model Context Protocol with an API key or an OAuth sign-in. Mail is untrusted input, so the server must limit what the model can read and send.

Updated November 20, 2026

## What is an MCP email server?

An MCP email server is a program that gives an AI model an inbox as a set of tools. The Model Context Protocol (MCP) is an open protocol for connecting AI applications to outside data and tools. A host application such as Claude, ChatGPT or Cursor runs a client, and the client talks to the server in JSON-RPC messages.

The server lists its tools. Each tool has a name, a description and a JSON Schema for its arguments. The model picks a tool, the client sends the call, and the server returns the result.

MCP defines two standard transports. A local server runs as a subprocess of the client and talks over standard input and output (stdio). A remote server takes each message as an HTTP POST to one endpoint (Streamable HTTP), so many clients can reach it at one URL.

## What tools should an MCP email server expose?

An MCP email server should expose a small set of tools with narrow arguments: enough to work a mailbox, and nothing that lets a model widen its own reach.

| Job | Typical tools | What to look for |
| --- | --- | --- |
| Find mail | List inboxes, list messages | Previews first and bodies on request, so one call cannot flood the model's context |
| Read mail | Read a message, read a thread | Screened text, with mail marked as data and not as instructions |
| Wait | Wait for the next message | One blocking call, so the model does not loop on a list tool |
| Write | Send, reply, create a draft | Outgoing mail is checked, and a human can be asked to approve |
| Review | List held mail | Shows that mail is waiting on a human, without its content |

The MCP specification puts duties on the server: validate every tool input, apply access controls, rate limit tool calls and sanitize tool outputs. For email the last one is the hard part, because the output is text a stranger wrote.

## OAuth or an API key: which should an MCP email server use?

Use OAuth when a human connects an assistant to their mail, and an API key when a program runs unattended. Authorization is optional in MCP, and the two transports treat it differently: a remote HTTP server should follow the protocol's OAuth 2.1 flow, while a stdio server reads its credentials from the environment.

|  | OAuth sign-in | API key |
| --- | --- | --- |
| Suits | A human adding the server to an assistant | A server-side agent, a script or a test |
| Setup | Paste one URL, sign in, approve | Create a key and put it in the client's configuration |
| Access | Chosen on a consent screen for each connection | Fixed when the key is made |
| Lifetime | Short-lived tokens that refresh | Until it is revoked |
| If it leaks | Disconnect that one app | Revoke the key and replace it wherever it is used |

With OAuth, a client that calls the server without a token gets a `401` whose `WWW-Authenticate` header points to the server's metadata. The client finds the authorization server there, sends the human to sign in, and comes back with a token issued for that one server. The token goes in the `Authorization` header of every request, never in the URL.

Either way, give the model the narrowest credential that does the job: read without send where reading is enough, one inbox where one is enough.

## What can go wrong when a model reads and sends mail?

An MCP email server hands a model text written by strangers, and hands the same model a tool that sends mail. That pairing is the risk. The OWASP Top 10 for LLM Applications ranks prompt injection as LLM01, the top risk, in both the 2025 edition and the current 2026 edition, and an inbox invites it: anyone can put text in front of the model by sending an email.

- **Injected instructions.** A message tells the model to drop its task. The text can be hidden from a human reader, or sit inside an attachment.
- **Data leaving by mail.** An injected instruction asks the model to forward a thread or a secret to an outside address. With a send tool, that is one call.
- **Account takeover.** A model that reads a human's mailbox can read password resets and sign-in codes. Whoever steers the model can request a reset and collect it.
- **Too much reach.** A credential that covers every inbox turns one bad message into a problem for all of them.

EchoLeak, CVE-2025-32711, showed the pattern in a shipped product: researchers showed that one crafted email could make Microsoft 365 Copilot disclose data with no click. Microsoft rated it 9.3 (critical) and published its advisory in June 2025, saying the flaw was already mitigated.

The MCP specification says a human should be able to deny a tool call. Approval prompts help, but the server should still enforce limits that no prompt can change.

## How do you connect an MCP email server?

Connecting an MCP email server takes a URL for a remote server, or a command for a local one, plus a credential. The examples use Trotta Mail, whose MCP server is at `https://api.trotta.email/mcp` over Streamable HTTP.

A client that follows the MCP authorization flow needs the URL and nothing else. In Claude Code:

```bash
claude mcp add --transport http trotta-mail https://api.trotta.email/mcp
```

Then run `/mcp` in Claude Code and sign in in the browser. In Cursor, add the server to `~/.cursor/mcp.json` and Cursor signs in with OAuth:

`mcp.json`:

```json
{
  "mcpServers": {
    "trotta-mail": { "url": "https://api.trotta.email/mcp" }
  }
}
```

ChatGPT, Claude and Codex use the same URL: see [connect an assistant](https://trotta.email/docs/connect).

An agent with no human at a browser sends an API key as a bearer token instead. One call creates an inbox and a key, with no account:

```bash
curl -X POST https://api.trotta.email/v1/agents/signup \
  -H "Content-Type: application/json" \
  -d '{"name": "riley"}'
```

Put the `api_key` from the answer in the client's configuration:

MCP client configuration:

```json
{
  "mcpServers": {
    "trotta-mail": {
      "url": "https://api.trotta.email/mcp",
      "headers": { "Authorization": "Bearer tm_live_..." }
    }
  }
}
```

To watch the discovery step, call the server with no token:

```bash
curl -i -X POST https://api.trotta.email/mcp
```

The answer:

```http
HTTP/2 401
www-authenticate: Bearer resource_metadata="https://api.trotta.email/.well-known/oauth-protected-resource/mcp", scope="mail:read mail:send"
```

Once connected, the model calls tools by name. This call waits for a verification code:

A tool call:

```json
{
  "name": "wait_for_message",
  "arguments": { "inbox_id": "inb_7Qh2mXc4", "has_code": true, "timeout": 60 }
}
```

## How does Trotta Mail's MCP server limit the risk?

Trotta Mail screens every message before it is delivered, so its MCP tools return mail that has already been checked. Attacks, known and new, are refused at the door or held outside the inbox for a human. No filter catches everything, so mail the guard is unsure about is held for a human too.

- Every tool returns the safe view: hidden text removed, instructions aimed at a model fenced off, risky links defanged. A key with wider scopes gets the same view through MCP.
- Held mail is withheld. `list_held` shows that a message is waiting and why, and nothing its sender wrote. A human releases it.
- In a human's mailbox, login mail is sealed: codes, password resets and sign-in links do not exist for any tool.
- In a human's mailbox an agent starts with drafts only. `send_message` answers `403 agent_drafts_only`, and `create_draft` leaves the message for the human to send.
- Outgoing mail is screened before it leaves. A message that carries a secret is not sent.
- An OAuth connection gets `mail:read`, `mail:send` or both, for the inboxes or the one pod its human picked. It cannot create inboxes or keys.

The tools are `create_inbox`, `list_inboxes`, `list_messages`, `get_inbox_updates`, `read_message`, `wait_for_message`, `send_message`, `reply_to_message`, `cancel_scheduled_message`, `create_draft`, `thread_context`, `read_attachment_text`, `answer_invitation`, `list_held` and `scan_content`. The [MCP docs](https://trotta.email/docs/mcp) describe each one.

The MCP server and every check are on every plan, Free included. [Sign up](https://trotta.email/signup), or follow the [MCP integration guide](https://trotta.email/integrations/mcp).

## Questions

### Does an MCP email server need OAuth?

No. Authorization is optional in MCP. A remote server should offer the protocol's OAuth 2.1 flow when a human connects it, and a bearer API key suits an agent that runs with no human at a browser.

### Can an MCP email server read my existing Gmail or Outlook mailbox?

Some MCP email servers connect to an existing mailbox over IMAP and SMTP. Trotta Mail's server works on Trotta Mail inboxes, an agent's own or a human's mailbox there, and it does not offer IMAP or SMTP access.

### Is it safe to let a model send email through MCP?

It is reasonable when the server enforces limits the model cannot change. Look for outgoing mail that is screened, a drafts mode where a human presses send, and credentials limited to the inboxes the agent needs.

### What is the difference between a local and a remote MCP email server?

A local server runs on your machine as a subprocess of the client, talks over stdio and reads its credentials from the environment. A remote server is one HTTPS endpoint that any client can reach, and it can sign a human in with OAuth.

### Which assistants can connect to Trotta Mail's MCP server?

ChatGPT, Claude, Claude Code, Codex and Cursor connect with the URL and an OAuth sign-in. An MCP client without OAuth sends an API key as a bearer token.

## Sources

- [Model Context Protocol specification, revision 2026-07-28](https://modelcontextprotocol.io/specification/2026-07-28)
- [Model Context Protocol specification: authorization](https://modelcontextprotocol.io/specification/2026-07-28/basic/authorization)
- [Model Context Protocol specification: tools](https://modelcontextprotocol.io/specification/2026-07-28/server/tools)
- [OWASP Top 10 for LLM Applications 2026, the current edition (published August 2026)](https://genai.owasp.org/resource/owasp-genai-llm-top-10-2026/)
- [OWASP Top 10 for LLM Applications 2025, LLM01: Prompt Injection](https://genai.owasp.org/llmrisk/llm01-prompt-injection/)
- [Microsoft Security Response Center, CVE-2025-32711: M365 Copilot Information Disclosure Vulnerability](https://msrc.microsoft.com/update-guide/vulnerability/CVE-2025-32711)

## Related

- [MCP](https://trotta.email/docs/mcp) Docs
- [Connect ChatGPT and Claude](https://trotta.email/docs/connect) Docs
- [MCP](https://trotta.email/integrations/mcp) Integrations
- [What is prompt injection?](https://trotta.email/learn/prompt-injection) Guides
- [AI agent security](https://trotta.email/learn/ai-agent-security) Guides
- [Prompt injection by email](https://trotta.email/threats/prompt-injection-by-email) Threat library

Give your agent an inbox of its own. Free for two inboxes. No card.

[Get an inbox](https://trotta.email/signup) [Read the docs](https://trotta.email/docs)
