{
  "markdown": "# teams-api\n\nAI-native Microsoft Teams integration — read conversations, send messages, and manage members via the Teams Chat Service REST API.\n\nDesigned for autonomous AI agents that need to interact with Teams: read messages, reply to people, monitor conversations, and participate in team workflows.\n\n[<img src=\"https://img.shields.io/badge/VS_Code-Install_Server-0098FF?style=flat-square&logo=visualstudiocode&logoColor=white\" alt=\"Install in VS Code\">](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%2522TEAMS_LOGIN%2522%253A%2522true%2522%257D%257D)\n[<img src=\"https://img.shields.io/badge/VS_Code_Insiders-Install_Server-24bfa5?style=flat-square&logo=visualstudiocode&logoColor=white\" alt=\"Install in VS Code Insiders\">](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%2522TEAMS_LOGIN%2522%253A%2522true%2522%257D%257D)\n[![Install in Cursor](https://cursor.com/deeplink/mcp-install-dark.svg)](https://cursor.com/en/install-mcp?name=teams&config=eyJjb21tYW5kIjoibnB4IiwiYXJncyI6WyIteSIsIi1wIiwidGVhbXMtYXBpQGxhdGVzdCIsInRlYW1zLWFwaS1tY3AiXSwiZW52Ijp7IlRFQU1TX0xPR0lOIjoidHJ1ZSJ9fQ%3D%3D)\n[![npm version](https://img.shields.io/npm/v/teams-api?style=flat-square)](https://www.npmjs.com/package/teams-api)\n[![MCP Registry](https://img.shields.io/badge/MCP_Registry-teams--api-green?style=flat-square)](https://registry.modelcontextprotocol.io)\n\n> [!NOTE]\n> This project was AI-generated using Claude Opus 4.6 with human guidance and review.\n\n## Getting Started\n\n`teams-api` can be used in three ways:\n\n1. **MCP server** for editors and AI tools — the recommended path for most users.\n2. **CLI** for direct terminal use.\n3. **Programmatic Node.js library** — advanced, documented near the end.\n\n### Prerequisites\n\n- **[Node.js](https://nodejs.org/)** (v18 or later) — required for `npx`, which all MCP and CLI commands use.\n\n### Install in your editor\n\nThe quickest way to get started is to click one of the install badges above, or follow the instructions for your editor below.\n\n#### Editor-specific instructions\n\n<details>\n<summary><strong>VS Code / VS Code Insiders</strong></summary>\n\n**Option 1 — One-click install:**\n\n[<img src=\"https://img.shields.io/badge/VS_Code-Install_Server-0098FF?style=flat-square&logo=visualstudiocode&logoColor=white\" alt=\"Install in VS Code\">](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%2522TEAMS_LOGIN%2522%253A%2522true%2522%257D%257D)\n[<img src=\"https://img.shields.io/badge/VS_Code_Insiders-Install_Server-24bfa5?style=flat-square&logo=visualstudiocode&logoColor=white\" alt=\"Install in VS Code Insiders\">](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%2522TEAMS_LOGIN%2522%253A%2522true%2522%257D%257D)\n\n**Option 2 — CLI:**\n\nmacOS / Linux:\n\n```bash\n# VS Code\ncode --add-mcp '{\"name\":\"teams\",\"command\":\"npx\",\"args\":[\"-y\",\"-p\",\"teams-api@latest\",\"teams-api-mcp\"],\"env\":{\"TEAMS_LOGIN\":\"true\"}}'\n\n# VS Code Insiders\ncode-insiders --add-mcp '{\"name\":\"teams\",\"command\":\"npx\",\"args\":[\"-y\",\"-p\",\"teams-api@latest\",\"teams-api-mcp\"],\"env\":{\"TEAMS_LOGIN\":\"true\"}}'\n```\n\nWindows (PowerShell):\n\n```powershell\n# VS Code\ncode --add-mcp '{\"name\":\"teams\",\"command\":\"npx\",\"args\":[\"-y\",\"-p\",\"teams-api@latest\",\"teams-api-mcp\"],\"env\":{\"TEAMS_LOGIN\":\"true\"}}'\n\n# VS Code Insiders\ncode-insiders --add-mcp '{\"name\":\"teams\",\"command\":\"npx\",\"args\":[\"-y\",\"-p\",\"teams-api@latest\",\"teams-api-mcp\"],\"env\":{\"TEAMS_LOGIN\":\"true\"}}'\n```\n\nWindows (CMD):\n\n```cmd\nrem VS Code\ncode --add-mcp \"{\\\"name\\\":\\\"teams\\\",\\\"command\\\":\\\"npx\\\",\\\"args\\\":[\\\"-y\\\",\\\"-p\\\",\\\"teams-api@latest\\\",\\\"teams-api-mcp\\\"],\\\"env\\\":{\\\"TEAMS_LOGIN\\\":\\\"true\\\"}}\"\n\nrem VS Code Insiders\ncode-insiders --add-mcp \"{\\\"name\\\":\\\"teams\\\",\\\"command\\\":\\\"npx\\\",\\\"args\\\":[\\\"-y\\\",\\\"-p\\\",\\\"teams-api@latest\\\",\\\"teams-api-mcp\\\"],\\\"env\\\":{\\\"TEAMS_LOGIN\\\":\\\"true\\\"}}\"\n```\n\n**Option 3 — Manual config:**\n\nAdd to your VS Code MCP config (`.vscode/mcp.json` or User Settings):\n\n```json\n{\n  \"mcpServers\": {\n    \"teams\": {\n      \"command\": \"npx\",\n      \"args\": [\"-y\", \"-p\", \"teams-api@latest\", \"teams-api-mcp\"],\n      \"env\": {\n        \"TEAMS_LOGIN\": \"true\"\n      }\n    }\n  }\n}\n```\n\n</details>\n\n<details>\n<summary><strong>Cursor</strong></summary>\n\n[![Install in Cursor](https://cursor.com/deeplink/mcp-install-dark.svg)](https://cursor.com/en/install-mcp?name=teams&config=eyJjb21tYW5kIjoibnB4IiwiYXJncyI6WyIteSIsIi1wIiwidGVhbXMtYXBpQGxhdGVzdCIsInRlYW1zLWFwaS1tY3AiXSwiZW52Ijp7IlRFQU1TX0xPR0lOIjoidHJ1ZSJ9fQ%3D%3D)\n\nOr add to `~/.cursor/mcp.json`:\n\n```json\n{\n  \"mcpServers\": {\n    \"teams\": {\n      \"command\": \"npx\",\n      \"args\": [\"-y\", \"-p\", \"teams-api@latest\", \"teams-api-mcp\"],\n      \"env\": {\n        \"TEAMS_LOGIN\": \"true\"\n      }\n    }\n  }\n}\n```\n\n</details>\n\n<details>\n<summary><strong>Claude Desktop</strong></summary>\n\nAdd to `claude_desktop_config.json` ([how to find it](https://modelcontextprotocol.io/quickstart/user)):\n\n```json\n{\n  \"mcpServers\": {\n    \"teams\": {\n      \"command\": \"npx\",\n      \"args\": [\"-y\", \"-p\", \"teams-api@latest\", \"teams-api-mcp\"],\n      \"env\": {\n        \"TEAMS_LOGIN\": \"true\"\n      }\n    }\n  }\n}\n```\n\n</details>\n\n<details>\n<summary><strong>Claude Code</strong></summary>\n\n```bash\nclaude mcp add teams -- npx -y -p teams-api@latest teams-api-mcp\n```\n\nThen 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.\n\n</details>\n\n<details>\n<summary><strong>Windsurf</strong></summary>\n\nAdd to `~/.codeium/windsurf/mcp_config.json`:\n\n```json\n{\n  \"mcpServers\": {\n    \"teams\": {\n      \"command\": \"npx\",\n      \"args\": [\"-y\", \"-p\", \"teams-api@latest\", \"teams-api-mcp\"],\n      \"env\": {\n        \"TEAMS_LOGIN\": \"true\"\n      }\n    }\n  }\n}\n```\n\n</details>\n\n> [!TIP]\n> On macOS with a FIDO2 passkey, replace `TEAMS_LOGIN` with `TEAMS_AUTO` for fully unattended auth. See [Authentication](#authentication) for details.\n\n### CLI\n\nYou can also use the CLI directly without installing anything:\n\n```bash\nnpx -y -p teams-api@latest teams-api auth --login\nnpx -y -p teams-api@latest teams-api list-conversations --login --limit 20\n```\n\nIf you use the CLI often, a global install is optional:\n\n```bash\nnpm install -g teams-api\nteams-api auth --login\n```\n\n### Advanced Topics\n\nManual token usage, debug-session auth, and programmatic Node.js usage are covered later in this README.\n\n## Platform support\n\n| Feature                | macOS          | Windows / Linux                   |\n| ---------------------- | -------------- | --------------------------------- |\n| **Interactive login**  | Full support   | Full support                      |\n| **Auto-login (FIDO2)** | Full support   | Not supported                     |\n| **Debug session**      | Full support   | Full support                      |\n| **Direct token**       | Full support   | Full support                      |\n| **Token caching**      | macOS Keychain | Windows DPAPI / Linux secret-tool |\n| **CLI & MCP server**   | Full support   | Full support                      |\n| **Programmatic API**   | Full support   | Full support                      |\n\n> [!NOTE]\n> **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](https://github.com/atom/node-keytar). If you hit issues on an older version, upgrade and re-run `teams-api auth --login`. See [SECURITY.md](./SECURITY.md) for details.\n\n## Authentication\n\nMost users do not need to manage tokens manually.\n\nIf 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.\n\nThose 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`.\n\nOn macOS, prefer auto-login when you have a platform authenticator / FIDO2 passkey set up. On other platforms, use interactive login.\n\nDirect token usage is the advanced/manual path.\n\n| Method                | Description                                                                  | Automation       | Platform |\n| --------------------- | ---------------------------------------------------------------------------- | ---------------- | -------- |\n| **Auto-login**        | Playwright launches system Chrome and captures the full token bundle         | Fully unattended | macOS    |\n| **Interactive login** | Opens a browser window and captures skype, middle-tier, and Substrate tokens | One-time manual  | All      |\n| **Debug session**     | Connects to a running Chrome instance and captures the full token bundle     | Semi-manual      | All      |\n| **Direct token**      | Provide a previously captured token or token bundle explicitly               | Manual           | All      |\n\n### Auto-login (macOS only)\n\nRequires macOS with a platform authenticator (e.g. Intune Company Portal) and a FIDO2 passkey enrolled. Fully unattended — no browser window appears.\n\n### Interactive login (recommended for Windows / Linux)\n\nThe 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:\n\n```bash\nteams-api auth --login\n```\n\nOptionally pre-fill your email:\n\n```bash\nteams-api auth --login --email you@example.com\n```\n\n> [!NOTE]\n> Interactive login prefers an installed browser (Edge or Chrome) when available, and falls back to Playwright's bundled Chromium.\n\n### Advanced / manual methods\n\n**Debug session** — start Chrome with `--remote-debugging-port=9222`, navigate to Teams and log in, then run:\n\n```bash\nteams-api auth --debug-port 9222\n```\n\n**Direct token** — advanced/manual only. Extract `x-skypetoken` from browser DevTools (Network tab) and pass it directly:\n\n```bash\nteams-api list-conversations --token \"<paste-token-here>\" --region emea\n```\n\nIf 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:\n\n```bash\nteams-api find-people \\\n  --token \"<paste-skype-token-here>\" \\\n  --bearer-token \"<paste-api-spaces-skype-bearer-token-here>\" \\\n  --substrate-token \"<paste-substrate-bearer-token-here>\" \\\n  --region emea \\\n  --query \"Jane Doe\"\n```\n\n> [!TIP]\n> Skip this section if you are using `--login`, `--auto`, `TEAMS_LOGIN`, or `TEAMS_AUTO`. Those modes capture the full token bundle automatically.\n\n> [!TIP]\n> Direct-token mode still needs an explicit region. See [API regions](#api-regions) below.\n\n## CLI\n\nPreferred without install:\n\n```bash\nnpx -y -p teams-api@latest teams-api <command> [options]\n```\n\nOptional global install for frequent use:\n\n```bash\nnpm install -g teams-api\nteams-api <command> [options]\n```\n\nThe examples below use `teams-api` for readability. If you are not installing globally, replace it with `npx -y -p teams-api@latest teams-api`.\n\n### Auth flags (available on all commands)\n\n| Flag                        | Description                                                                      |\n| --------------------------- | -------------------------------------------------------------------------------- |\n| `--login`                   | Interactive browser login (all platforms)                                        |\n| `--auto`                    | Auto-acquire token via FIDO2 passkey (macOS)                                     |\n| `--email <email>`           | Corporate email (required with `--auto`, optional otherwise)                     |\n| `--token <token>`           | Use an existing skype token (advanced/manual)                                    |\n| `--bearer-token <token>`    | Optional middle-tier bearer token (advanced/manual)                              |\n| `--substrate-token <token>` | Optional Substrate bearer token (advanced/manual)                                |\n| `--debug-port <port>`       | Chrome debug port (default: 9222)                                                |\n| `--region <region>`         | API region override. Auto-detected for login/debug auth; required with `--token` |\n| `--format <format>`         | Output format: concise, detailed                                                 |\n| `--output <file>`           | Export output to file (default format: concise)                                  |\n\n### Examples\n\n```bash\n# Acquire a token (interactive — all platforms)\nteams-api auth --login\n\n# Acquire a token (auto — macOS with FIDO2)\nteams-api auth --auto --email you@example.com\n\n# List conversations\nteams-api list-conversations --login --limit 20 --format detailed\n\n# Find a conversation by topic\nteams-api find-conversation --auto --email you@example.com --query \"Design Review\"\n\n# Find a 1:1 chat by person name\nteams-api find-one-on-one --auto --email you@example.com --person-name \"Jane Doe\"\n\n# Find people, including office location when profile enrichment is available\nteams-api find-people --auto --email you@example.com --query \"Jane Doe\"\n\n# Get profiles for MRIs returned by people search or member listing\nteams-api get-profiles --auto --email you@example.com \\\n  --user-identifiers \"8:orgid:00000000-0000-0000-0000-000000000000\"\n\n# Read messages (by topic name, person name, or direct ID)\nteams-api get-messages --auto --email you@example.com --chat \"Design Review\"\nteams-api get-messages --auto --email you@example.com --to \"Jane Doe\" --max-pages 5\nteams-api get-messages --auto --email you@example.com --conversation-id \"19:abc@thread.v2\" --format detailed\n\n# Newest-first order (API returns newest-first; default is oldest-first/chronological)\nteams-api get-messages --auto --email you@example.com --chat \"General\" --order newest-first\n\n# Send a message\nteams-api send-message --auto --email you@example.com --to \"Jane Doe\" --content \"Hello!\"\nteams-api send-message --auto --email you@example.com --chat \"Design Review\" --content \"Status update\"\n\n# List members\nteams-api get-members --auto --email you@example.com --chat \"Design Review\"\n\n# Get current user info\nteams-api whoami --auto --email you@example.com\n\n# Export messages to a file (default format: concise)\nteams-api get-messages --auto --email you@example.com --chat \"General\" --output exports/general.md\n\n# Export as JSON to a file\nteams-api get-messages --auto --email you@example.com --chat \"General\" --format detailed --output exports/general.json\n```\n\n## MCP server\n\nThe MCP server exposes Teams operations as tools for AI agents via stdio transport. See [Getting Started](#install-in-your-editor) for editor-specific setup.\n\n### Advanced: direct token configuration\n\nUse this only if you already have tokens from another flow or need to avoid browser-based auth entirely:\n\n```json\n{\n  \"mcpServers\": {\n    \"teams\": {\n      \"command\": \"npx\",\n      \"args\": [\"-y\", \"-p\", \"teams-api@latest\", \"teams-api-mcp\"],\n      \"env\": {\n        \"TEAMS_TOKEN\": \"<paste-skype-token-here>\",\n        \"TEAMS_BEARER_TOKEN\": \"<optional-api-spaces-skype-bearer-token>\",\n        \"TEAMS_SUBSTRATE_TOKEN\": \"<optional-substrate-bearer-token>\",\n        \"TEAMS_REGION\": \"emea\"\n      }\n    }\n  }\n}\n```\n\n> [!TIP]\n> 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`.\n\n### Environment variables\n\n| Variable                        | Description                                                                            |\n| ------------------------------- | -------------------------------------------------------------------------------------- |\n| `TEAMS_TOKEN`                   | Pre-existing skype token                                                               |\n| `TEAMS_BEARER_TOKEN`            | Optional middle-tier bearer token                                                      |\n| `TEAMS_SUBSTRATE_TOKEN`         | Optional Substrate bearer token                                                        |\n| `TEAMS_REGION`                  | API region override. Required with `TEAMS_TOKEN`; optional otherwise                   |\n| `TEAMS_EMAIL`                   | Corporate email. Optional — the server prompts the AI agent if needed                  |\n| `TEAMS_AUTO`                    | Set to `true` to enable auto-login (macOS + FIDO2)                                     |\n| `TEAMS_LOGIN`                   | Set to `true` to enable interactive browser login                                      |\n| `TEAMS_DEBUG_PORT`              | Chrome debug port (default: 9222)                                                      |\n| `TEAMS_EDIT_REPLY_GUARD`        | Edit reply guard: `allow` (default), `warn`, or `block`. See below                     |\n| `TEAMS_AGENT_MARKER`            | Agent marker prefix for sent/edited messages (e.g. `Ⓜ`). See below                    |\n| `TEAMS_DELETE_MODE`             | Delete mode: `hard` (default), `soft`, or `block`. See below                           |\n| `TEAMS_DELETE_TOMBSTONE`        | Custom tombstone text for soft-delete mode. See below                                  |\n| `TEAMS_AUDIT_LOG`               | Audit logging: `off` (default), `stderr`, or `file:<path>`. See below                  |\n| `TEAMS_PROTECTED_CONVERSATIONS` | Comma-separated glob patterns of conversations where edit/delete is blocked. See below |\n\n#### Agent marker\n\nWhen an AI agent sends or edits messages on behalf of a user, it can be hard to tell which messages were composed by the agent and which by the human. The `TEAMS_AGENT_MARKER` environment variable (or `--agent-marker` CLI flag / `agentMarker` MCP parameter) automatically prepends a configurable string to message content:\n\n```jsonc\n{\n  \"env\": {\n    \"TEAMS_AGENT_MARKER\": \"Ⓜ\", // or \"🤖\", \"[Bot]\", etc.\n  },\n}\n```\n\nWhen set, every `send-message` and `edit-message` call prepends the marker followed by a space to the content. For example, with `TEAMS_AGENT_MARKER=Ⓜ`, sending \"Hello world\" produces \"Ⓜ Hello world\".\n\nThe per-call parameter takes precedence over the environment variable. Pass an empty string to disable the marker for a specific call.\n\n#### Edit reply guard\n\nWhen editing a message that already has replies, the original context can be lost — replies may no longer make sense. The `TEAMS_EDIT_REPLY_GUARD` environment variable (or `--reply-guard` CLI flag / `replyGuard` MCP parameter) controls this:\n\n| Value   | Behavior                                                                           |\n| ------- | ---------------------------------------------------------------------------------- |\n| `allow` | Edit proceeds normally (default, backward-compatible)                              |\n| `warn`  | Edit proceeds but an annotation is appended: _\"⚠️ This message was edited after…\"_ |\n| `block` | Edit is refused with an error listing the reply count                              |\n\nThe per-call parameter takes precedence over the environment variable.\n\n#### Delete mode (soft-delete)\n\nHard-deleting messages removes content permanently, which can be problematic for auditability and conversation flow in group chats. The `TEAMS_DELETE_MODE` environment variable (or `--delete-mode` CLI flag / `deleteMode` MCP parameter) controls how message deletion is handled:\n\n| Value   | Behavior                                                            |\n| ------- | ------------------------------------------------------------------- |\n| `hard`  | Permanently delete the message (default, current behavior)          |\n| `soft`  | Replace message content with a tombstone marker instead of deleting |\n| `block` | Refuse deletion entirely with an error                              |\n\nWhen using `soft` mode, the message content is replaced with `~~This message was removed by an agent~~` by default. Customize the tombstone text with `TEAMS_DELETE_TOMBSTONE` (or `--delete-tombstone` / `deleteTombstone`):\n\n```jsonc\n{\n  \"env\": {\n    \"TEAMS_DELETE_MODE\": \"soft\",\n    \"TEAMS_DELETE_TOMBSTONE\": \"🗑️ [removed by automation]\",\n  },\n}\n```\n\nThe per-call parameters take precedence over environment variables.\n\n#### Audit logging\n\nState-modifying actions (edit and delete) can emit structured audit events for compliance and traceability. The `TEAMS_AUDIT_LOG` environment variable controls where events are written:\n\n| Value         | Behavior                                                    |\n| ------------- | ----------------------------------------------------------- |\n| `off`         | No audit logging (default)                                  |\n| `stderr`      | Write JSON Lines to stderr                                  |\n| `file:<path>` | Append JSON Lines to the specified file (created on demand) |\n\n```jsonc\n{\n  \"env\": {\n    \"TEAMS_AUDIT_LOG\": \"file:/var/log/teams-audit.jsonl\",\n  },\n}\n```\n\nEach event is a single JSON line with the following fields:\n\n| Field               | Description                                                                   |\n| ------------------- | ----------------------------------------------------------------------------- |\n| `timestamp`         | ISO 8601 timestamp                                                            |\n| `action`            | `\"edit\"`, `\"delete\"`, or `\"soft-delete\"`                                      |\n| `conversationId`    | Conversation thread ID                                                        |\n| `conversationLabel` | Human-readable conversation label (topic or 1:1 partner name)                 |\n| `messageId`         | Target message ID                                                             |\n| `content`           | New content for edits, tombstone text for soft-delete, `null` for hard delete |\n\nAudit logging is designed to be silent — errors in the audit pipeline never affect tool execution.\n\n#### Protected conversations\n\nSome conversations contain sensitive or compliance-relevant information where accidental edits or deletions could be harmful. The `TEAMS_PROTECTED_CONVERSATIONS` environment variable (or `--protected-conversations` CLI flag / `protectedConversations` MCP parameter) blocks edit and delete actions in matching conversations:\n\n```jsonc\n{\n  \"env\": {\n    \"TEAMS_PROTECTED_CONVERSATIONS\": \"Incident *,*compliance*,Architecture Decisions\",\n  },\n}\n```\n\nPatterns are comma-separated and support `*` as a wildcard (matches any characters). Matching is case-insensitive. When a conversation's name matches any pattern, both `edit-message` and `delete-message` throw an error before making any changes — the message is left untouched.\n\nThe per-call parameter takes precedence over the environment variable, so individual tool invocations can override the configured patterns when needed.\n\n### Available tools\n\nAll MCP tools accept an optional `format` parameter (`concise` or `detailed`). Default format is `concise`.\n\n| Tool                       | Description                                           |\n| -------------------------- | ----------------------------------------------------- |\n| `teams_list_conversations` | List available conversations                          |\n| `teams_find_conversation`  | Find a conversation by topic or member name           |\n| `teams_find_one_on_one`    | Find a 1:1 chat with a person                         |\n| `teams_get_profiles`       | Get user profiles, including office location          |\n| `teams_find_people`        | Search the organization directory                     |\n| `teams_find_chats`         | Search chats by name or member                        |\n| `teams_get_messages`       | Get messages from a conversation                      |\n| `teams_send_message`       | Send a message to a conversation                      |\n| `teams_get_members`        | List members of a conversation                        |\n| `teams_get_transcript`     | Get a meeting transcript from a recorded conversation |\n| `teams_download_file`      | Download message files and inline images              |\n| `teams_describe_image`     | Describe an inline Teams image with a vision model    |\n| `teams_whoami`             | Get the authenticated user's display name             |\n\nWorkflow guidance, tips, and important notes are served automatically via the MCP server's `instructions` field — no separate skill file needed. For the same content on the CLI, run `teams-api guide`.\n\n### Image descriptions\n\n`teams_describe_image` reuses the existing Teams AMS image download support and sends the image bytes to an OpenAI-compatible vision endpoint. Configure it with `TEAMS_IMAGE_DESCRIPTION_API_KEY` or `OPENAI_API_KEY`. Optional overrides: `TEAMS_IMAGE_DESCRIPTION_MODEL` and `TEAMS_IMAGE_DESCRIPTION_BASE_URL`.\n\nExamples:\n\n```bash\nteams-api describe-image --chat \"Project Chat\" --message-id 1773736076914 --image-index 0\nteams-api describe-image --ams-object-id 0-eaua-d2-877b82634f4e978692f2243d445a6650\n```\n\n## API regions\n\nThe Teams Chat Service URL varies by region. Login-based and debug-session auth detect it automatically. You only need to set `--region` or `TEAMS_REGION` when you are supplying tokens directly or want to force an override:\n\n| Region | Base URL                                     |\n| ------ | -------------------------------------------- |\n| `apac` | `https://apac.ng.msg.teams.microsoft.com/v1` |\n| `emea` | `https://emea.ng.msg.teams.microsoft.com/v1` |\n| `amer` | `https://amer.ng.msg.teams.microsoft.com/v1` |\n\n## Known limitations\n\n- **File attachments are not supported from remote AI hosts** (e.g. Claude.ai). The MCP server runs locally on your machine, so `--file` / `--image` paths must exist on your local filesystem. Cloud-hosted AI clients run in isolated containers and cannot access local paths. Use a local MCP client (Claude Desktop, Cursor, VS Code) or the CLI for file attachments.\n- Token lifetime is ~24 hours. After expiry, you must re-acquire.\n- The Teams Chat Service REST API is undocumented and may change without notice.\n- Auto-login requires macOS, system Chrome, a platform authenticator, and a FIDO2 passkey. On other platforms, use interactive login (`--login`) instead.\n- The members API returns empty display names for 1:1 chat participants. Use `findOneOnOneConversation()` to resolve names from message history.\n- Reaction actor identities come from the `emotions` field in message payloads. Parsing handles both JSON-string and array formats.\n\n## Programmatic API\n\nThis is the advanced integration path. Most users should start with MCP or CLI instead.\n\nInstall the package in your project:\n\n```bash\nnpm install teams-api\n```\n\nExample:\n\n```typescript\nimport { TeamsClient } from \"teams-api\";\n\n// Interactive login — opens a browser, you log in manually (all platforms)\nconst client = await TeamsClient.fromInteractiveLogin();\n\n// Or auto-login via platform authenticator (macOS + FIDO2 passkey)\nconst autoClient = await TeamsClient.fromAutoLogin({\n  email: \"you@example.com\",\n});\n\n// Advanced/manual: create a client from previously captured tokens\nconst manualClient = TeamsClient.fromToken(\"skype-token-here\", \"emea\");\n\nconst conversations = await client.listConversations();\nconst messages = await client.getMessages(conversations[0].id, {\n  maxPages: 5,\n  onProgress: (count) => console.log(`Fetched ${count} messages`),\n});\n\nawait client.sendMessage(conversations[0].id, \"Hello from the API!\");\n\nconst oneOnOne = await client.findOneOnOneConversation(\"Jane Doe\");\nconst members = await client.getMembers(conversations[0].id);\nconst profiles = await client.getProfiles(members.map((member) => member.id));\nconsole.log(profiles.map((profile) => profile.userLocation));\n```\n\n## Contributing\n\nSee [CONTRIBUTING.md](CONTRIBUTING.md) for development setup, architecture, and implementation notes.\n\n## License\n\nMIT\n",
  "bytes": 28940,
  "sha": "a571f0adfc0448eb1768dbe24df34b46b018575d2e90e8bc3678c575cdab9bb7",
  "repo_slug": "maxim-mazurok/teams-api",
  "fonte": "repo",
  "truncated": false,
  "api": "https://agentalog.com/api/listings/mcp_io_github_maxim_mazurok_teams_api_08577fa2/readme"
}