OpenClaw agents already run long-lived sessions. With an MCPmailer inbox they gain a durable identity the outside world can reach: email in, email out, threads preserved.
Create a mailbox
One per agent, so its address and its key are the same identity.
Run openclaw mcp add
With --auth oauth there is no token to store anywhere.
Check it
openclaw mcp doctor mcpmailer --probe connects and lists what it found.
Restart the gateway
The tool list is read when the server connects.
{
"mcp": {
"servers": {
"mcpmailer": {
"url": "https://connect.mcpmailer.com/mcp",
"transport": "streamable-http",
"requestTimeoutMs": 320000,
"headers": {
"Authorization": "Bearer ${MCPMAILER_KEY}"
}
}
}
}
}OAuth is the route their docs recommend, and ours supports it. The second form is for a key you already hold: keep it in the environment rather than in the file.
# OAuth: a browser opens once, nothing is written to disk
openclaw mcp add mcpmailer \
--url https://connect.mcpmailer.com/mcp \
--transport streamable-http \
--auth oauth \
--timeout 320000
# Or with a key you already have
openclaw mcp add mcpmailer \
--url https://connect.mcpmailer.com/mcp \
--transport streamable-http \
--header "Authorization: Bearer \$MCPMAILER_KEY" \
--timeout 320000
openclaw mcp doctor mcpmailer --probeWithout "transport": "streamable-http" the server is treated as the older SSE style and the connection does not come up. The CLI writes the field for you; a hand-edited config is where it goes missing.
Headers expand ${VAR} from the environment, which is how their docs suggest avoiding a literal bearer token in a file you might commit.
wait_for_reply can block for 300 seconds. requestTimeoutMs is in milliseconds and has no documented default, so set it to 320000 or the gateway may give up before the reply lands.
A session that is already running does not have to wait on a tool call. Turn on hooks in the OpenClaw config, then register a webhook pointing at its /hooks/wake route to interrupt the main session, or /hooks/agent to run an isolated turn beside it. The hooks token goes in an Authorization header and the body template takes the shape that route expects. /docs/openclaw has both templates, along with the timeouts, the tool filter, and running one gateway against several mailboxes.
The endpoint speaks Streamable HTTP MCP with 67 tools across mail, contacts, notes, and a vault, including send_email, read_message, search_inbox, and wait_for_reply. Errors are structured so OpenClaw can react: a quota rejection includes the reset time.