01 / MCP & CLI PLAYBOOK · 7 min read · UPDATED 2026-12-06

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.

16 MCP Tools HTTP :8788 ~33 MB RAM Glama Grade A
Package & Version @bitefoundry/teams@0.14.0
MCP Surface teams mcp (16 tools)
Local HTTP API 127.0.0.1:8788 (Bearer)
Footprint ~33 MB RAM vs ~1,240 MB

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.

Zero Cloud Relay · Direct to Microsoft Graph

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.

Install & Sign In (macOS / Linux / Windows)
# 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 Code (One-Line CLI Registration)
claude mcp add teams -- teams mcp
Cursor (.cursor/mcp.json) & Claude Desktop
{
  "mcpServers": {
    "teams": {
      "command": "teams",
      "args": ["mcp"]
    }
  }
}
OpenAI Codex (~/.codex/config.toml)
[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 ToolModeBehavior & Context / Safety Notes
list_chatsReadLists 1:1 and group chats from local WAL cache + Graph metadata with pagination.
list_teams_channelsReadLists joined Teams and channels with cursor pagination from SQLite cache.
get_messagesReadReads recent messages in compact mode by default (omitted summary + links extraction; pass compact: false for full payloads).
get_threadReadReads a channel root post and paginated replies (thread.returned, thread.has_more, root.reply_count).
search_messagesReadRuns offline hybrid SQLite FTS5 trigram + 1–2 char CJK LIKE full-text search across cached rooms.
list_membersReadLists chat or channel members with cached cursor pagination.
search_usersReadSearches Microsoft Entra directory users by display name or email prefix.
get_presenceReadChecks user availability and activity state via Graph presence endpoints.
download_attachmentReadDownloads message attachments or hosted images safely into a confined directory.
send_messageWritePosts Markdown (**bold**, *italic*, code, links, @mentions, optional subject) and returns compact message.msg_id.
reply_messageWriteReplies to a specific channel root message ID without polluting top-level posts.
send_fileWriteUploads and shares a local file or inline screenshot with optional Markdown caption.
create_chatWriteCreates a new 1:1 or group chat with explicit participant list and optional topic.
update_chatWriteUpdates an existing group chat topic (delegated Chat.ReadWrite, up to 250 chars).
edit_messageWriteUpdates an authored message body, --subject, or single-node exact find/replace preserving links and mentions.
delete_messageDestructiveHard-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.

Practical CLI, Pipe & Loopback HTTP Workflows
# 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 using ConfirmFriction::DestructiveUppercaseY—ignoring Enter and lowercase y, and normalizing Korean 2-beolsik Shift+ㅛ to Shift+Y.
  • MCP Explicit Confirmation Gate: delete_message refuses execution unless the tool payload literally includes JSON boolean "confirm": true, stopping accidental deletions before any HTTP call leaves your machine.
  • CLI --yes & --offline Boundaries: teams delete requires --yes for non-interactive deletion, while --offline reads strictly from the local SQLite cache with zero network egress.
  • Loopback HTTP Hardening (:8788): Rejects foreign Host headers (DNS-rebinding protection) and cross-site Origin / Sec-Fetch-Site requests with 403, generates a 32-byte random Bearer token when --token is omitted, and bans --allow-keyless on 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