Skip to main content
Glama
multi-account-google-mcp

multi-account-google-mcp

by taminororo

multi-account-google-mcp

複数の Google アカウント(Gmail / Drive / Calendar)を、1つの MCP サーバーから操作するためのセルフホスト型 MCP サーバー。 OAuth トークンは第三者のサービスに預けず、手元で AES-256-GCM で暗号化して保管する。

  • account: "all" や account: "group:lab" で、全アカウント・グループを横断して検索・予定表示・空き時間検索ができる

  • アカウントごとに読み取り専用にできる(例: 大学のアカウントは読むだけ)

  • 書き込み系(送信・返信・共有・削除など)は、アカウントの明示指定が必須

  • Claude Code(stdio)と Claude.ai のカスタムコネクタ(Streamable HTTP + MCP 認可)の両方に対応

開発中。実際の Google アカウントでの動作確認手順は docs/verification.md、設計は docs/design.md、 Claude.ai 向けの公開手順は docs/deploy.md、セキュリティ方針は SECURITY.md。

必要なもの

  • Node.js 22 以上

  • Google Cloud のプロジェクトと、「デスクトップアプリ」の OAuth クライアント(mymcp oauth setup が手順を表示する)

Related MCP server: google-accounts-mcp

セットアップ(Claude Code)

npm install
npm run build
npm link
  1. データディレクトリと暗号鍵を作る

mymcp init
  1. Google Cloud で作った OAuth クライアントを登録する(手順が表示される)

mymcp oauth setup
  1. アカウントを追加する(ブラウザで Google にサインインする)

mymcp account add work --description "仕事用" --group main
  1. Claude Code に登録する

mymcp connect claude-code

CLI

コマンド

内容

init

データディレクトリと暗号鍵を作る

oauth setup

Google Cloud の OAuth クライアントを登録する

account add ALIAS

アカウントを追加する。--description --group --read-only --gmail-filters

account list

アカウントの一覧と状態(ACTIVE / EXPIRED / REVOKED)

account edit ALIAS

説明・グループ・権限を変える。--permission gmail=write drive=read など

account reauth ALIAS

期限切れのアカウントを再認可する

account remove ALIAS

Google 側でトークンを取り消してから削除する

config show / config set KEY VALUE

default-account / concurrency / timeout-ms

connect claude-code

claude mcp add を実行する(--dry-run で表示のみ)

serve

MCP サーバーを stdio で起動する

serve --http --public-url URL

Claude.ai 用に HTTP で起動する(docs/deploy.md)

http set-password / http revoke-all

HTTP モードのオーナーパスワード設定、接続済みクライアントの全取り消し

ファイルの置き場所

内容

既定の場所

変更する環境変数

アカウント情報と暗号化トークン

~/.config/multi-account-google-mcp/store.json

MAGM_DATA_DIR

HTTP モードの認可状態(クライアント登録・トークンのハッシュ)

~/.config/multi-account-google-mcp/http-auth.json

MAGM_DATA_DIR

暗号鍵

~/.local/share/multi-account-google-mcp/master.key

MAGM_KEY_FILE(または MAGM_ENCRYPTION_KEY に鍵そのもの)

鍵ファイルは store.json とは別にバックアップすること。鍵を失うと、保存したトークンは復号できない(アカウントを追加し直せば復旧できる)。

MCP ツール

account には、エイリアス("work")、"all"、"group:NAME" を渡せる。「横断」の列が ○ のツールだけが "all" とグループに対応する。 書き込み系は単一エイリアスの明示が必須で、そのアカウントのそのサービスが write 権限でなければ拒否する。

サービス

ツール

種別

横断

共通

list_accounts

読み取り

-

Gmail

gmail_search_threads / gmail_list_drafts

読み取り

○

Gmail

gmail_get_thread / gmail_get_message / gmail_list_labels / gmail_download_attachment / gmail_list_filters

読み取り

Gmail

gmail_create_draft / gmail_update_draft / gmail_send_message / gmail_reply / gmail_forward

書き込み

Gmail

gmail_label_thread / gmail_unlabel_thread / gmail_create_label

書き込み

Gmail

gmail_trash_thread / gmail_untrash_thread / gmail_mark_thread_spam / gmail_unmark_thread_spam

書き込み

Gmail

gmail_create_filter / gmail_delete_filter(--gmail-filters で追加したアカウントのみ)

書き込み

Drive

drive_search_files / drive_list_recent_files

読み取り

○

Drive

drive_get_file_metadata / drive_read_file_content

読み取り

Drive

drive_create_file / drive_update_file / drive_copy_file / drive_share_file / drive_trash_file

書き込み

Calendar

calendar_list_calendars / calendar_list_events / calendar_find_free_time

読み取り

○

Calendar

calendar_get_event

読み取り

Calendar

calendar_create_event / calendar_update_event / calendar_delete_event

書き込み

複数アカウントの結果は { results, errors, truncated } の形で返る。results の各項目には account が付き、失敗したアカウントは errors に入る(1つの失敗で全体は失敗しない)。

開発

npm test
npm run typecheck

テストや手元の試験では MAGM_DATA_DIR と MAGM_KEY_FILE で一時ディレクトリを指定し、本物のデータに触れないようにする。

ライセンス

MIT

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      Not graded
      quality
      B
      maintenance
      A multi-account, token-efficient MCP server for Google Workspace services including Gmail, Calendar, Drive, Docs, and Sheets. It enables secure management of multiple accounts with compact data retrieval and keychain-backed authentication for efficient workflow automation.
      4
      MIT
    • F
      license
      Not graded
      quality
      C
      maintenance
      A local MCP server that lets AI assistants access Gmail, Drive, Docs, and Calendar across multiple Google accounts, routing each request by a human-readable account alias. It supports reading, searching, and writing with per-account tagging while keeping OAuth credentials secure and separate.
      -
    • A
      license
      Not graded
      quality
      C
      maintenance
      A self-hosted MCP server that gives an AI client read, search, triage, drafting, attachment/export and label-management access to several Gmail or Google Workspace accounts at once, with each call naming an explicit account. Sending is disabled unless armed twice, mail deletion is impossible, and tokens, exports and audit data stay local.
      MIT