Email Infrastructure for Gemini CLI via MCP

Connect MultiMail's 43-tool MCP server to Gemini CLI and give your terminal-based AI workflows full email capabilities — send, read, thread, and approve from the command line.


Gemini CLI is Google's terminal-based AI assistant, built for developers who want agent-augmented workflows without leaving the command line. By adding MultiMail as an MCP server, Gemini CLI gains access to structured email operations: reading inboxes, sending messages, managing threads, and surfacing pending approvals for human review.

MultiMail's MCP server exposes 44 tools covering the full email lifecycle. Gemini CLI connects to it over stdio, which means the server process runs locally alongside your terminal session. Configuration requires only a MultiMail API key and a JSON edit to ~/.gemini/settings.json.

The integration suits developer automation workflows well: processing CI notifications, triaging support inboxes, or building lightweight agent loops that send transactional email under human oversight. MultiMail's graduated oversight modes let you decide how much autonomy Gemini gets — from requiring approval on every send to fully autonomous operation.

Get started

1

Install Gemini CLI

Install Gemini CLI via npm if you haven't already. Node.js 18 or later is required.

json
npm install -g @google/gemini-cli
gemini --version
2

Get your MultiMail API key

Log in to your MultiMail account and copy your API key from the dashboard. Keys start with mm_live_ for production or mm_test_ for sandbox testing. Use mm_test_ while setting up to avoid sending live email during configuration.

3

Add MultiMail to your Gemini settings

