mcpField
G
gmail

gmail

github.com/blink-new生産性181 回インストール
リポジトリ

gmail について

gmail は、Gmail のメールを管理する Node.js 製コマンドラインスクリプト群です。複数の名前付きアカウントに対応し、検索、閲覧、送信、下書き、ラベル操作を行えます。

主な機能

  1. 01複数アカウントの連携と管理
  2. 02Gmail 検索構文によるメール検索
  3. 03メールやスレッドの閲覧
  4. 04添付ファイル付き送信と返信
  5. 05下書きの作成、送信、削除
  6. 06ラベルとメール状態の管理

活用シーン

  1. 01未読メールや添付メールの検索
  2. 02スレッドを読んで返信を作成
  3. 03コマンドラインから添付メールを送信
  4. 04メールのアーカイブやラベル変更

インストール

コマンドをコピーしてターミナルで実行します。

$npx skills add https://github.com/blink-new/claude --skill gmail

インストール後、Claude Code で/gmailを入力して読み込まれたか確認します。

同梱ファイル

SKILL.md と一緒にインストールされる参考資料やスクリプト。

.gitignore
package.json
scripts/
_client.mjs
_mime.mjs
accounts.mjs
auth.mjs
draft.mjs
label.mjs
list.mjs
read.mjs
reply.mjs
search.mjs
send.mjs

詳細

Gmail

すべてのスクリプトは ~/.cursor/skills/gmail/scripts/ にあります。どこからでも実行できます。

アカウント管理

# List linked accounts
node accounts.mjs --list

# Link an account (runs browser OAuth flow)
node accounts.mjs --link                      # links as "default"
node accounts.mjs --link --account=work       # links as named account

# Unlink an account
node accounts.mjs --unlink --account=work

アカウントの保存先:

~/.cursor/skills/gmail/
├── credentials.json              # shared OAuth2 client (one for all accounts)
└── accounts/
    ├── default/
    │   ├── token.json            # access + refresh tokens  ← SENSITIVE
    │   └── profile.json          # cached email address
    └── work/
        ├── token.json
        └── profile.json

すべてのスクリプトは --account=<name> を受け付けます(デフォルト:default)

初回セットアップ

# 1. Get credentials.json from Google Cloud Console:
#    console.cloud.google.com → Gmail API → Credentials → OAuth Client ID → Desktop App → Download JSON
mv ~/Downloads/client_secret_*.json ~/.cursor/skills/gmail/credentials.json

# 2. Link your first account
node ~/.cursor/skills/gmail/scripts/accounts.mjs --link

スクリプト

list.mjs
node list.mjs [--account=work] [--max=50] [--label=UNREAD] [--next-page=<token>]
search.mjs
node search.mjs --query="from:stripe" [--account=work] [--max=20] [--next-page=<token>]
# Gmail query syntax: from: to: subject: is:unread has:attachment after:2026/03/01
read.mjs
node read.mjs --id=<messageId> [--account=work]          # single message
node read.mjs --id=<threadId> --thread [--account=work]  # full thread
node read.mjs --id=<messageId> --raw                     # show raw HTML
reply.mjs
node reply.mjs --message-id=<id> --body="Text" [--account=work]
node reply.mjs --message-id=<id> --html="<b>Hi</b>"
node reply.mjs --message-id=<id> --body="Hi" --cc="[email protected]" --bcc="[email protected]"
node reply.mjs --message-id=<id> --body="See attached" --attachments="/path/a.pdf"
send.mjs
node send.mjs --to="[email protected]" --subject="Hi" --body="Text" [--account=work]
node send.mjs --to="[email protected]" --subject="Hi" --html="<h1>Hello</h1>"
node send.mjs --to="[email protected]" --subject="Hi" --body="Hi" --cc="[email protected]" --bcc="[email protected]"
node send.mjs --to="[email protected]" --subject="Files" --body="See attached" --attachments="/path/a.pdf,/path/b.png"
label.mjs
node label.mjs --list [--account=work]
node label.mjs --id=<messageId> --mark-read [--account=work]
node label.mjs --id=<messageId> --mark-unread
node label.mjs --id=<messageId> --archive
node label.mjs --id=<messageId> --trash
node label.mjs --id=<messageId> --star / --unstar
node label.mjs --id=<messageId> --add-label=IMPORTANT
node label.mjs --id=<messageId> --remove-label=SPAM
draft.mjs
node draft.mjs --list [--account=work]
node draft.mjs --create --to="[email protected]" --subject="Hi" --body="Text"
node draft.mjs --create --reply-to=<messageId> --body="Reply"   # To: auto-filled
node draft.mjs --read --id=<draftId>
node draft.mjs --send --id=<draftId>
node draft.mjs --delete --id=<draftId>

不正利用の報告ワークフロー

node search.mjs --query="from:namecheap subject:abuse"
node read.mjs --id=<messageId> --thread
node reply.mjs --message-id=<id> --body="Dear Namecheap Legal & Abuse Team,

Thank you for your message regarding ticket <TICKET-ID>.

We have completed our investigation and taken the following actions:

1. The account in question has been permanently suspended.
2. The reported URL (hxxp:// <PROJECT-ID> [.] sites [.] blink [.] new/) has been deactivated and now returns an HTTP 410 response.
3. All content and deployments associated with this account have been removed.

Our platform has a strict Acceptable Use Policy and we act promptly on all reports.
The blink.new domain is fully compliant with your Terms of Service.

Please let us know if anything further is needed to close this case.

Best regards,
Kai Feng
CEO, Blink.new
[email protected]"

クラウドのセットアップ

echo "GMAIL_CREDENTIALS=$(base64 -i ~/.cursor/skills/gmail/credentials.json)"
echo "GMAIL_TOKEN=$(base64 -i ~/.cursor/skills/gmail/accounts/default/token.json)"

クラウドコンテナのシークレットとして設定してください。スクリプトはファイルより環境変数を優先して自動検出します(デフォルトアカウントのみ)。

セキュリティ

  • credentials.json と token.json ファイルは gitignore 対象です。マシンの外に持ち出さないでください。
  • アクセスを取り消すには、https://myaccount.google.com/permissions → アプリを見つける →[アクセス権を取り消す]

コメント