# Gmail

> Connect a Gmail mailbox to FlyMyAI agents.

Lets an agent work with a Google mailbox: search threads, draft replies,
and manage labels on your behalf.

## What it can do

- Search threads with Gmail query syntax
- Read full threads, including metadata and bodies
- Create drafts and list existing ones
- Create and apply labels to messages or entire threads
- Remove labels

The MCP does **not** send messages automatically - it always stops at a
draft so you can review before sending.

## How to get credentials

Gmail uses Google OAuth - there's no token to copy.

1. In FlyMyAI, open the Gmail MCP and start the setup flow.
2. A Google consent screen opens in a new tab. Sign in with the Google
   account whose mailbox the agent should use.
3. Review the requested scopes - Gmail asks for read, modify, and label
   access. Approve.
4. You're redirected back to FlyMyAI; the tool flips to **Configured**.

To revoke access later, go to
[myaccount.google.com/permissions](https://myaccount.google.com/permissions),
find **FlyMyAI**, and remove it.

## Fields to fill in FlyMyAI

No fields - the OAuth flow stores the tokens automatically. If you need
to switch the mailbox, remove the tool and connect again with the other
account.

## Troubleshooting

- **"This app isn't verified"** - we're on Google's verified list; if you
  see this, make sure you're clicking the FlyMyAI-branded consent screen
  and not a lookalike.
- **Scopes keep reappearing** - your Google admin may have scope
  restrictions. Ask them to allow the listed Gmail scopes for FlyMyAI.
- **`invalid_grant` after a while** - the refresh token was revoked
  (password changed, admin unlinked the app, or 6 months of idle). Remove
  the tool in FlyMyAI and reconnect.

## Links

- [Google account permissions](https://myaccount.google.com/permissions)
- [Gmail API reference](https://developers.google.com/gmail/api/reference/rest)
