Skip to main content
Glama
Microsoft Teams MCP Server

Microsoft Teams MCP Server

by adkins-amdg

Microsoft Teams MCP Server

An MCP server that gives an AI agent access to Microsoft Teams via Microsoft Graph, using delegated, device-code authentication — the server acts as you, so it can only touch what your own Teams account can already see (least-privilege by default).

Built with the official MCP TypeScript SDK + MSAL. Runs locally over stdio.

What it can do

Scope

Tools

Messages

teams_list_chats, teams_get_chat_messages, teams_send_chat_message, teams_list_channel_messages, teams_send_channel_message, teams_reply_channel_message

Teams & channels

teams_list_joined_teams, teams_list_channels, teams_list_team_members, teams_create_channel

Meetings & calendar

teams_create_meeting, teams_list_events, teams_get_event

Search & files

teams_search_messages, teams_list_channel_files

Identity

teams_whoami

Every read tool supports response_format: "markdown" | "json" and a limit. Write tools (send_*, reply_*, create_*) are annotated non-read-only so clients can gate them.


Related MCP server: Teams MCP

1. Entra ID setup (one time)

You need an app registration in Microsoft Entra ID (Azure AD). You don't need to be a global admin to create it, but some delegated scopes are admin-restricted (see below).

  1. Go to Entra ID → App registrations → New registration.

    • Name: Teams MCP (delegated)

    • Supported account types: Accounts in this organizational directory only (single tenant) is fine.

    • Redirect URI: leave blank.

  2. On the new app, open Authentication →

    • Under Advanced settings, set Allow public client flows = Yes. (Required for device-code.)

  3. Open API permissions → Add a permission → Microsoft Graph → Delegated permissions and add:

    • User.Read

    • Chat.ReadWrite

    • ChannelMessage.Send

    • ChannelMessage.Read.All (admin consent)

    • Team.ReadBasic.All

    • Channel.ReadBasic.All

    • Channel.Create

    • TeamMember.Read.All (admin consent)

    • Calendars.ReadWrite

    • OnlineMeetings.ReadWrite

    • Files.Read.All

    • Sites.Read.All

    • offline_access (usually added automatically)

  4. Click Grant admin consent for the tenant. (The .All read scopes won't work without it. If you're not an admin, send your Teams/M365 admin this list to consent.)

  5. Copy the Application (client) ID and your Directory (tenant) ID from the app's Overview page.

Why delegated, not application permissions? Application (app-only) permissions would grant the server org-wide read of every chat in the tenant — a large PHI/privacy blast radius and a harder security review. Delegated keeps the server scoped to your own access. If you later need unattended automation, add a client-credentials path then.


2. Install & build

cd teams-mcp-server
npm install
npm run build

3. Configure environment

cp .env.example .env
# edit .env: set TEAMS_MCP_CLIENT_ID and TEAMS_MCP_TENANT_ID

Or export the variables in your shell / MCP client config (below).

4. Sign in (one time)

export TEAMS_MCP_CLIENT_ID=<your-app-client-id>
export TEAMS_MCP_TENANT_ID=<your-tenant-id>     # or "organizations"
npm run login

You'll see a message like "To sign in, use a web browser to open https://microsoft.com/devicelogin and enter the code XXXXXXXX." Complete it in your browser. The token cache (including a refresh token) is saved to ~/.teams-mcp-token-cache.json, so you won't need to do this again until the refresh token expires or is revoked.

5. Connect it to your MCP client

Point your MCP client at the built server over stdio. Example client config:

{
  "mcpServers": {
    "teams": {
      "command": "node",
      "args": ["/absolute/path/to/teams-mcp-server/dist/index.js"],
      "env": {
        "TEAMS_MCP_CLIENT_ID": "<your-app-client-id>",
        "TEAMS_MCP_TENANT_ID": "<your-tenant-id>"
      }
    }
  }
}

