Sponsored Content

DEV Community

Zhu
Zhu

Posted on

Give Your AI Agent Its Own Inbox: A 5-Minute Setup with MCP

Most email APIs are send-only. But if you're building an agent that needs to
have a conversation over email — support, scheduling, invoicing — it needs
to receive replies too, with thread context.

In this post we'll set up an agent with its own mailbox using the Model
Context Protocol. This is an official EngageLab Email tutorial, so feedback
from developers is welcome.

What you'll end up with

  • An agent that sends email from its own address (not your personal inbox)
  • Replies arriving as structured data the agent can read
  • Conversation threads as a first-class object

Step 1 — Get a Secret Key

Create an EngageLab account and generate a Secret Key from the console (it looks like
sk_sg_xxx — the prefix encodes the region). Or use the CLI to create one
via browser login:

npm install -g @engagelabemail/cli
engagelab-email-cli login
Enter fullscreen mode Exit fullscreen mode

You'll also need a mailbox — create one in the console (shared subdomain is
fastest to start; custom domains need DNS verification).

Step 2 — Register the MCP server

For Claude Code:

claude mcp add engagelab-email \
  -e ENGAGELAB_EMAIL_SECRET_KEY=sk_sg_yourkey \
  -- npx -y @engagelabemail/mcp
Enter fullscreen mode Exit fullscreen mode

Or in claude_desktop_config.json:

{
"mcpServers": {
"engagelab-email": {
"command": "npx",
"args": ["-y", "@engagelabemail/mcp"],
"env": { "ENGAGELAB_EMAIL_SECRET_KEY": "sk_sg_yourkey" }
}
}
}
Enter fullscreen mode Exit fullscreen mode




Step 3 — Talk to it

Ask your agent:

List my mailboxes, then send an email from the first one to
me@example.com saying "invoice #42 approved", then check for new messages.

The agent now has 9 tools: send, reply, list inbound mail, get a message,
poll for new mail, and browse threads.

Why a dedicated mailbox (not Gmail access)

  • Blast radius: the agent can only read/write its own mailbox
  • Threads: replies group into conversations, so the agent keeps context
  • Machine-first: everything is JSON over MCP — no IMAP parsing

Gotchas

  • Sandbox mode (sandbox: true in send_email) skips real delivery while you're iterating on prompts
  • Attachments are base64 in the tool schema — fine for documents, clunky for >5MB files
  • Mailbox creation is currently a console step; programmatic creation is on the roadmap

Repo: https://github.com/Metaverse-Cloud/engagelab-email-mcp

Package: https://www.npmjs.com/package/@engagelabemail/mcp

What would you build first — a support agent, or an approval bot?

Top comments (0)