mcpField
G
gmail

gmail

github.com/the-focus-ai生産性5119 回インストール15 週間前に更新
リポジトリ

gmail について

TypeScriptのコマンドラインスクリプトでGmailのメールとGoogle Calendarの予定を扱うClaude向けスキルです。メール検索・読み書きに加え、予定の操作やMarkdownからの装飾メール作成に対応します。

主な機能

  1. 01Gmailの検索・一覧・読み書き
  2. 02カレンダーの一覧と予定の管理
  3. 03MarkdownからHTMLメールを作成
  4. 04Google OAuthによる認証
  5. 05コマンド結果をJSONで出力

活用シーン

  1. 01未読メールや送信者別のメールを検索
  2. 02コマンドラインでメールを読む・送る
  3. 03今後のカレンダー予定を確認
  4. 04Markdown形式の装飾メールを送信

インストール

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

$npx skills add https://github.com/the-focus-ai/google-skill --skill gmail

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

同梱ファイル

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

references/
api-patterns.md
setup-guide.md
scripts/
gmail.ts

詳細

Gmail & Calendar スキル

Gmail のメールを読んだり、送信したり、検索したりできます。カレンダーの予定を一覧表示、作成、削除できます。

初回セットアップ

npx tsx ${CLAUDE_PLUGIN_ROOT}/skills/gmail/scripts/gmail.ts auth を実行して、Google 認証を行います。OAuth の同意画面を表示するため、ブラウザーが開きます。

トークンはプロジェクトごとに .claude/google-skill.local.json に保存されます。

独自の認証情報を使用する(任意)

デフォルトでは、このスキルは埋め込みの OAuth 認証情報を使用します。代わりに独自の Google Cloud プロジェクトの認証情報を使用するには、次の手順を実行します。

  1. Google Cloud プロジェクトを作成し、必要な API(Gmail、Calendar、Sheets、Docs、YouTube、Drive)を有効にします
  2. OAuth 2.0 認証情報を作成します(デスクトップアプリタイプ)
  3. JSON をダウンロードし、~/.config/google-skill/credentials.json に保存します

このファイルが存在する場合、スキルは自動的にその認証情報を使用します。

Gmail コマンド

# List messages
npx tsx ${CLAUDE_PLUGIN_ROOT}/skills/gmail/scripts/gmail.ts list
npx tsx ${CLAUDE_PLUGIN_ROOT}/skills/gmail/scripts/gmail.ts list --query="is:unread" --max=5

# Read message
npx tsx ${CLAUDE_PLUGIN_ROOT}/skills/gmail/scripts/gmail.ts read <message-id>

# Send email (plain text)
npx tsx ${CLAUDE_PLUGIN_ROOT}/skills/gmail/scripts/gmail.ts send \
  --to="[email protected]" \
  --subject="Hello" \
  --body="Message content"

# Send HTML email
npx tsx ${CLAUDE_PLUGIN_ROOT}/skills/gmail/scripts/gmail.ts send \
  --to="[email protected]" \
  --subject="Hello" \
  --body="Plain text fallback" \
  --html="<h1>Hello</h1><p>HTML content</p>"

# Send with attachments
npx tsx ${CLAUDE_PLUGIN_ROOT}/skills/gmail/scripts/gmail.ts send \
  --to="[email protected]" \
  --subject="With files" \
  --body="See attached" \
  --attachment="/path/to/file.pdf,/path/to/other.docx"

# Send HTML with inline images
npx tsx ${CLAUDE_PLUGIN_ROOT}/skills/gmail/scripts/gmail.ts send \
  --to="[email protected]" \
  --subject="Newsletter" \
  --body="Plain text version" \
  --html="<h1>Hello</h1><img src='cid:logo'>" \
  --inline="/path/to/logo.png:logo"

# Labels
npx tsx ${CLAUDE_PLUGIN_ROOT}/skills/gmail/scripts/gmail.ts labels
npx tsx ${CLAUDE_PLUGIN_ROOT}/skills/gmail/scripts/gmail.ts label <id> --add="IMPORTANT"