If no cached account exists, the first tool call triggers an interactive device-code login printed to stderr. Running npm run login first avoids that.


Testing

Use the MCP Inspector to exercise tools interactively:

npx @modelcontextprotocol/inspector node dist/index.js

Start with teams_whoami to confirm auth, then teams_list_joined_teams → grab a team_id → teams_list_channels, etc.

How auth works

  • MSAL PublicClientApplication with the device-code flow.

  • Tokens + refresh token cached to disk (TEAMS_MCP_TOKEN_CACHE, default ~/.teams-mcp-token-cache.json, written 0600).

  • Each Graph call acquires a token silently from cache; only an expired/revoked refresh token forces a new device-code login.

Notes & limits

  • Admin-restricted scopes: ChannelMessage.Read.All and TeamMember.Read.All require tenant admin consent. Without it those specific tools return a clear 403 with guidance.

  • Search uses the Microsoft Search API (/search/query, chatMessage entity) — relevance-ranked, not a literal grep.

  • Meetings are created as calendar events with isOnlineMeeting: true (Teams provider), which puts them on your calendar, invites attendees, and returns a join link.

  • Channel files resolve the channel's SharePoint filesFolder, then list its children.

  • Responses are truncated at 25,000 characters with guidance to narrow the query.

  • HIPAA note: this server can read message content that may contain PHI. It runs locally and holds no data beyond the on-disk token cache, but treat the host machine accordingly.

Project layout

teams-mcp-server/
├── package.json
├── tsconfig.json
├── .env.example
├── README.md
└── src/
    ├── index.ts          # entry point + `login` command
    ├── constants.ts      # Graph base URL, scopes, limits
    ├── auth.ts           # MSAL device-code + disk token cache
    ├── graph.ts          # Graph request/pagination/error/format helpers
    ├── schemas.ts        # shared Zod fragments
    └── tools/
        ├── identity.ts   # teams_whoami
        ├── teams.ts      # teams & channels
        ├── messages.ts   # chat + channel messaging
        ├── meetings.ts   # meetings & calendar
        └── search.ts     # search + channel files

Available Tools

16 tools
teams_create_channelCreate a channelA

Create a new channel in a team. This MODIFIES the team.

Args:

  • team_id (string): the team ID

  • display_name (string): channel name (1-50 chars)

  • description (string, optional): channel description

  • membership_type ('standard' | 'private'): default 'standard'

Returns: JSON { id, displayName, webUrl }.

Inputs: team_id (required), display_name (required), description, membership_type.

teams_create_meetingCreate a Teams meetingA

Create a Microsoft Teams meeting as a calendar event on the user's calendar, with a Teams join link and (optionally) invited attendees. This CREATES an event and sends invitations.

Args:

  • subject (string): meeting title

  • start (string): ISO local date-time, e.g. '2026-07-02T14:00:00'

  • end (string): ISO local date-time, must be after start

  • time_zone (string): IANA/Windows time zone (default 'America/Chicago')

  • attendees (string[], optional): attendee email addresses

  • body (string, optional): meeting description / agenda

Returns: JSON { id, subject, joinUrl, webLink }.

Inputs: end (required), start (required), subject (required), body, +2 more.

teams_get_chat_messagesRead chat messagesA
Read-onlyIdempotent

Read recent messages from a 1:1 or group chat, newest first.

Args:

  • chat_id (string): the chat ID (from teams_list_chats)

  • limit (number, 1-50): max messages (default 20)

  • response_format ('markdown' | 'json'): output format (default markdown)

Returns: JSON { count, messages: [{ id, from, createdDateTime, text, webUrl }] }.

Inputs: chat_id (required), limit, response_format.

teams_get_eventGet a calendar eventA
Read-onlyIdempotent

Get full details for a single calendar event, including the Teams join link and body preview.

Args:

  • event_id (string): the event ID (from teams_list_events)

  • response_format ('markdown' | 'json'): output format (default markdown)

