Skip to content

Gmail API and MCP

Gmail lets applications read, search and manage messages and send email from an authorized user's mailbox. An agent can search mailbox messages, read email and send replies from the connected account. Connect your Gmail account once with OAuth in Longwave; agents act only on that account.

Add to Longwave

Add Gmail to your agent

Paste this into Claude Code or a terminal. Then run /mcp to sign in.

functions
8
access
Connect account
tasks
1

Use Gmail on Longwave

  1. Download Longwave or open app.longwave.run.
  2. Connect your Gmail account once. Agents then act on that account, and only that account.
  3. Ask for the result in any thread, for example: “Find customer emails about a product issue”. The agent picks the Gmail function and calls it.

Use Gmail in Claude Code, Codex, Cursor or ChatGPT

Add the Longwave MCP server once. It carries 2,593 functions across 103 tools, including Gmail, and asks you to sign in on first use.

Why call Gmail through Longwave

  • One sign-in to Gmail, shared by every harness and device you use.
  • One MCP server for 103 tools, so your agent setup does not grow a key and a server per vendor.
  • Spending limits per key and per account, checked before a paid call is made.
  • Each call is recorded with the provider, the cost and the result, and can be read again from another device.

Gmail functions

Functions 5

Function Price
gmail.threads.list gmail.threads.list
See vendor pricing
gmail.threads.get gmail.threads.get
See vendor pricing
gmail.drafts.create gmail.drafts.create
See vendor pricing
gmail.messages.modify gmail.messages.modify
See vendor pricing
gmail.labels.list gmail.labels.list
See vendor pricing

Gmail 3

Every function here: Included within the connected account's API quota or product plan; no separate per-call fee published. Included within the connected account's API quota or product plan; no separate per-call fee published.

Function
List Gmail messages List one bounded page of message IDs from the connected Gmail mailbox. gmail.messages.list
Get a Gmail message Read one parsed message from the connected Gmail mailbox. gmail.messages.get
Send a Gmail message Send a base64url-encoded RFC 2822 message, including recipient headers, from the connected mailbox. gmail.messages.send

Prices are Gmail's published rates. Source: Gmail pricing.

Use cases

Questions people ask

What does Gmail message search return?

The messages.list endpoint returns message IDs and thread IDs. Retrieve an individual message to read its contents. Gmail documentation

What format does Gmail use to send a message?

The API accepts an RFC 2822 message encoded as a base64url string in the raw field. This includes the headers and body of the email. Gmail documentation

How does Longwave access my Gmail account?

You sign in to Gmail once and approve the permissions the functions need. Longwave stores the token encrypted and uses it only for calls you or your agents make. Disconnect it at any time in settings.

How do I use Gmail in Claude Code?

Add the Longwave MCP server once with claude mcp add --transport http longwave https://api.longwave.run/v1/mcp/tasks, sign in, and ask for what you need. Claude finds the right Gmail function and calls it.

Use Gmail in Longwave

Ask any Longwave thread for the result, or add Longwave to Claude Code, Codex, Cursor or ChatGPT.

Add to Longwave