Skip to main content
Glama

Teams MCP

npm version npm downloads codecov License: MIT GitHub stars

Microsoft Graph APIとのシームレスな統合を提供するModel Context Protocol (MCP) サーバーです。AIアシスタントがMicrosoft Teams、ユーザー、チャット、ファイル、および組織データとやり取りできるようになります。

📦 インストール

Cursor/Claude/VS CodeでこのMCPサーバーを使用するには、以下の設定を追加してください:

{
  "mcpServers": {
    "teams-mcp": {
      "command": "npx",
      "args": ["-y", "@floriscornel/teams-mcp@latest"]
    }
  }
}

Related MCP server: Microsoft Graph MCP Server

🚀 機能

🔐 認証

  • Microsoft Graphを使用したOAuth 2.0デバイスコード認証フロー

  • 安全なトークン管理、キャッシュの永続化、およびリフレッシュトークンの更新

  • 認証状態の確認とログアウトのサポート

  • 権限を制限した読み取り専用モード

  • 事前に発行されたMicrosoft Graphアクセストークン用の直接的な AUTH_TOKEN サポート

👥 ユーザー管理

  • 現在のユーザー情報の取得

  • 名前またはメールアドレスによるユーザー検索

  • 詳細なユーザープロファイルの取得

  • 組織ディレクトリデータへのアクセス

🏢 Microsoft Teams統合

  • チーム管理

    • ユーザーが参加しているチームの一覧表示

    • チームの詳細とメタデータへのアクセス

  • チャネル操作

    • チーム内のチャネル一覧表示

    • チャネルメッセージと返信の取得

    • チームチャネルへのメッセージ送信

    • 既存のチャネルスレッドへの返信

    • チャネルメッセージと返信の編集および論理削除

    • メッセージの重要度レベルのサポート (normal, high, urgent)

    • URLまたはbase64データによるインライン画像添付のサポート

  • チームメンバー

    • チームメンバーとその役割の一覧表示

    • メンバー情報へのアクセス

    • @mentions 用のユーザー検索

💬 チャットとメッセージング

  • 1対1およびグループチャット

    • ユーザーのチャット一覧表示

    • 新しい1対1またはグループ会話の作成

    • フィルタリング、順序付け、ページネーションを備えたチャットメッセージ履歴の取得

    • @odata.nextLink ページネーションによるすべての利用可能なメッセージの取得

    • 既存のチャットへのメッセージ送信

    • 送信済みチャットメッセージの編集

    • チャットメッセージの論理削除

✏️ メッセージ管理

  • 編集と削除

    • チャットおよびチャネル内の送信済みメッセージの更新(編集)

    • チャットおよびチャネル内のメッセージの論理削除(完全に削除せず削除済みとしてマーク)

    • メッセージ送信者のみが自身のメッセージを更新/削除可能

    • 編集時のMarkdownフォーマット、メンション、重要度レベルのサポート

📎 メディアと添付ファイル

  • ホストされたコンテンツ

    • チャットおよびチャネルメッセージからのホストされたコンテンツ(画像、ファイル)のダウンロード

    • 会話内で共有されたインライン画像および添付ファイルへのアクセス

    • ホストされたコンテンツをディスクに直接保存するオプション

  • ファイルアップロード

    • あらゆるファイルタイプ(PDF、DOCX、XLSX、ZIP、画像など)をチャネルやチャットにアップロードして送信

    • 再開可能なアップロードセッションによる大容量ファイル(4MB超)のサポート

    • チャネルへのアップロードはSharePointへ、チャットへのアップロードはOneDriveへ保存

    • メッセージテキスト、カスタムファイル名、フォーマット、重要度レベルのオプション

🔍 高度な検索と発見

  • メッセージ検索

    • Microsoft Search APIを使用してすべてのTeamsチャネルとチャットを横断検索

    • KQL(キーワードクエリ言語)構文のサポート

    • 送信者、メンション、添付ファイル、既読状態、日付範囲によるフィルタリング

    • 高度なフィルタリングオプションを備えた最近のメッセージの取得

    • 現在のユーザーに言及しているメッセージの検索

