gmail-reader-mcp
Provides read-only Gmail access: list and search emails, fetch single or batched emails and full threads, list labels, and download attachments to disk.
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@gmail-reader-mcp find unread emails from my boss this week"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
gmail-reader-mcp
MCP (Model Context Protocol) server for reading Gmail through the Gmail API. Read-only by design: list, search, and fetch emails and whole threads — single or batched — and download attachments safely to disk.
Tools
Tool | Description |
| Sign in with a Google URL shown directly in the chat; reports current account |
| Revoke access at Google and remove the saved session; cancels any pending sign-in |
| List emails in a label (default |
| Search all mail with Gmail search syntax ( |
| Full content of one email (plain-text body, HTML converted) plus its attachment list |
| Full content of up to 50 emails in one call |
| Every message of a conversation, in order |
| System and user labels with IDs and unread/total counts |
| Attachment part IDs, names, sizes, types, and inline flag for an email |
| Save one attachment to disk |
| Save several (or all) attachments of an email in one call |
Related MCP server: Gmail MCP Server
Setup
1. Create a Google Cloud OAuth client
You need your own OAuth client of type Desktop app with the Gmail API enabled. Using the Gmail API is free; no billing account is required.
Option A — personal mode (recommended). Open Google Cloud's personal mode onboarding (the link preselects a Desktop app client and enables the Google Workspace APIs, Gmail included). Choose Create a new project, give the client a name, accept the User Data Policy, and click Continue. Copy the Client ID and Client secret it shows. The client only works for your own Google account and needs no consent-screen setup, test users, or app verification, so sign-in shows no "unverified app" warning.
Option B — standard project (if you can't use personal mode).
In the Google Cloud console, create a project.
Enable the Gmail API for it.
Open Google Auth Platform and configure it: any app name, your email as support/contact, audience External.
Under Data Access, add the scope
https://www.googleapis.com/auth/gmail.readonly.Under Audience, add your Google account as a test user.
Under Clients, create a client of type Desktop app, and copy its Client ID and Client secret.
Testing mode limits: while a standard project's publishing status is Testing, Google expires refresh tokens after 7 days, so you will be asked to sign in again about once a week (the tools tell the assistant when). Publishing the app removes that limit but requires a homepage, a privacy-policy URL and authorized domains on the Branding page. Standard projects also show a "Google hasn't verified this app" screen at sign-in — choose Continue, since it is your own app.
2. Configure your MCP client
{
"mcpServers": {
"gmail-reader": {
"command": "npx",
"args": ["-y", "gmail-reader-mcp"],
"env": {
"GOOGLE_CLIENT_ID": "your-client-id.apps.googleusercontent.com",
"GOOGLE_CLIENT_SECRET": "your-client-secret"
}
}
}
}Optional: GMAIL_ACCOUNT=you@gmail.com pre-selects that account on the Google sign-in page.
3. First run
Ask your assistant to run the authenticate tool (or just ask it to read your mail — any tool that needs auth will tell it to). The chat shows a Google sign-in URL: open it in a browser on the same machine and grant read-only Gmail access. The browser redirects to a short-lived listener on 127.0.0.1, which completes the sign-in. The session is saved, so this only happens once per machine.
Google's device-code flow does not allow Gmail scopes, so the server uses the loopback flow (authorization code + PKCE) recommended for desktop apps.
Credentials & security
The OAuth client secret is never bundled with the package: you provide it via environment variables. For "Desktop app" clients, Google does not treat it as confidential, but keep it out of version control anyway.
The refresh token is stored in the OS credential store (Windows Credential Manager / macOS Keychain / Linux Secret Service). If none is available it falls back to a permission-restricted file in the per-user app-data directory (
%LOCALAPPDATA%\gmail-reader-mcp,~/Library/Application Support/gmail-reader-mcp, or$XDG_CONFIG_HOME/gmail-reader-mcp) and warns on stderr.The only scope requested is
gmail.readonly; this server cannot send, modify, or delete mail.Attachment filenames are sanitized (path traversal, reserved characters) before writing to disk, and existing files are never overwritten.
sign_outrevokes the token at Google and deletes it locally. You can also revoke access anytime at myaccount.google.com/permissions.
Development
npm install
cp .env.example .env # fill in GOOGLE_CLIENT_ID / GOOGLE_CLIENT_SECRET
npm run mcp # run from source (tsx)
npm run build # compile to dist/
npm run format # prettierLicense
GPL-3.0
Available Tools
11 toolsauthenticateA
Sign in to the Google account used by the other tools. Returns a Google sign-in URL: show it to the user and ask them to open it in a browser on this machine and grant read-only Gmail access. Run this when other tools report that authentication is required. Safe to call anytime — reports the current account if already signed in.
Inputs: no named parameters.
download_attachmentA
Download a specific email attachment and save it to disk. Use list_attachments (or get_email) first to get the part ID. To save several (or all) attachments from an email in one call, use download_attachments instead. Returns the full path where the file was saved.
Inputs: partId (required), messageId (required), saveTo.
download_attachmentsA
Download multiple attachments from an email in a single call and save them to disk. Omit partIds to download all file attachments. Returns the saved path for each file.
Inputs: messageId (required), saveTo, partIds, includeInline.
get_emailA
Get the full content of a specific email by its ID: headers, plain-text body (HTML-only emails are converted to text), and its attachment list. To fetch several emails at once use get_emails; for a whole conversation use get_thread.
Inputs: id (required).
get_emailsA
Get the full content of multiple emails by their IDs in one call (fetched concurrently). Much faster than calling get_email repeatedly. Returns headers, plain-text body, and attachment list for each.
Inputs: ids (required).
get_threadA
Get every message of a Gmail conversation (thread) in chronological order, with full plain-text bodies and attachment lists.
Inputs: threadId (required).
list_attachmentsA
List all attachments of a specific email. Returns each attachment's part ID, name, size, MIME type, and whether it is inline (embedded image/signature). Use download_attachment for one file, or download_attachments to save several (or all) in a single call.
Inputs: messageId (required).
list_emailsA
List emails in a Gmail label (default INBOX), newest first, optionally narrowed with a Gmail search query. Returns IDs, thread IDs, subject, sender, date, unread/attachment flags, and a snippet. Use pageToken to page through results.
Inputs: label, query, pageToken, maxResults.
list_labelsA
List all Gmail labels (system labels like INBOX/SENT and user-created labels) with their IDs and message/unread counts. Use a label ID with list_emails.
Inputs: no named parameters.
search_emailsB
Search all Gmail mail using Gmail search syntax (keywords plus operators like from:, subject:, has:attachment, after:, newer_than:). Searches subject, body, sender, recipients, and attachment names.
Inputs: query (required), pageToken, maxResults, includeSpamTrash.
sign_outA
Sign out of the Google account: revokes this app's access token at Google, removes the saved session from this machine, and cancels any pending sign-in. After this, the authenticate tool must be run again before other tools work.
Inputs: no named parameters.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 11 tools
Most tools are cleanly separated, and the descriptions explicitly cross-reference alternatives (get_email vs get_emails vs get_thread, download_attachment vs download_attachments). The main soft spot is list_emails vs search_emails: list_emails also accepts a Gmail search query, so an agent may hesitate over which to use. That overlap is real but minor, since one is label-scoped paging and the other is global search.
Almost everything follows a consistent snake_case verb_noun pattern (list_emails, get_thread, list_labels, download_attachment). The singular/plural pairs (get_email/get_emails, download_attachment/download_attachments) are systematic rather than confusing. Only the bare verbs authenticate and sign_out break the noun pattern, which is a small deviation.
Eleven tools is well within the ideal range and every one earns its place: two auth lifecycle tools, listing/search/read tools, thread and label inspection, and attachment listing plus single/bulk download. Nothing looks redundant or filler.
For a deliberately read-only Gmail reader the lifecycle is nearly complete: sign-in, sign-out, label discovery, paged listing, search, single/bulk message fetch, threads, and attachment listing plus download. Minor gaps exist (no profile/account info tool, no way to page or list threads directly, attachments only saved to disk), but agents can work around all of these.
Maintenance
Related MCP Connectors
Policy-guarded Gmail for AI agents: search, read, draft and send under rules you set.
Email inboxes for AI agents: read, search, reply, send, bulk send and read attachments.
Give AI agents their own email inboxes: list, read and send mail via scoped, revocable OAuth grants.
Email for AI agents: read, search and send from your Gmail, Outlook, Yahoo, iCloud or IMAP inbox.
Related MCP Servers
- AlicenseNot gradedqualityDmaintenanceEnables LLMs to read, search, and manage emails via IMAP with secure, read-only access to email accounts.6MIT
- AlicenseNot gradedqualityDmaintenanceEnables AI assistants to search, read, and download attachments from Gmail using natural language, with read-only access.2MIT
- AlicenseNot gradedqualityCmaintenanceEnables read-only access to multiple email accounts, including Gmail via App Password and generic IMAP providers, so an agent can list accounts and folders, search messages, and fetch messages or attachments. All operations are strictly read-only, with no sending, writing, deleting, or moving.1MIT
- AlicenseNot gradedqualityBmaintenanceEnables natural-language interaction with Gmail, including reading, searching, drafting, and managing emails, with safety features like read-only mode and bounded reads.Apache 2.0