gmail-mcp
gmail-mcp v1.0.0
Gmail向けの統合マルチアカウントGoogle OAuth2 MCPサーバー。 複数のGoogleアカウントをまたいで、メールの検索、閲覧、作成、送信、下書き、整理をシームレスに行えます。
機能(統合ツール4種)
gmail_search: 公式のGmail検索構文でメールを検索(is:unread、from:boss@corp.com、subject:invoice、newer_than:2d、has:attachment)gmail_read: メールの本文とメタデータ(件名、送信者、テキスト本文、HTML、CC、BCC、ラベル、添付ファイル一覧)を閲覧gmail_send: メールの送信または下書き作成(HTML、CC、BCC、スレッド返信、ファイル添付に対応)gmail_manage: ラベル付け、アーカイブ、ゴミ箱管理、既読/未読の切り替え、完全削除、マルチアカウントの一覧表示
Related MCP server: Moist
マルチアカウント構成
単一のGoogle Cloud OAuthクライアント(credentials.json)で複数のGmailアカウントを認証できます。
トークンはアカウントごとに~/.secrets/gmail/tokens/<account_name>.jsonに保存されます。
1. Google OAuth認証情報の設定(初回のみ)
Google Cloud Consoleでプロジェクトを作成する。
Gmail APIを有効にする。
OAuth 2.0 クライアントID(デスクトップアプリケーション)を作成する。
クライアントシークレットのJSONファイルをダウンロードし、
~/.secrets/gmail/credentials.jsonとして保存する(またはGMAIL_CREDENTIALS_JSONを設定する)。
2. アカウントの認証
各アカウントで対話式の認証CLIを実行します:
gmail-auth default # Authenticates primary account
gmail-auth work # Authenticates secondary work account
gmail-auth client_x # Authenticates any additional account認証済みの全アカウントを一覧表示:
gmail-auth --listMCPクライアントへのインストール(Claude Desktop、OpenCode、Cursor、Windsurf)
オプション1: uvxによる即時導入(推奨)
{
"mcpServers": {
"gmail": {
"command": "uvx",
"args": ["--from", "git+https://github.com/Steph-ux/gmail-mcp.git", "gmail-mcp"]
}
}
}オプション2: pip installによる導入
pip install git+https://github.com/Steph-ux/gmail-mcp.gitその後、MCP設定ファイルに以下を追加:
{
"mcpServers": {
"gmail": {
"command": "gmail-mcp"
}
}
}オプション3: ローカルクローン(開発用)
{
"mcpServers": {
"gmail": {
"command": "python",
"args": ["D:\\Steph\\script\\gmail-mcp\\server.py"]
}
}
}使用例
1. メールの検索
# Search in default account:
gmail_search(query='is:unread from:github')
# Search in work account:
gmail_search(account='work', query='subject:invoice newer_than:7d')2. メールの閲覧
gmail_read(account='work', message_id='18f2a9b4c10d')3. メールの送信または下書き作成
# Send direct email:
gmail_send(
account='default',
to='colleague@example.com',
subject='Project Update',
body_text='Here is the latest status...',
body_html='<h1>Project Update</h1><p>Here is the latest status...</p>'
)
# Create a draft:
gmail_send(
account='work',
to='client@example.com',
subject='Proposal draft',
body_text='Please review the proposal.',
draft=True
)4. 整理と管理
# Archive email:
gmail_manage(account='work', action='archive', message_id='18f2a9b4c10d')
# Mark as unread:
gmail_manage(account='default', action='mark_unread', message_id='18f2a9b4c10d')
# Move to trash:
gmail_manage(account='default', action='trash', message_id='18f2a9b4c10d')
# List active accounts:
gmail_manage(action='list_accounts')テスト
pytest testsライセンス
MIT
This server cannot be deployed
Maintenance
Related MCP Connectors
Email infrastructure for AI agents — send, receive, search, and reply to email over MCP.
A MCP server for Gmail that lets you search, read, and draft emails and replies.
Email inboxes for AI agents: send, receive, reply, search, and manage threaded email over MCP.
Hosted email MCP for your own Gmail, Outlook.com, Microsoft 365, iCloud or IMAP inbox: read, search, draft, reply in thread, forward and file mail. It moves or flags up to 500 messages in one call, and a send leaves exactly one copy in Sent. A calendar is a separate connection, and connecting one adds diary and scheduling tools.
Related MCP Servers
- AlicenseNot gradedqualityDmaintenanceEnables interaction with Gmail through the MCP protocol, supporting sending, reading, searching, replying, forwarding, managing drafts and labels, and saving attachments.12 npm3MIT
- AlicenseNot gradedqualityDmaintenanceEnables Gmail operations such as reading, sending, searching, and managing emails, threads, labels, and drafts via MCP tools.1MIT
- FlicenseNot gradedqualityDmaintenanceEnables searching, reading, and drafting emails across multiple Gmail accounts through a single MCP server.-
- FlicenseNot gradedqualityDmaintenanceEnables reading, searching, sending, and drafting Gmail emails via MCP tools, with support for multiple accounts and background notifications.-