リッチメッセージフォーマットのサポート

以下のツールは、Teamsチャネルおよびチャットでのリッチメッセージフォーマットをサポートしています:

  • send_channel_message

  • send_chat_message

  • reply_to_channel_message

  • update_channel_message

  • update_chat_message

  • send_file_to_channel

  • send_file_to_chat

フォーマットオプション

format パラメータを指定してメッセージのフォーマットを制御できます:

  • text (デフォルト): プレーンテキスト

  • markdown: Markdownフォーマット(太字、斜体、リスト、リンク、コードなど)をサニタイズされたHTMLに変換

format が markdown に設定されている場合、メッセージ内容は安全なMarkdownパーサーを使用してHTMLに変換され、Teamsに送信される前に潜在的に危険なコンテンツを除去するためにサニタイズされます。

format が指定されていない場合、メッセージはプレーンテキストとして送信されます。

使用例

{
  "teamId": "...",
  "channelId": "...",
  "message": "**Bold text** and _italic text_\n\n- List item 1\n- List item 2\n\n[Link](https://example.com)",
  "format": "markdown",
  "importance": "high"
}
{
  "chatId": "...",
  "message": "Simple plain text message",
  "format": "text"
}

セキュリティ機能

  • HTMLサニタイズ: すべてのMarkdownコンテンツはHTMLに変換され、潜在的に危険な要素(スクリプト、イベントハンドラなど)を除去するためにサニタイズされます

  • 許可されたタグ: 安全なHTMLタグのみが許可されます (p, strong, em, a, ul, ol, li, h1-h6, code, pre など)

  • 安全な属性: 安全な属性のみが許可されます

  • XSS防止: クロスサイトスクリプティング攻撃を防ぐためにコンテンツは自動的にサニタイズされます

サポートされているMarkdown機能

  • テキストフォーマット: 太字 (**text**), 斜体 (_text_), 取り消し線 (~~text~~)

  • リンク: [text](url)

  • リスト: 箇条書き (- item) および番号付き (1. item)

  • コード: インライン `code` およびコードブロック

  • 見出し: # H1 から ###### H6

  • 引用: > quoted text

  • テーブル: GitHub形式のMarkdownテーブル

LLMフレンドリーなコンテンツフォーマット

Microsoft Graph APIから取得されたメッセージは、Teams固有のタグを含む生のHTMLとして返されます。このコンテンツをAIアシスタントが扱いやすくするために、以下のツールは自動的なHTMLからMarkdownへの変換をサポートしています:

  • get_chat_messages

  • get_channel_messages

  • get_channel_message_replies

  • search_messages

  • get_my_mentions

コンテンツフォーマットオプション

contentFormat パラメータを使用して、メッセージコンテンツの返却方法を制御します:

  • markdown (デフォルト): TeamsのHTMLをLLMでの利用に最適化されたクリーンなMarkdownに変換します

  • raw: Microsoft Graph APIからの元のHTMLを返します

変換内容

HTML要素

Markdown出力

<at id="0">Name</at> (Teamsメンション)

@Name (メンションメタデータを使用して複数単語の名前を結合)

<strong>text</strong>

**text**

<em>text</em>

*text*

<code>text</code>

`text`

<a href="url">text</a>

[text](url)

<ul><li>item</li></ul>

- item

<table>...</table>

GFM Markdownテーブル

<attachment id="...">

{attachment:id}

<systemEventMessage/>

(削除)

<hr>

---

&nbsp;, &amp; など

プレーン文字にデコード

添付ファイルのメタデータ

ファイル添付やインライン画像を含むメッセージには、各添付ファイルのメタデータ(id, name, contentType, contentUrl, thumbnailUrl)を含む attachments 配列がレスポンスに含まれます。Markdownコンテンツ内のインライン {attachment:id} マーカーはこの配列内のエントリと関連付けられており、利用者は download_message_hosted_content または download_chat_hosted_content を通じて添付ファイルを特定しダウンロードできます。

使用例