Returns: JSON event object with subject, start, end, joinUrl, attendees, body preview.

Inputs: event_id (required), response_format.

teams_list_channel_filesList channel filesA
Read-onlyIdempotent

List files and folders stored in a channel's Files tab (the channel's SharePoint-backed document folder).

Args:

  • team_id (string): the team ID

  • channel_id (string): the channel ID

  • limit (number, 1-50): max items (default 20)

  • response_format ('markdown' | 'json'): output format (default markdown)

Returns: JSON { count, items: [{ id, name, type, size, webUrl, lastModifiedDateTime }] }.

Inputs: team_id (required), channel_id (required), limit, response_format.

teams_list_channel_messagesRead channel messagesA
Read-onlyIdempotent

Read recent top-level messages from a team channel, newest first.

Args:

  • team_id (string): the team ID

  • channel_id (string): the channel ID (from teams_list_channels)

  • limit (number, 1-50): max messages (default 20)

  • response_format ('markdown' | 'json'): output format (default markdown)

Returns: JSON { count, messages: [{ id, from, createdDateTime, text, webUrl }] }.

Inputs: team_id (required), channel_id (required), limit, response_format.

teams_list_channelsList channels in a TeamA
Read-onlyIdempotent

List channels within a given team.

Args:

  • team_id (string): the team ID (from teams_list_joined_teams)

  • limit (number, 1-50): max channels (default 20)

  • response_format ('markdown' | 'json'): output format (default markdown)

Returns: JSON { count, channels: [{ id, displayName, description, membershipType, webUrl }] }.

Inputs: team_id (required), limit, response_format.

teams_list_chatsList my chatsA
Read-onlyIdempotent

List the user's recent 1:1 and group chats (not channel conversations).

Use this to find the chat_id for reading or sending chat messages.

Args:

  • limit (number, 1-50): max chats (default 20)

  • response_format ('markdown' | 'json'): output format (default markdown)

Returns: JSON { count, chats: [{ id, topic, chatType, members }] }.

Inputs: limit, response_format.

teams_list_eventsList calendar eventsA
Read-onlyIdempotent

List the user's upcoming calendar events (ordered by start time).

Args:

  • limit (number, 1-50): max events (default 20)

  • days_ahead (number, 1-90): look-ahead window in days (default 14)

  • response_format ('markdown' | 'json'): output format (default markdown)

Returns: JSON { count, events: [{ id, subject, start, end, joinUrl, attendees }] }.

Inputs: limit, days_ahead, response_format.

teams_list_joined_teamsList joined TeamsA
Read-onlyIdempotent

List the Microsoft Teams the signed-in user is a member of.

Use this first to discover team IDs needed by channel/message tools.

Args:

  • limit (number, 1-50): max teams to return (default 20)

  • response_format ('markdown' | 'json'): output format (default markdown)

Returns: JSON { count, teams: [{ id, displayName, description }] }.

Inputs: limit, response_format.

teams_list_team_membersList Team membersA
Read-onlyIdempotent

List members of a team, including their roles (e.g. 'owner').

Note: requires the delegated scope TeamMember.Read.All, which may need a one-time Entra admin consent.

Args:

  • team_id (string): the team ID

  • limit (number, 1-50): max members (default 20)

  • response_format ('markdown' | 'json'): output format (default markdown)

Returns: JSON { count, members: [{ id, displayName, email, roles }] }.

Inputs: team_id (required), limit, response_format.

teams_reply_channel_messageReply in a channel threadA

Reply to an existing top-level channel message (adds to its thread).

Args:

  • team_id (string): the team ID

  • channel_id (string): the channel ID

  • message_id (string): the parent message ID (from teams_list_channel_messages)

  • content (string): the reply body (max 28000 chars)

  • content_type ('text' | 'html'): body format (default text)

Returns: JSON { id, webUrl } of the created reply.

Inputs: content (required), team_id (required), channel_id (required), message_id (required), +1 more.

