Skip to main content
GmailVFS browses labels, messages, and attachments via the Gmail API. Both runtimes share the same OAuth config: a Google Cloud clientId / clientSecret plus a long-lived refreshToken for the user. Setup steps live at Google Workspace Credentials.

Node

Browser

For OAuth in a browser, prefer PKCE so secrets stay off the page; the Google setup guide shows the flow.

Config

Fields marked secret are redacted in snapshots.

VFS.md

The VFS.md an agent reads with Gmail mounted at /<path>.

Virtual Filesystem

VFS Layout

/<path>
  • <label> is a Gmail label: INBOX, SENT, DRAFT, IMPORTANT, STARRED, TRASH, SPAM or any user label.
  • <yyyy-mm-dd> is the date the message was received. Listing one (ls /<path>/INBOX/2026-05-03/) pushes after:/before: into the Gmail query, much cheaper than scanning the whole label.
  • <subject> is sanitized: ls the date directory rather than construct it. <message-id> is the Gmail message id.
  • The email body is in the .gmail.json file; read it with cat, head or jq, keeping the suffix. The sibling directory, the same name without the extension, holds attachments only: cat one to download its bytes. grep -r over a date directory skips these binary files.
  • A grep or rg hit names the .gmail.json file, not the attachments directory. To list a message’s attachments, ls its path with .gmail.json stripped; ENOENT means it has none: ls /<path>/INBOX/2026-05-03/<subject>__<message-id>/
A .gmail.json is processed by Mirage, not the raw Gmail API response:
Useful jq paths:
To act on messages (read by id, triage, raw API calls), use the gws CLI if installed (gws gmail --help).

Supported Unix Commands for VFS

Unix commands work on each path as on a local filesystem, as far as the path supports them:

Limitations of Unix Commands for VFS

Where a path differs from a local filesystem:Run man <cmd> or <cmd> --help for one command’s usage.

Integration

What Gmail answers through its own API, so fewer files are read. Integration explains each command. The Python Gmail docs list when each search answers and what it can miss.

Mount mode

read. For the mounted layout (labels, dates, attachments) see the Python Gmail docs.