MaillyDocs

Give Gemini CLI its own email address

Connect Gemini CLI to a Mailly inbox over Remote MCP with OAuth, so it can read mail, save reply drafts and send after your approval.

Gemini CLI can work from a real inbox: search threads, read incoming mail, save reply drafts and send once you approve the final text. Mailly gives it an address such as your-name@mailly.site and connects over Remote MCP. Gemini CLI discovers Mailly's OAuth settings on its own, so there is no client ID to configure.

Google replaced Gemini CLI with Antigravity CLI for unpaid-tier and Google One users on June 18, 2026. See Google's announcement. This guide covers Gemini CLI.

What you get

  • A two-way inbox on @mailly.site, or on your own domain on the Developer plan.
  • About 70 typed MCP tools for threads, drafts, sending, domains, contacts, templates, campaigns and workflows, limited to the permissions you grant.
  • Sending under your control: Gemini CLI shows the exact text and recipients, and Mailly sends only after you confirm.

Get an inbox

Already have a Mailly account? Skip to the next step.

Paste this prompt into Gemini CLI. It reads Mailly's setup instructions, asks for the name you want, reserves it over HTTP and gives you a verification link.

Prompt
Read https://mailly.site/auth.md
and set up a Mailly inbox for me over HTTP.
Ask me for the name if unknown; if taken, ask for another,
with no blind retries.
Send me the verification link.
After I confirm the inbox in my browser,
store the API key securely, tell me the address,
and ask me before sending any email.

Open the link, sign in or register with your own verified email, and confirm the inbox. Gemini CLI then receives the address and your account's API key. You can also start at mailly.site/onboard. See Let an agent set up an inbox for the rules.

Add the Mailly MCP server

gemini mcp add --transport http --scope user mailly https://mcp.mailly.site/mcp

--scope user writes to ~/.gemini/settings.json so Mailly is available everywhere. The default scope is project, which writes to .gemini/settings.json in the current folder. To edit the file by hand, use httpUrl for Mailly's Streamable HTTP endpoint (url means SSE in Gemini CLI):

~/.gemini/settings.json
{
  "mcpServers": {
    "mailly": {
      "httpUrl": "https://mcp.mailly.site/mcp"
    }
  }
}

Sign in and choose permissions

Leave out any OAuth settings. On the first connection Mailly answers 401, Gemini CLI discovers the authorization server, registers itself with dynamic client registration and opens your browser. Sign in to Mailly and choose what Gemini CLI may do:

PermissionWhat Gemini CLI can do
mail:readRead your inboxes, threads, sent mail, drafts and settings. Always granted.
mail:draftSave, edit and discard reply drafts. No sending.
mail:sendSend replies, forwards and new emails you have reviewed.
workspace:manageManage addresses, domains, templates, contacts, campaigns, workflows and webhooks.

Gemini CLI stores the tokens in ~/.gemini/mcp-oauth-tokens.json and refreshes them when they expire.

Verify the connection

  1. Run gemini mcp list. It shows each server's configuration and connection status. Inside a session, /mcp shows the same.
  2. Ask Gemini CLI: "Use Mailly to list my inbox addresses and my five most recent threads." It should call mailly_list_inbox_addresses and mailly_list_threads.
  3. Send an email from your personal account to your Mailly address, then ask: "Read my latest Mailly thread and save a reply draft. Show me the exact text and don't send it." Gemini CLI calls mailly_read_thread and mailly_save_draft. Approve or discard the draft in the conversation.

Use the CLI instead

OAuth needs a local browser, so it won't complete over SSH or in headless runs. There, use mailly-cli from Gemini CLI's shell. mailly login --no-browser prints the sign-in URL to open on another device.

npm install -g mailly-cli   # Node.js 18+
mailly login --no-browser
mailly inbox addresses list --json
mailly inbox threads list --json

Troubleshooting

  • Mailly shows as disconnected or needs sign-in: run /mcp auth mailly to authenticate again.
  • Connection errors right after adding Mailly by hand: check that the entry uses httpUrl, not url. With url, Gemini CLI tries SSE.
  • The browser can't open (SSH, containers): OAuth requires local browser access. Use the CLI as above.
  • A tool you expected is missing: it needs a permission you didn't grant. Run /mcp auth mailly and grant the permission on Mailly's consent page. Mailly never widens an existing grant on its own.
  • No mail arrives: check the address in the workspace and look in the inbox's Spam folder.

On this page