Skip to Content
Fluxmail

Connect an MCP client

Choose your MCP client, configure local or HTTP access, and verify the mailbox connection.

Connect your client after installing Fluxmail and connecting a mailbox through the local quickstart or Docker guide. For an agent to do the configuration, use agent-first setup.

Stdio can create and inspect schedules within the client's permissions, but it does not deliver them. For a stdio installation, keep fluxmail serve or fluxmail scheduled run running with the same data directory. Remote HTTP installations already deliver schedules through serve, including after a client disconnects. Before starting a delivery worker, review pending schedules.

Choose one transport

Where Fluxmail runsTransportAuthentication
On the same computer as the clientstdioYour saved local member session
In Docker or on another machineStreamable HTTPOAuth sign-in, or a Fluxmail API key

Use one transport per connection. We recommend Full access for normal MCP use, and the examples below select it explicitly. Full allows reading, sending, scheduling, drafts, organization, and moving mail into or out of Trash. It excludes permanent deletion. Choose read-write or read-only for restricted access. Bare stdio and API keys created without permission options also get Full access.

Most HTTP clients can sign in with OAuth. You add the MCP URL, then sign in to Fluxmail in your browser and choose what the client can use. Clients without OAuth support need an API key in an Authorization header. Check your client's entry below.

Option 1: Connect over stdio

Your client launches fluxmail stdio --profile full using the member session saved during setup. You do not need to start fluxmail serve. The client must run as the same operating-system user and use the same data directory as setup.

Add --account <account-id> to the arguments to limit the client to one mailbox. Repeat it for several mailboxes. For multiple local instances or a custom installation path, see Local instance settings.

Option 2: Connect over Streamable HTTP

A local installation needs a running HTTP server:

fluxmail serve

Docker Compose already starts the server. The local endpoint is http://localhost:8977/mcp. For a remote server, use its public HTTPS URL followed by /mcp.

Sign in with OAuth

OAuth needs a public URL that uses HTTPS, or a loopback address such as the default http://localhost:8977 when the client runs on the same computer. Set FLUXMAIL_PUBLIC_URL to the HTTPS address clients use to reach the server. When the public URL is plain HTTP on another host, Fluxmail turns OAuth off and accepts only API keys. fluxmail serve prints which sign-in methods the server accepts. If your public URL has a path, such as https://mail.example.com/fluxmail, clients look for /.well-known/oauth-authorization-server/fluxmail at the root of the domain, so your reverse proxy also needs to send that path to Fluxmail unchanged.

When you add the MCP URL, the client opens a Fluxmail page in your browser. Sign in with your member email and password, then choose permissions and mailboxes. The client's requested permissions start checked, and you can uncheck any of them. Permanent deletion appears only when the client asks for it, and you have to check it yourself. If you have one mailbox, it starts selected. Otherwise, select mailboxes or choose all your mailboxes, which also covers mailboxes you get access to later.

The client keeps access for 90 days and refreshes its tokens on its own. To see or revoke connections:

fluxmail connections list
fluxmail connections revoke <connection-id>

To change which mailboxes a connection can use, run fluxmail connections accounts <connection-id> with repeated --account options or --all-accounts. To change its permissions, revoke it and connect the client again. Suspending a member, resetting their password, or changing it revokes their connections.

Hosted clients such as Claude on the web and ChatGPT on the web connect from their own servers, so they need a Fluxmail URL that is reachable from the internet. They cannot use localhost.

Use an API key

Create a named API key on the instance your client will use. This example grants Full access to one mailbox:

fluxmail apikey create --name my-agent --profile full --account <account-id>

For Docker, prefix that command with docker compose exec fluxmail. The key is shown once. Store it in the client's secret store or private configuration; never commit a real key or paste it into a chat.

Choose your client

Use the local or HTTP instructions within your client's section. In HTTP examples, replace the URL with your server's endpoint. Where an example uses an API key, enter the key privately in place of fmk_.... Preserve other servers in your configuration.

claude mcp add fluxmail -- fluxmail stdio --profile full

Test the connection

Reload or restart your client, then check that its discovered tools match your chosen permissions. With read access, ask:

Use Fluxmail to list the mailboxes I can access. For my selected mailbox,
call list_folders with its accountId. Report whether both calls succeed.
Do not read message bodies, send mail, create drafts, or modify messages.

The account list checks the connection and mailbox visibility. A successful folder call also checks provider access. If the list is empty, confirm that you connected a mailbox to this instance and that the member and client can access it.

For a custom policy without mail.read, check tool discovery only. Do not add permissions or send a message just to test the connection. If your client needs a restart, report verification as pending. A REST check can verify an existing read-scoped HTTP key, but it does not prove that MCP works.

