Email (IMAP & JMAP)

Connect a mailbox so agents can read email, organize messages, create drafts, and send replies

Gatana connects directly to your email provider through IMAP or JMAP and provides MCP tools for the mailbox. You do not need to run a separate email MCP server.

An agent can search messages, read attachments, and prepare replies. You choose whether it can also change the mailbox or send email. Each user connects their own mailbox by default.

For the provider rules behind the presets, and how to choose an access level, see the guide How to connect email to MCP.

Add an email server

  1. Open Servers and create a server with the type Email.
  2. Select a Provider. Gatana fills in the connection settings for Gmail, Microsoft 365, Fastmail, and iCloud Mail. For another provider, select Other (IMAP) or Other (JMAP) and enter its address.
  3. Select the Authorization Method if the provider offers a choice.
  4. Select an Access Scope from the table below.
  5. Enter a server slug and select Create Server.
  6. If you use OAuth, complete the provider setup in the server's Settings tab.
  7. Open Credentials and connect your mailbox. Each user does this with their own account. An agent can also provide a connection link when a tool call needs credentials.

See Credentials for sign-in options and Profiles to use different mailboxes with different clients.

Access levels

The access level controls which tools Gatana provides. Your email provider must also allow the requested actions.

Access ScopeWhat the agent can do
Read onlyList folders, search and read messages, and read attachments. Reading a message does not mark it as read.
Read and organizeAll read actions, plus mark messages as read or unread, change flags, move messages, move messages to Trash, and create drafts. A person can review and send the drafts in their mail app.
Read, organize and sendAll read and organize actions, plus send new messages and replies.

For IMAP, Gatana provides send_message only if an SMTP server is configured. For JMAP, the server and the user's token must support sending.

Provider setup

Gmail

The Gmail preset uses IMAP to access mail and SMTP to send it. You can use an app password or OAuth.

To use Email + Password:

  1. Turn on 2-Step Verification for your Google Account.
  2. Create a Google app password. Account or organization policy can prevent this option from appearing.
  3. In Gatana Credentials, save your full email address as username and the app password as password.

To use OAuth:

  1. Select OAuth when you create the server.
  2. In Google Cloud, configure the consent screen and create an OAuth client of type Web application.
  3. Add the redirect URI shown in the Gatana OAuth settings to the client.
  4. Save the client ID and secret in Gatana. Keep the preset scopes: openid, email, and https://mail.google.com/.
  5. Save the settings. Each user can then connect through Credentials.

The mail scope allows access to IMAP and SMTP through OAuth. The Gatana access level controls which tools the agent can use. See Google's IMAP and SMTP OAuth documentation.

Microsoft 365

The Microsoft 365 preset uses OAuth with Exchange Online. Your organization must register an app before users can connect.

  1. Register an app in Microsoft Entra ID. Add the delegated Exchange Online permissions IMAP.AccessAsUser.All and SMTP.Send.
  2. Add the redirect URI shown in Gatana to the app registration.
  3. Save the app's client ID and secret in the Gatana OAuth settings.
  4. In the issuer, authorization URL, and token URL, replace organizations with your Directory (tenant) ID. Keep the preset scopes, including openid, email, and offline_access.
  5. Save the settings. Each user can then connect through Credentials.

See Microsoft's IMAP and SMTP OAuth setup.

To send email, the mailbox must also allow Authenticated SMTP. An administrator can check this in the Microsoft 365 admin center under Users → Active users → Mail → Manage email apps. Organization policies can also block SMTP AUTH. See Microsoft's SMTP AUTH settings.

Fastmail

The Fastmail preset uses JMAP with an API token. It fills in the session URL automatically.

  1. In Fastmail, open Settings → Privacy & Security → Manage API tokens.
  2. Create a token with access to mail. Allow sending only if the agent needs it.
  3. In Gatana Credentials, save the API token as token.
  4. If the token cannot send, set the Gatana access level to Read and organize or Read only.

See Fastmail's API documentation for token and JMAP details.

iCloud Mail

The iCloud preset uses IMAP and SMTP with an app-specific password.

  1. Sign in at Apple Account.
  2. Open Sign-In and Security → App-Specific Passwords and create a password for Gatana. Your Apple Account must have two-factor authentication enabled.
  3. In Gatana Credentials, save your iCloud email address as username and the app-specific password as password.

See Apple's app-specific password instructions.

Other providers

IMAP and SMTP

Select Other (IMAP) and enter the IMAP host, such as imap.example.com. To allow sending, also enter an SMTP host. Leave it empty to prevent sending.

The creation form uses port 993 with TLS for IMAP and port 465 with TLS for SMTP. After creation, you can change the hosts, ports, and encryption in Settings. STARTTLS requires a TLS upgrade before sign-in. Gatana stops if the upgrade fails.

Each user saves username and password in Credentials. SMTP uses the same credentials as IMAP. Use an app password if your provider requires one.

The Save a copy in Sent setting saves an extra copy after SMTP accepts a message. Turn it off if your provider already saves sent messages. The Gmail and Microsoft 365 presets have this setting off.

JMAP

Select Other (JMAP) and enter the session URL supplied by your provider, such as https://mail.example.com/.well-known/jmap.

Each user saves an API token as token in Credentials. Gatana sends it as a Bearer token. You can change the headers in Settings if your server needs a different format.

Gatana uses the session's primary mail account by default. Set Account ID in Settings to select another account available in the session. Sending uses JMAP and does not need SMTP.

You cannot change the protocol after you create the server. To switch between IMAP and JMAP, create another server.

Available tools

ToolMinimum accessAction
list_mailboxesReadList folders, their roles, and message counts.
search_messagesReadFind messages in one folder, newest first. Return message summaries and the match count.
get_messageReadRead a message's headers and body, and list its attachments.
get_attachmentReadRead one attachment. Text files return as text; other files return as base64.
set_flagsOrganizeMark messages as read or unread, or add or remove flags.
move_messagesOrganizeMove messages to another folder. IMAP message IDs change after a move.
trash_messagesOrganizeMove messages to Trash. They can be restored until the mail server empties Trash.
create_draftOrganizeSave a plain-text message or reply in Drafts for review.
send_messageSendSend a plain-text message or reply from the connected mailbox.

Search and read

Search defaults to the inbox. Use list_mailboxes to find another folder and pass its ID as mailbox. Filters include text, sender, recipient, subject, date, read status, and flag status. The text filter supports Gmail search syntax on Gmail.

Search returns up to 20 messages by default. Set limit from 1 to 100. Use the returned message IDs with get_message to read the bodies.

Message bodies return as plain text by default, with a limit of 20,000 characters. Set maxLength from 1,000 to 200,000 to change this limit. The result sets isTextTruncated when the text exceeds the limit.

If a link appears only in the HTML body, request format: "html". Gatana converts the HTML to Markdown.

Attachments have a separate size limit. get_attachment accepts up to 1,000,000 bytes by default. Set maxBytes up to 10,000,000. Larger attachments are rejected.

Organize and reply

Flag, move, and trash operations accept up to 100 message IDs per call. After an IMAP move, use the returned newId, when available, or search again.

To prepare a reply, set inReplyTo to the original message ID and provide the body as text. If you omit to, Gatana uses the original message's reply address or sender. If you omit subject, Gatana uses the original subject with a reply prefix. It also sets the reply headers.

Drafts and sent messages support to, cc, and bcc. These tools accept plain-text bodies without outgoing attachments. Use your mail app to send a saved draft. The send_message tool creates and sends a new message; it cannot send a saved draft by ID.

Last updated on

On this page