Add multi-account support#5
Conversation
Allow managing multiple Gmail accounts from a single server instance. Each tool accepts an optional `account` parameter; omitting it uses the default account for full backwards compatibility. - Replace singleton OAuth2Client with per-account Gmail client map - Add loadAllAccounts() to discover credentials-*.json files - Add authenticate(accountName) for per-account auth flow - Add `account` param to all 19 existing tool schemas - Add list_accounts tool to show configured accounts - Update README with multi-account usage docs Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
cd7c7ed to
1c542ad
Compare
|
Wouldn't it be better to just add the same mcp multiple times so you can leverage existing enable/disable UI? there is an env var to help you namespace your auth keys via folders. Here's an example of what you can do already: This way, you can leverage existing tool permissions for each account for each mcp. |
|
Thanks for this! I don't use multi-account myself, so I can't properly test or validate this PR. I'd like to get at least one community member who actually uses multiple Gmail accounts to test and review before merging. If anyone reading this uses multi-account Gmail and can test this branch, please report back here. Side note: the |
|
It takes 2 mins to create a gmail account.
…On Sat, 7 Mar 2026 at 20:48, Arty McLabin ***@***.***> wrote:
*ArtyMcLabin* left a comment (ArtyMcLabin/Gmail-MCP-Server#5)
<#5 (comment)>
Thanks for this! I don't use multi-account myself, so I can't properly
test or validate this PR. I'd like to get at least one community member who
actually uses multiple Gmail accounts to test and review before merging.
If anyone reading this uses multi-account Gmail and can test this branch,
please report back here.
Side note: the accountName parameter is used directly in filesystem paths
(credentials-${accountName}.json) — would be good to add a /^[\w-]+$/
validation check to prevent path traversal edge cases.
—
Reply to this email directly, view it on GitHub
<#5 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/BNBT4L5AZKTZWH22HFQT33T4PPV7NAVCNFSM6AAAAACWGEWCPCVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHM2DAMJWGEYTQOJWHA>
.
You are receiving this because you authored the thread.Message ID:
***@***.***>
|
creating an acc is not the problem. in fact i have more google accs already. the problem is that i cannot genchi genbutsu it since i don't need it for my day-to-day flow, so i cannot judge on it's performance correctly. need here someone who actually needs it and can confirm it's useful and functional :] |
Summary
Details
node dist/index.js auth <account-name>to authenticate named accounts~/.gmail-mcp/credentials-<account-name>.jsonaccountparameter; omit for defaultlist_accountstool to see configured accountsThis is a resubmission of GongRzhe/Gmail-MCP-Server#93.
Test plan
node dist/index.js auth work— authenticates a named accountlist_accounts— shows all configured accountssearch_emailswithaccount: "work"— searches the named accountaccountparam (default account, backwards-compatible)🤖 Generated with Claude Code