microsoft-teams-mcp
MCP server for Microsoft Teams — list every chat and channel you are in,
read any of them by id or name, pull everything you have not read yet,
read your Activity feed, fetch inline images, and — each one confirmed by you first — post messages
and reactions, using your signed-in browser session.
This project was developed and is maintained by AI (Claude Code). Use at your
own discretion.
How it works
Chats and channels are read through Teams' own chat-service REST API
(https://teams.cloud.microsoft/api/chatsvc/<region>/v1). The server needs a
bearer token for it, and the only place one exists is your signed-in
teams.cloud.microsoft tab: through the
fetchproxy browser bridge it
captures the Authorization header off a request the Teams web app makes to
its chat service — once. From then on every call is a plain server-side
request; the token is cached in ~/.microsoft-teams-mcp/token.json for its
~23h lifetime (so a restart needs no browser), and a 401 re-captures once and
replays. teams.microsoft.com (the old host) is not supported.
So chats and channels no longer need to be open in the browser — any of
them can be read by id or name, and listing covers every chat, not just the
ones the sidebar shows. To capture a token, an idle tab is not enough: click
into any chat so Teams calls its chat service.
Token capture timing (read this if a call says it could not get a token)
A capture reads the header off the next matching request the Teams page
makes while the capture is waiting — the bridge has no "recently seen"
request to fall back on. So clicking into a chat before a call starts never
counts: the click has to land within the capture window (TEAMS_CAPTURE_TIMEOUT,
default 30 s) after the call starts. Every capture error says exactly that,
with the real window length, and names the step that failed with a stable code:
| Code | Step that failed | Next step |
|---|
token_bridge_not_approved | The ContextMint Bridge has not approved this server (or this capture) yet | Approve microsoft-teams-mcp in the extension popup, then retry |
token_bridge_unreachable | No browser with the bridge extension is connected | Open that browser and check the extension is connected, then retry |
token_no_tab | The bridge found no signed-in Teams tab | Open and sign in to teams.cloud.microsoft, then retry and click into a chat while it waits |
token_no_request_seen | The window closed with no matching request (the bridge cannot tell an idle tab from a missing one); the error says how long it waited and when the previous token expired | Retry, and within the window click into any chat (search token: run a search in the Teams search box) |
token_token_rejected | A freshly captured token was still refused | Reload the Teams tab (sign in again if asked), then retry and click while it waits |
token_capture_failed | Anything else (e.g. a header too short to be a token) | As the message says |
Three things make the window easier to hit:
- Progress while waiting. When the client asked for progress (claude.ai
sends a
progressToken), a capture reports "Waiting for the Teams tab: click
into any chat now (25s left)" every 5 s, so a client that shows progress gives
you the chance to act in time.
- A Teams tab opened for you (local installs). On a local install, as a
chat-service capture starts the server opens
https://teams.cloud.microsoft/
in your default browser (or the one TEAMS_BROWSER names — set it to the
browser the bridge runs in, e.g. Microsoft Edge); a loading Teams page lists
its chats through the chat service at once, inside the window, with no click
needed. At most one tab per 10 minutes; TEAMS_OPEN_TEAMS_TAB=false turns it
off. Never on a hosted install (the browser is not on the server's machine),
and not for the search token (only a search you run makes that request).
teams_token_status. Reports which tokens are held and until when without
touching the browser — check it before a write. With wait: true it primes a
token that is not held, waiting up to 120 s: start it, then click into a chat
(or, with token: "substrate", run a search in the Teams search box).
The Activity feed comes from the same API. It is a chat-service
conversation of its own (48:notifications), so teams_list_activity reads
it like any chat — no Activity view (or any view) needs to be open, and
nothing reads the page. The bridge is used for one thing only: capturing the
token.