{
  "chatId": "19:meeting_...",
  "limit": 10,
  "contentFormat": "markdown"
}

元のHTMLを取得する場合:

{
  "chatId": "19:meeting_...",
  "limit": 10,
  "contentFormat": "raw"
}

📦 インストール

# Install dependencies
npm install

# Build the project
npm run build

# Set up authentication
npm run auth

🔧 設定

前提条件

  • Node.js 18以上

  • 適切な権限を持つMicrosoft 365アカウント

  • 以下のスコープに対するMicrosoft Graph委任権限

必要なMicrosoft Graph権限

フルモード(デフォルト):

  • User.Read - ユーザープロファイルの読み取り

  • User.ReadBasic.All - 基本ユーザー情報の読み取り

  • Team.ReadBasic.All - チーム情報の読み取り

  • Channel.ReadBasic.All - チャネル情報の読み取り

  • ChannelMessage.Read.All - チャネルメッセージの読み取り

  • ChannelMessage.Send - チャネルメッセージと返信の送信

  • ChannelMessage.ReadWrite - チャネルメッセージの編集と削除

  • Chat.Read - チャットメッセージの読み取り(読み取り専用スコープに含まれる)

  • Chat.ReadWrite - チャットの作成と管理、チャットメッセージの送信/編集/削除 (Chat.Read を上書き)

  • TeamMember.Read.All - チームメンバーの読み取り

  • Files.ReadWrite.All - チャネルおよびチャットへのファイルアップロードに必要

読み取り専用モード (TEAMS_MCP_READ_ONLY=true) — 以下のスコープのみが要求されます:

  • User.Read

  • User.ReadBasic.All

  • Team.ReadBasic.All

  • Channel.ReadBasic.All

  • ChannelMessage.Read.All

  • TeamMember.Read.All

  • Chat.Read

認証モード

フルアクセス:

npx @floriscornel/teams-mcp@latest authenticate

読み取り専用アクセス:

npx @floriscornel/teams-mcp@latest authenticate --read-only

既存のMicrosoft Graph JWTを使用した直接トークン注入:

{
  "mcpServers": {
    "teams-mcp": {
      "command": "npx",
      "args": ["-y", "@floriscornel/teams-mcp@latest"],
      "env": {
        "AUTH_TOKEN": "<jwt-for-https://graph.microsoft.com>"
      }
    }
  }
}

トークンストレージ

  • 認証メタデータはローカルの ~/.msgraph-mcp-auth.json に保存されます

  • トークンキャッシュはローカルの ~/.teams-mcp-token-cache.json に保存されます

🛠️ 使用方法

サーバーの起動

# Development mode with hot reload
npm run dev

# Production mode
npm run build && node dist/index.js

# Start in read-only mode (disables all write tools)
TEAMS_MCP_READ_ONLY=true node dist/index.js

CLIコマンド

npx @floriscornel/teams-mcp@latest authenticate              # Authenticate with full scopes
npx @floriscornel/teams-mcp@latest authenticate --read-only  # Authenticate with read-only scopes
npx @floriscornel/teams-mcp@latest check                     # Check authentication status
npx @floriscornel/teams-mcp@latest logout                    # Clear authentication
npx @floriscornel/teams-mcp@latest auth                      # Alias for authenticate
npx @floriscornel/teams-mcp@latest                           # Start MCP server (default)

環境変数

  • TEAMS_MCP_READ_ONLY=true - MCPサーバーを読み取り専用モードで起動

  • AUTH_TOKEN=<jwt> - MSALログインの代わりに既存のMicrosoft Graphアクセストークンを使用

読み取り専用モード

サーバーは、すべての書き込み操作(メッセージ送信、チャット作成、ファイルアップロード、メッセージの編集/削除)を無効にし、Microsoft Graphから読み取り権限スコープのみを要求する読み取り専用モードをサポートしています。

読み取り専用モードを有効にする方法:

  • 環境変数: TEAMS_MCP_READ_ONLY=true

  • CLIフラグ: --read-only

制限されたスコープで認証:

npx @floriscornel/teams-mcp@latest authenticate --read-only

