AgentStack
MCP verified MIT Self-run

Microsoft Teams API

mcp-maxim-mazurok-teams-api · by Maxim-Mazurok

AI-native Microsoft Teams integration — read chats, send messages, search people

No reviews yet
0 installs
9 views
0.0% view→install

Install

$ agentstack add mcp-maxim-mazurok-teams-api

✓ scanned · ✓ verified — works with Claude Code, Cursor, and more.

Security review

✓ Passed

No issues found. Passed automated security review. · v0.10.0 How review works →

  • Prompt-injection patterns
  • Secret / credential exfiltration
  • Dangerous shell & filesystem operations
  • Untrusted network calls
  • Known-malicious package signatures

What it can access

  • Network access No
  • Filesystem access No
  • Shell / process execution No
  • Environment & secrets No
  • Dynamic code execution No

From automated source analysis of v0.10.0. “Used” means the capability is present in the source — more access means more to trust, not that it’s unsafe.

Are you the author of Microsoft Teams API? Claim this listing to set pricing, connect Stripe payouts, and keep 70% of every sale.
Sign up to claim

About

teams-api

AI-native Microsoft Teams integration — read conversations, send messages, and manage members via the Teams Chat Service REST API.

Designed for autonomous AI agents that need to interact with Teams: read messages, reply to people, monitor conversations, and participate in team workflows.

