Skip to main content
Glama

Microsoft Teams MCP Server & CLI

Direct AI Assistant Integration, EDU Assignment Automation & Standalone CLI for Microsoft Teams

npm version License: MIT Node.js Linux Ready Windows Ready


Table of Contents


Related MCP server: Teams MCP

Overview

mcp-server-msteams connects Large Language Models (Claude, GPT, Gemini, DeepSeek) and command-line users directly to Microsoft Teams.

Why Choose mcp-server-msteams?

  • No Azure app registration: Use the Teams sign-in you already know. There is no separate Graph permission prompt or Azure application setup.

  • HTTP-first token refresh: Prefer direct Teams session refresh before launching Playwright when credentials already exist.

  • EDU Assignments: List coursework, read instructions, attach files, and verify the submitted state; check exact attachments manually for important work.

  • 🐧 Full Linux & Windows Parity: Native cross-platform engine auto-detects Google Chrome, Brave, Microsoft Edge, and Chromium across distributions without hardcoded .exe or OS paths.

  • Local privacy: Session-state files use AES-256-GCM with a random per-install key. The key and browser cookies remain in your OS account, so protect your local profile.

  • 🛠️ Dual Interface: Includes both an MCP stdio server for AI clients and the standalone msteams CLI for bash/zsh/PowerShell scripts.


Quick Start

npm-only installation (no Git clone, Azure CLI, or app registration):

npm install --global mcp-server-msteams
msteams login
msteams status

Uninstall:

npm uninstall --global mcp-server-msteams

Source checkouts also provide scripts/install.ps1, scripts/uninstall.ps1, scripts/install.cmd, scripts/uninstall.cmd, scripts/install.sh, and scripts/uninstall.sh. See Uninstall and erase local sessions.

Publishing note: The updated version 1.0.6 must be published to npm separately before npm commands install these new changes.

1. Configure in AI MCP Clients

Add mcp-server-msteams to your AI client's configuration file. The client will launch the server on-demand via npx:

Claude Desktop

Add to %APPDATA%\Claude\claude_desktop_config.json (Windows) or ~/.config/Claude/claude_desktop_config.json (Linux/macOS):

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

Cursor & Windsurf

Add to your project's .cursor/mcp.json or global MCP settings:

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

Local Clone Execution (For Local Development)

If you prefer to run from a local repository clone:

{
  "mcpServers": {
    "teams": {
      "command": "node",
      "args": ["/absolute/path/to/mcp-server-msteams/dist/index.js"]
    }
  }
}

2. Standalone Terminal CLI Usage

You can use all features directly from your command prompt without an AI client.

Method A: Direct Execution (Fastest — If Installed Globally)

Install once from NPM:

npm install -g mcp-server-msteams

Then run commands anywhere in your terminal:

# Check session status
msteams status

# Sign in to Teams (opens browser once)
msteams login

# List active coursework
msteams assignments --status active

Method B: Running via NPX (Without Global Installation)

If you do not want to install globally, run using npx:

# Check session status
npx -y -p mcp-server-msteams msteams status

# Sign in to Teams (opens browser once)
npx -y -p mcp-server-msteams msteams login

# List active coursework
npx -y -p mcp-server-msteams msteams assignments --status active

