단일 연결을 통해 여러 Gmail 계정의 이메일을 읽고, 검색하고, 초안을 작성하고, 라벨을 지정할 수 있도록 AI 클라이언트에 기능을 제공합니다.
다른 이름 cunicopia-dev/gmail-mcp, gmail-mcp, multi-account-gmail-mcp
- 스타
- 6
- Tools
- 18
- 다운로드, 30일
- 403
- 최신 버전
- 0.3.0
- 마지막 커밋
- 2026년 11월 2일
- 라이선스
- MIT
Multi-Account Gmail MCP란?
Multi-Account Gmail은(는) MCP server입니다. 단일 연결을 통해 여러 Gmail 계정의 이메일을 읽고, 검색하고, 초안을 작성하고, 라벨을 지정할 수 있도록 AI 클라이언트에 기능을 제공합니다. 18개 도구를 제공합니다. 예: list_accounts, search_messages, read_message.
프로젝트 README에서 생성된 요약
Multi-Account Gmail MCP server 정보
이 MCP server를 사용하면 단일 AI 인터페이스에서 여러 Gmail 받은 편지함을 관리할 수 있습니다. 연결당 하나의 계정만 허용하는 일반적인 통합 방식과 달리, 이 도구는 단일 Google Cloud client를 사용하여 원하는 만큼의 계정을 인증할 수 있습니다. 로컬 SQLite 데이터베이스 내에서 인증 토큰을 관리하는 로컬 stdio server로 작동하므로, 사용자가 자격 증명에 대한 완전한 소유권을 유지할 수 있습니다.
개발자는 특정 도구를 사용하여 메시지 읽기, 스레드 검색, 라벨 관리 및 초안 작성을 수행할 수 있습니다. 독특한 기능은 단일 쿼리로 인증된 모든 계정을 동시에 훑어볼 수 있는 능력입니다. 높은 보안 수준을 유지하기 위해, 이 server는 이메일을 자율적으로 발송하는 대신 초안을 작성하도록 설계되었습니다. 또한 세분화된 OAuth scope를 사용하여 읽기, 작성, 수정과 같은 필수 기능으로 액세스를 제한하며, 이메일 발송이나 전달 설정 변경 권한은 명시적으로 제외합니다.
활용 사례
- 1통합 받은 편지함 검색연결된 모든 Gmail 계정에서 특정 송장을 한 번에 검색합니다.
- 2이메일 초안 작성 자동화특정 메시지 스레드에 대한 답장을 생성하고, 수동 검토를 위해 초안으로 저장합니다.
프로젝트의 README를 바탕으로 작성되었습니다. 모든 활용 사례는 해당 내용의 인용문과 대조하여 확인합니다.
Multi-Account Gmail MCP 설치 방법
형식 확인: 2026년 11월 10일Cursor에 추가Goose에 추가Claude Code에 Multi-Account Gmail MCP 설치
$ claude mcp add gmail-mcp -- uvx multi-account-gmail-mcpCursor에 Multi-Account Gmail MCP 설치
~/.cursor/mcp.json
{
"mcpServers": {
"gmail-mcp": {
"command": "uvx",
"args": [
"multi-account-gmail-mcp"
]
}
}
}VS Code에 Multi-Account Gmail MCP 설치
.vscode/mcp.json
{
"servers": {
"gmail-mcp": {
"type": "stdio",
"command": "uvx",
"args": [
"multi-account-gmail-mcp"
]
}
}
}VS Code CLI에 Multi-Account Gmail MCP 설치
$ code --add-mcp '{"name":"gmail-mcp","type":"stdio","command":"uvx","args":["multi-account-gmail-mcp"]}'Claude Desktop에 Multi-Account Gmail MCP 설치
claude_desktop_config.json
{
"mcpServers": {
"gmail-mcp": {
"command": "uvx",
"args": [
"multi-account-gmail-mcp"
]
}
}
}Codex에 Multi-Account Gmail MCP 설치
$ codex mcp add gmail-mcp -- uvx multi-account-gmail-mcpCodex config.toml에 Multi-Account Gmail MCP 설치
~/.codex/config.toml
[mcp_servers.gmail-mcp] command = "uvx" args = ["multi-account-gmail-mcp"]
Gemini CLI에 Multi-Account Gmail MCP 설치
$ gemini mcp add -s user gmail-mcp uvx -- multi-account-gmail-mcpGemini settings.json에 Multi-Account Gmail MCP 설치
~/.gemini/settings.json
{
"mcpServers": {
"gmail-mcp": {
"command": "uvx",
"args": [
"multi-account-gmail-mcp"
]
}
}
}Multi-Account Gmail MCP 도구 18
README에서 감지됨list_accountssearch_messagesread_messageread_threaddownload_attachmentssearch_all_accountscreate_draftlist_draftslist_labelscreate_labelmodify_labelstrash
| list_accounts | — | |
| search_messages | — | |
| read_message | — | |
| read_thread | — | |
| download_attachments | — | |
| search_all_accounts | — | |
| create_draft | — | |
| list_drafts | — | |
| list_labels | — | |
| create_label | — | |
| modify_labels | — | |
| trash | — |
도구 18개 모두 보기도구 수 줄이기
bulk_actionread_messagescount_messageslist_filterscreate_filterdelete_filter
| bulk_action | — | |
| read_messages | — | |
| count_messages | — | |
| list_filters | — | |
| create_filter | — | |
| delete_filter | — |
구성
GMAIL_MCP_CLIENT_SECRETPath to the Google OAuth "Desktop app" client-secret JSON. Defaults to ~/.gmail-mcp/client_secret.json.
GMAIL_MCP_DBPath to the SQLite token store holding per-account refresh tokens. Defaults to ~/.gmail-mcp/tokens.db.
GMAIL_MCP_OAUTH_PORTLocalhost port for the OAuth redirect during account authorization. Defaults to 8765.
| 이름 | 설명 | 유형 |
|---|---|---|
| GMAIL_MCP_CLIENT_SECRET | Path to the Google OAuth "Desktop app" client-secret JSON. Defaults to ~/.gmail-mcp/client_secret.json. | |
| GMAIL_MCP_DB | Path to the SQLite token store holding per-account refresh tokens. Defaults to ~/.gmail-mcp/tokens.db. | |
| GMAIL_MCP_OAUTH_PORT | Localhost port for the OAuth redirect during account authorization. Defaults to 8765. |
자동 검사
2026년 11월 12일에 실행됨전체 보고서 →자동 검사를 통과했습니다. 이는 보안 감사가 아닙니다. 코드를 직접 읽고 서버에 필요한 최소한의 권한만 부여하십시오. 검사 방식
- 소스 저장소 연결 및 접근 가능통과
- 오픈 소스 라이선스 (OSI)통과
- 최근 1년 내 커밋 또는 릴리스통과
- 패키지 이름이 인기 패키지와 유사하지 않음통과
- 원격 엔드포인트가 HTTPS 사용검사되지 않음
- 파괴적인 도구에 라벨 표시됨검사되지 않음
- 모델에 대한 숨겨진 지침 없음통과
- 패키지 및 해당 종속성에 중요한 보안 권고 없음통과
README
GitHub에서 보기gmail-mcp
An MCP server that reads across all your Gmail accounts from one connection.
Most Gmail integrations — including the native connectors — bind a single
account per OAuth grant: connect a second inbox and you disconnect the first.
gmail-mcp keeps any number of accounts authorized at once. One Google Cloud
client authorizes them all, each lands as a row in a local SQLite file, and every
tool takes an account argument that routes to the right mailbox.
search_all_accounts sweeps all of them in a single query.
Python 3.12+ · MIT · stdio MCP server + auth CLI · local SQLite token store
It's built to be owned completely: runs in-process over stdio, stores tokens in one SQLite file you can inspect, copy, or delete, talks only to Google and your MCP client, and hardcodes no secrets.
It reads, searches, drafts, and labels. It doesn't send — create_draft leaves
a draft for you to send yourself. That's a deliberate default (reasoning in
Security model), not a hard stance; if you want autonomous
send, it's a small addition or a different server.
Contents
- The idea in 30 seconds
- Design notes
- Tools
- Architecture
- Identity & auth model
- Security model
- Install
- Quickstart
- Configuration
- Register with an MCP client
- Development
- Project layout
- License
The idea in 30 seconds
Authorize N accounts once via the CLI. Then every tool takes an account, and
search_all_accounts hits all of them at once:
search_all_accounts(query="invoice newer_than:30d")
── personal@gmail.com ───────────────────────────────
from: billing@acme.com subject: Invoice #4821 (id 18f...)
── work@company.com ─────────────────────────────────
from: ap@vendor.io subject: March invoice (id 19a...)
One query, every inbox, each result tagged with its account and carrying the
message id — so the agent can chain read_message(account, id) or
create_draft(...) next.
Design notes
One OAuth client, many inboxes. A single Google Cloud project and one
client_secret.json authorize every account. Adding the tenth inbox is the same
one-command flow as the first.
Boring storage. Tokens live in one SQLite file under ~/.gmail-mcp/. No
daemon, no keyring dependency, no cloud. Back it up by copying it; revoke an
account by deleting a row; inspect it with any SQLite tool.
Least privilege. Four granular scopes — gmail.readonly, gmail.compose,
gmail.modify, gmail.settings.basic — never the full-mailbox
https://mail.google.com/. It can read, draft, label, and manage filters; it
never sends mail, and filters it creates can't forward mail off-account.
Headless-friendly. The auth flow assumes the server may have no browser: it prints a consent URL, binds a fixed port, and you SSH-forward the redirect. Works fine on a desktop too.
Tools
Every tool except list_accounts and search_all_accounts takes an account
(the email address). Unknown accounts return an error listing the authorized ones.
| Tool | Arguments | Returns |
|---|---|---|
list_accounts |
— | Authorized accounts + last-used time. Discover valid account values. |
search_messages |
account, query, max_results=20 |
Message summaries (Gmail search syntax) with ids. |
read_message |
account, message_id, format="full", max_body_chars? |
Decoded headers, plaintext body (HTML stripped if needed), attachment metadata. Body capped by default; pass max_body_chars=0 for the full body. |
read_thread |
account, thread_id, max_body_chars? |
Every message in the thread, in order. Each body capped by default; max_body_chars=0 for full. |
download_attachments |
account, message_id, index? |
Save a message's attachments to disk and return absolute paths. Address them by the #N shown in read_message; omit index for all of them. Fixed download root, no destination argument. Dangerous file types and anything on a spam-labeled message are refused. |
search_all_accounts |
query, max_results_per_account=10 |
One search across every account, each result tagged by account. |
create_draft |
account, body, to?, subject?, cc?, bcc?, html=false, reply_to_message_id?, reply_all=false, from_addr? |
A draft (not sent). Returns the draft id. With reply_to_message_id the draft is a reply inside that message's thread: recipient, subject, In-Reply-To, References and the thread id come from it, and to/subject become optional overrides. Without it, to and subject are required. from_addr sets the From header for a verified send-as alias; it defaults to the account address. |
list_drafts |
account, max_results=20 |
Draft ids in the account. |
list_labels |
account |
The account's labels (name + id). |
create_label |
account, name |
Create a user label (nest with /). Idempotent: an existing name (case-insensitive) returns its id and creates nothing. |
modify_labels |
account, selection (message_id | message_ids | query), add?, remove? |
Add/remove labels on a selection (one id, a list, or everything a query matches), batched 1000/call. General mutator: archive = remove INBOX, mark-read = remove UNREAD, star = add STARRED. |
trash |
account, selection (message_id | message_ids | query) |
Move a selection to Trash (recoverable 30 days; not permanent delete). Refuses an empty selection. |
bulk_action |
account, action, selection (message_id | message_ids | query) |
Friendly verb layer over modify_labels. action ∈ archive/unarchive/mark_read/mark_unread/star/unstar/spam/unspam/trash/untrash. Batched 1000/call; refuses an empty selection. |
read_messages |
account, message_ids | query, max_results=25 |
Batch-read full content of many messages in one call (vs. N read_message calls). |
count_messages |
query, account?, all_accounts=false |
Count matches without fetching content — blast-radius check before a bulk action. all_accounts gives a per-account breakdown + total. |
list_filters |
account |
The account's filters: id, criteria, actions (label ids shown as names). |
create_filter |
account, one of from_address/to_address/subject/query/has_attachment, plus an action (archive/mark_read/delete/star or add_labels/remove_labels) |
A server-side rule applied to incoming mail. Can't forward off-account. |
delete_filter |
account, filter_id |
Remove a filter by id (leaves already-acted-on mail alone). |
Architecture
flowchart TD
subgraph client[Your machine]
Agent[MCP client / agent]
CLI[gmail-mcp-auth CLI]
Server[gmail-mcp stdio server]
Store[("SQLite<br/>~/.gmail-mcp/tokens.db")]
Secret["client_secret.json<br/>one OAuth client"]
end
Google[Google OAuth + Gmail API]
CLI -->|"loopback OAuth, once per account"| Google
CLI -->|"store refresh token"| Store
Secret -.-> CLI
Agent -->|"tool call (account=...)"| Server
Server -->|"look up + refresh creds"| Store
Secret -.-> Server
Server -->|"read / draft / label"| Google
Server --> Agent
Authorization happens once per account through the CLI (it needs a browser). After that the stdio server reads tokens straight from SQLite, refreshing access tokens on demand and persisting them back. The rest of this section is the "why it works the way it does" detail.
Identity & auth model
How gmail-mcp authenticates to Gmail, juggles multiple accounts under a single
OAuth client, refreshes tokens over time, and authorizes accounts on a headless
server. If you just want to get running, jump to Quickstart.
The OAuth model
gmail-mcp authenticates using a Google "Desktop app" OAuth client (an
installed application in OAuth 2.0 terms), driven by the InstalledAppFlow
helper from google-auth-oauthlib.
Why an installed-app / desktop client. Installed apps run on a machine the
end user controls, so OAuth treats them as public clients: the client_secret
in the downloaded client_secret.json is not assumed to be confidential.
That's the right trust model for a local CLI/desktop tool — there's no
server-side component that could keep a secret truly secret, and security rests
on the user controlling the redirect (the loopback address) rather than on secret
confidentiality. It's the client type Google recommends for command-line and
desktop tools.
The loopback redirect flow. After you approve consent in a browser, Google
redirects the authorization code to http://localhost:<port>/, where a tiny
throwaway HTTP server (started by InstalledAppFlow.run_local_server) catches
it. gmail-mcp pins this to a fixed port (default 8765, override with
GMAIL_MCP_OAUTH_PORT) and runs with open_browser=False so it works on
machines with no browser — see The headless auth path.
Scopes requested. Four granular scopes — never the full-mailbox
https://mail.google.com/:
| Scope | What it grants |
|---|---|
gmail.readonly |
Read mail and metadata: search messages/threads, read bodies, list labels and drafts. Read-only — cannot modify anything. |
gmail.compose |
Create, update, and manage drafts. Used only by create_draft. |
gmail.modify |
Add/remove labels on messages and create labels. Used by modify_labels, bulk_action, trash and create_label. |
gmail.settings.basic |
List, create, and delete filters. Used by list_filters/create_filter/delete_filter. Does not grant forwarding-address changes (that's gmail.settings.sharing, not requested). |
gmail.send is not requested. Without it the credential simply has no Gmail API
path to send mail — the drafts-only behavior is a property of the grant, not just
an omitted tool. gmail.settings.sharing is likewise not requested, so no filter
can forward mail to another address. The scope list lives in one place: SCOPES
in src/gmail_mcp/config.py.
Adding the filter scope to an existing install: widening
SCOPESdoes not retro-grant already-authorized accounts. Each account must re-rungmail-mcp-auth addto re-consent to the new scope; until it does, the filter tools return a403 insufficient scopeerror.
The multi-account model
- One OAuth client authorizes many accounts. You create a single Google
Cloud project and one "Desktop app" OAuth client, then run the consent flow
once per Gmail account, signing into the account you want to add each time. A
single
client_secret.jsoncan authorize any number of accounts. - Each account is a row in SQLite. Every authorized account is stored in the
accountstable (~/.gmail-mcp/tokens.db, override withGMAIL_MCP_DB), keyed by email. The row holds the long-lived refresh token, the most recent access-token blob, the granted scopes, and timestamps. - Tool calls route by the
accountparam. Every tool exceptlist_accountsandsearch_all_accountstakes anaccount. The server looks that email up, builds a credential for it, and calls the Gmail API as that account. Unknown accounts return a clear error listing what's authorized.search_all_accountsiterates over every stored row.
flowchart LR
Client[MCP client / agent] -->|"account=a@x.com"| Server[gmail_mcp.server]
Server --> Store[("accounts table<br/>keyed by email")]
Store -->|"row a@x.com"| CredsA[Credentials a]
Store -->|"row b@y.com"| CredsB[Credentials b]
CredsA --> InboxA["Gmail: a@x.com"]
CredsB --> InboxB["Gmail: b@y.com"]
Secret["client_secret.json<br/>one OAuth client"] -.->|"shared by all rows"| CredsA
Secret -.-> CredsB
Token lifecycle
Initial grant (one-time, per account, via the CLI). The OAuth flow needs a
browser, which an MCP tool can't drive cleanly, so authorization lives in the
gmail-mcp-auth CLI rather than as a tool.
sequenceDiagram
actor User
participant CLI as gmail-mcp-auth add
participant Browser
participant Google as Google OAuth + Gmail API
participant Store as SQLite token store
User->>CLI: run `gmail-mcp-auth add`
CLI->>CLI: load client_secret.json,<br/>start loopback server on :8765
CLI-->>User: print consent URL (open_browser=False)
User->>Browser: open URL, sign into target account
Browser->>Google: consent + approve scopes
Google-->>Browser: redirect with authorization code
Browser->>CLI: GET http://localhost:8765/?code=...
CLI->>Google: exchange code for tokens
Google-->>CLI: access token + refresh token
CLI->>Google: users.getProfile (discover email)
Google-->>CLI: emailAddress
CLI->>Store: upsert(email, refresh_token, token, scopes)
CLI-->>User: "Authorized and stored: you@gmail.com"
- The CLI passes
prompt="consent"to force a refresh token to be issued — Google only returns one on a fresh consent. The CLI errors clearly if no refresh token comes back (revoke the app at https://myaccount.google.com/permissions and re-run). - The account's email is discovered, not typed: after the token exchange the
CLI calls
users.getProfileand keys the stored row by the returned address.
Per-request refresh (every tool call). Access tokens are short-lived (≈1
hour). On each call the server rebuilds a credential for the target account, lets
google-auth refresh it on demand, and persists the refreshed blob back.
sequenceDiagram
participant Client as MCP client / agent
participant Server as gmail_mcp.server
participant Store as SQLite token store
participant Google as Google OAuth + Gmail API
Client->>Server: tool call (account=you@gmail.com)
Server->>Store: get(account) → refresh_token + last token
Server->>Server: build Credentials
alt access token still valid
Server->>Google: Gmail API request
else access token expired
Server->>Google: refresh using refresh_token
Google-->>Server: new access token
Server->>Store: update_token(account, new blob)
Server->>Google: Gmail API request
end
Google-->>Server: response
Server->>Store: touch(account) → last_used_at
Server-->>Client: result (email content wrapped as untrusted)
If a refresh fails (revoked grant, expired refresh token), the server raises
GmailAuthError with a "re-run gmail-mcp-auth add" message rather than crashing.
Testing vs. Published — the 7-day gotcha. This is the usual "it stopped working after a week" surprise:
- While the OAuth consent screen is in Testing mode, only listed test
users can authorize, and refresh tokens issued to an unverified app
expire after 7 days — you'd re-run
gmail-mcp-auth addweekly. - Publishing the app (consent screen → Publish app) makes refresh tokens long-lived. Google will warn it's "unverified" — expected and fine for a self-hosted personal tool you don't distribute. For long-lived use, publish. SETUP.md has the exact clicks.
The headless auth path
The typical target is a headless server (no desktop, no browser), but OAuth consent has to happen in a browser. The flow bridges that:
-
open_browser=False— the CLI prints the consent URL instead of launching a browser. You open it on your own laptop, signed into the account you're adding. -
Fixed loopback port — after approval Google redirects to
http://localhost:<port>/. That "localhost" is the server's loopback, where the CLI listens. The port is fixed (default8765,GMAIL_MCP_OAUTH_PORT) so you can forward it deterministically. -
SSH port-forward — bridge your laptop's browser to the server's loopback:
ssh -L 8765:localhost:8765 you@your-serverNow when the redirect hits
localhost:8765on your laptop, SSH tunnels it to the server, where the CLI catches the code and finishes the exchange.
Security model
An inbox is full of text other people wrote, so it's a natural place for prompt injection. The standard framing is the lethal trifecta — injection is dangerous when an agent has all three of:
flowchart LR
A[Private data<br/>your mailboxes] --- C{Injection<br/>risk}
B[Untrusted content<br/>any email you receive] --- C
D[Egress channel<br/>a way to send data out] --- C
C -.->|drafts-only removes the obvious one| D
style D stroke-dasharray: 5 5
A mail reader has the first two by nature. A couple of choices keep the third low-stakes:
-
Drafts instead of send.
create_draftis the outgoing ceiling — there's no send tool and nogmail.sendscope. A draft sits in your drafts folder until you send it, so an instruction buried in an email can't make the agent mail your data anywhere. Sensible default, easy to change if you want send. -
Email content is marked as untrusted. Message text the tools return is wrapped in
⟦UNTRUSTED EMAIL CONTENT⟧delimiters by a single helper (wrap_untrustedingmail.py), with ids kept outside so tool-chaining still works. The read tools also note in their descriptions that content is data, not instructions. Multi-message responses (search results, threads, cross-account sweeps) emit the fence once around the whole content blob — not once per message — and key each body to a trusted#Nid manifest that sits outside the fence. This both cuts delimiter token overhead and keeps real ids exclusively in the trusted region, so an attacker can't smuggle a forged id into a place the agent treats as authoritative. -
Attachments land in one fixed place, and some never land at all.
download_attachmentswrites only under~/.gmail-mcp/attachments/<message_id>/(GMAIL_MCP_ATTACHMENT_DIR). There is deliberately no destination argument, because one would be an arbitrary-file-write primitive that an instruction buried in an email could aim at~/.zshrc. Filenames are attacker-chosen, so they are reduced to inert ASCII basenames (path separators dropped, leading dots stripped, bidi overrides removed, length capped, index-prefixed), and the resolved path is re-checked against the root before the write. Files are written owner-only, withO_NOFOLLOWso a pre-planted symlink can't redirect them.Screening happens before any bytes are fetched. It refuses every file type Gmail itself blocks in transit (
.exe,.jar,.js,.vbs,.iso,.py, ~50 more), macro-enabled Office documents, executable MIME types, and every attachment on a message Gmail labeledSPAM. All of a filename's dot-suffixes are checked, not just the last, soinvoice.pdf.exeis caught. Archives are saved but flagged, since nothing here can look inside one.This is a type screen, not a virus scan. Gmail scans attachments server-side but does not expose the verdict through its API. There is no malware field on the message or attachment resource, and
attachments.getwill serve bytes the Gmail web UI refuses to let you download. A clean verdict here means "not an obvious weapon," never "scanned and safe." The saved file's contents remain untrusted third-party data.
Known limitation. This only governs this server's surface. If the same
agent session also has a tool that can reach the open internet (web fetch, HTTP),
that's a separate egress path gmail-mcp can't do anything about — pairing it
with an arbitrary-egress tool re-opens the trifecta elsewhere. Be deliberate
about which tools share a session.
Two more notes: no audit log is implemented (intentionally out of scope), and no
secrets are hardcoded — client_id/client_secret come from your downloaded
client_secret.json, and tokens live only in your local SQLite store.
Install
Requires Python 3.12+. The PyPI distribution is multi-account-gmail-mcp
(the bare gmail-mcp name is taken); it installs the gmail-mcp and
gmail-mcp-auth commands.
# From PyPI
pip install multi-account-gmail-mcp
# or, to get the commands on PATH globally:
uv tool install multi-account-gmail-mcp # or: pipx install multi-account-gmail-mcp
# or run without installing:
uvx multi-account-gmail-mcp
From source (for development):
git clone https://github.com/cunicopia-dev/gmail-mcp.git
cd gmail-mcp
python -m venv .venv && source .venv/bin/activate
pip install -e . # add ".[dev]" for ruff + pytest
This installs two console scripts: gmail-mcp (the stdio server) and
gmail-mcp-auth (the account-authorization CLI).
Quickstart
You need a Google "Desktop app" OAuth client (client_secret.json) and one
authorization per account. The full click-by-click — creating the Google Cloud
project, enabling the Gmail API, publishing the consent screen, and the headless
SSH-forward step — is in docs/SETUP.md. The short version:
# 1. Drop your downloaded OAuth client here:
mkdir -p ~/.gmail-mcp && mv ~/Downloads/client_secret_*.json ~/.gmail-mcp/client_secret.json
# 2. Authorize an account (prints a URL to open in a browser; repeat per account).
# On a headless server, SSH in with -L 8765:localhost:8765 first.
gmail-mcp-auth add
# 3. Confirm what's authorized.
gmail-mcp-auth list
# 4. Point your MCP client at the `gmail-mcp` command (see below).
Remove an account later with gmail-mcp-auth remove you@gmail.com.
Configuration
All optional — sane defaults under ~/.gmail-mcp/.
| Variable | Default | Purpose |
|---|---|---|
GMAIL_MCP_DB |
~/.gmail-mcp/tokens.db |
SQLite token store path. |
GMAIL_MCP_CLIENT_SECRET |
~/.gmail-mcp/client_secret.json |
Downloaded Google OAuth client. |
GMAIL_MCP_OAUTH_PORT |
8765 |
Fixed loopback port for the auth flow (forward this over SSH on a headless box). |
GMAIL_MCP_ATTACHMENT_DIR |
~/.gmail-mcp/attachments |
Download root for download_attachments. Files land in a per-message subdirectory. This is the only location the server writes to. |
GMAIL_MCP_MAX_ATTACHMENT_BYTES |
26214400 (25 MB) |
Per-attachment size ceiling. Gmail's own limit is 25 MB, so this refuses nothing Gmail would deliver. 0 (or negative) means unlimited. |
GMAIL_MCP_MAX_BODY_CHARS |
500 |
Default per-message body cap for read_message/read_thread. Deliberately tight so reads are cheap by default; 0 (or negative) means unlimited, and a per-call max_body_chars argument overrides it. |
Multi-Account Gmail MCP 질문
Multi-Account Gmail MCP를 Claude Code에 추가하려면 어떻게 하나요?
터미널에서 claude mcp add gmail-mcp -- uvx multi-account-gmail-mcp를 실행합니다. 모든 프로젝트에서 사용할 수 있게 하려면 --scope user를 추가합니다.
Multi-Account Gmail MCP를 Cursor에 추가하려면 어떻게 하나요?
~/.cursor/mcp.json를 열고 mcpServers 아래에 서버를 추가합니다. 위 설치 섹션에 표시된 Cursor 구성을 사용합니다.
Multi-Account Gmail MCP는 어떤 도구를 제공하나요?
18개 도구를 제공합니다. 예: list_accounts, search_messages, read_message, read_thread, download_attachments.
이 MCP server가 이메일을 자동으로 발송할 수 있나요?
아니요, 보안을 위해 이메일을 직접 발송하는 대신 초안을 작성하도록 설계되었습니다.
여러 Gmail 계정을 어떻게 관리하나요?
단일 Google Cloud client를 사용하여 여러 계정을 인증하며, 토큰은 로컬 SQLite 데이터베이스에 저장합니다.
모든 받은 편지함을 한 번에 검색할 수 있나요?
네, search_all_accounts 도구를 사용하면 인증된 모든 계정을 대상으로 단일 쿼리를 실행할 수 있습니다.
인증을 위해 브라우저가 필요한가요?
SSH 포워딩을 위한 동의 URL을 제공하여 브라우저가 없는 환경에서도 작동하는 headless 인증 경로를 지원합니다.