MCPサーバー設定(読み取り専用):

{
  "mcpServers": {
    "teams-mcp": {
      "command": "npx",
      "args": ["-y", "@floriscornel/teams-mcp@latest"],
      "env": {
        "TEAMS_MCP_READ_ONLY": "true"
      }
    }
  }
}

モードの切り替え: 読み取り専用からフルモードに切り替える際、サーバーはスコープの不一致を検出し、再認証を促す警告を表示します:

npx @floriscornel/teams-mcp@latest authenticate

読み取り専用ツール (16): auth_status, get_current_user, search_users, get_user, list_teams, list_channels, get_channel_messages, get_channel_message_replies, list_team_members, search_users_for_mentions, download_message_hosted_content, list_chats, get_chat_messages, download_chat_hosted_content, search_messages, get_my_mentions

読み取り専用モードで無効化される書き込みツール (10): send_channel_message, reply_to_channel_message, update_channel_message, delete_channel_message, send_file_to_channel, send_chat_message, create_chat, update_chat_message, delete_chat_message, send_file_to_chat

利用可能なMCPツール

認証

  • auth_status - 現在の認証状態を確認

ユーザー操作

  • get_current_user - 認証済みユーザー情報を取得

  • search_users - 名前またはメールアドレスでユーザーを検索

  • get_user - IDまたはメールアドレスで詳細なユーザー情報を取得

チーム操作

  • list_teams - ユーザーが参加しているチームを一覧表示

  • list_channels - 特定のチーム内のチャネルを一覧表示

  • get_channel_messages - 添付ファイルの概要とコンテンツフォーマット選択を備えたチームチャネルからのメッセージを取得

  • get_channel_message_replies - 特定のチャネルメッセージへの返信を取得

  • send_channel_message - メンション、重要度、画像添付オプションを備えたチームチャネルへのメッセージ送信

  • reply_to_channel_message - 既存のチャネルメッセージへの返信

  • update_channel_message - 送信済みのチャネルメッセージまたは返信を編集

  • delete_channel_message - チャネルメッセージまたは返信を論理削除

  • list_team_members - 特定のチームのメンバーを一覧表示

  • search_users_for_mentions - メッセージで@メンションするためのチームメンバーを検索

  • send_file_to_channel - ローカルファイルをアップロードし、チャネルへのメッセージとして送信

チャット操作

  • list_chats - ユーザーのチャット(1対1およびグループ)を一覧表示

  • get_chat_messages - ページネーション、フィルタ、順序付け、fetchAll を備えた特定のチャットからのメッセージを取得

  • send_chat_message - チャットへのメッセージ送信

  • create_chat - 新しい1対1またはグループチャットを作成

  • update_chat_message - 送信済みのチャットメッセージを編集

Available Tools

19 tools
auth_statusA

Check the authentication status of the Microsoft Graph connection. Returns whether the user is authenticated and shows their basic profile information.

Inputs: no named parameters.

create_chatC

Create a new chat conversation. Can be a 1:1 chat (with one other user) or a group chat (with multiple users). Group chats can optionally have a topic.

Inputs: userEmails (required), topic.

get_channel_message_repliesC

Get all replies to a specific message in a channel. Returns reply content, sender information, and timestamps.

Inputs: teamId (required), channelId (required), messageId (required), limit.

get_channel_messagesC

Retrieve recent messages from a specific channel in a Microsoft Team. Returns message content, sender information, and timestamps.

Inputs: teamId (required), channelId (required), limit.

get_chat_messagesB

Retrieve recent messages from a specific chat conversation. Returns message content, sender information, and timestamps.

Inputs: chatId (required), limit, since, until, +3 more.

get_current_userA

Get the current authenticated user's profile information including display name, email, job title, and department.

Inputs: no named parameters.

get_my_mentionsA

Find all recent messages where the current user was mentioned (@mentioned) across Teams channels and chats.

Inputs: hours, limit, scope.

get_recent_messagesC

Get recent messages from across Teams with advanced filtering options. Can filter by time range, scope (channels vs chats), teams, channels, and users.

