Skip to main content
Glama
zacco16

Gmail MCP Server

by zacco16

Gmail MCP サーバー

Gmail API 統合用のモデル コンテキスト プロトコル (MCP) サーバー実装。AI アシスタントが Gmail サービスと対話できるようになります。

特徴

コア機能

  • メール操作

    • 高度なフィルタリングでメールをリストする

    • 特定のメールを全文で読む

    • 新しいメールを作成して送信する

  • ドラフト管理

    • 新しい下書きを作成する

    • 既存の下書きを一覧表示する

    • 下書きコンテンツを読む

    • 下書きコンテンツと受信者を更新する

    • 下書きを削除する

  • カレンダー操作

    • 今後のカレンダーイベントを一覧表示する

    • 詳細なイベント情報を読む

    • 新しいカレンダーイベントを作成する

    • イベントのフィルタリングと検索

    • タイムゾーンのサポート

    • iOSカレンダー同期のサポート

検索とフィルタリング

  • Gmail 検索クエリのサポート

  • ラベルベースのフィルタリング

  • カスタマイズ可能な結果制限

  • カレンダーイベント検索機能

安全

  • Google OAuth2.0統合

  • 安全な資格情報管理

  • リフレッシュトークンの処理

  • マルチスコープ認証のサポート

Related MCP server: Enhanced Gmail MCP Server

クイックスタート

前提条件

  • Node.js (v14以上)

  • npm (v6以上)

  • Gmail とカレンダー API が有効になっている Google Cloud Platform アカウント

  • 適切なスコープを持つ OAuth 2.0 認証情報

インストール

  1. 依存関係をクローンしてインストールします。

    git clone [repository-url]
    cd gmail-mcp-server
    npm install
  2. 環境を構成する:

    # Create .env file
    cp .env.example .env
    
    # Add your credentials:
    GOOGLE_CLIENT_ID="your_client_id"
    GOOGLE_CLIENT_SECRET="your_client_secret"
    REDIRECT_URI="http://localhost:4100/code"
    GOOGLE_REFRESH_TOKEN="your_refresh_token"
  3. ビルドして実行:

    npm run build
    npm start

発達

利用可能なスクリプト

  • npm run dev - ウォッチモードでビルドして実行する

  • npm run build - プロジェクトをビルドする

  • npm run clean - ビルド成果物をクリーンアップする

  • npm run watch - 変更を監視する

プロジェクト構造

gmail-mcp-server/
├── src/
│   ├── config/         # Configuration and setup
│   ├── services/       # Core business logic
│   │   ├── gmail/      # Gmail services
│   │   └── calendar/   # Calendar services
│   ├── tools/          # MCP tool implementations
│   │   ├── calendar/   # Calendar tools
│   │   ├── drafts/     # Draft management tools
│   │   └── messages/   # Email tools
│   ├── types/          # TypeScript definitions
│   └── index.ts        # Server entry point
├── dist/              # Compiled JavaScript
└── tests/             # Test files (pending)

APIインターフェース

メッセージの一覧

listEmails({
  maxResults?: number,    // Default: 10
  query?: string,         // Gmail search query
  labelIds?: string[],    // Filter by labels
  verbose?: boolean       // Include details
})

メッセージを読む

readEmail({
  messageId: string    // Message ID to fetch
})

ドラフト運営

// List Drafts
listDrafts({
  maxResults?: number,    // Default: 10
  query?: string,         // Search query
  verbose?: boolean       // Include details
})

// Read Draft
readDraft({
  draftId: string        // Draft ID to fetch
})

// Create Draft
draftEmail({
  to: string[],
  subject: string,
  body: string,
  cc?: string[],
  bcc?: string[],
  isHtml?: boolean
})

// Update Draft
updateDraft({
  draftId: string,       // Draft ID to update
  to?: string[],         // New recipients
  cc?: string[],         // New CC recipients
  bcc?: string[],         // New BCC recipients
  subject?: string,      // New subject
  body?: string,         // New body content
  isHtml?: boolean       // Content type flag
})

// Delete Draft
deleteDraft({
  draftId: string        // Draft ID to delete
})

メールを送信

sendEmail({
  to: string[],
  subject: string,
  body: string,
  cc?: string[],
  bcc?: string[],
  isHtml?: boolean,
  draftId?: string    // Optional: send existing draft
})

カレンダー操作

// List Events
listEvents({
  maxResults?: number,    // Default: 25
  timeMin?: string,       // Start time (ISO 8601)
  timeMax?: string,       // End time (ISO 8601)
  query?: string,         // Text search term
  timeZone?: string      // Default: Australia/Brisbane
})

// Read Event Details
readEvent({
  eventId: string,       // Event ID to fetch details
  timeZone?: string     // Default: Australia/Brisbane
})

// Create Event
createEvent({
  summary: string,       // Event title
  start: {
    dateTime: string,    // ISO 8601 start time
    timeZone?: string    // Start time timezone
  },
  end: {
    dateTime: string,    // ISO 8601 end time
    timeZone?: string    // End time timezone
  },
  description?: string,  // Optional event description
  location?: string,     // Optional event location
  attendees?: Array<{    // Optional attendees
    email: string,
    displayName?: string,
    optional?: boolean
  }>,
  status?: 'confirmed' | 'tentative' | 'cancelled',
  sendNotifications?: boolean
})

エラー処理

サーバーは、以下に対する包括的なエラー処理を実装します。

  • 認証失敗

  • API レート制限

  • 無効なリクエスト

  • ネットワークの問題

  • カレンダーの同期の問題

  • イベントIDの検証

  • タイムゾーンの検証

貢献

ガイドラインについてはCONTRIBUTING.mdをご覧ください。

変更履歴

バージョン履歴と更新については、 CHANGELOG.md を参照してください。

ロードマップ

計画されている機能と改善についてはBacklog.md を参照してください。

ライセンス

MIT ライセンス - 詳細についてはライセンスを参照してください。

-
security - not tested
F
license - not found
-
quality - not tested

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/zacco16/gmail-mcp-server'

If you have feedback or need assistance with the MCP directory API, please join our Discord server