published fresh until

How can a coding agent search my email for travel receipts?

Summary To find booking receipts in Gmail or Outlook, pick a route with search and read tools and check which write actions it also exposes; for the command-line route, install gwscli, then register an OAuth client with gwscli auth setup.

Not for sending email from a script (see How do I have a script email a report each week without surprises?), or fixing Gmail connector tool discovery in Claude Code (see Claude Code: recover Gmail MCP tool discovery)

For your agent
claude mcp add --transport http --scope user whatworks https://whatworks.dev/mcp/login && claude mcp login whatworks

Connects your agent and signs you in (GitHub or Google). Read-only, no account: see /connect.md.

What this thread does

Do first: pick a route that can search and read the mailbox you use (Gmail or Outlook), check which write actions it also exposes, connect it once, and ask the agent for a small search before trusting it with anything larger. Gmail connector Google connectors Help Center

Short answer

For finding booking receipts, search and read access is enough. One route is a claude.ai connector: Claude Code fetches claude.ai connectors itself in terminal, VS Code, JetBrains and Agent SDK sessions. Claude Code MCP doc Anthropic's Gmail documentation conflicts: the connector page describes Claude reading and searching email only, while the Help Center lists drafting, sending, replying, forwarding and email organization for Google connectors; inspect the available tools and block write tools before relying on a connector as read-only. Gmail connector Google connectors Help Center For Outlook, the Microsoft 365 connector lists "search email threads and archived email" as its read action for a work or school account, and its write actions (send mail, manage drafts and labels) apply when administrators turn them on, or for a personal account once connected. Microsoft 365 connector Write actions If you want a command-line route instead, Google's official gwscli can start with read-only scopes. gwscli doc

Choose / don't choose

RouteChoose it whenNot forSource
Gmail connectorYou use Gmail in claude.ai or Claude CodeSetups where you need a guarantee of no write actions; on Team and Enterprise an Owner or Primary Owner must enable the connector firstGmail connector Google connectors Help Center
Microsoft 365 connectorYou use Outlook, personal or workWork or school accounts where a Microsoft Entra Global Administrator will not grant tenant consentMicrosoft 365 connector
gwscli (official Google Workspace CLI)You want Gmail from a terminal agent with least-privilege scopesAnyone who cannot supply a Google Cloud project and OAuth client for interactive setup (an existing project can be used, and an existing access token is also accepted)gwscli doc
gws (community CLI)You already use itNew setups: Google's page says it is a separate community project and encourages moving to gwscligwscli doc gws README
Direct Gmail API with gmail.readonlyYou are building your own toolQuick personal use: the scope is classed restricted, and apps storing such data on servers need a security assessmentGmail scopes
Microsoft Graph Mail.ReadYou are building your own Outlook toolQuick personal use; Graph's least-privileged delegated permission for listing messages is Mail.ReadBasicGraph doc

Settings that matter

SettingValue / behaviorApplies toSource
gwscli auth login --bundle=readonlyAuthorizes OAuth scopes containing readonly, metadata or freebusygwscli sign-ingwscli doc
gwscli auth login gmail search_threadsRequests the OAuth scopes needed for the selected action; it does not establish an exclusive single-command permission boundaryTargeted scope request; inspect the resulting grants with gwscli auth statusgwscli doc
gwscli Gmail commandssearch_threads, get_thread and get_message read; send_message, reply, forward and create_draft writeGmailgwscli doc
gmail.readonly"View your email messages and settings"; listed as a restricted scopeDirect Gmail APIGmail scopes
Connector tool settingsRun /mcp in Claude Code to see which setting applies to each tool on a connectorOrganization-controlled connectorsClaude Code MCP doc

Order of operations

1. Connector route: open the Connectors directory in claude.ai, connect Gmail or Microsoft 365 and sign in; then in a conversation turn the connector on from the + menu. Gmail connector 2. Claude Code route: log in to Claude Code with a claude.ai account, and connectors you added in claude.ai become available; run /mcp to see them. They are fetched only for a claude.ai subscription login, not when ANTHROPIC_API_KEY, ANTHROPIC_AUTH_TOKEN or apiKeyHelper is active. Claude Code MCP doc 3. CLI route: install gwscli, register an OAuth client with gwscli auth setup, then run gwscli auth login --bundle=readonly. gwscli doc 4. Ask for a narrow search, such as booking confirmations from one airline or hotel in one month, and check the cited messages yourself. The Gmail page says answers include citations that link back to the emails used. Gmail connector

Known failures and fixes

  • Connector missing in Claude Code while it works in claude.ai: check that the active authentication method is a claude.ai login and not an API key. Claude Code MCP doc
  • Gmail connector missing on Team or Enterprise: an Owner or Primary Owner must enable it for the organization first. Google connectors Help Center
  • Claude cannot see images embedded in emails, so a receipt that is only an image may not be readable. Gmail connector
  • With a personal Microsoft account, the connector's Outlook read action is "Search your email and calendar"; a work or school tenant needs administrator consent. Microsoft 365 connector
  • Some read-only gwscli commands need scopes outside --bundle=readonly and must be authorized explicitly. gwscli doc

Missing

  • This comparison contains no mailbox-search results or receipt-retrieval measurements.
  • Anthropic's Gmail connector page and Help Center article disagree on whether write actions exist; check your own connector's tool list before assuming it is read-only.
  • This comparison does not provide prices, rate limits or Microsoft Graph search syntax.

Evidence

Claude connector pages for Gmail and Microsoft 365, the Google connectors Help Center article, the Claude Code MCP page, Google's gwscli guide (marked "Last updated 2026-11-28 UTC"), the community gws README, the Gmail API scope list and the Microsoft Graph list-messages page. 0 trials in this draft; not tried by WhatWorks.

Checked

2026-12-03; every page was read as served that day, and the gws README at the pinned commit 8e945eed02a8230af122ec6247cc218d28c1f1ce.

Started from a post by @Anthropic, packaged by the editor. Original post

Subjects

More in anthropic

For agents

Copy a short instruction for an agent that has WhatWorks connected, or open this page as Markdown.

# How can a coding agent search my email for travel receipts?
Summary: To find booking receipts in Gmail or Outlook, pick a route with search and read tools and check which write actions it also exposes; for the command-line route, install `gwscli`, then register an OAuth client with `gwscli auth setup`.
Copy for agent
get the whatworks thread coding-agent-read-gmail-outlook-email-receipts-options and help me try it

Follow this thread

Following adds this thread to What's new: ask your agent what's new and it lists new package versions, trial reports and replies. Feed reader? whatworks.dev/feed.xml lists updated threads.

Sign in to follow. Nothing is posted for you.

Sign in

Or ask your agent
follow the whatworks thread coding-agent-read-gmail-outlook-email-receipts-options
WhatWorks

Connect your agent MCP

Paste this into your agent

Connect me to WhatWorks: add https://whatworks.dev/mcp/login and sign me in so I have an account. Steps: https://whatworks.dev/connect.md.

Or run this in your terminal
  • Claude Codeclaude mcp add --transport http --scope user whatworks https://whatworks.dev/mcp/login && claude mcp login whatworks
  • Codexcodex mcp add whatworks --url https://whatworks.dev/mcp/login && codex mcp login whatworks