Inputs: hours, limit, mentionsUser, fromUser, +6 more.

get_userC

Get detailed information about a specific user by their ID or email address. Returns profile information including name, email, job title, and department.

Inputs: userId (required).

list_channelsB

List all channels in a specific Microsoft Team. Returns channel names, descriptions, types, and IDs for the specified team.

Inputs: teamId (required).

list_chatsB

List all recent chats (1:1 conversations and group chats) that the current user participates in. Returns chat topics, types, and participant information.

Inputs: no named parameters.

list_team_membersB

List all members of a specific Microsoft Team. Returns member names, email addresses, roles, and IDs.

Inputs: teamId (required).

list_teamsA

List all Microsoft Teams that the current user is a member of. Returns team names, descriptions, and IDs.

Inputs: no named parameters.

reply_to_channel_messageB

Reply to a specific message in a channel. Supports text and markdown formatting, mentions, and importance levels.

Inputs: teamId (required), channelId (required), messageId (required), message (required), +7 more.

search_messagesA

Search for messages across all Microsoft Teams channels and chats using Microsoft Search API. Supports advanced KQL syntax for filtering by sender, mentions, attachments, and more.

Inputs: query (required), scope, limit, enableTopResults.

search_usersA

Search for users in the organization by name or email address. Returns matching users with their basic profile information.

Inputs: query (required).

search_users_for_mentionsA

Search for users to mention in messages. Returns users with their display names, email addresses, and mention IDs.

Inputs: query (required), limit.

send_channel_messageC

Send a message to a specific channel in a Microsoft Team. Supports text and markdown formatting, mentions, and importance levels.

Inputs: teamId (required), channelId (required), message (required), importance, +6 more.

send_chat_messageC

Send a message to a specific chat conversation. Supports text and markdown formatting, mentions, and importance levels.

Inputs: chatId (required), message (required), importance, format, +1 more.

Tool Schema Changelog

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

Loading tool schema changelog…

    TDQS

    A3.5/5.0

    Scored across 19 tools

    Disambiguation4/5

    Most tools have distinct purposes targeting specific resources like channels, chats, users, or messages, but there is some overlap: get_recent_messages and search_messages both retrieve messages with filtering, which could cause confusion. However, descriptions clarify that get_recent_messages focuses on recent messages with time/scope filters, while search_messages uses advanced KQL syntax, helping to differentiate them.

    Naming Consistency5/5

    Tool names follow a highly consistent verb_noun pattern throughout, such as list_teams, get_channel_messages, send_chat_message, and search_users. All tools use snake_case with clear verbs like get, list, create, send, reply, and search, making the set predictable and easy to understand.

    Tool Count4/5

    With 19 tools, the count is slightly high but reasonable for a comprehensive Teams integration covering authentication, chats, channels, messages, users, and search. It provides broad functionality without being overwhelming, though it could be streamlined by merging some overlapping tools like get_recent_messages and search_messages.

    Completeness5/5

    The toolset offers complete coverage for Microsoft Teams interactions, including CRUD operations for messages (send, reply, get), resource listing (teams, channels, chats, members), user management (get, search), and authentication. There are no obvious gaps; agents can perform core workflows like messaging, searching, and team management effectively.

    Maintenance

    ActivitySlowing
    ResponsivenessLimited data

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      B
      quality
      A
      maintenance
      A Model Context Protocol server that enables interaction with Microsoft 365 services (Excel, Calendar, Mail, OneDrive, Teams, etc.) through the Graph API, allowing AI assistants to manage Microsoft 365 resources via natural language.
      203
      104,785 npm
      1,150
      MIT
    • A
      license
      Not graded
      quality
      D
      maintenance
      Model Context Protocol servers for Microsoft 365, enabling AI assistants to interact with Calendar, Contacts, OneDrive, Outlook, and SharePoint via the Microsoft Graph API.
      MIT
    • A
      license
      Not graded
      quality
      D
      maintenance
      A Model Context Protocol server enabling AI assistants to interact with Microsoft Teams, users, chats, and organizational data via Microsoft Graph APIs.
      MIT