qs-gmail
Provides tools for managing multiple Gmail accounts, including searching and reading messages, listing labels, archiving, marking read/unread, sending messages, creating and deleting drafts, and managing account tokens.
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., "@qs-gmailsearch my exhibition account for unread emails from 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.
qs-gmail
複数の Gmail アカウントを 1 つのサーバーでまとめて扱う MCP サーバー。 アカウントを「識別子」で引けるので、AI エージェントから業務用メールボックスを横断的に検索・操作できる。
Model Context Protocol (MCP) server that manages multiple Gmail accounts under a single stdio server. Local, zero API cost.
実際のインサイドセールス業務で運用しているツール。展示会後の追客メール対応など、個人メールとは別の業務用アカウントをエージェントから扱うために作った。
なぜ作ったか
既製の Gmail コネクタは基本「1 ユーザー = 1 アカウント」前提。業務では用途別の共有メールボックスを複数扱いたいが、それを 1 つのエージェントから区別して操作する手段がなかった。 → 複数アカウントを 1 DB・1 サーバーで識別子管理する Gmail MCP を実装した。
Related MCP server: Gmail MCP Server
設計のポイント
マルチアカウントを識別子で抽象化 —
exhibitionのような識別子でアカウントを引く。トークンはnode:sqliteの 1 DB に集約し、アカウント追加は CLI 一発loopback OAuth で認証 — デスクトップアプリ型 OAuth クライアントを使い、ブラウザ承認 → ループバックでトークンを受け取って永続化。リフレッシュ時は自動で再保存
認証情報は env もファイルも両対応 —
QS_GMAIL_CLIENT_ID/SECRETがあれば優先、無ければ GCloud からダウンロードしたclient_secretJSON を読む。鍵はリポジトリ外に置く設計副作用ツールを明示分離 — 検索・読取は安全側、送信やアーカイブなど副作用のあるものは別ツールとして切り出し、誤爆しにくくしている
MCP ツール
ツール | 役割 |
| 登録済みアカウント一覧 |
| 検索(query / 差出人ドメイン / 期間 / 未読のみ / 件数) |
| 本文取得 |
| ラベル一覧 |
| アーカイブ(INBOX 除去) |
| 既読 / 未読 |
| 送信(副作用・要確認) |
| 下書き作成(返信スレッド連結対応・署名は手動付与) |
send_message / create_draft は本文と添付に加えてインライン画像を扱える。
html: true… 本文をtext/htmlで送る(リンクをクリック可能にする)attachments: ["/abs/path.pdf", …]…multipart/mixedで添付(拡張子から MIME 判定・日本語ファイル名可)inlineImages: [{ path: "/abs/logo.png", cid: "qslogo" }]…multipart/relatedで本文に埋め込む。本文側は<img src="cid:qslogo">と書く。cid省略時は拡張子を除いたファイル名。添付と併用するとmixed[ related[ html, 画像 ], 添付 ]の入れ子になる
| list_drafts | 下書き一覧(draftId +宛先 / 件名 / snippet) |
| delete_draft | 下書きを完全削除(副作用・要確認) |
| remove_account | トークン削除 |
スタック
Node.js (ESM) / @modelcontextprotocol/sdk / googleapis / node:sqlite
セットアップ
npm install
# GCloud でデスクトップアプリ型 OAuth クライアントを作成し、
# client_secret JSON を ~/.gmail-mcp-credentials.json に置く
# (または QS_GMAIL_CLIENT_ID / QS_GMAIL_CLIENT_SECRET を設定。.env.example 参照)
node authorize.js <識別子> # 例: node authorize.js work
# → ブラウザで承認するとトークンが DB に保存されるMCP ホスト(Claude Code 等)には stdio サーバーとして登録する。
個人で開発した MCP サーバー群の 1 つ。
This server cannot be deployed
Maintenance
Related MCP Connectors
Email infrastructure for AI agents — send, receive, search, and reply to email over MCP.
Manage Gmail end-to-end: search, read, send, draft, label, and organize threads. Automate workflow…
Email inboxes and calendars for AI agents: send, receive, search, draft and schedule.
Email inboxes and calendars for AI agents: send, receive, search, draft and schedule.
Related MCP Servers
- AlicenseNot gradedqualityDmaintenanceEnables interaction with Gmail through the Gmail API to read, send, and manage emails. Supports multiple Gmail accounts with real-time monitoring and advanced features for email search and attachment handling.17Apache 2.0
- AlicenseNot gradedqualityDmaintenanceEnables AI assistants to read, search, organize, and draft emails in Gmail inboxes with support for multiple accounts, OAuth authentication, and 26 comprehensive tools for email management.105 npm3MIT
- AlicenseBqualityCmaintenanceEnables AI assistants to manage multiple Gmail accounts simultaneously with built-in OAuth authentication, supporting email reading, sending, drafts, labels, and account management.6057 npm4MIT
- FlicenseAqualityBmaintenanceConnects AI assistants to multiple Gmail accounts simultaneously, enabling search, read, draft, send, and reply operations with per-account permission controls.54-