Open ~/.gemini/settings.json (create it if it doesn't exist) and add the MultiMail MCP server under the mcpServers key. The npx invocation downloads and runs the server on first use.

json
{
  "mcpServers": {
    "multimail": {
      "command": "npx",
      "args": ["-y", "@multimail/mcp-server"],
      "env": {
        "MULTIMAIL_API_KEY": "mm_live_your_key_here"
      }
    }
  }
}
4

Restart Gemini CLI and verify tools

Start a new Gemini CLI session. The MultiMail tools should now be available. Ask Gemini to list available tools or run a test check_inbox call to confirm the connection.

json
gemini
# In the Gemini prompt:
# > What MultiMail tools do you have access to?
5

Set your oversight mode

By default, MultiMail uses gated_send mode — reads are autonomous but sends require your approval via decide_email. Adjust this per mailbox in the dashboard or via the API. Start here and graduate toward more autonomy once you trust the agent's behavior.

json
curl -X PATCH https:"cm">//api.multimail.dev/mailboxes/your-mailbox-id \
  -H "Authorization: Bearer $MULTIMAIL_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"oversight_mode": "gated_send"}'

Available MCP tools

ToolDescriptionExample
check_inboxLists recent emails in a mailbox with metadata: sender, subject, timestamp, read status, and tags. Accepts filters for date range, read state, and tags.Check whether any new support requests arrived in [email protected] in the last 24 hours.
read_emailFetches the full content of a specific email by ID, including headers, body text, and attachment metadata.Read email em_01J9XY... to extract the order number and issue description from its body.
get_threadRetrieves all messages in an email thread ordered chronologically, preserving the full conversation context.Get the full support thread before drafting a reply so the agent doesn't repeat already-covered ground.
send_emailSends a new email from a MultiMail mailbox. In gated_send or gated_all mode the message is queued for approval rather than delivered immediately.Send a project status update to the team after a CI build completes, held for approval before delivery.
reply_emailSends a reply to an existing email, preserving thread context and setting correct In-Reply-To and References headers.Reply to a customer inquiry with a resolution, keeping the original message in the thread.
tag_emailApplies one or more string tags to an email for categorization, filtering, and downstream routing.Tag inbound emails as billing, technical, or general based on subject and body classification.
decide_emailApproves or rejects a pending outbound message that is waiting in the gated_send or gated_all queue.Approve a drafted reply after reviewing it for accuracy, releasing it for delivery.
list_pendingLists all outbound messages currently waiting for human approval, with subject, recipient, and queued timestamp.Review the full approval queue before starting a morning standup to see what the agent drafted overnight.
cancel_messageCancels a pending outbound message before it is approved or delivered, removing it from the queue.Cancel a scheduled email when the underlying data it references has changed and the draft is no longer accurate.
search_contactsSearches contact history for email addresses matching a name, domain, or keyword from prior correspondence.Find all known contacts at a target company before composing an outreach message.
create_mailboxCreates a new mailbox on your account, either on a custom domain you control or on multimail.dev.Provision a dedicated mailbox for a new agent workflow or project without touching the dashboard.

Usage examples

Gemini settings.json — MCP server configuration
json
{
  "mcpServers": {
    "multimail": {
      "command": "npx",
      "args": ["-y", "@multimail/mcp-server"],
      "env": {
        "MULTIMAIL_API_KEY": "mm_live_your_key_here"
      }
    }
  }
}

Minimal configuration to add MultiMail to Gemini CLI. Place this in ~/.gemini/settings.json on macOS or Linux, or %USERPROFILE%\.gemini\settings.json on Windows.

Inbox triage prompt
text
Check the inbox for [email protected] from the last 6 hours.

For each unread email:
1. Call read_email to get the full content
2. Call tag_email to label it as 'billing', 'technical', or 'general' based on the subject and body
3. Draft a reply acknowledging receipt and estimating a response window
4. Call send_email to queue the draft — oversight mode will hold it for my approval

After processing all emails, call list_pending so I can review the queued replies.

A Gemini CLI prompt that reads an inbox, classifies emails by category, and queues replies for gated approval before delivery.

CI notification script
bash
"cm">#!/bin/bash
"cm"># ci-notify.sh — called by CI pipeline after build finishes
BUILD_STATUS=${1}   "cm"># 'success' or 'failure'
BUILD_URL=${2}
TEAM_EMAIL=${3:[email protected]}

gemini --prompt "Call send_email with:
  from: &"cm">#039;[email protected]'
  to: &"cm">#039;${TEAM_EMAIL}'
  subject: &"cm">#039;Build ${BUILD_STATUS}: ${GITHUB_REF_NAME:-local}'
  body: &"cm">#039;The ${GITHUB_WORKFLOW:-build} workflow completed with status ${BUILD_STATUS}. Details: ${BUILD_URL}'

Then call list_pending to confirm the message is queued for approval."

Shell script that invokes Gemini CLI to send a structured build notification email when a CI job completes. Runs as a post-build step.

Approval queue review prompt
text
Call list_pending to show me all outbound emails waiting for approval.

For each pending message, show me:
- Recipient address
- Subject line
- First 300 characters of the body
- How long it has been queued

Then ask me whether to approve or reject each one. Call decide_email with my answer for each message.

When the queue is empty, tell me how many messages were approved and how many were rejected.

Interactive Gemini CLI session that walks through the pending approval queue and processes each message with your input.

Thread summarizer with reply draft
text
Call get_thread with thread_id 'th_01K2AB...' to retrieve the full conversation.

Summarize the thread in three bullet points:
- What the customer originally asked
- What has been resolved so far
- What is still open

Draft a reply that:
- Acknowledges the open items specifically
- Provides next steps with concrete timeframes
- Does not repeat information already covered

Call reply_email to queue the draft. Use oversight mode — do not send until I approve via decide_email.

Retrieves a full email thread, summarizes the conversation, and drafts a reply held for approval.


Best practices

Use project-level settings for team workflows

Gemini CLI supports a project-level settings file at .gemini/settings.json in your repository root. Committing a shared MCP config there means every team member connects to the same MultiMail setup automatically. Omit the API key from the committed file and have each developer export MULTIMAIL_API_KEY from their shell profile — the MCP server subprocess inherits environment variables from the shell that launched Gemini.

Start with gated_send, then graduate

New integrations should use gated_send oversight mode so you can audit what Gemini drafts before anything is delivered. After reviewing 20 to 30 queued sends and confirming they match your expectations, switch to monitored mode. You'll still receive notifications for every send but won't need to approve each one individually.

Pin the MCP server version for stable workflows

The npx -y @multimail/mcp-server invocation pulls the latest published version on each run. For production workflows, pin a specific release: set args to ["-y", "@multimail/[email protected]"]. This prevents unexpected behavior after upstream updates and makes your configuration reproducible across machines.

Use mm_test_ keys during prompt development

MultiMail API keys prefixed with mm_test_ route to a sandbox environment where send_email calls are captured and logged but never delivered to real recipients. Use a test key in your settings.json while developing and iterating on Gemini CLI prompts, then swap to mm_live_ only when you are ready to handle live email.

Scope API keys to minimum required permissions

MultiMail API keys can be scoped to specific mailboxes and operations. For a Gemini CLI workflow that only needs to read and triage one inbox, create a key restricted to that mailbox with read and tag permissions only. This limits the blast radius if the key leaks from your settings.json.


Common questions

Does Gemini CLI support SSE or streamable HTTP MCP transport?
No. Gemini CLI's MCP integration currently uses stdio transport only. The @multimail/mcp-server npm package supports stdio and works correctly with Gemini CLI. The remote MCP endpoint at mcp.multimail.dev uses streamable HTTP and is not compatible with Gemini CLI's current MCP client implementation.
Can I use MultiMail with Gemini CLI and Claude Code simultaneously?
Yes. Each MCP client runs its own stdio subprocess of @multimail/mcp-server. Both clients connect to the same MultiMail account via your API key. Actions taken in one client — sending a message, tagging an email, approving a pending send — are immediately reflected in the shared mailbox state visible to the other client.
How do I prevent Gemini from sending emails without my approval?
Configure your mailbox to use gated_send or gated_all oversight mode. In gated_send mode all outbound messages are queued and require explicit approval via decide_email before delivery. gated_all extends this requirement to all mutations. Set the mode via the MultiMail dashboard or by calling PATCH https://api.multimail.dev/mailboxes/{id} with {"oversight_mode": "gated_send"}.
Is my API key secure when stored in settings.json?
The ~/.gemini/settings.json file is stored as plaintext on your local filesystem. For better security, omit the API key from the env block in settings.json and instead export MULTIMAIL_API_KEY from your shell profile (~/.zshrc or ~/.bashrc). The MCP server process inherits environment variables from the shell that launched Gemini CLI, so the key stays out of any file on disk.
What Node.js version is required?
Both Gemini CLI and @multimail/mcp-server require Node.js 18 or later. If you are running an older version, use nvm or fnm to install a compatible release: nvm install 20 && nvm use 20. Verify with node --version before attempting to start a Gemini CLI session.
Can I use a custom domain mailbox, not just multimail.dev addresses?
Yes. You can add custom domain mailboxes via the MultiMail dashboard or by calling the create_mailbox MCP tool directly from a Gemini CLI session. Once created, mailboxes on your own domain (e.g., [email protected]) are available to all MCP clients using your API key and behave identically to multimail.dev addresses for all tool operations.
Why are my MultiMail tools not appearing in Gemini CLI after configuration?
The most common causes are a JSON syntax error in settings.json (validate with jsonlint or jq . ~/.gemini/settings.json), a missing or incorrect API key in the env block, or a Node.js version below 18. Set MULTIMAIL_LOG_LEVEL=debug in the env block to enable verbose stdio logging, which Gemini CLI surfaces in its debug output and will show connection errors from the MCP server process.

More MCP clients

The only agent email with a verifiable sender

Email infrastructure built for AI agents. Verifiable identity, graduated oversight, and a 38-tool MCP server. Formally verified in Lean 4.