[](https://insiders.vscode.dev/redirect?url=vscode%3Amcp%2Finstall%3F%257B%2522name%2522%253A%2522teams%2522%252C%2522command%2522%253A%2522npx%2522%252C%2522args%2522%253A%255B%2522-y%2522%252C%2522-p%2522%252C%2522teams-api%2540latest%2522%252C%2522teams-api-mcp%2522%255D%252C%2522env%2522%253A%257B%2522TEAMSLOGIN%2522%253A%2522true%2522%257D%257D) [](https://insiders.vscode.dev/redirect?url=vscode-insiders%3Amcp%2Finstall%3F%257B%2522name%2522%253A%2522teams%2522%252C%2522command%2522%253A%2522npx%2522%252C%2522args%2522%253A%255B%2522-y%2522%252C%2522-p%2522%252C%2522teams-api%2540latest%2522%252C%2522teams-api-mcp%2522%255D%252C%2522env%2522%253A%257B%2522TEAMSLOGIN%2522%253A%2522true%2522%257D%257D) [](https://cursor.com/install-mcp?name=teams&config=%7B%22name%22%3A%22teams%22%2C%22command%22%3A%22npx%22%2C%22args%22%3A%5B%22-y%22%2C%22-p%22%2C%22teams-api%40latest%22%2C%22teams-api-mcp%22%5D%2C%22env%22%3A%7B%22TEAMS_LOGIN%22%3A%22true%22%7D%7D) [](https://www.npmjs.com/package/teams-api) [](https://registry.modelcontextprotocol.io)

> [!NOTE] > This project was AI-generated using Claude Opus 4.6 with human guidance and review.

Getting Started

teams-api can be used in three ways:

  1. MCP server for editors and AI tools — the recommended path for most users.
  2. CLI for direct terminal use.
  3. Programmatic Node.js library — advanced, documented near the end.

Prerequisites

  • Node.js (v18 or later) — required for npx, which all MCP and CLI commands use.

Install in your editor

The quickest way to get started is to click one of the install badges above, or follow the instructions for your editor below.

Editor-specific instructions

VS Code / VS Code Insiders

Option 1 — One-click install:

[](https://insiders.vscode.dev/redirect?url=vscode%3Amcp%2Finstall%3F%257B%2522name%2522%253A%2522teams%2522%252C%2522command%2522%253A%2522npx%2522%252C%2522args%2522%253A%255B%2522-y%2522%252C%2522-p%2522%252C%2522teams-api%2540latest%2522%252C%2522teams-api-mcp%2522%255D%252C%2522env%2522%253A%257B%2522TEAMSLOGIN%2522%253A%2522true%2522%257D%257D) [](https://insiders.vscode.dev/redirect?url=vscode-insiders%3Amcp%2Finstall%3F%257B%2522name%2522%253A%2522teams%2522%252C%2522command%2522%253A%2522npx%2522%252C%2522args%2522%253A%255B%2522-y%2522%252C%2522-p%2522%252C%2522teams-api%2540latest%2522%252C%2522teams-api-mcp%2522%255D%252C%2522env%2522%253A%257B%2522TEAMSLOGIN%2522%253A%2522true%2522%257D%257D)

Option 2 — CLI:

macOS / Linux:

# VS Code
code --add-mcp '{"name":"teams","command":"npx","args":["-y","-p","teams-api@latest","teams-api-mcp"],"env":{"TEAMS_LOGIN":"true"}}'

# VS Code Insiders
code-insiders --add-mcp '{"name":"teams","command":"npx","args":["-y","-p","teams-api@latest","teams-api-mcp"],"env":{"TEAMS_LOGIN":"true"}}'

Windows (PowerShell):

# VS Code
code --add-mcp '{"name":"teams","command":"npx","args":["-y","-p","teams-api@latest","teams-api-mcp"],"env":{"TEAMS_LOGIN":"true"}}'

# VS Code Insiders
code-insiders --add-mcp '{"name":"teams","command":"npx","args":["-y","-p","teams-api@latest","teams-api-mcp"],"env":{"TEAMS_LOGIN":"true"}}'

Windows (CMD):

rem VS Code
code --add-mcp "{\"name\":\"teams\",\"command\":\"npx\",\"args\":[\"-y\",\"-p\",\"teams-api@latest\",\"teams-api-mcp\"],\"env\":{\"TEAMS_LOGIN\":\"true\"}}"

rem VS Code Insiders
code-insiders --add-mcp "{\"name\":\"teams\",\"command\":\"npx\",\"args\":[\"-y\",\"-p\",\"teams-api@latest\",\"teams-api-mcp\"],\"env\":{\"TEAMS_LOGIN\":\"true\"}}"

Option 3 — Manual config:

Add to your VS Code MCP config (.vscode/mcp.json or User Settings):

{
  "mcpServers": {
    "teams": {
      "command": "npx",
      "args": ["-y", "-p", "teams-api@latest", "teams-api-mcp"],
      "env": {
        "TEAMS_LOGIN": "true"
      }
    }
  }
}

Cursor

[](https://cursor.com/install-mcp?name=teams&config=%7B%22name%22%3A%22teams%22%2C%22command%22%3A%22npx%22%2C%22args%22%3A%5B%22-y%22%2C%22-p%22%2C%22teams-api%40latest%22%2C%22teams-api-mcp%22%5D%2C%22env%22%3A%7B%22TEAMS_LOGIN%22%3A%22true%22%7D%7D)

Or add to ~/.cursor/mcp.json:

{
  "mcpServers": {
    "teams": {
      "command": "npx",
      "args": ["-y", "-p", "teams-api@latest", "teams-api-mcp"],
      "env": {
        "TEAMS_LOGIN": "true"
      }
    }
  }
}

Claude Desktop

Add to claude_desktop_config.json (how to find it):

{
  "mcpServers": {
    "teams": {
      "command": "npx",
      "args": ["-y", "-p", "teams-api@latest", "teams-api-mcp"],
      "env": {
        "TEAMS_LOGIN": "true"
      }
    }
  }
}

Claude Code

claude mcp add teams -- npx -y -p teams-api@latest teams-api-mcp

Then set the environment variable TEAMS_LOGIN=true in your shell before starting Claude Code. The server will ask for your email interactively on first use.

Windsurf

Add to ~/.codeium/windsurf/mcp_config.json:

{
  "mcpServers": {
    "teams": {
      "command": "npx",
      "args": ["-y", "-p", "teams-api@latest", "teams-api-mcp"],
      "env": {
        "TEAMS_LOGIN": "true"
      }
    }
  }
}

> [!TIP] > On macOS with a FIDO2 passkey, replace TEAMS_LOGIN with TEAMS_AUTO for fully unattended auth. See [Authentication](#authentication) for details.

CLI

You can also use the CLI directly without installing anything:

npx -y -p teams-api@latest teams-api auth --login
npx -y -p teams-api@latest teams-api list-conversations --login --limit 20

If you use the CLI often, a global install is optional:

npm install -g teams-api
teams-api auth --login

Advanced Topics

Manual token usage, debug-session auth, and programmatic Node.js usage are covered later in this README.

Platform support

| Feature | macOS | Windows / Linux | | ---------------------- | -------------- | --------------------------------- | | Interactive login | Full support | Full support | | Auto-login (FIDO2) | Full support | Not supported | | Debug session | Full support | Full support | | Direct token | Full support | Full support | | Token caching | macOS Keychain | Windows DPAPI / Linux secret-tool | | CLI & MCP server | Full support | Full support | | Programmatic API | Full support | Full support |

> [!NOTE] > Windows Defender false positive: Older versions of this package used inline PowerShell to call the Windows DPAPI — a pattern that Windows Defender flags as ransomware-like behavior. This has been replaced with native Windows Credential Manager storage via keytar. If you hit issues on an older version, upgrade and re-run teams-api auth --login. See [SECURITY.md](./SECURITY.md) for details.

Authentication

Most users do not need to manage tokens manually.

If you use interactive login, auto-login, or a Chrome debug session, teams-api captures the full token bundle automatically from Teams web traffic. That includes the base skypeToken plus the extra bearer tokens used for profile resolution and reliable people/chat/channel search.

Those flows also detect the Teams chat region automatically from the intercepted request URLs, so most users do not need to set --region or TEAMS_REGION.

On macOS, prefer auto-login when you have a platform authenticator / FIDO2 passkey set up. On other platforms, use interactive login.

Direct token usage is the advanced/manual path.

| Method | Description | Automation | Platform | | --------------------- | ---------------------------------------------------------------------------- | ---------------- | -------- | | Auto-login | Playwright launches system Chrome and captures the full token bundle | Fully unattended | macOS | | Interactive login | Opens a browser window and captures skype, middle-tier, and Substrate tokens | One-time manual | All | | Debug session | Connects to a running Chrome instance and captures the full token bundle | Semi-manual | All | | Direct token | Provide a previously captured token or token bundle explicitly | Manual | All |

Auto-login (macOS only)

Requires macOS with a platform authenticator (e.g. Intune Company Portal) and a FIDO2 passkey enrolled. Fully unattended — no browser window appears.

Interactive login (recommended for Windows / Linux)

The easiest cross-platform option. A browser window opens, you log in with any method your organization supports (password, MFA, passkey, etc.), and the token is captured automatically:

teams-api auth --login

Optionally pre-fill your email:

teams-api auth --login --email you@example.com

> [!NOTE] > Interactive login prefers an installed browser (Edge or Chrome) when available, and falls back to Playwright's bundled Chromium.

Advanced / manual methods

Debug session — start Chrome with --remote-debugging-port=9222, navigate to Teams and log in, then run:

teams-api auth --debug-port 9222

Direct token — advanced/manual only. Extract x-skypetoken from browser DevTools (Network tab) and pass it directly:

teams-api list-conversations --token "" --region emea

If you want reliable people/chat/channel lookup and profile resolution on the direct-token path, also pass the extra bearer tokens captured from Teams requests:

teams-api find-people \
  --token "" \
  --bearer-token "" \
  --substrate-token "" \
  --region emea \
  --query "Jane Doe"

> [!TIP] > Skip this section if you are using --login, --auto, TEAMS_LOGIN, or TEAMS_AUTO. Those modes capture the full token bundle automatically.

> [!TIP] > Direct-token mode still needs an explicit region. See [API regions](#api-regions) below.

CLI

Preferred without install:

npx -y -p teams-api@latest teams-api  [options]

Optional global install for frequent use:

npm install -g teams-api
teams-api  [options]

The examples below use teams-api for readability. If you are not installing globally, replace it with npx -y -p teams-api@latest teams-api.

Auth flags (available on all commands)

| Flag | Description | | --------------------------- | -------------------------------------------------------------------------------- | | --login | Interactive browser login (all platforms) | | --auto | Auto-acquire token via FIDO2 passkey (macOS) | | --email | Corporate email (required with --auto, optional otherwise) | | --token | Use an existing skype token (advanced/manual) | | --bearer-token | Optional middle-tier bearer token (advanced/manual) | | --substrate-token | Optional Substrate bearer token (advanced/manual) | | --debug-port | Chrome debug port (default: 9222) | | --region | API region override. Auto-detected for login/debug auth; required with --token | | --format | Output format: concise, detailed | | --output | Export output to file (default format: concise) |

Examples

# Acquire a token (interactive — all platforms)
teams-api auth --login

# Acquire a token (auto — macOS with FIDO2)
teams-api auth --auto --email you@example.com

# List conversations
teams-api list-conversations --login --limit 20 --format detailed

# Find a conversation by topic
teams-api find-conversation --auto --email you@example.com --query "Design Review"

# Find a 1:1 chat by person name
teams-api find-one-on-one --auto --email you@example.com --person-name "Jane Doe"

# Read messages (by topic name, person name, or direct ID)
teams-api get-messages --auto --email you@example.com --chat "Design Review"
teams-api get-messages --auto --email you@example.com --to "Jane Doe" --max-pages 5
teams-api get-messages --auto --email you@example.com --conversation-id "19:abc@thread.v2" --format detailed

# Newest-first order (API returns newest-first; default is oldest-first/chronological)
teams-api get-messages --auto --email you@example.com --chat "General" --order newest-first

# Send a message
teams-api send-message --auto --email you@example.com --to "Jane Doe" --content "Hello!"
teams-api send-message --auto --email you@example.com --chat "Design Review" --content "Status update"

# List members
teams-api get-members --auto --email you@example.com --chat "Design Review"

# Get current user info
teams-api whoami --auto --email you@example.com

# Export messages to a file (default format: concise)
teams-api get-messages --auto --email you@example.com --chat "General" --output exports/general.md

# Export as JSON to a file
teams-api get-messages --auto --email you@example.com --chat "General" --format detailed --output exports/general.json

MCP server

The MCP server exposes Teams operations as tools for AI agents via stdio transport. See [Getting Started](#install-in-your-editor) for editor-specific setup.

Advanced: direct token configuration

Use this only if you already have tokens from another flow or need to avoid browser-based auth entirely:

{
  "mcpServers": {
    "teams": {
      "command": "npx",
      "args": ["-y", "-p", "teams-api@latest", "teams-api-mcp"],
      "env": {
        "TEAMS_TOKEN": "",
        "TEAMS_BEARER_TOKEN": "",
        "TEAMS_SUBSTRATE_TOKEN": "",
        "TEAMS_REGION": "emea"
      }
    }
  }
}

> [!TIP] > If you do use direct tokens, teams-api auth --login prints the full token object as JSON. For basic chat operations, skypeToken is enough. For reliable people/chat/channel search and profile resolution, also pass bearerToken and substrateToken.

Environment variables

| Variable | Description | | ------------------------------- | -------------------------------------------------------------------------------------- | | TEAMS_TOKEN | Pre-existing skype token | | TEAMS_BEARER_TOKEN | Optional middle-tier bearer token | | TEAMS_SUBSTRATE_TOKEN | Optional Substrate bearer token | | TEAMS_REGION | API region override. Required with TEAMS_TOKEN; optional otherwise | | TEAMS_EMAIL | Corporate email. Optional — the server prompts the AI agent if needed | | TEAMS_AUTO | Set to true to enable auto-login (macOS + FIDO2) | | TEAMS_LOGIN | Set to true to enable interactive browser login | | TEAMS_DEBUG_PORT | Chrome debug port (default: 922

Source & license

This open-source MCP server is cataloged on AgentStack and links to its original source — we do not rehost the code.

Install and usage instructions live in the source repository linked above.

Reviews

No reviews yet — be the first.

Versions

  • v0.10.0 Imported from the upstream source.