When you want the agent to retrieve email, ask it to list the five latest inbox messages. See MCP tools for available operations and Troubleshooting for connection failures.

MCPB bundle permissions

The MCPB bundle selects full automatically when no permission profile is saved. It grants the Full access described above and cannot permanently delete messages. Scheduled delivery still requires fluxmail serve or fluxmail scheduled run with the same data directory.

A saved profile overrides the bundle default. If you upgrade an installation without a saved profile, it can receive Full access automatically. To retain read-only access, explicitly save read-only in the bundle's Permission profile setting before upgrading. Save read-write to allow drafts, organization, and Trash without sending or scheduling.

Limit access

For stdio, put the permission profile and mailbox allowlist in the server arguments. For HTTP, those settings belong to the OAuth connection or API key and can be changed without editing client configuration. See Permissions for custom policies and key updates.

Local instance settings

Every stdio client launches fluxmail stdio. Without --instance, Fluxmail selects the active local profile first, then a local profile named local, then the sole local profile under any other name. It uses the member session saved for that profile. You do not need to run fluxmail serve.

Before connecting, run fluxmail setup for a new installation. For an existing installation, list profiles with fluxmail instances list and log in to the local profile the client will use with fluxmail --instance <name> login. Use local for the default profile created by setup or when recreating a missing local profile. The MCP client must run as the same operating-system user and use the same Fluxmail data directory as the setup or login command.

To pin the client to a particular local profile, add --instance <name> before stdio in the client command. You must choose a profile this way if several local profiles exist and none is active or named local. An explicit remote profile is rejected; use Streamable HTTP for remote instances. The stdio selection does not change the active profile for other CLI commands.

If a desktop client cannot find fluxmail, use the absolute executable path returned by which fluxmail (where fluxmail on Windows). For a project-local installation, use /absolute/path/to/installation/node_modules/.bin/fluxmail and keep that installation directory available.

For a custom data directory, set FLUXMAIL_DATA_DIR in the MCP server's environment to the same absolute path used during setup. In JSON configurations, add "env": { "FLUXMAIL_DATA_DIR": "/absolute/path/to/data" } to the server entry.

Work with messages

See Sending and retries before enabling sends or forwards. It explains delivery status, retry keys, and previews.

Mail tools return typed structuredContent and readable text. get_email and get_thread accept bodyFormat to select text, HTML, both, or no body. Large bodies include truncation metadata; use get_email_body to read the remaining text. Thread messages are paged. download_attachment returns the attachment's metadata and a protected resource link. Set inline to include the file in the tool response. UTF-8 text files such as plain text, CSV, and JSON come back as text. Inline PNG, JPEG, GIF, and WebP images come back as image content, and an inline PDF also includes the text of its first pages. Each PDF text result covers up to 200 pages or 80,000 characters and names the pages it includes. To read further, set pages to a page or range such as 201-400. Clients that use an MCP protocol version older than 2025-06-18 receive the link as a uri field in the JSON text.

Attach and save files through a folder

A stdio connection can attach files from a folder on your computer and save attachments to it, so files don't pass through the assistant as base64. The folder is attachments in the Fluxmail data directory, ~/.fluxmail/attachments by default, and Fluxmail creates it when the connection starts. To use another existing folder, add --attachment-dir to the server arguments. To turn the folder off, add --no-attachment-dir:

fluxmail stdio --profile full --attachment-dir /Users/me/Mail/Attachments

The draft and send tools accept attachmentFiles, a list of files in the folder, such as [{ "path": "q3-report.pdf" }]. Fluxmail reads each file and adds it to the message. The file name and type come from the file unless you set filename or mimeType. Files still count toward the attachment size limit.

save_attachment saves an attachment as a new file in the folder instead of returning it. It writes files, so it needs the mail.drafts permission as well as mail.read, and read-only connections don't have it. Saved attachments are not limited by max_attachment_mb, but Fluxmail holds each one in memory while it saves it, and the mail provider's own message size limits still apply. Fluxmail never replaces a file that exists. It also won't save a hidden file, or into a hidden folder such as .git, because the content comes from the sender and other apps may read those files as settings.

Fluxmail refuses any path outside the folder, including through symbolic links, because a message could ask the assistant to attach a private file. Keep only files you're willing to send in the folder. A folder that holds Fluxmail's data directory, database or a secret file it reads, such as your home directory, is refused, and so is a folder inside the data directory other than its attachments folder. Streamable HTTP connections don't have a folder.

Input errors explain which field needs attention. Search syntax errors include data.diagnostics. Provider error text is replaced with a safe message. Bulk changes with failed or uncertain messages are marked as MCP tool errors; inspect the per-message results before retrying.

Last updated