Connect Claude Code, Cursor & Codex to Microsoft Teams (Zero Electron)
Replace the 1.2 GB Teams desktop app with @bitefoundry/teams (~33 MB RAM): wire all 16 stdio MCP tools into Claude Code, Cursor, or Codex, pipe compact --json and -p ANSI threads, serve loopback HTTP on :8788, and enforce Shift+Y destructive confirmation.
Why Run Microsoft Teams as a Native Rust MCP Binary Instead of Electron
The official Microsoft Teams desktop client runs inside WebView2/Electron and routinely consumes ~1,240 MB of RAM across multiple renderer processes. For engineers pairing with AI coding agents (Claude Code, Cursor, OpenAI Codex, or OpenCode), browser scraping and manual copy-paste break down immediately on long release threads.
@bitefoundry/teams compiles to a single 12.6 MiB native Rust binary (~33 MB steady-state RAM, 498 passing Rust tests) that unifies a borderless Modern TUI v2, a scriptable --json / -p CLI, a loopback Axum HTTP REST + Streamable HTTP POST /mcp server on 127.0.0.1:8788, and a Glama Grade A 16-tool stdio MCP server over one bundled SQLite WAL + FTS5 cache.
OAuth tokens live exclusively in your OS keychain (Windows Credential Manager, macOS Keychain, or Linux Secret Service). External token brokers (TEAMS_ACCESS_TOKEN, TEAMS_TOKEN_FILE, TEAMS_TOKEN_REFRESH_CMD) and corporate TLS-inspecting proxies (TEAMS_EXTRA_CA_PEM) are supported natively.
1. Install the Binary and Authenticate with Microsoft Graph
Install a prebuilt native binary for Windows (x64/ARM64), macOS (Apple Silicon/Intel), or Linux (x64/ARM64, GLIBC 2.28+) without needing Node.js at runtime. Then sign in with either the default Microsoft Graph Command Line Tools flow or your organization's Entra ID desktop app registration.
# Choose one install method (all ship the identical native binary)
brew install bitefoundry/tap/teams # macOS & Linux
curl -fsSL https://bitefoundry.dev/i | sh -s teams # macOS & Linux (SHA256-verified)
npm i -g @bitefoundry/teams # Cross-platform via npm
# Windows PowerShell (no Node): & ([scriptblock]::Create((irm https://bitefoundry.dev/w))) teams
# Sign in via Microsoft Graph (stored in OS keychain)
teams login
# Or with your company's Entra ID app registration:
teams login --client-id YOUR_CLIENT_ID --tenant-id YOUR_TENANT_ID
# Verify scopes & token health before connecting an AI agent
teams doctor --probe
2. Wire teams mcp into Claude Code, Cursor & OpenAI Codex
teams mcp speaks newline-delimited JSON-RPC 2.0 over stdio and reads directly from your local SQLite FTS5 cache for instant search and low-latency thread reads. Every message-reading tool returns compact JSON by default with an omitted count summary and explicit full-read hints so long channels never blow up LLM context windows.
claude mcp add teams -- teams mcp
{
"mcpServers": {
"teams": {
"command": "teams",
"args": ["mcp"]
}
}
}
[mcp_servers.teams]
command = "teams"
args = ["mcp"]
3. Complete 16-Tool Microsoft Teams MCP Reference
All 16 tools exposed by io.github.BiteFoundry/teams declare MCP readOnlyHint annotations and emit structured errors on invalid targets or missing delegated scopes.
| MCP Tool | Mode | Behavior & Context / Safety Notes |
|---|---|---|
| list_chats | Read | Lists 1:1 and group chats from local WAL cache + Graph metadata with pagination. |
| list_teams_channels | Read | Lists joined Teams and channels with cursor pagination from SQLite cache. |
| get_messages | Read | Reads recent messages in compact mode by default (omitted summary + links extraction; pass compact: false for full payloads). |
| get_thread | Read | Reads a channel root post and paginated replies (thread.returned, thread.has_more, root.reply_count). |
| search_messages | Read | Runs offline hybrid SQLite FTS5 trigram + 1–2 char CJK LIKE full-text search across cached rooms. |
| list_members | Read | Lists chat or channel members with cached cursor pagination. |
| search_users | Read | Searches Microsoft Entra directory users by display name or email prefix. |
| get_presence | Read | Checks user availability and activity state via Graph presence endpoints. |
| download_attachment | Read | Downloads message attachments or hosted images safely into a confined directory. |
| send_message | Write | Posts Markdown (**bold**, *italic*, code, links, @mentions, optional subject) and returns compact message.msg_id. |
| reply_message | Write | Replies to a specific channel root message ID without polluting top-level posts. |
| send_file | Write | Uploads and shares a local file or inline screenshot with optional Markdown caption. |
| create_chat | Write | Creates a new 1:1 or group chat with explicit participant list and optional topic. |
| update_chat | Write | Updates an existing group chat topic (delegated Chat.ReadWrite, up to 250 chars). |
| edit_message | Write | Updates an authored message body, --subject, or single-node exact find/replace preserving links and mentions. |
| delete_message | Destructive | Hard-gated: rejects any call unless literal JSON boolean "confirm": true is present before contacting Graph. |
4. Scriptable --json, -p ANSI Print Mode & Loopback HTTP (:8788)
Beyond MCP, the same binary powers shell scripts, CI release bots, and local editor integrations. Use --json for deterministic machine-readable stdout (runtime failures emit {"ok":false,"error":{"code":"..."}} with exit code 1), -p --pager to render styled ANSI threads outside alternate-screen mode (respecting NO_COLOR=1), or teams serve for an authenticated Axum HTTP server on 127.0.0.1:8788.
# Read a channel in compact JSON (pass --full for complete Graph fields)
teams read "Acme Engineering/platform-release" --limit 25 --json
# Render styled ANSI output into $PAGER (no TUI raw mode, respects NO_COLOR=1)
teams read "Acme Engineering/platform-release" -p --pager
teams thread "Acme Engineering/platform-release" 1700000000000 --offline --json
# Surgical single-node edit preserving mentions, links & attachments
teams edit "Acme Engineering/platform-release" 1700000000000 \
--find "STATE: STAGED" --replace "STATE: READY"
# Offline SQLite FTS5 search across synced rooms
teams search "connection pooling" --json
# Start hardened local HTTP API on 127.0.0.1:8788 (Bearer token required on all routes except /health)
teams serve --port 8788 --token "$TEAMS_API_TOKEN"
curl http://127.0.0.1:8788/conversations -H "Authorization: Bearer $TEAMS_API_TOKEN"
5. Multi-Surface Destructive Safety Patterns (Shift+Y, confirm: true, --offline)
Giving an agent or fast keyboard user access to corporate chat requires explicit friction around irreversible mutations. BiteFoundry Teams enforces guardrails across every surface:
- TUI Destructive Confirmation (
Shift+Y): Deleting your own message opens a modal with a structured blast-radius summary usingConfirmFriction::DestructiveUppercaseY—ignoringEnterand lowercasey, and normalizing Korean 2-beolsikShift+ㅛtoShift+Y. - MCP Explicit Confirmation Gate:
delete_messagerefuses execution unless the tool payload literally includes JSON boolean"confirm": true, stopping accidental deletions before any HTTP call leaves your machine. - CLI
--yes&--offlineBoundaries:teams deleterequires--yesfor non-interactive deletion, while--offlinereads strictly from the local SQLite cache with zero network egress. - Loopback HTTP Hardening (
:8788): Rejects foreignHostheaders (DNS-rebinding protection) and cross-siteOrigin/Sec-Fetch-Siterequests with403, generates a 32-byte random Bearer token when--tokenis omitted, and bans--allow-keylesson non-loopback binds.
Frequently Asked Questions
Does @bitefoundry/teams work with Claude Code, Cursor, and OpenAI Codex on Windows, macOS, and Linux?
Yes. Every release ships native x64 and ARM64 binaries for Windows, macOS, and Linux (GLIBC 2.28+). Register `teams mcp` via `claude mcp add teams -- teams mcp`, `.cursor/mcp.json`, or `~/.codex/config.toml`.
How do I prevent an AI agent from burning tokens on huge Microsoft Teams threads?
Both `teams read --json` and the MCP `get_messages` / `get_thread` tools return compact JSON by default with top-level `omitted` counts and targeted `hint` commands. Use `search_messages` against the local SQLite FTS5 index first, then fetch only the exact thread root and reply window you need.
How does destructive message deletion stay safe in TUI, CLI, and MCP?
TUI deletion requires uppercase `Shift+Y` (ignoring `Enter` and lowercase `y`), CLI deletion requires `--yes`, and MCP `delete_message` rejects calls lacking literal JSON boolean `"confirm": true`.
Can I use BiteFoundry Teams behind a corporate TLS-inspecting proxy or custom Entra ID tenant?
Yes. Pass `--client-id` and `--tenant-id` to `teams login`, or supply an external token via `TEAMS_ACCESS_TOKEN` / `TEAMS_TOKEN_REFRESH_CMD`. For corporate proxies, point `TEAMS_EXTRA_CA_PEM` (or `SSL_CERT_FILE`) at your PEM root certificate.
Related BiteFoundry Product Pages
More Technical Guides
Atlassian Jira & Confluence MCP & Terminal Client (Zero Docker)
Unified Atlassian Jira & Confluence MCP server and Rust terminal client without Docker or Node (@bitefoundry/atlassian@0.12.0, 37 MCP tools / 15 --read-only tools, ADF <-> Markdown, cross-linking, j/cf aliases, HTTP :8789 + POST /mcp).
Read Public & Private Google Docs and Drive URLs from Terminal & MCP
Read public and private Google Docs and Drive URLs from the terminal and AI agents (@bitefoundry/gdocs@0.4.0, zero-login gdocs <url>, -p ANSI print, UTF-16 optimistic-locked editing + replace_doc_markdown, 11 stdio & Streamable HTTP MCP tools + --read-only, HTTP :8794, 5.4 MiB binary).
Unified Microsoft 365 MCP Stack: Outlook, OneNote & SharePoint/OneDrive
Unified Microsoft 365 MCP stack in native Rust: Outlook (24 tools, :3939, fields projection), OneNote (18 tools, :8793, scoped data-id edits, native Linux), SharePoint & OneDrive (20 tools, :8790, ETag-safe uploads), all with OS keychain auth and zero cloud relay.