teams-mcp
by zongwei-tang
README.md
# teams-mcp
**English** | [中文](README.zh-CN.md)
An MCP server for Microsoft Teams that works with **personal accounts (Teams free, i.e. Outlook / Hotmail / Live) and work or school accounts**, with several accounts signed in at once.
- **No Azure app registration and no browser automation.** You sign in with a device code (open a URL, type a short code; works from a phone too), and tokens renew themselves after that.
- **143 tools:** chats, messages, contacts, presence, search, images / files / GIFs, meetings and calendar, call history, Teams free communities, teams and channels, team management, plus raw escape hatches.
- **68 tools are verified on a real personal account** (marked "tested" below). The work-account tools follow the Teams web client's own APIs but have not been tested on a real work tenant yet.
## Install
```bash
git clone https://github.com/zongwei-tang/teams-mcp.git && cd teams-mcp
npm install && npm run build
```
Requires Node.js 22+.
## Connect an MCP client
Claude Code:
```bash
claude mcp add teams -- node /absolute/path/to/teams-mcp/dist/index.js
```
Claude Desktop, Cursor and others (`mcpServers` config):
```json
{
"mcpServers": {
"teams": { "command": "node", "args": ["/absolute/path/to/teams-mcp/dist/index.js"] }
}
}
```
### Remote (HTTP)
`teams-mcp serve` offers the same tools over Streamable HTTP at `/mcp`. Every request needs `Authorization: Bearer <TEAMS_MCP_TOKEN>`:
```bash
TEAMS_MCP_TOKEN=$(openssl rand -hex 32) node dist/index.js serve --port 8080 # listens on 127.0.0.1 by default
```
- **Expose it over HTTPS only.** Put it behind a reverse proxy such as Caddy or nginx, or deploy to a platform that terminates HTTPS. Do not open port 8080 to the internet: plain HTTP leaks the token and your messages.
- **The token is your Teams account.** Whoever has it can read and send messages as you. Use at least 32 random characters, and keep it out of code and screenshots.
- In remote mode, file tools only read and write inside `TEAMS_MCP_FILES_DIR` (default `<data dir>/files`), and system paths such as `/proc` are always refused.
- For clients that cannot send custom headers, set `TEAMS_MCP_ALLOW_PATH_TOKEN=1` and use `/mcp/<token>`. The token then shows up in access logs, so only turn this on if you must.
The repo ships a `Dockerfile` for Railway and similar platforms. Set the variable `TEAMS_MCP_TOKEN`, mount a persistent volume at `/data` (accounts and tokens live there), and use `/healthz` as the health check path. After deploying, sign in once on the remote server with `teams_login`. Optionally, `TEAMS_MCP_SEED_ACCOUNTS` takes a base64-encoded `accounts.json` that is imported once when the volume is empty; delete the variable afterwards, because it contains refresh tokens.
Claude Code with a remote server:
```bash
claude mcp add --transport http teams https://<your-domain>/mcp --header "Authorization: Bearer <TEAMS_MCP_TOKEN>"
```
## Sign in
Ask the assistant to call `teams_login` (`account_type` `personal` or `work`). It shows a URL and a short code; open the URL on any device, enter the code and sign in to your Microsoft account, then the assistant calls `teams_login_status` to finish.
You can also sign in from a terminal:
```bash
node dist/index.js login personal # personal account
node dist/index.js login work # work/school account (optionally --tenant contoso.onmicrosoft.com)
node dist/index.js login work --graph # optional: add Microsoft Graph (permissions users can grant themselves: calendar, files, team lists)
node dist/index.js login work --graph-admin # optional: also permissions a tenant admin approves once (team/channel members and settings, tabs, tags, apps, channel messages, transcripts)
node dist/index.js accounts # list signed-in accounts
```
With several accounts, every tool takes an optional `account` argument, and `teams_use_account` sets the default. A personal and a work account with the same email are kept apart (the alias gets `#work` / `#personal`).
Accounts and tokens are stored in `~/.teams-mcp/accounts.json` (mode 600, locked and merged when several processes use it; change the folder with `TEAMS_MCP_HOME`). `teams_logout` removes an account.
## Personal vs. work accounts
| | Personal | Work |
|---|---|---|
| 1:1 and group chats: send, edit, delete and restore, reactions, @mentions, forward, pin messages | ✓ | ✓ |
| Unread, read receipts, mute, hide, pin chats, rename, add/remove members, invite links | ✓ | ✓ |
| People search, contacts, blocking, profiles, presence read/write, status message | ✓ | ✓ (contacts, blocking: unknown) |
| Full-text message search, file search by name | ✓ | ✓ (file search: personal only) |
| Send images / files / GIFs, downloads, revoke sharing links | ✓ | ✓ |
| Meet now, schedule / update / cancel meetings, rename and delete meeting links, recordings and transcripts | ✓ | ✓ |
| Call history, activity feed (@mentions etc.) | ✓ | ✓ |
| Teams, channels, posts and replies | ✓ Teams free "communities" | ✓ |
| Scheduled messages, saved messages, followed threads, work location | — not offered by Teams free | ✓ |
| Team / channel / member / tag / tab / app management (Graph) | — | ✓ (`--graph` / `--graph-admin`) |
## Tools
"Personal" column: "✓ tested" = verified on a real personal account. "Work" column: "?" = unknown or not implemented for work accounts.
### Accounts
| Tool | Description | Personal | Work |
|---|---|:-:|:-:|
| `teams_login` | Sign in to Microsoft Teams with a device code (no browser automation, no app registration), for personal accounts (Teams free: Outlook/Hotmail/Live) and work/school accounts. | ✓ tested | ✓ |
| `teams_login_status` | Check (and optionally wait for) a device-code sign-in started with teams_login. | ✓ tested | ✓ |
| `teams_accounts` | List signed-in Teams accounts (personal and work) and which one is the default. | ✓ tested | ✓ |
| `teams_use_account` | Make an account the default for later calls. | ✓ | ✓ |
| `teams_logout` | Remove a signed-in account and its stored tokens from this machine. | ✓ | ✓ |
| `teams_whoami` | Your Teams identity for an account: name, email, MRI (Teams user id), tenant, region. | ✓ tested | ✓ |
### Chats and messages
| Tool | Description | Personal | Work |
|---|---|:-:|:-:|
| `teams_list_chats` | List your conversations (1:1, group, meeting chats; channels for work accounts; Teams free communities and their channels for personal accounts), newest first, with last-message preview and unread flag. | ✓ tested | ✓ |
| `teams_find_chats` | Find existing chats by name or by the people in them, e.g. query "Family trip" or "Anna Ben", or people ["anna@contoso.com"]. | ✓ tested | ✓ |
| `teams_get_chat` | Details of a chat/channel thread: topic, type, creator, members (with names) and pinned messages. | ✓ tested | ✓ |
| `teams_get_messages` | Read messages from a conversation, newest first, optionally only between `since` and `until`. | ✓ tested | ✓ |
| `teams_get_message` | Get one message (full content, reactions, files). | ✓ tested | ✓ |
| `teams_send_message` | Send a message. | ✓ tested | ✓ |
| `teams_forward_message` | Forward a message to another chat, to people (`to`) or to "notes"; the forward keeps the original author and attachments, and an optional comment is sent right after it. | ✓ tested | ✓ |
| `teams_note_to_self` | Save a note in your own Teams self-chat ("Notes"/"Chat with yourself"). | ✓ tested | ✓ |
| `teams_edit_message` | Edit one of your messages. | ✓ tested | ✓ |
| `teams_delete_message` | Delete one of your messages (soft delete, like the Teams client; teams_undelete_message restores it). | ✓ tested | ✓ |
| `teams_undelete_message` | Restore a message you deleted (undo teams_delete_message). | ✓ tested | ✓ |
| `teams_add_reaction` | React to a message. | ✓ tested | ✓ |
| `teams_remove_reaction` | Remove your reaction from a message. | ✓ tested | ✓ |
| `teams_pin_message` | Pin or unpin a message at the top of a chat. | ✓ tested | ✓ |
| `teams_mark_read` | Mark a conversation read (up to a message, default the latest). | ✓ tested | ✓ |
| `teams_mark_all_read` | Mark many conversations read in one go: the ones given, or every unread conversation when none are given. | ✓ | ✓ |
| `teams_mark_unread` | Mark a conversation as unread. | ✓ tested | ✓ |
| `teams_get_unread` | Unread conversations with their latest messages — a quick "catch me up". | ✓ tested | ✓ |
| `teams_create_chat` | Start a chat with people by email/name/MRI; your existing 1:1, or a group chat with exactly these people (and this topic), is reused (existing:true when one was found), else a new chat is created. | ✓ | ✓ |
| `teams_add_chat_member` | Add a person to a group chat. | ✓ | ✓ |
| `teams_remove_chat_member` | Remove a person from a group chat. | ✓ | ✓ |
| `teams_leave_chat` | Leave a group chat. | ✓ | ✓ |
| `teams_rename_chat` | Set a group chat topic/name. | ✓ | ✓ |
| `teams_mute_chat` | Mute or unmute notifications for a conversation. | ✓ tested | ✓ |
| `teams_hide_chat` | Hide or unhide a chat in your chat list; a hidden chat reappears when a new message arrives. | ✓ tested | ✓ |
| `teams_read_receipts` | Who has read how far in a chat (read receipts / consumption horizons). | ✓ tested | ✓ |
| `teams_send_typing` | Show a typing indicator in a chat. | ✓ tested | ✓ |
| `teams_wait_for_message` | Wait (up to ~110s) for a new message in a conversation after a given message id/time. | ✓ tested | ✓ |
| `teams_get_activity` | Your activity feed: @mentions, replies, reactions and other notifications, with where they happened. | ✓ tested | ✓ |
| `teams_mark_activity_read` | Mark activity-feed items (ids from teams_get_activity) read or unread. | ✓ | ✓ |
| `teams_get_saved_messages` | Messages you saved/bookmarked (work accounts). | — | ✓ |
| `teams_save_message` | Save (bookmark) or unsave a message. | ✓ tested | ✓ |
| `teams_get_followed_threads` | Channel threads you follow (work accounts). | — | ✓ |
| `teams_get_call_history` | Your recent calls: direction, 1:1 or group, accepted/missed/declined, times, duration and the people. | ✓ tested | ✓ |
| `teams_export_chat` | Export a conversation history to a Markdown file on disk (oldest first). | ✓ tested | ✓ |
| `teams_get_link` | Build a Teams deep link to a chat or message. | ✓ tested | ✓ |
| `teams_chat_invite_link` | Get, enable or disable the invite link of a group chat or community, which anyone you share it with can use to join. | ✓ tested | ✓ |
| `teams_join_chat_by_link` | Join a group chat or community from an invite link someone shared (https://teams.live.com/l/…). | ✓ | ✓ |
| `teams_schedule_message` | Schedule a message that Teams sends later by itself (no client needs to be running); returns its draftId. | — | ✓ |
| `teams_list_scheduled_messages` | Your scheduled messages that have not been sent yet, with draftId, chat and send time. | — | ✓ |
| `teams_cancel_scheduled_message` | Cancel a scheduled message (draftId from teams_list_scheduled_messages). | — | ✓ |
### People, contacts, presence, search
| Tool | Description | Personal | Work |
|---|---|:-:|:-:|
| `teams_search_people` | Find people by name, email or phone (+country code); returns MRIs usable in other tools. | ✓ tested | ✓ |
| `teams_get_person` | Profiles (name, email, title, department) for one or more people by MRI, object id, email or name. | ✓ tested | ✓ |
| `teams_frequent_contacts` | People you interact with most. | ✓ tested | ✓ |
| `teams_list_contacts` | Your Teams contacts (buddy list), with addresses from their profiles. | ✓ tested | ? |
| `teams_add_contact` | Add a person (MRI, email or name) to your Teams contacts. | ✓ | — |
| `teams_remove_contact` | Remove a person from your Teams contacts. | ✓ | — |
| `teams_list_blocked` | People you have blocked. | ✓ tested | ? |
| `teams_block_person` | Block a person so they cannot message or call you, or unblock them with blocked: false. | ✓ | ? |
| `teams_find_chat_with` | Get the 1:1 chat with someone (creates it if needed) — returns a conversation id. | ✓ tested | ✓ |
| `teams_get_presence` | Presence (Available/Busy/Away/DoNotDisturb/Offline…), status note, out-of-office and work location for people, or for you when people is omitted. | ✓ tested | ✓ |
| `teams_set_presence` | Set your presence, optionally for N minutes; "Reset" returns to automatic (the result says how). | ✓ tested | ✓ |
| `teams_get_my_status` | Your own presence settings: forced status and when it ends, status message, out-of-office, work location. | ✓ tested | ✓ |
| `teams_set_status_message` | Set (or clear with empty text) your Teams status message. | ✓ tested | ✓ |
| `teams_set_work_location` | Set where you work (Office, Remote, TimeOff; Unknown clears it), shown on your presence card until the end of today or `until`. | — | ✓ |
| `teams_search_messages` | Full-text search of your Teams messages, optionally by sender, chat and date; results carry conversationId, messageId and fromMri. | ✓ tested | ✓ |
| `teams_search_files` | Find files shared in your chats by file name, with the shareUrl or conversation and message ids teams_download_file takes. | ✓ tested | — |
### Images, files, GIFs
| Tool | Description | Personal | Work |
|---|---|:-:|:-:|
| `teams_send_image` | Upload a local image (png/jpg/gif/webp/bmp) and post it inline into a chat, with an optional caption; animated GIFs stay animated. | ✓ tested | ✓ |
| `teams_send_file` | Upload a local file (any type, any size) and post it into a chat or channel as a file card. | ✓ tested | ✓ |
| `teams_download_file` | Download a file, image, video clip or voice message shared in Teams (Skype-era media too) to a local path, or a directory ending in /. | ✓ tested | ✓ |
| `teams_get_shared_files` | Files, images, video clips and voice messages shared in a conversation (newest first, Skype-era media too), with the links teams_download_file needs. | ✓ tested | ✓ |
| `teams_list_sent_files` | Files you uploaded to chats (your OneDrive "Microsoft Teams Chat Files" folder), newest first, with their sharing links (who can open them). | ✓ tested | ✓ |
| `teams_revoke_file_link` | Stop sharing a file in your OneDrive (e.g. one sent with teams_send_file) by removing all its sharing links and grants, or only permission_id from teams_list_sent_files; people in the chat can no longer open it. | ✓ tested | ✓ |
| `teams_share_drive_file` | Post an existing OneDrive file into a chat as a file card, found by item_id, path (e.g. "Documents/cv.pdf") or a search query. | ✓ | ✓ |
| `teams_search_gifs` | Search Giphy GIFs the way the Teams GIF picker does; returns urls for teams_send_gif. | ✓ tested | ✓ |
| `teams_send_gif` | Post a Giphy GIF into a chat: give url (with title/width/height from teams_search_gifs), or query to send the top result. | ✓ tested | ✓ |
| `teams_forward_media` | Forward the images and video clips of a message to another chat; the media service re-shares them so the new chat can see them. | ✓ tested | ✓ |
| `teams_get_video_transcript` | Captions (transcript text) of a video message, by conversation_id + message_id or the video url, with its status and language. | ✓ | ✓ |
### Teams, channels and Teams free communities
| Tool | Description | Personal | Work |
|---|---|:-:|:-:|
| `teams_list_teams` | Teams you belong to, with their channels. | ✓ tested | ✓ |
| `teams_list_channels` | Channels of one team (work) or community (Teams free). | ✓ | ✓ |
| `teams_find_channel` | Find channels by (part of) the channel or team name, among your teams (work) or communities (Teams free). | ✓ | ✓ |
| `teams_get_channel_posts` | Posts in a channel, each with its replies: the newest, older ones (before_post_id) or the ones around a message (around_message_id). | ✓ | ✓ |
| `teams_get_post_replies` | Replies in one channel thread, oldest first: all of them up to `limit` (default 100) (work channels and Teams free communities). | ✓ | ✓ |
| `teams_post_to_channel` | Start a new post (thread) in a channel or community, optionally with a subject. | ✓ | ✓ |
| `teams_reply_to_post` | Reply in a channel or community thread (both account kinds). | ✓ | ✓ |
| `teams_get_pinned_posts` | Pinned posts of a channel or community: rules, links, announcements (both account kinds). | ✓ | ✓ |
| `teams_pin_post` | Pin or unpin a post in a channel or community; needs permission to pin (both account kinds). | ✓ | ✓ |
| `teams_get_favorites` | Your pinned (favourite) chats and channels: the Favorites folder of your Teams sidebar (both account kinds). | ✓ tested | ✓ |
| `teams_pin_chat` | Pin (favourite) or unpin a chat or channel in the Favorites of your sidebar (both account kinds). | ✓ tested | ✓ |
| `teams_get_team_tags` | Tags of a team (for @tag mentions); needs the team group id (work/school accounts). | — | ✓ |
| `teams_list_custom_emoji` | Your organisation's custom emoji (work/school accounts; Teams free has none). | — | ✓ |
| `teams_get_community` | Details of a Teams free community, or of a work team thread: description, join settings, channels and (Teams free) its guidelines. | ✓ | ✓ |
| `teams_list_community_members` | Members of a community, team or channel with their roles, one page at a time (both account kinds). | ✓ | ✓ |
| `teams_list_community_invitations` | Your pending invitations to Teams free communities (personal accounts). | ✓ | — |
| `teams_respond_community_invitation` | Accept or decline an invitation to a Teams free community (personal accounts). | ✓ | — |
| `teams_request_join_community` | Ask to join a Teams free community whose admins approve new members (personal accounts). | ✓ | — |
| `teams_list_community_join_requests` | Pending requests to join a Teams free community you administer (personal accounts). | ✓ | — |
| `teams_leave_community` | Leave a Teams free community (personal accounts). | ✓ | — |
| `teams_get_channel_email` | A channel's email address and who may send to it (work/school accounts). | — | ✓ |
| `teams_list_join_requests` | Pending requests to join a team you own (work/school accounts). | — | ✓ |
| `teams_handle_join_requests` | Approve or reject requests to join a team you own (work/school accounts). | — | ✓ |
| `teams_discover_teams` | Find public teams in your organisation that you can join (work/school accounts). | — | ✓ |
| `teams_join_team` | Join a public team or ask to join a private one; cancel: true withdraws your pending request (work/school accounts). | — | ✓ |
| `teams_search_channels` | Search channels across your organisation, including teams you are not in (work/school accounts). | — | ✓ |
### Meetings and calendar
| Tool | Description | Personal | Work |
|---|---|:-:|:-:|
| `teams_list_meetings` | Calendar meetings in a time range (default: 7 days from start), with join links, meeting chat ids and whether you organise them; personal and work accounts. | ✓ tested | ✓ |
| `teams_get_meeting` | One calendar meeting in detail (event_id from teams_list_meetings): attendees with their responses, agenda, join link and chat id, times in UTC. | ✓ tested | ✓ |
| `teams_meet_now` | Create an instant Teams meeting and get its join link, short link, meeting code, chat id and update_url (for renaming or deleting the link). | ✓ tested | ✓ |
| `teams_schedule_meeting` | Schedule a Teams meeting in your calendar and invite attendees by email (personal: a scheduled Teams free meeting, or as fallback a meeting link in an Outlook.com event, "via" says which; work: an Outlook/Teams meeting). | ✓ tested | ✓ |
| `teams_update_meeting` | Reschedule or edit a meeting you organise (personal and work accounts): subject, start/end, location, agenda (replaces the description, keeps the join link), add/remove attendees by email; attendees get the update. | ✓ tested | ✓ |
| `teams_respond_to_meeting` | Accept, tentatively accept or decline a meeting invitation (event_id from teams_list_meetings); the organizer is notified. | ✓ | ✓ |
| `teams_cancel_meeting` | Cancel a meeting you organise (attendees are notified), or delete it if nobody else is invited; for invitations use teams_respond_to_meeting decline. | ✓ tested | ✓ |
| `teams_find_meeting_times` | Suggest times when you and the attendees are free, with each attendee's availability (work accounts). | — | ✓ |
| `teams_list_meeting_chats` | Meetings you are in, from their meeting chats (works when the calendar is empty): title, type, join link, meeting code and chat id; give thread_id or a pasted join_url for one meeting. | ✓ tested | ✓ |
| `teams_rename_meeting_link` | Rename a meeting link (Meet now / Teams free meeting) and its chat, identified by thread_id, meeting_code or update_url from teams_meet_now. | ✓ tested | ? |
| `teams_delete_meeting_link` | Delete a meeting link you created so nobody can join it any more (the chat stays), identified by thread_id, meeting_code or update_url. | ✓ tested | ? |
| `teams_meeting_options` | Read a meeting's options (lobby, who can present, …) by meeting_code, join_url or thread_id, and change them with set {"<option name>": value} if you organise it. | ✓ | — |
| `teams_list_recordings` | Recordings and transcripts posted in a meeting chat (or, without conversation_id, your recent meeting chats), newest first, with video and transcript links (download videos with teams_download_file). | ✓ tested | ✓ |
| `teams_get_transcript` | Transcript (speakers + text) of a recorded meeting by thread_id: work from the recording in OneDrive/SharePoint or the meeting chat, personal (Teams free) from the meeting chat. | ✓ | ✓ |
### Team management (Microsoft Graph) and escape hatches
| Tool | Description | Personal | Work |
|---|---|:-:|:-:|
| `teams_get_team` | Team details and settings (work/school, Graph). | — | ✓ |
| `teams_create_team` | Create a new team; you become its owner (work/school, Graph). | — | ✓ |
| `teams_clone_team` | Copy a team (channels, tabs, settings, apps and/or members) into a new team (work/school, Graph; asynchronous). | — | ✓ |
| `teams_get_team_operation` | Status of an asynchronous team operation (create, clone, archive); once it succeeded, targetResourceId is the team's group id (work/school, Graph). | — | ✓ |
| `teams_update_team` | Rename a team or change its description or visibility (work/school, Graph). | — | ✓ |
| `teams_archive_team` | Archive or unarchive a team (work/school, Graph, owners only). | — | ✓ |
| `teams_list_team_members` | Members and owners of a team (work/school, Graph). | — | ✓ |
| `teams_add_team_member` | Add someone to a team (work/school, Graph, owners only). | — | ✓ |
| `teams_remove_team_member` | Remove someone from a team (work/school, Graph, owners only). | — | ✓ |
| `teams_set_member_role` | Make a team member an owner or a plain member; with channel_id, in a private/shared channel (work/school, Graph, owners only). | — | ✓ |
| `teams_create_channel` | Create a channel in a team (work/school, Graph). | — | ✓ |
| `teams_update_channel` | Rename a channel or change its description (work/school, Graph). | — | ✓ |
| `teams_delete_channel` | Delete a channel (work/school, Graph). | — | ✓ |
| `teams_list_channel_members` | Members of a (private/shared) channel (work/school, Graph). | — | ✓ |
| `teams_add_channel_member` | Add a team member to a private/shared channel (work/school, Graph). | — | ✓ |
| `teams_remove_channel_member` | Remove someone (or "me") from a private/shared channel (work/school, Graph). | — | ✓ |
| `teams_leave_channel` | Leave a private or shared channel (work/school); standard channels follow team membership. | — | ✓ |
| `teams_list_channel_files` | Files in a channel's SharePoint folder (work/school, Graph). | — | ✓ |
| `teams_list_tabs` | Tabs pinned in a channel (work/school, Graph). | — | ✓ |
| `teams_add_website_tab` | Pin a website as a tab in a channel (work/school, Graph). | — | ✓ |
| `teams_list_team_apps` | Apps installed in a team (work/school, Graph). | — | ✓ |
| `teams_list_my_apps` | Apps installed for you personally in Teams (work/school, Graph). | — | ✓ |
| `teams_create_tag` | Create a team tag for @-mentioning a group of members (work/school, Graph). | — | ✓ |
| `teams_list_tag_members` | Who is in a team tag (work/school, Graph). | — | ✓ |
| `teams_update_tag` | Rename a team tag, change its description, or add and remove its members (work/school, Graph). | — | ✓ |
| `teams_delete_tag` | Delete a team tag (work/school, Graph). | — | ✓ |
| `teams_get_channel_messages_graph` | Channel messages via Microsoft Graph, an alternative to teams_get_channel_posts with reply counts (work/school). | — | ✓ |
| `teams_raw_get` | Escape hatch, read only: GET any Teams/Graph endpoint with this account's credentials. | ✓ tested | ✓ |
| `teams_raw_request` | Escape hatch: call any Teams/Graph endpoint with any method (it can change or delete data); prefer teams_raw_get for reads. | ✓ tested | ✓ |
## How it works
- **Sign-in:** OAuth 2.0 device code with the public client ids of Microsoft's own Teams clients (personal: `8ec6bc83-…`, tenant `consumers`; work: `1fec8e78-…`). The optional Graph sign-in uses Microsoft Graph Command Line Tools (`14d82eec-…`).
- **Tokens:** the refresh token is exchanged on demand for access tokens to each service (chat service, middle tier, presence, CSA, Substrate, Graph), and for a Skype token to reach the chat service. Expired tokens and 401s trigger one refresh (concurrent requests share it) and a retry.
- **APIs:** the chat service `…/v1/users/ME/conversations/…` (the same for both account types; the host comes from `regionGtms`, and cross-region redirects are followed). Personal accounts also use `teams.live.com/api/mt` (people, contacts, meetings), `/ups/global` (presence), `/api/csa` (communities, pins), `msgsearch.skype.com` (Teams free search) and Microsoft Graph (OneDrive, Outlook calendar).
- **Security:** tokens only go to the account's own Microsoft service hosts. The chat service, Graph and media service each have a host allowlist, so links from tool arguments or message content are never fetched with credentials, and credentials are dropped on cross-origin redirects.
## Caveats
- **Unofficial project.** Not affiliated with or endorsed by Microsoft. "Microsoft Teams" is a trademark of Microsoft.
- It signs in as Microsoft's own Teams client (its public client ids and a browser User-Agent) and calls undocumented internal APIs. This may break the Microsoft Services Agreement or your organisation's policies, and accounts can be restricted. Use it at your own risk.
- For a work account, check that your employer / IT allows it first. Device-code sign-ins raise security alerts in some organisations, and some block them with Conditional Access.
- Once connected to an AI assistant, your messages are sent to that model provider, and a remote deployment stores your sign-in on the server. Messages others send you can carry instructions aimed at the AI (prompt injection), so watch what the assistant is about to do before it sends or deletes anything.
- Do not use it for mass messaging, spam or harassment.
- Microsoft can change these internal APIs at any time.
- Write actions (sending, deleting, changing members, blocking) take effect for real.
- On personal accounts, a forced status such as Busy is only visible to others while one of your Teams clients is online; `teams_set_presence` with `Reset` goes back to automatic.
- Files sent from a personal account are OneDrive "anyone with the link can view" shares, as Teams free itself does; `teams_revoke_file_link` stops sharing.
## Tests
```bash
npm test # the full call chain against a fake Microsoft (about 200 tests)
```
## Credits
Protocol details were adapted from these MIT projects: [m0nkmaster/msteams-mcp](https://github.com/m0nkmaster/msteams-mcp) (work-account internal APIs), [floriscornel/teams-mcp](https://github.com/floriscornel/teams-mcp) (Graph tools) and [Yannicked/NoSlacking](https://github.com/Yannicked/NoSlacking) (Teams free protocol verified on real personal accounts). The personal-account sign-in first appeared in [EionRobb/purple-teams](https://github.com/EionRobb/purple-teams).
This server cannot be deployed
Maintenance
ActivityMaintained
ResponsivenessNo recent community issues