gmail-writer
Provides tools to manage Gmail threads, labels, attachments, and search using the Gmail API with full modify scope.
Click on "Install 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-writerarchive the thread about project updates"
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-writer-mcp
A local MCP server that gives Claude working Gmail write operations: because the hosted Gmail MCP's write tools are broken by design.
The bug this fixes
The claude.ai hosted Gmail MCP shows write tools (label_thread,
unlabel_thread, …) but every call fails with "insufficient
authentication scopes". Root cause, found the hard way: the hosted MCP has
a tool cap during OAuth negotiation, and under it it only requests
gmail.readonly: never gmail.modify. The write tools are advertised
but can never work. This server sidesteps the whole path: a local MCP
process with its own Desktop OAuth client requesting the correct scope.
Related MCP server: gmail-multi-mcp
Tools
Tool | Description |
| Add/remove labels on a thread: move, archive, star, mark read/unread |
| Search threads with Gmail query syntax |
| List all labels with IDs |
| Find attachments across messages matching a query (metadata only) |
| Download one attachment by ID |
| Bulk-download every attachment matching a query, foldered per email |
Also included: label-for-deletion.mjs, a standalone script that applies a
review label to inbox junk matching your queries (edit the QUERIES array;
set GMAIL_DELETION_LABEL_ID) so you bulk-delete from the Gmail UI with
one filtered view.
Setup
Requires Node 18+.
In Google Cloud Console: create a project, enable the Gmail API, create a Desktop app OAuth client, and download its
client_secret.json. Note: while the OAuth consent screen is in "Testing" status, Google expires refresh tokens after 7 days. Add yourself as a test user or publish the app to avoid weekly re-authentication.Run the bundled bootstrap to authorise and write
~/.gmail_token.json(scopehttps://www.googleapis.com/auth/gmail.modify, chmod 600):
uv run --with google-auth-oauthlib oauth_bootstrap.py client_secret.json
# or: pip install google-auth-oauthlib && python3 oauth_bootstrap.py client_secret.json The resulting file has the shape
{client_id, client_secret, token, refresh_token, expiry, scopes}: it
is self-contained and the server refreshes it automatically.
3. npm install, then register with Claude Code:
claude mcp add gmail-writer -- node /path/to/gmail-writer-mcp/index.jsnode test.jsruns the non-destructive test suite against your mailbox.
Usage
The attachment tools chain naturally. For example, ask Claude:
Find every invoice PDF from 2026 and save them foldered per email.
and it will use gmail_list_attachments plus gmail_download_all_attachments
to land the files under ~/Downloads/gmail-attachments/, one folder per email.
Security notes
The token file grants mail write access: keep it out of any repo (
chmod 600, never commit). The bootstrap and the server both write it with owner-only permissions, and the server warns at startup if it is readable by anyone else.This server cannot send email. There is no send or draft capability, by design, so a misbehaving session cannot write to anyone on your behalf.
The
gmail.modifyscope does include trashing (adding the TRASH or SPAM label), which effectively deletes mail. Rely on your client's tool-approval prompt before approving modify calls.outputDiron the attachment download tools is model-controlled: review tool calls before approving so downloads land where you expect.The server runs locally and talks only to Google's API; nothing is proxied through third parties.
Built on the official MCP TypeScript SDK and googleapis.
Licence
MIT.
This server cannot be installed
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Related MCP Servers
- AlicenseAqualityAmaintenanceLocal-first Gmail MCP server using PKCE + loopback OAuth flow that stores refresh tokens in the OS keychain, enabling secure read/write Gmail access via MCP tools without tokens leaving the device.20MIT
- AlicenseAqualityCmaintenanceConnect multiple Gmail accounts to any MCP client, enabling search, read, draft, send, label, and organize mail across unlimited accounts with local-only OAuth token storage.22283MIT
- AlicenseNot gradedqualityBmaintenanceA local MCP server that provides Gmail tools (search, read, send, draft, label management) while keeping your emails only between your machine and Google, with no third-party access.MIT
- AlicenseNot gradedqualityCmaintenanceA self-hostable Gmail MCP server that enables Gmail search/read, sending, replies, drafts, labels, and attachment downloads via MCP tools with OAuth authorization. Supports stdio and streamable HTTP transports.MIT
Related MCP Connectors
Read, search, send, organize, draft and schedule email across your inboxes from any MCP client.
Streamable HTTP MCP server for Google Calendar and Sheets with OAuth login.
Self-hosted federated MCP gateway: one OAuth 2.1 MCP server in front of N apps, user-level scopes.
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/haniabdemai/gmail-writer-mcp'
If you have feedback or need assistance with the MCP directory API, please join our Discord server