Skip to main content
Glama

@developer.k/ms-graph-mcp

Microsoft Graph と Microsoft 365 向けのモジュール式 Model Context Protocol サーバーです。

委任されたデバイスコード認証を使用し、Teams、Outlook メール、カレンダー、Microsoft To Do、連絡先、メールボックス設定、Outlook カテゴリのツールを公開します。

GitHub リポジトリ | npm パッケージ

リリースノートとアップグレード要件については、変更履歴 を参照してください。

機能

モジュール

機能

Graph

デバイスコード認証、認証状態、サインイン済みプロファイル

Teams

Teams、チャネル、チャネルメッセージ、チャット、チャットメンバー、自分宛てチャットメッセージ

Mail

フォルダー、メッセージ検索、添付ファイル、下書き、送信/返信/転送、フラグ、カテゴリ、移動/削除、受信トレイルール

Calendar

カレンダー、日付範囲のイベント表示、イベント、オンライン会議、招待、空き時間/予定あり、会議候補

To Do

タスクリスト、タスク、繰り返し、リマインダー、完了、チェックリスト項目、リンクされたリソース

Contacts

連絡先フォルダーと連絡先(一般的な個人用およびビジネス用フィールドを含む)

Outlook

メールボックス設定、勤務時間、自動応答、マスターカテゴリ

Related MCP server: M365 Graph MCP Server

要件

  • Node.js 18 以降

  • パブリッククライアントフローが有効な Microsoft Entra アプリ登録

  • 使用するモジュールに必要な委任された Microsoft Graph アクセス許可

  • Mail、Calendar、Contacts、メールボックス設定用の Exchange Online または Outlook.com メールボックス

  • Teams チャットおよびチャネル API 用に Teams を含む Microsoft 365 または Office 365 ライセンス

calendar_get_schedule と calendar_find_meeting_times は、職場または学校アカウント向けであり、個人用 Microsoft アカウントではサポートされていません。

個人用 Outlook.com アカウントの場合は、個人用 Microsoft アカウントをサポートするアプリを登録し、MS_TENANT_ID を common に設定します。

スクリーンショットベースの Microsoft Graph API セットアップガイド に従って、アプリの登録、アクセス許可の追加、パブリッククライアントフローの有効化を行ってください。

委任されたアクセス許可

デフォルトのスコープセットは、含まれるすべてのモジュールに必要なアクセス許可を要求します。

モジュール

アクセス許可

Core

User.Read, offline_access

Teams

Team.ReadBasic.All, Channel.ReadBasic.All, ChannelMessage.Read.All, ChannelMessage.Send, Chat.Read, ChatMessage.Send

Mail

Mail.ReadWrite, Mail.Send

Calendar

Calendars.ReadWrite, Calendars.ReadWrite.Shared

To Do

Tasks.ReadWrite

Contacts

Contacts.ReadWrite

Outlook 設定、カテゴリ、ルール

MailboxSettings.ReadWrite

一部のテナントポリシーでは、管理者の同意が必要です。選択したモジュールのみが必要な場合は、MS_GRAPH_SCOPES を使用してより小さなセットを要求してください。

クイックスタート

MCP クライアントを構成して、公開されたパッケージを npx で実行します。構成値は MCP クライアントの env ブロックに直接配置できます。シェル環境変数は他に必要ありません。

{
  "mcpServers": {
    "ms-graph": {
      "command": "npx",
      "args": ["-y", "@developer.k/ms-graph-mcp"],
      "env": {
        "MS_CLIENT_ID": "your-entra-application-client-id",
        "MS_TENANT_ID": "organizations"
      }
    }
  }
}

graph_auth_device_code を呼び出し、返されたログイン URL を開いてデバイスコードを入力し、その後 graph_auth_status を呼び出します。アクセス許可を追加した後、または古いデバイスコードフローが期限切れになった場合は、force: true を使用します。

構成

必須:

  • MS_CLIENT_ID: Microsoft Entra アプリケーション (クライアント) ID。

省略可能:

  • MS_TENANT_ID: organizations、common、またはディレクトリ (テナント) ID。デフォルト: organizations。

  • MS_GRAPH_SCOPES: デフォルトのスコープセットを置き換える、カンマまたはスペース区切りの委任スコープ。

  • MS_GRAPH_TOKEN_CACHE_PATH: ローカル MSAL トークンキャッシュのパス。

  • MS_GRAPH_ACCOUNT_USERNAME: 複数のアカウントが利用可能な場合に選択するキャッシュされたアカウント。

読み取り重視のカスタムスコープセットの例:

{
  "env": {
    "MS_CLIENT_ID": "your-entra-application-client-id",
    "MS_TENANT_ID": "organizations",
    "MS_GRAPH_SCOPES": "User.Read Mail.Read Calendars.Read Tasks.Read Contacts.Read MailboxSettings.Read offline_access"
  }
}

ツール

Graph:

graph_auth_device_code
graph_auth_status
graph_get_me

Teams:

teams_list_joined_teams
teams_list_channels
teams_list_channel_messages
teams_send_channel_message
teams_list_chats
teams_list_chat_messages
teams_list_chat_members
teams_find_self_chat
teams_send_chat_message
teams_send_self_message

Mail:

mail_list_folders
mail_list_messages
mail_get_message
mail_list_attachments
mail_get_attachment
mail_add_attachment
mail_create_draft
mail_update_draft
mail_create_reply_draft
mail_create_forward_draft
mail_send_draft
mail_send_message
mail_reply
mail_reply_all
mail_forward
mail_update_message
mail_move_message
mail_delete_message
mail_list_rules
mail_create_rule
mail_update_rule
mail_delete_rule

Calendar:

calendar_list_calendars
calendar_get_calendar
calendar_create_calendar
calendar_update_calendar
calendar_delete_calendar
calendar_list_events
calendar_get_event
calendar_create_event
calendar_update_event
calendar_delete_event
calendar_cancel_event
calendar_respond_event
calendar_get_schedule
calendar_find_meeting_times

Microsoft To Do:

todo_list_task_lists
todo_get_task_list
todo_create_task_list
todo_update_task_list
todo_delete_task_list
todo_list_tasks
todo_get_task
todo_create_task
todo_update_task
todo_complete_task
todo_delete_task
todo_list_checklist_items
todo_create_checklist_item
todo_update_checklist_item
todo_delete_checklist_item
todo_list_linked_resources
todo_create_linked_resource
todo_delete_linked_resource

Contacts:

contacts_list_folders
contacts_get_folder
contacts_create_folder
contacts_update_folder
contacts_delete_folder
contacts_list
contacts_get
contacts_create
contacts_update
contacts_delete

Outlook 設定とカテゴリ:

outlook_get_mailbox_settings
outlook_update_mailbox_settings
outlook_set_automatic_replies
outlook_list_categories
outlook_get_category
outlook_create_category
outlook_update_category
outlook_delete_category

プロンプトの例

Show the 10 most recent unread messages in my Inbox.
Find messages containing "quarterly report" and summarize their subjects and senders.
Create a draft reply to this message, but do not send it.
Create a draft email to user@example.com with the subject "Project update".
Send draft MESSAGE_ID after showing me its current recipients and subject.
Move message MESSAGE_ID to folder FOLDER_ID.
Show my calendar events for next week in Asia/Seoul.
Find a 30-minute time when all three attendees are available.
Create a Teams online meeting tomorrow at 2 PM.
Accept event EVENT_ID and send a response.
List my Microsoft To Do task lists.
Add a high-priority task due Friday with a reminder one day earlier.
Add three checklist items to task TASK_ID.
Mark task TASK_ID as completed.
Find the contact with email user@example.com.
Create a business contact in folder FOLDER_ID.
Schedule automatic replies from Monday morning through Friday evening.
Create an Outlook category named "Customer" using preset7.

受信者と内容を確認できるように、メール送信ツールの前に下書きツールを使用することをお勧めします。送信、返信、転送、キャンセル、移動、削除の各ツールは、実際の Microsoft 365 データを変更します。

ローカル開発

このセクションは、ローカルクローンから実行する場合にのみ使用してください:

npm install
npm test
{
  "mcpServers": {
    "ms-graph": {
      "command": "node",
      "args": ["/path/to/ms-graph-mcp/build/index.js"],
      "env": {
        "MS_CLIENT_ID": "your-entra-application-client-id",
        "MS_TENANT_ID": "organizations"
      }
    }
  }
}

プロジェクト構造

src/
|-- auth/
|   +-- msal.ts
|-- graph/
|   +-- client.ts
|-- modules/
|   |-- calendar.ts
|   |-- contacts.ts
|   |-- mail.ts
|   |-- outlook.ts
|   |-- shared.ts
|   |-- teams.ts
|   +-- todo.ts
|-- config.ts
|-- index.ts
|-- tools.ts
+-- types.ts

現在の制限

  • ツールは、サインインしているユーザーの /me リソースに対して動作します。共有メールボックスと委任された共有フォルダーはまだ公開されていません。

  • stdio MCP サーバーには永続的なパブリックコールバックエンドポイントがないため、Webhook サブスクリプションは含まれていません。

  • 単純なファイル添付は 3 MiB に制限されています。より大きな添付ファイルには、Microsoft Graph のアップロードセッションが必要です。

  • 連絡先フィルタリングは、正確なメールアドレスの一致をサポートしています。Microsoft Graph は、連絡先コレクションに対する一般的な名前検索を公開していません。

  • イベントとメッセージの本文には、Microsoft Graph によって提供される外部 HTML が含まれる場合があります。

このパッケージには、資格情報、テナント識別子、アカウント識別子、その他の個人設定は含まれていません。

Related MCP Connectors

Related MCP Servers