Email for Claude Code

Fluxmail is a self-hosted MCP server that lets Claude Code search, read, draft, and send email in your Gmail, Outlook, Exchange, or IMAP mailboxes. It runs on your machine, and you decide which mailboxes and actions Claude Code can use.

What you can do

Morning inbox brief

Ask Claude Code to summarize unread mail from the last day, group it by sender or project, and list what needs a reply.

Find messages and attachments

Describe the message you need. Claude Code turns it into a Fluxmail search across your mailboxes, opens the thread, and can download an attachment to read alongside your code.

Draft replies for review

Have Claude Code draft a reply in your mailbox. You read it in your mail client and send it, or allow sending once you trust the workflow.

Connect Claude Code to your email

  1. 1. Install Fluxmail and connect a mailbox

    Install the CLI, create the first administrator, and connect Gmail with the local OAuth flow. Outlook needs a Microsoft app registration; IMAP needs provider credentials. The quickstart covers Docker and provider setup.

    npm install -g fluxmail
    fluxmail setup --name "Your name" --email you@example.com
    fluxmail accounts add gmail
  2. 2. Add Fluxmail to Claude Code

    When Fluxmail and Claude Code run on the same computer, add the stdio server:

    claude mcp add fluxmail -- fluxmail stdio --profile read-only
  3. Or connect over HTTP

    When Fluxmail runs in Docker or on another machine, create an API key with fluxmail apikey create --name claude-code --profile read-only. Start the server with fluxmail serve unless Docker is already running it, then connect over Streamable HTTP:

    claude mcp add --transport http fluxmail http://localhost:8977/mcp \
      --header "Authorization: Bearer fmk_..."

The setup above grants read-only access. Change the stdio profile to read-write to draft and organize without sending. For HTTP, the API key holds the permission profile, so you can change it later without editing the Claude Code config.

Run claude mcp list to confirm the server is connected, then ask Claude Code for the five latest emails in your inbox.

See Permissions for every profile and capability, and the Claude Code MCP docs for client settings.

Check an inbox summary before changing mail

The setup above uses read-only access. Try this prompt with a mailbox you connected:

List my five newest inbox messages with their sender and subject. Tell me which appear to need a reply, and explain why. Do not mark, move, draft, or send anything.

Check the result

Compare the five messages against your mail client. The summary should refer to real messages in the selected mailbox, and the mailbox should remain unchanged. An empty inbox can correctly return no messages.

To create drafts, change the stdio profile or HTTP key to read-write and reconnect. That profile also allows organizing and trashing mail, but cannot send or permanently delete messages. Review a draft in your mail client before sending it yourself.

Continue with Gmail triage and draft replies

If the connection does not work

  • Run claude mcp list and confirm Fluxmail is connected. If it is missing, check the scope where you registered the server and restart the session.
  • If the server connects but no mailbox appears, run fluxmail accounts list as the same operating-system user. Check the instance, member, and mailbox scope used by the client.
  • For a command-not-found error, use the absolute path to the installed Fluxmail executable. For HTTP 401, check the API key and Authorization header. For a permission error, check the key or stdio profile before retrying.
Troubleshoot provider authentication and client access

Common questions

Does Claude Code have built-in Gmail access?
Claude Code connects to email through MCP servers you add. Fluxmail is one option. It works with Gmail and also with Outlook, Exchange, and IMAP mailboxes.
Can Claude Code send email through Fluxmail?
Yes, when the connection allows the mail.send capability. The default full profile allows it. With the read-write profile, Claude Code can draft but not send.
Where is my email stored?
Fluxmail runs on your computer or server and connects directly to your email provider. Provider credentials are encrypted in a local SQLite database. Claude Code sends the email content it reads to Anthropic, as it does with any tool output.

Reviewed

Build on top of email

Run Fluxmail on your own infrastructure and use it through MCP, REST API, or CLI.