How to Give OpenClaw Its Own Email Address Using MCP
Add Mailcycle to OpenClaw with openclaw mcp add, check it with probe, and use a webhook to OpenClaw's /hooks so an arriving email starts an agent turn.
OpenClaw is built to stay running: a gateway that holds your agents and reacts to what comes in. Email is one of the most common things that comes in. A sign-in code, a supplier’s order confirmation, a customer asking a question at two in the morning.
Wiring OpenClaw to your own Gmail or Outlook gets it there, but it also gives an always-on agent your full mailbox and the right to write as you. Every email it reads is text from someone else, and one crafted message can try to steer an agent holding all of that.
A dedicated inbox narrows it. OpenClaw gets its own address, sees only mail sent there, and starts out able to reply only to whoever wrote to it.
In this tutorial you’ll add Mailcycle’s MCP server, mailcycle-mcp, to OpenClaw, check it with openclaw mcp probe, and have OpenClaw read and reply to a real email. Then you’ll go one step further than most MCP clients allow: a Mailcycle webhook that starts an OpenClaw agent turn the moment mail arrives, with no polling.
What you’ll build
After setup, openclaw mcp probe confirms the server and its tools:
mailcycle: 7 tools
OpenClaw names MCP tools <server>__<tool>, so the agent works with mailcycle__list_addresses, mailcycle__read_message, mailcycle__reply and the rest, found through Tool Search. Asked for its address, it gets back:
Addresses:
- amber_finch2@birchpier.com
Reply only: this agent can answer whoever wrote a message it received,
and no one else. Use the reply tool.
With the webhook in place, the flow runs on its own:
- An email reaches the agent’s address.
- Mailcycle posts a
message.receivedevent tohttps://your-gateway.example.com/hooks/mailcycle, with your hook token in theAuthorizationheader. - OpenClaw accepts it, matches the
mailcyclemapping and starts an agent run with a message like New email in Mailcycle, message msg_…. - The agent calls
mailcycle__read_message, which fetches and decrypts the email on the gateway’s machine, and handles it, replying withmailcycle__replyif that’s the job.
We tested this on OpenClaw 2026.11.3: without the header the hook returned 401, and with it 200 and an agent run started. The address above is an example.
Prerequisites
- OpenClaw, 2026.11.3 or later, with an agent set up. Install with
curl -fsSL https://openclaw.ai/install.sh | bashornpm install -g openclaw@latest --allow-scripts=openclaw. - Node.js 20 or later on the gateway’s machine, for
npx. Check withnode --version. - A Mailcycle account on Scale, or the free 7-day Scale trial, for the MCP part. AI agents are a Scale feature, and the trial needs no card.
- For the webhook section only: the Operator plan or above, which is where webhooks start, and an OpenClaw gateway reachable at a public HTTPS address. Mailcycle won’t post to plain
http, an IP address or a local hostname. - An email account you can send from, for testing.
Step 1: Create a Mailcycle account and start the trial
- Open app.mailcycle.email/operator/signup. There’s no email address or password: the account is a 12-word recovery phrase generated on your device.
- Tick I’m 18+ and agree to the Terms of Service and choose Create account.
- Store the 12 words safely, tick I’ve saved my 12 words somewhere safe. and choose Continue. They’re the only way back in.
- The free Scale trial starts on its own and you land on AI agents. If it can’t start, Plans & Billing opens instead.
You land on AI agents with the Scale trial running and its end date shown. The trial starts from the web app; the mobile apps show it but don’t start it.
Step 2: Pair the agent and give it an address
Pair on the machine where the OpenClaw gateway runs, since that’s where the MCP server will run. Pairing creates the agent’s encryption key there and hands it to your app inside the MC1: line.
npx -y mailcycle-mcp pair --name "OpenClaw"
It prints an MC1: line and waits. In the web app:
- Open AI agents.
- Paste the line under Paste the line it prints and choose Find agent.
- Under Agent found, check the name and choose Connect agent. The terminal prints Connected. Now give the agent an email address in the app.
- On Add email address, keep Generate new, choose a name and select Assign email address.
The terminal prints Ready: with the address and exits. The agent shows under Your agents, set to Reply only.
The key lives in ~/.config/mailcycle/agent.json for the user the gateway runs as. If the gateway runs as a different user or in a container, pair as that user, or point both pair and the server at the same file with MAILCYCLE_AGENT_FILE.
Step 3: Connect OpenClaw to the Mailcycle MCP server
Add the server
openclaw mcp add mailcycle --command npx --arg -y --arg mailcycle-mcp --connect-timeout 30
Each argument to npx gets its own --arg. --connect-timeout 30 is optional with 0.7.0 (see below), but it costs nothing.
The command writes to ~/.openclaw/openclaw.json, which the gateway reloads on its own. If you prefer to edit the file, the same server in OpenClaw’s JSON5 config is:
{
mcp: {
servers: {
mailcycle: {
command: "npx",
args: ["-y", "mailcycle-mcp"],
enabled: true,
connectionTimeoutMs: 30000,
requestTimeoutMs: 120000,
},
},
},
}
openclaw mcp set mailcycle '{"command":"npx","args":["-y","mailcycle-mcp"]}' sets it from the command line in one go.
Check it
openclaw mcp probe mailcycle
should print mailcycle: 7 tools. For a fuller check that also looks at the config, run openclaw mcp doctor mailcycle --probe. openclaw mcp status --verbose shows the configured servers without starting them.
The connect timeout
OpenClaw gives an MCP server a few seconds to start, and in our test the default was 5. With the older 0.6 package, the first npx download and start took around 20 seconds and the probe timed out. Since 0.7.0, mailcycle-mcp is one bundled file with no dependencies and starts in about a second, so the default is enough. --connect-timeout 30 (or connectionTimeoutMs: 30000) covers a slow network on the first download.
requestTimeoutMs is the limit for one tool call. Each wait_for_message call returns within 50 seconds, so 120000 leaves room.
Tool Search
OpenClaw doesn’t hand every MCP tool’s schema to the model up front. When tools.toolSearch is unset, embedded runs use Tool Search: the model calls tool_search to find a tool, tool_describe to read it, and dispatch_action to call it. This keeps the prompt small when you have many servers.
For Mailcycle, that means the first time a turn needs email, the model searches before it acts. Mailcycle’s tool descriptions use the words email and inbox, so a search for either should turn them up. If you’d rather the model saw the tools directly, set tools.toolSearch to false in your config.
Approval
MCP tool approvals follow the session’s permission posture, and OpenClaw’s default full-permission posture doesn’t prompt. So out of the box, mailcycle__reply runs without asking. To change that for this server:
openclaw mcp configure mailcycle --approval prompt
--approval takes auto, prompt or approve; check openclaw mcp configure --help for exactly how each behaves in your version. For an agent started by a webhook, with nobody watching, Mailcycle’s own send mode is the more dependable limit: see the security section.
How authentication works
The OpenClaw config holds no secrets for Mailcycle. The server reads its credential and key from agent.json when it starts.
- Keep
agent.jsonand theMC1:line private. - OpenClaw’s stdio launcher silently drops some variables from a server’s
env, such asNODE_OPTIONS,LD_*andDYLD_*, so don’t rely on those for the server. - Removing the agent in the app revokes it, and the server deletes the key file on its next refused call.
Step 4: Receive your first email
Ask your OpenClaw agent:
Wait for an email with “hello” in the subject. Give it five minutes.
It finds and calls mailcycle__wait_for_message with subject_contains: "hello". Only mail that arrives after the first call starts counts, so start the wait before you send.
A single call waits up to 50 seconds. If nothing has come, the tool tells the agent to call again with the same filters, and the next call carries on from where the first one started, so nothing is missed. Several calls in a row are expected.
From your own email, send a message to the agent’s address with the subject hello from me. When it arrives, the agent gets the sender, subject, body and any attachments, numbered from [0].
For mail already in the inbox:
List the last 10 messages.
Step 5: Read and reply
Summarise that email in one line, then open attachment 0.
The agent uses mailcycle__read_message and mailcycle__read_attachment. Text and images come back directly. Other files are saved to a folder you name inside ~/.config/mailcycle/files on the gateway’s machine.
Reply: “Got it, thanks. This came from OpenClaw.”
mailcycle__reply sends the answer from the address you wrote to, threaded under your message.
New agents are reply-only, so send_message to an address that hasn’t written in is refused. If the agent needs to start conversations, set Sending to Send to anyone on its page in the app. Only a signed-in session can change it.
The tools
In OpenClaw each name below has the mailcycle__ prefix.
| Tool | What it does |
|---|---|
list_addresses |
The agent’s addresses, and what it may send |
wait_for_message |
Waits up to 50 seconds per call for new mail and returns it in full |
list_messages |
The newest messages, with a preview of each |
read_message |
One message in full |
read_attachment |
Opens an attachment, or saves it to the files folder |
reply |
Replies to the sender, threaded, from the address they wrote to |
send_message |
Sends a new message, when the agent is set to Send to anyone |
Start the agent when mail arrives
Steps 4 and 5 have the agent wait for mail inside a conversation. That’s fine for a sign-in code you’re expecting right now. For a support address or an order inbox, you don’t want a model call sitting in a wait loop all day. You want the email itself to wake the agent.
An MCP client usually acts only when someone types. OpenClaw can do more, because its gateway accepts HTTP hooks that start agent runs. And Mailcycle webhooks can now carry a header of your own, which is what OpenClaw’s hooks check. Put the two together and each email starts a turn.
How it fits together
-
Mailcycle sends a webhook for
message.received. The body holds only ids, never the email itself:{ "id": "evt_4k2m9x7q1b8c3v6n0z5a", "type": "message.received", "createdAt": "2026-09-19T09:14:03.000Z", "payload": { "messageId": "msg_91be02c4a7d1", "inboxId": "ibx_k3v9x2mq7a" } } -
OpenClaw only accepts a hook with the right token in
Authorization: Bearer …. Mailcycle sends that header on every delivery, alongside its usualMailcycle-Signature. -
An OpenClaw mapping turns the hook into an agent run, with a message built from a template. Inside the template, OpenClaw’s
payloadis the whole Mailcycle event, so the message id ispayload.payload.messageId. -
The agent reads the message with its Mailcycle MCP tools, which decrypt it on the gateway’s machine. The email’s content never passes through the webhook.
You need the Operator plan or above for webhooks, and the gateway must be reachable at a public HTTPS URL, for example through a reverse proxy or a tunnel with a certificate.
1. Turn on hooks in OpenClaw
Add this to ~/.openclaw/openclaw.json, using a long random value of your own for the token:
{
"hooks": {
"enabled": true,
"path": "/hooks",
"token": "a-long-random-hook-token",
"allowedAgentIds": ["main"],
"mappings": [
{
"match": { "path": "mailcycle" },
"action": "agent",
"agentId": "main",
"name": "Mailcycle {{type}}",
"messageTemplate": "New email in Mailcycle, message {{payload.payload.messageId}}. Read it with the mailcycle read_message tool and handle it."
}
]
}
}
What each part does:
path: "/hooks"serves hooks under/hooks, andmatch: { path: "mailcycle" }picks up requests to/hooks/mailcycle.tokenis the secret OpenClaw expects in theAuthorizationheader.action: "agent"withagentId: "main"starts a run on yourmainagent.allowedAgentIdslimits which agents hooks may start.namelabels the run, here Mailcycle message.received.messageTemplateis what the agent is told. “Handle it” is deliberately open; replace it with the actual job, such as draft a reply and show it to me or if it’s an invoice, save the PDF and reply to confirm.
2. Add the webhook in Mailcycle
- In the app, open API, then Webhooks.
- Add
https://your-gateway.example.com/hooks/mailcycle. - Choose the
message.receivedevent. - Choose Add a header. Enter
Authorizationas the name andBearer a-long-random-hook-tokenas the value, with your real token.
Mailcycle never shows the header’s value again after you save it.
3. Try it
Send an email to the agent’s address. Within seconds, OpenClaw should start a run named Mailcycle message.received, and the agent should read the message and act on your template.
If the run doesn’t start, check the webhook’s deliveries in the app. A 401 means the header is missing or the token doesn’t match; that’s exactly what we saw before adding the header in our test. Also check that the URL’s path is hooks.path followed by the mapping’s match.path, here /hooks/mailcycle.
Things to know
- The event fires for mail to any address on your account. The agent can only open mail to the addresses assigned to it, so if the account has other addresses, the agent will be told about messages it can’t read. Keep the agent’s addresses and the account’s other addresses in mind when you write the template.
- A test delivery from the app goes to the same path, so it starts a run too, with no message id in it.
- Anyone with the hook token can start agent runs. Treat it like a password. If it leaks, change it in
openclaw.jsonand update the header in Mailcycle.
Troubleshooting
openclaw mcp probe mailcycle times out.
Check you have mailcycle-mcp 0.7.0 or later, which starts in about a second; npx -y mailcycle-mcp fetches the latest. Add --connect-timeout 30, or set connectionTimeoutMs: 30000. Then run npx -y mailcycle-mcp by hand as the gateway’s user: it should wait silently until Ctrl+C. If not, check node --version and npm access.
The agent says it has no email tools.
With Tool Search on, the model has to search first. Ask it to search its tools for “email”. If that doesn’t help, set tools.toolSearch to false.
The agent replies without asking.
That’s OpenClaw’s default posture. Use openclaw mcp configure mailcycle --approval, or set the agent to Read only in Mailcycle while you test.
The webhook gets 401.
The Authorization header is missing, or its value isn’t exactly Bearer followed by hooks.token.
Mailcycle won’t save the webhook URL.
It must be https, on a hostname rather than an IP address, and not a local name. Adding webhooks also needs the Operator plan.
The run starts but the message id is blank.
Use {{payload.payload.messageId}}. OpenClaw’s payload is the whole Mailcycle event, and the event’s own payload holds the id.
“Mailcycle isn’t connected on this machine yet, so this agent has no mailbox.”
The server runs, but its user has no agent.json. Pair as the gateway’s user, following step 2. No restart needed.
“This machine already has a connected agent.”
Replace it with npx -y mailcycle-mcp pair --force, or use a separate MAILCYCLE_AGENT_FILE.
“This agent was removed from Mailcycle, so its key has been deleted.” The agent was removed in the app. Pair again.
“This agent has no email address yet.” Add an address to the agent in the app.
“Nothing matching arrived in 50 seconds.”
One call ended. The agent should call again with the same filters. If the mail arrived before the first call, use list_messages. Check that subject_contains and from_contains match.
“This agent is set to reply only, so it cannot start new conversations.” Reply to a received message, or switch the agent to Send to anyone. Reply-only agents answer senders whose mail passes SPF or DMARC.
“Sending is turned off for this agent.” The agent is Read only. Change its sending mode in the app.
“This device is paused until the account’s plan is paid for.” The plan ended and the account is on Free, which has no agents. Choose a plan and the same agent comes back without pairing.
“Too many requests.” A limit was hit, such as hourly sends. The message says when to retry.
Security and best practices
Unattended runs need hard limits. Once mail starts turns on its own, a stranger’s email is effectively the prompt. Reply-only sending means the worst a hostile message can do through Mailcycle is get a reply sent to its own sender. It can still try to steer what the agent does with OpenClaw’s other tools, so be deliberate about what the main agent can reach, or map hooks to a narrower agent.
Approve sends where you can. For conversations, --approval on the Mailcycle server makes OpenClaw ask before tools run. For webhook runs, write the template to draft rather than send, such as draft a reply and post it for my approval, and keep Mailcycle’s send mode as the backstop, because a prompt is advice to the model and the send mode isn’t.
Mail is labelled as the sender’s words. Bodies and text attachments reach the model wrapped as information from the sender. That’s a layer of defence, not a guarantee.
The webhook carries ids, not mail. Email content is encrypted on arrival and decrypted only by mailcycle-mcp on the gateway’s machine. What the agent reads then goes to your model provider, as with any tool output.
Files stay in one folder. Attachments are saved to and attached from ~/.config/mailcycle/files, or the folders in MAILCYCLE_FILES_DIR, and nowhere else.
Protect both secrets. agent.json is the agent’s mailbox key; the hook token starts agent runs. Keep both out of repositories, and rotate the token or remove the agent if either leaks.
Stay within acceptable use. Codes from your own apps and services you’re authorised to use are a good fit. Bulk account creation elsewhere, or getting around other services’ verification, breaks the acceptable use policy. The AI agent email security guide goes further into prompt injection through email.
When the trial ends
Nothing is charged. The account moves to Free, and what Free doesn’t include, AI agents among it, is paused rather than deleted. Mail keeps arriving and is held. Choose a plan within 21 days and everything returns, the same agent included, without pairing again. After 21 days, whatever is still paused is deleted.
What you’ve built
OpenClaw now has its own email address, with tools to wait for mail, read it, open attachments and reply in the thread. With the webhook, it no longer waits at all: an email arrives, the gateway starts a run, and the agent deals with it. That suits a support address, an orders inbox, or the sign-in codes your own services send.
Related guides
The webhook route is general. Receive email by webhook explains the signature check, and the webhooks guide lists every event.
The AI agents guide has the OpenClaw hooks config alongside the rest of the reference, and the webhooks guide covers events and deliveries. For other clients, see the Mailcycle MCP server page and the email MCP server setup guide for Claude Desktop, Cursor, Codex, VS Code or any other MCP client. There’s also a walkthrough for Claude Code.
FAQ
Can OpenClaw react to an email without me asking?
Yes. Add a Mailcycle webhook that posts to OpenClaw's /hooks/mailcycle with an Authorization: Bearer header carrying your hook token, and map that path to an agent run. Each arriving email then starts a turn. Webhooks need the Operator plan and a gateway reachable over public HTTPS.
Why does openclaw mcp probe time out on the first start?
Older mailcycle-mcp versions took about 20 seconds to start on first download, past OpenClaw's 5 second connect timeout in our test. 0.7.0 starts in about a second. Adding --connect-timeout 30 is a safe extra margin.
Why doesn't the agent see the Mailcycle tools in its tool list?
OpenClaw puts MCP tools behind Tool Search, so the model finds them with tool_search first. To give it the tool schemas directly instead, set tools.toolSearch to false.
Does the webhook send the email's content to OpenClaw?
No. The message.received event carries only the message id and address id. The agent then reads the message through mailcycle-mcp, which decrypts it on the gateway's machine.
Will OpenClaw ask before replying to an email?
Not by default, because OpenClaw's default permission posture doesn't prompt for MCP tools. Change it with openclaw mcp configure mailcycle --approval, or keep the agent on Reply only or Read only in Mailcycle.
Why does the OpenClaw webhook get a 401?
The Authorization header is missing, or its value is not exactly Bearer followed by hooks.token.
Why will Mailcycle not save the OpenClaw webhook URL?
It must be https, on a hostname rather than an IP address, and not a local name. Adding webhooks also needs the Operator plan.
Related
Email for AI agents
- Gmail MCP Alternative: A Dedicated Inbox for Your AI Agent (Instead of Gmail)
- Email MCP Server: Complete Setup Guide for Claude Desktop, Cursor, Codex and VS Code (MCP setup for every client)
- AI Agent Email Security: How to Keep AI Agents Out of Your Personal Inbox (Security)
- AI Agent Inbox: Give Your Agent Its Own Email Address (MCP, TypeScript and Python) (Agent inbox in code)
- How to Give an Agno Agent Its Own Email Inbox (Agno)
- How to Give an AutoGen Agent Its Own Email Inbox (AutoGen)
- How to Give Claude Code Its Own Email Address Using MCP (Claude Code)
- How to Give Claude Desktop Its Own Email Address Using MCP (Claude Desktop)
- How to Give Cline Its Own Email Address Using MCP (Cline)
- How to Give Codex CLI Its Own Email Address Using MCP (Codex CLI)
- How to Give a CrewAI Agent Its Own Email Inbox (CrewAI)
- How to Give Crush Its Own Email Address Using MCP (Crush)
- How to Give Cursor Its Own Email Address Using MCP (Cursor)
- How to Give Gemini CLI Its Own Email Address Using MCP (Gemini CLI)
- How to Give Goose Its Own Email Address Using MCP (Goose)
- How to Give Hermes Agent Its Own Email Address Using MCP (Hermes Agent)
- How to Give Kilo Code CLI Its Own Email Address Using MCP (Kilo Code CLI)
- How to Give a LangGraph Agent Its Own Email Inbox (LangGraph)
- How to Give a LlamaIndex Agent Its Own Email Inbox (LlamaIndex)
- How to Give a Mastra Agent Its Own Email Inbox (Mastra)
- How to Give an n8n AI Agent Its Own Email Inbox (n8n)
- How to Give an OpenAI Agents SDK Agent Its Own Email Inbox (OpenAI Agents SDK)
- How to Give OpenCode Its Own Email Address Using MCP (OpenCode)
- How to Give a Pydantic AI Agent Its Own Email Inbox (Pydantic AI)
- How to Give Qwen Code Its Own Email Address Using MCP (Qwen Code)
- How to Give a Semantic Kernel Agent Its Own Email Inbox (Semantic Kernel)
- How to Give a smolagents Agent Its Own Email Inbox (smolagents)
- How to Give a Vercel AI SDK Agent Its Own Email Inbox (Vercel AI SDK)
- How to Give GitHub Copilot in VS Code Its Own Email Address Using MCP (VS Code + Copilot)
- How to Give Windsurf (Devin Desktop) Its Own Email Address Using MCP (Windsurf (Devin Desktop))