(Note for Windows Command Prompt users: In cmd.exe, do not paste bash comment lines starting with #).


Architecture & Data Flow

  1. Protocol Layer: Standard JSON-RPC 2.0 over standard I/O (MCP specification compliant).

  2. Session Engine:

    • Stores session state in ~/.teams-mcp-server/ (Linux/macOS) or %APPDATA%\teams-mcp-server\ (Windows).

    • Local token database encrypted with authenticated AES-256-GCM.

    • Persistent browser profile preserves Microsoft SSO cookies, enabling silent headless re-authentication.

  3. Multi-Service Cloud Gateway:

    • ChatSvc (chatsvcagg.teams.microsoft.com): Real-time messaging, channels, direct chats, reactions.

    • Substrate (substrate.office.com): Microsoft 365 natural language search, Outlook emails, people graph.

    • Assignments (assignments.edu.cloud.microsoft): Coursework data, submission deadlines, rubrics.

    • SharePoint downloads: Uses the existing local browser session for supported HTTPS SharePoint web links. No Graph token is requested.


CLI Commands vs MCP Tools Reference

The server exposes 30+ tools to AI agents via MCP, each available as a direct command in the msteams CLI:

Authentication & Session

MCP Tool Name

CLI Command

Parameters

Description

teams_status

msteams status

(None)

Check authentication status, tenant info, and token validity across all services.

teams_login

msteams login

(None)

Opens a visible browser window for Microsoft Teams login. Auto-saves session and closes.

EDU Coursework & Assignments

MCP Tool Name

CLI Command

Parameters

Description

teams_list_assignments

msteams assignments

--status <active|completed|all>

List coursework across classes with due dates, grades, and submission state.

teams_get_assignment

msteams assignment

--classId <id> --assignmentId <id>

Get detailed assignment instructions, attached files, rubrics, and submission info.

teams_attach_file

msteams attach_file

--classId <id> --assignmentId <id> --filePath <path> [--turnIn]

Upload and attach a local file directly to an assignment submission via Playwright automation, with optional instant turn-in.

teams_remove_attachment

msteams remove_attachment

--classId <id> --assignmentId <id> [--fileName <name>]

Remove an uploaded attachment from a working submission.

teams_submission_action

msteams submission_action

--action <submit|unsubmit|view> --classId <id> --assignmentId <id> --submissionId <id>

Turn in an assignment, undo turn-in, or mark as viewed.

Messaging & Chats

MCP Tool Name

CLI Command

Parameters

Description

teams_get_chat

msteams chat <userId>

--userId <id> (alias: --user)

Resolve or start a 1:1 direct chat with a person; returns conversation ID.

teams_list_chats

msteams chats

[--limit <n>]

List recent conversations (1:1 chats, group chats, meetings, channels) newest activity first.

teams_get_thread

msteams thread

[--conversationId <id>] [--fromUrl <url>] [--threadRootId <id>] [--limit <n>] [--order <asc|desc>] [--since <iso>] [--markRead] (alias: --to)

Read message history from a Teams conversation or channel thread.

teams_send_message

msteams send_message <content>

[--conversationId <id>] [--replyToMessageId <id>] [--contentType <auto|text|html|markdown>] [--subject <title>] [--scheduleAt <iso>] (aliases: --to, --reply)

Send a message to a conversation (defaults to self-notes 48:notes). Supports Markdown tables and @mentions.

teams_get_message

msteams message

--conversationId <id> --messageId <id> (aliases: --to, --msg)

Get a single message by ID with full content and metadata.

teams_create_group_chat

msteams create_group_chat

--userIds <id1,id2,...> [--topic <title>]

Create a new group chat with multiple people.

teams_edit_message

msteams edit_message

--conversationId <id> --messageId <id> --content <text> [--contentType <type>] (aliases: --to, --msg)

Edit the text content of a message you previously sent.

teams_delete_message

msteams delete_message

--conversationId <id> --messageId <id> (aliases: --to, --msg)

Delete a message sent by you (soft delete).

teams_get_unread

msteams unread

[--conversationId <id>] (alias: --to)

Fetch unread conversation status across Teams or for a specific conversation.

teams_mark_read

msteams mark_read

--conversationId <id> --messageId <id> (aliases: --to, --msg)

Mark a conversation as read up to a specific message.

teams_wait_for_reply

msteams wait_for_reply

[--conversationId <id>] [--fromUrl <url>] [--maxWaitSeconds <n>] [--intervalSeconds <n>] [--includeSelf] (alias: --to)

Block/poll until a new message arrives in a conversation.

teams_get_activity

msteams activity

[--limit <n>] [--syncState <token>]

Fetch your activity feed (mentions, reactions, replies, and notifications).

teams_search_emoji

msteams emoji <query>

--query <text>

Search for emojis by name or keyword.

teams_add_reaction

msteams add_reaction

--conversationId <id> --messageId <id> --emoji <key> (aliases: --to, --msg)

React to a message (like, heart, laugh, surprised, sad, angry, or custom emoji).

teams_remove_reaction

msteams remove_reaction

--conversationId <id> --messageId <id> --emoji <key> (aliases: --to, --msg)

Remove an emoji reaction from a message.

teams_get_saved_messages

msteams saved_messages

[--limit <n>]

List messages bookmarked/saved by the user.

teams_save_message

msteams save_message

--conversationId <id> --messageId <id> [--rootMessageId <id>] (aliases: --to, --msg)

Bookmark/save a message in Teams.

teams_unsave_message

msteams unsave_message

--conversationId <id> --messageId <id> [--rootMessageId <id>] (aliases: --to, --msg)

Remove a saved bookmark from a message.

teams_get_followed_threads

msteams followed_threads

[--limit <n>]

List channel threads you are following in Teams.

Search & Directory

MCP Tool Name

CLI Command

Parameters

Description

teams_search

msteams search <query>

[--maxResults <n>] [--from <n>] [--size <n>]

Semantic natural language search across messages, chats, and channels with query operators.

teams_search_email

msteams email <query>

[--maxResults <n>] [--from <n>] [--size <n>]

Search your Exchange/Outlook inbox and sent mail from Teams context.

teams_find_channel

msteams channel <query>

[--limit <n>]

Find Teams channels by name.

teams_search_people

msteams people <query>

[--limit <n>]

Search institutional directory for colleagues, professors, and classmates by name or email.

Files & Meeting Transcripts

MCP Tool Name

CLI Command

Parameters

Description

teams_get_shared_files

msteams shared_files

--conversationId <id> [--pageSize <n>] [--skipToken <token>] (alias: --to)

List files and links shared within a conversation with download URLs.

teams_download_file

msteams download_file

--url <url> --outputPath <path>

Download supported SharePoint web URLs with Playwright; Graph drive-item URLs are unsupported.

teams_get_meetings

msteams meetings

[--startDate <iso>] [--endDate <iso>] [--limit <n>]

Retrieve upcoming and past calendar events and Teams meetings.

teams_get_transcript

msteams transcript

--threadId <id> [--meetingDate <iso>]

Download automated meeting transcripts with speaker timestamps.

teams_get_tags

msteams tags

--teamId <id> [--query <text>]

Get channel tags for a Teams team (used for @mention tags).

People & Contacts

MCP Tool Name

CLI Command

Parameters

Description

teams_get_me

msteams me

(None)

Get profile details, tenant ID, and email of the logged-in user.

teams_get_person

msteams person <mri>

--mris <mri,mri...>

Look up detailed job title, department, and contact info for people by MRI.

teams_get_frequent_contacts

msteams frequent_contacts

[--limit <n>]

Get the list of contacts you interact with most frequently.

teams_get_favorites

msteams favorites

(None)

Get your favourite/pinned conversations in Teams.

teams_add_favorite

msteams add_favorite

--conversationId <id> (alias: --to)

Pin a conversation to favorites.

teams_remove_favorite

msteams remove_favorite

--conversationId <id> (alias: --to)

Remove a conversation from favorites.


Step-by-Step Assignment Workflow

Here is how an AI assistant or student automates coursework using msteams:

Step 1: Check Coursework Deadlines

msteams assignments --status active

Output returns all pending homework, modules, quizzes, and due dates across your enrolled classes.

Step 2: Read Detailed Instructions &amp; Download Resources

msteams assignment --classId "19:abc...tacx" --assignmentId "a8f3b..."

Returns assignment details and resource links. For downloads, only HTTPS SharePoint web URLs are supported; Graph drive-item links must be opened in Teams.

Step 3: Attach Local Submission File

# Attach file and optionally turn in immediately:
msteams attach_file \
  --classId "19:abc...tacx" \
  --assignmentId "a8f3b..." \
  --filePath "/path/to/report.pdf" \
  --turnIn

Playwright waits for the file name to appear, then uses the Assignments API to verify turn-in state. Pass both --classId and --assignmentId with --turnIn. Filename presence alone is not definitive proof of the exact attachment; check Teams before relying on graded work.

Step 4: Undo Turn-In or Remove Attachment (If needed)

# Undo turn-in:
msteams submission_action --action unsubmit --classId "19:abc..." --assignmentId "a8f3b..." --submissionId "sub_01..."

# Remove attachment:
msteams remove_attachment --classId "19:abc..." --assignmentId "a8f3b..." --fileName "report.pdf"

Linux Dual-Boot &amp; Native Setup Guide

If you are using Linux (Ubuntu, Debian, Fedora, Arch, Manjaro, Pop!_OS) or testing on a dual-boot setup:

Prerequisites &amp; Browser Installation

Ensure you have Node.js >= 20 and any Chromium-based browser installed:

1. Install Node.js 20+

# Ubuntu / Debian
curl -fsSL https://deb.nodesource.com/setup_20.x | sudo -E bash -
sudo apt install -y nodejs git

# Fedora
sudo dnf install -y nodejs git

# Arch Linux
sudo pacman -S nodejs npm git

2. Install or Use Your Default Browser

mcp-server-msteams automatically detects your system's default browser directly from your operating system settings (via xdg-settings on Linux, UserChoice registry on Windows, or AppleScript on macOS).

It coordinates with:

  • Chromium-based: Google Chrome, Microsoft Edge, Brave, Opera, Vivaldi, Chromium

  • Non-Chromium: Mozilla Firefox (uses dedicated browser-profile-firefox session with automated fallback to Chromium if remote debugging protocol is unavailable)

If you don't already have a browser installed on Linux, install any of the following:

# Option A: Google Chrome (Ubuntu / Debian)
wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb
sudo apt install -y ./google-chrome-stable_current_amd64.deb

# Option B: Brave Browser (Ubuntu / Debian)
sudo curl -fsSLo /usr/share/keyrings/brave-browser-archive-keyring.gpg https://brave-browser-apt-release.s3.brave.com/brave-browser-archive-keyring.gpg
echo "deb [signed-by=/usr/share/keyrings/brave-browser-archive-keyring.gpg] https://brave-browser-apt-release.s3.brave.com/ stable main" | sudo tee /etc/apt/sources.list.d/brave-browser-release.list
sudo apt update && sudo apt install -y brave-browser

# Option C: Mozilla Firefox (Ubuntu / Debian)
sudo apt install -y firefox

# Option D: Chromium (Ubuntu / Debian)
sudo apt install -y chromium-browser

# Option E: Microsoft Edge (Ubuntu / Debian)
curl https://packages.microsoft.com/keys/microsoft.asc | gpg --dearmor > microsoft.gpg
sudo install -o root -g root -m 644 microsoft.gpg /etc/apt/trusted.gpg.d/
sudo sh -c 'echo "deb [arch=amd64] https://packages.microsoft.com/repos/edge stable main" > /etc/apt/sources.list.d/microsoft-edge-dev.list'
sudo apt update && sudo apt install -y microsoft-edge-stable

Cloning &amp; Local Verification

# 1. Clone repository
git clone https://github.com/kasim672/mcp-server-msteams.git
cd mcp-server-msteams

# 2. Install dependencies & build
npm install
npm run build

# 3. Run unit tests (574 tests)
npm test

# 4. Sign in to Teams (opens browser GUI)
node dist/cli.js login

# 5. Verify authentication status
node dist/cli.js status

Environment Variables

Configure optional overrides in your ~/.bashrc or ~/.zshrc:

Variable

Description

Example

TEAMS_BROWSER

Explicitly choose browser engine (chrome, edge, brave, firefox, chromium). Defaults to auto-detecting system default browser.

export TEAMS_BROWSER=firefox

TEAMS_BROWSER_PATH

Absolute path to custom browser executable.

export TEAMS_BROWSER_PATH=/usr/bin/google-chrome

LOG_LEVEL

Logging verbosity (debug, info, warn, error).

export LOG_LEVEL=debug


Windows Setup Guide

  1. Ensure Node.js >= 20 is installed from nodejs.org.

  2. Microsoft Edge is pre-installed on Windows 10/11 and is automatically detected. Brave and Google Chrome are also supported.

  3. In PowerShell or Command Prompt:

# Clone and build
git clone https://github.com/kasim672/mcp-server-msteams.git
cd mcp-server-msteams
npm install
npm run build
npm test

# Initial login
node dist\cli.js login

# Check status
node dist\cli.js status

Session data on Windows is securely stored in %APPDATA%\teams-mcp-server\.


Development &amp; Testing

# Run all unit tests once
npm test

# Run tests in watch mode
npm run test:watch

# Run code coverage report
npm run test:coverage

# TypeScript type checking
npm run typecheck

# Code linting
npm run lint

Uninstall and erase local sessions

npm uninstall --global mcp-server-msteams removes the package, but preserves the local Teams session. To remove your cached credentials and persistent browser profile as well, from a source checkout:

# PowerShell: uninstall and erase local credentials
.\\scripts\\uninstall.ps1 -PurgeSession
REM CMD: uninstall only (retains the session)
scripts\\uninstall.cmd
# Linux/macOS: uninstall and erase local credentials
sh scripts/uninstall.sh --purge-session

Windows session directory: %APPDATA%\\teams-mcp-server. Unix: ~/.teams-mcp-server. Remove the MCP entry from your AI assistant's configuration separately; npm cannot edit every client's settings.

Privacy and limitations

  • No Microsoft Graph API, Graph-token exchange, separate Azure app registration, or Azure CLI is used. Teams still relies on Microsoft's normal sign-in service.

  • Session-state files and the browser profile are local. Requests still go to Microsoft, and AI assistants may transmit tool outputs to their model provider under the assistant's own privacy policy.

  • teams_download_file now uses a signed-in browser to download SharePoint HTTPS links only. Some SharePoint viewers still need a manual download. Graph-style education attachment fileUrl values are not supported.

  • Existing GitHub Actions configuration was not expanded, and no new MCP capabilities were added.


Security &amp; Encryption

  • No Third-Party Relays: Every API request communicates directly from your machine to Microsoft's official cloud endpoints (*.microsoft.com, *.office.com).

  • Encrypted Local Storage: Cached session-state files use AES-256-GCM and a random local session.key, not a hostname-based key. Both the key and browser profile stay in the user directory; this is not hardware-backed protection. Version-1 encrypted files are still readable for migration.

  • Owner-Only File Permissions: On Linux and macOS, the session directory is created with 0o700 (rwx------) and files with 0o600 (rw-------).

  • No Credential Escalation: The server operates strictly within the permissions of your logged-in Microsoft Teams account.


Troubleshooting &amp; FAQ

Q: Browser fails to launch on Linux with "Missing $DISPLAY"?

mcp-server-msteams automatically detects headless Linux terminal environments and switches to headless mode. For the initial login (msteams login), ensure you are running in a desktop GUI environment (GNOME, KDE, XFCE, Sway) or pass an X11 forwarding session (ssh -X).

Q: "SingletonLock" error when starting browser?

If a browser session crashed unexpectedly, Chromium may leave behind a lock file. mcp-server-msteams automatically detects and clears stale SingletonLock files older than your running process. If needed, you can delete it manually:

# Linux / macOS
rm -f ~/.teams-mcp-server/browser-profile/SingletonLock

# Windows (PowerShell)
Remove-Item -Force "$env:APPDATA\teams-mcp-server\browser-profile\SingletonLock"

Q: How do I completely reset my login session?

Delete the local configuration folder and run msteams login again:

# Linux / macOS
rm -rf ~/.teams-mcp-server

# Windows (PowerShell)
Remove-Item -Recurse -Force "$env:APPDATA\teams-mcp-server"

License

This project is licensed under the MIT License. See the LICENSE file for details.

Developed and maintained by Kasim Ghanchi (@kasim672).

Tool Schema Changelog

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

Loading tool schema changelog…

    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 access Microsoft Teams, chats, users, files, and organizational data via Microsoft Graph APIs, including messaging, search, attachment handling, and user management.
      12 npm
      MIT
    • A
      license
      Not graded
      quality
      A
      maintenance
      Enables AI assistants to interact with Microsoft Teams and Microsoft Graph for messaging, chat and channel operations, user and team discovery, file uploads/downloads, and advanced message search.
      12 npm
      MIT
    • A
      license
      Not graded
      quality
      A
      maintenance
      Enables AI assistants to interact with Microsoft Teams and Microsoft Graph data, including messaging, chat and channel operations, user search, file uploads, and message discovery via search.
      12 npm
      MIT