# Download as EML
npx tsx ${CLAUDE_PLUGIN_ROOT}/skills/gmail/scripts/gmail.ts download <message-id>

# Send markdown as styled HTML email (Focus.AI branding)
npx tsx ${CLAUDE_PLUGIN_ROOT}/skills/gmail/scripts/gmail.ts send-md \
  --to="[email protected]" \
  --file="/path/to/report.md" \
  --style=client  # or "labs" for Focus.AI Labs style

# Subject defaults to first H1 in markdown, or specify explicitly:
npx tsx ${CLAUDE_PLUGIN_ROOT}/skills/gmail/scripts/gmail.ts send-md \
  --to="[email protected]" \
  --file="report.md" \
  --style=labs \
  --subject="Weekly Report"

# Create as draft instead of sending:
npx tsx ${CLAUDE_PLUGIN_ROOT}/skills/gmail/scripts/gmail.ts send-md \
  --to="[email protected]" \
  --file="report.md" \
  --draft

# Create a draft email (plain text or HTML)
npx tsx ${CLAUDE_PLUGIN_ROOT}/skills/gmail/scripts/gmail.ts draft \
  --to="[email protected]" \
  --subject="Draft Subject" \
  --body="Draft content"

# Create HTML draft with attachments
npx tsx ${CLAUDE_PLUGIN_ROOT}/skills/gmail/scripts/gmail.ts draft \
  --to="[email protected]" \
  --subject="Draft with files" \
  --body="Plain text fallback" \
  --html="<h1>Hello</h1>" \
  --attachment="/path/to/file.pdf"

スタイル付きメールテンプレート

send-md コマンドは、Focus.AI のブランドガイドラインに沿って Markdown を美しくスタイル設定された HTML メールに変換します。

  • client(デフォルト):ティールのアクセント、控えめな境界線、角丸を使ったプロフェッショナルなスタイル
  • labs:黒い境界線、ボックスシャドウ、大文字のヘッダーを使った大胆で実験的なスタイル

対応要素:見出し、太字/斜体、リンク、コードブロック、表、リスト、引用、水平線。

カレンダーコマンド

# List calendars
npx tsx ${CLAUDE_PLUGIN_ROOT}/skills/gmail/scripts/gmail.ts calendars

# List upcoming events
npx tsx ${CLAUDE_PLUGIN_ROOT}/skills/gmail/scripts/gmail.ts events
npx tsx ${CLAUDE_PLUGIN_ROOT}/skills/gmail/scripts/gmail.ts events --max=20

# Get event details
npx tsx ${CLAUDE_PLUGIN_ROOT}/skills/gmail/scripts/gmail.ts event <event-id>

# Create event
npx tsx ${CLAUDE_PLUGIN_ROOT}/skills/gmail/scripts/gmail.ts create \
  --summary="Meeting" \
  --start="2026-01-15T10:00:00" \
  --end="2026-01-15T11:00:00" \
  --location="Conference Room" \
  --description="Discuss project"

# Delete event
npx tsx ${CLAUDE_PLUGIN_ROOT}/skills/gmail/scripts/gmail.ts delete <event-id>

検索演算子(Gmail)

演算子例説明
from:from:[email protected]送信者
to:to:[email protected]宛先
subject:subject:meeting件名に含まれる語句
is:unreadis:unread未読のみ
has:attachmenthas:attachment添付ファイルあり
newer_than:newer_than:7dN 日以内
label:label:workラベルあり

出力

すべてのコマンドは、success フィールドと data フィールドを含む JSON を返します。

認証状態の確認

npx tsx ${CLAUDE_PLUGIN_ROOT}/skills/gmail/scripts/gmail.ts check

ヘルプ

npx tsx ${CLAUDE_PLUGIN_ROOT}/skills/gmail/scripts/gmail.ts --help

コメント