teams_search_messagesSearch Teams messagesA
Read-onlyIdempotent

Search across the user's Teams chat and channel messages using the Microsoft Search API. Returns matching messages with a snippet and a deep link.

Note: relevance-ranked full-text search; exact phrasing and recency affect hits.

Args:

  • query (string): the search text (e.g. 'Plaid key', 'HIPAA BAA')

  • limit (number, 1-50): max hits (default 20)

  • response_format ('markdown' | 'json'): output format (default markdown)

Returns: JSON { total, count, moreResultsAvailable, hits: [{ id, from, createdDateTime, snippet, webUrl }] }.

Inputs: query (required), limit, response_format.

teams_send_channel_messagePost a channel messageA

Post a new top-level message to a team channel as the signed-in user.

Args:

  • team_id (string): the team ID

  • channel_id (string): the channel ID

  • content (string): the message body (max 28000 chars)

  • content_type ('text' | 'html'): body format (default text)

Returns: JSON { id, webUrl } of the created message.

Inputs: content (required), team_id (required), channel_id (required), content_type.

teams_send_chat_messageSend a chat messageA

Send a message to a 1:1 or group chat. This POSTS a message as the signed-in user.

Args:

  • chat_id (string): the chat ID (from teams_list_chats)

  • content (string): the message body (max 28000 chars)

  • content_type ('text' | 'html'): body format (default text)

Returns: JSON { id, webUrl } of the created message.

Inputs: chat_id (required), content (required), content_type.

teams_whoamiWho am I (Teams)A
Read-onlyIdempotent

Return the Microsoft 365 identity the server is authenticated as (delegated).

Use this to confirm which account the Teams MCP is acting on behalf of before sending messages or creating meetings.

Args: none.

Returns: JSON { id, displayName, userPrincipalName, mail, jobTitle }.

Inputs: no named parameters.

Tool Schema Changelog

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

Loading tool schema changelog…

    TDQS

    A4.2/5.0

    Scored across 16 tools

    Disambiguation5/5

    Every tool serves a distinct purpose: creating channels, meetings, sending/receiving messages in channels and chats, listing resources, etc. No two tools overlap in functionality, so an agent can easily select the correct one.

    Naming Consistency5/5

    All tools follow the exact pattern `teams_verb_noun` in snake_case. Verbs are uniformly imperative (create, get, list, reply, search, send, whoami), making the set predictable and easy to navigate.

    Tool Count5/5

    With 16 tools, the server covers the core Teams operations (team/channel management, messaging, meetings, events, files) without unnecessary bloat. The number is well-proportioned to the domain.

    Completeness4/5

    The surface enables most everyday workflows: reading and writing messages in channels and chats, listing teams/channels/members/events/files, creating channels and meetings, and searching. Minor gaps like updating or deleting messages or channels are absent, but the core is solid.

    Maintenance

    ActivityInactive
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      Not graded
      quality
      A
      maintenance
      Enables AI assistants to read and act on Microsoft Teams data through Microsoft Graph, covering team and channel operations, 1:1 and group chat messaging with rich formatting, message editing, deletion and search, file and image upload or download, and user directory lookups. Supports OAuth device-code authentication with token caching plus a read-only mode for safer, permission-limited access.
      12 npm
      MIT
    • A
      license
      Not graded
      quality
      A
      maintenance
      Enables AI assistants to interact with Microsoft Teams and Microsoft Graph, covering chats and channel messaging, message search, user and team member lookups, and file upload or attachment downloads. Supports OAuth device-code authentication, rich Markdown formatting, and LLM-friendly conversion of Teams HTML into Markdown.
      12 npm
      MIT
    • A
      license
      Not graded
      quality
      A
      maintenance
      Enables AI assistants to interact with Microsoft Teams and Microsoft Graph APIs for messaging, search, user management, file uploads, and chat/channel operations.
      12 npm
      MIT