GuidesClaude Code or Codex + Gmail
DocsGuidesHow to give Claude Code or Codex access to Gmail

How to give Claude Code or Codex access to Gmail

Connect Gmail to Claude Code or Codex in three commands: pip install connectonion, co auth google, co skills link. No Google Cloud project; credentials stay on your computer.

Install ConnectOnion, run co auth google to connect your Google account, then run co skills link. That links ConnectOnion's bundled skills, including co-google, into Claude Code and Codex. When you ask either agent about your mail, it can run co gmail inbox, co gmail read and co gmail send from its shell. You don't create a Google Cloud project, and the credentials are saved only on your computer.

1. Install ConnectOnion and sign in

co init creates your identity and signs in to OpenOnion, which the Google connection needs.

pip install connectonion
co init

2. Connect your Google account

Consent runs through OpenOnion's Google app. The credentials come back encrypted to a one-time key your CLI generated. By default it asks for Gmail, Calendar, Drive and YouTube; pass --scopes to ask for less.

co auth google
# Opening Google consent. Credentials will be saved only on this computer.
# Google connected. Actual granted scopes saved locally. Next: co status

This links 30 bundled skills into both agents. co-google routes Google account work to the Gmail, Drive, Calendar and YouTube commands.

co skills link

4. Ask your agent

In Claude Code or Codex, ask something like "summarise my unread Gmail from today". The agent runs co gmail through its normal shell tool, so its usual command-approval settings apply.

5. Check it yourself

Every command the agent runs, you can run too. A row number needs the listing ID that co gmail inbox prints beside the rows.

co gmail inbox --unread
co gmail read 3 --listing <listing-id>
co gmail send alice@example.com "Hello" "Thanks for today."

FAQ

Does this work with Outlook too?

Yes. Run co auth microsoft, then the agent can use co outlook inbox, co outlook read, co outlook send and co outlook calendar.

Where are the Gmail credentials stored?

In your global ~/.co/keys.env by default, on your computer. To keep a project separate, put --env-file /absolute/path/.env before the command.

Can I limit what the agent can access?

Yes. co auth google --scopes takes a comma-separated list of limited scopes instead of the default Gmail, Calendar, Drive and YouTube.

Does it also work with Google Calendar and Drive?

Yes. The same login covers co gcalendar (events and Meet links) and co gdrive (list, search, download, upload).

Do I need a Google Cloud project or OAuth client?

No. The consent runs through OpenOnion's Google app, so there is no cloud project, consent screen or verification review on your side.

Updated 2026-09-26. Commands checked against ConnectOnion 1.8.8.

Star us on GitHub

If ConnectOnion saves you time, a ⭐ goes a long way — and earns you a coffee chat with our founder.