Skip to content
Back to search

teams-mcp

MCP server providing comprehensive Microsoft Teams and Graph API access for AI assistants including messaging, search, and user management.

Safety scan

A static text scan, not a guarantee. Select the badge to see what was scanned and every finding.

Checked today

Check it deeper on your machine

It has changed since its scan on 11 Nov 2026.

As a Claude Code plugin, install it and then ask Claude Code:

/plugin marketplace add keithmackay/mackayi/plugin install scanskillsafety@mackayiDo a deep scan of https://github.com/floriscornel/teams-mcp with scanskillsafety

Or from a terminal, clone it and run it:

git clone https://github.com/keithmackay/scanskillsafety-skill ~/.claude/skills/scanskillsafetynode ~/.claude/skills/scanskillsafety/cli.cjs --deep 'https://github.com/floriscornel/teams-mcp'

It checks the exact commit: every file, its packages against OSV (api.osv.dev), how it compares with this page's scan (findsafeskills.com receives the repository's address), and, if you agree, Claude reading every file with your own Claude subscription. It never runs the code.

Badge for your README
findsafeskills safety rating

Markdown

[![findsafeskills safety rating](/api/listings/floriscornel--teams-mcp/badge.svg)](/listings/floriscornel--teams-mcp)

HTML

<a href="/listings/floriscornel--teams-mcp"><img src="/api/listings/floriscornel--teams-mcp/badge.svg" alt="findsafeskills safety rating" /></a>

Install

i

Install instructions from the README

As written by the repo's author. findsafeskills has not verified these steps.

To use this MCP server in Cursor/Claude/VS Code, add the following configuration:

{
  "mcpServers": {
    "teams-mcp": {
      "command": "npx",
      "args": ["-y", "@floriscornel/teams-mcp@latest"]
    }
  }
}

What was scanned

The files the safety scan read, as written by the repository's author and shown as plain text. Lines with a finding are marked.

README.md · README · 549 lines

View this file on GitHub (read at the repository's current version: the scan did not record which commit it read)

  1. # Teams MCP
  2. [![npm version](https://img.shields.io/npm/v/@floriscornel/teams-mcp.svg)](https://www.npmjs.com/package/@floriscornel/teams-mcp)
  3. [![npm downloads](https://img.shields.io/npm/dm/@floriscornel/teams-mcp.svg)](https://www.npmjs.com/package/@floriscornel/teams-mcp)
  4. [![codecov](https://codecov.io/gh/floriscornel/teams-mcp/graph/badge.svg)](https://app.codecov.io/gh/floriscornel/teams-mcp)
  5. [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
  6. [![GitHub stars](https://img.shields.io/github/stars/floriscornel/teams-mcp.svg)](https://github.com/floriscornel/teams-mcp/stargazers)
  7. A Model Context Protocol (MCP) server that provides seamless integration with Microsoft Graph APIs, enabling AI assistants to interact with Microsoft Teams, users, chats, files, and organizational data.
  8. <a href="https://glama.ai/mcp/servers/@floriscornel/teams-mcp">
  9. <img width="380" height="200" src="https://glama.ai/mcp/servers/@floriscornel/teams-mcp/badge" alt="Teams MCP server" />
  10. </a>
  11. ## 📦 Installation
  12. To use this MCP server in Cursor/Claude/VS Code, add the following configuration:
  13. ```json
  14. {
  15. "mcpServers": {
  16. "teams-mcp": {
  17. "command": "npx",
  18. "args": ["-y", "@floriscornel/teams-mcp@latest"]
  19. }
  20. }
  21. }
  22. ```
  23. ## 🚀 Features
  24. ### 🔐 Authentication
  25. - OAuth 2.0 device code authentication flow with Microsoft Graph
  26. - Secure token management, cache persistence, and refresh token renewal
  27. - Authentication status checking and logout support
  28. - Read-only mode with reduced scopes
  29. - Direct `AUTH_TOKEN` support for pre-issued Microsoft Graph access tokens
  30. ### 👥 User Management
  31. - Get current user information
  32. - Search users by name or email
  33. - Retrieve detailed user profiles
  34. - Access organizational directory data
  35. ### 🏢 Microsoft Teams Integration
  36. - **Teams Management**
  37. - List user's joined teams
  38. - Access team details and metadata
  39. - **Channel Operations**
  40. - List channels within teams
  41. - Retrieve channel messages and replies
  42. - Send messages to team channels
  43. - Reply to existing channel threads
  44. - Edit and soft delete channel messages and replies
  45. - Support for message importance levels (`normal`, `high`, `urgent`)
  46. - Support for inline image attachments via URL or base64 data
  47. - **Team Members**
  48. - List team members and their roles
  49. - Access member information
  50. - Search users for `@mentions`
  51. ### 💬 Chat & Messaging
  52. - **1:1 and Group Chats**
  53. - List user's chats
  54. - Create new 1:1 or group conversations
  55. - Retrieve chat message history with filtering, ordering, and pagination
  56. - Fetch all available messages via `@odata.nextLink` pagination
  57. - Send messages to existing chats
  58. - Edit previously sent chat messages
  59. - Soft delete chat messages
  60. ### ✏️ Message Management
  61. - **Edit & Delete**
  62. - Update (edit) sent messages in chats and channels
  63. - Soft delete messages in chats and channels (marks as deleted without permanent removal)
  64. - Only message senders can update/delete their own messages
  65. - Support for Markdown formatting, mentions, and importance levels on edits
  66. ### 📎 Media & Attachments
  67. - **Hosted Content**
  68. - Download hosted content (images, files) from chat and channel messages
  69. - Access inline images and attachments shared in conversations
  70. - Optionally save hosted content directly to disk
  71. - **File Upload**
  72. - Upload and send any file type (PDF, DOCX, XLSX, ZIP, images, etc.) to channels and chats
  73. - Large file support (>4 MB) via resumable upload sessions
  74. - Channel uploads go to SharePoint and chat uploads go to OneDrive
  75. - Optional message text, custom filename, formatting, and importance levels
  76. ### 🔍 Advanced Search & Discovery
  77. - **Message Search**
  78. - Search across all Teams channels and chats using Microsoft Search API
  79. - Support for KQL (Keyword Query Language) syntax
  80. - Filter by sender, mentions, attachments, read state, and date ranges
  81. - Get recent messages with advanced filtering options
  82. - Find messages mentioning the current user
  83. ## Rich Message Formatting Support
  84. The following tools support rich message formatting in Teams channels and chats:
  85. - `send_channel_message`
  86. - `send_chat_message`
  87. - `reply_to_channel_message`
  88. - `update_channel_message`
  89. - `update_chat_message`
  90. - `send_file_to_channel`
  91. - `send_file_to_chat`
  92. ### Format Options
  93. You can specify the `format` parameter to control the message formatting:
  94. - `text` (default): Plain text
  95. - `markdown`: Markdown formatting (bold, italic, lists, links, code, etc.) converted to sanitized HTML
  96. When `format` is set to `markdown`, the message content is converted to HTML using a secure markdown parser and sanitized to remove potentially dangerous content before being sent to Teams.
  97. If `format` is not specified, the message will be sent as plain text.
  98. ### Example Usage
  99. ```json
  100. {
  101. "teamId": "...",
  102. "channelId": "...",
  103. "message": "**Bold text** and _italic text_\n\n- List item 1\n- List item 2\n\n[Link](https://example.com)",
  104. "format": "markdown",
  105. "importance": "high"
  106. }
  107. ```
  108. ```json
  109. {
  110. "chatId": "...",
  111. "message": "Simple plain text message",
  112. "format": "text"
  113. }
  114. ```
  115. ### Security Features
  116. - **HTML Sanitization**: All markdown content is converted to HTML and sanitized to remove potentially dangerous elements (scripts, event handlers, etc.)
  117. - **Allowed Tags**: Only safe HTML tags are permitted (p, strong, em, a, ul, ol, li, h1-h6, code, pre, etc.)
  118. - **Safe Attributes**: Only safe attributes are allowed
  119. - **XSS Prevention**: Content is automatically sanitized to prevent cross-site scripting attacks
  120. ### Supported Markdown Features
  121. - **Text formatting**: Bold (`**text**`), italic (`_text_`), strikethrough (`~~text~~`)
  122. - **Links**: `[text](url)`
  123. - **Lists**: Bulleted (`- item`) and numbered (`1. item`)
  124. - **Code**: Inline `` `code` `` and fenced code blocks
  125. - **Headings**: `# H1` through `###### H6`
  126. - **Blockquotes**: `> quoted text`
  127. - **Tables**: GitHub-flavored markdown tables
  128. ## LLM-Friendly Content Format
  129. Messages retrieved from the Microsoft Graph API are returned as raw HTML containing Teams-specific tags. To make this content more consumable by AI assistants, the following tools support automatic HTML-to-Markdown conversion:
  130. - `get_chat_messages`
  131. - `get_channel_messages`
  132. - `get_channel_message_replies`
  133. - `search_messages`
  134. - `get_my_mentions`
  135. ### Content Format Options
  136. Use the `contentFormat` parameter to control how message content is returned:
  137. - `markdown` (default): Converts Teams HTML to clean Markdown, optimized for LLM consumption
  138. - `raw`: Returns the original HTML from the Microsoft Graph API
  139. ### What Gets Converted
  140. | HTML Element | Markdown Output |
  141. | -------------------------------------- | --------------------------------------------------------- |
  142. | `<at id="0">Name</at>` (Teams mention) | `@Name` (multi-word names merged using mentions metadata) |
  143. | `<strong>text</strong>` | `**text**` |
  144. | `<em>text</em>` | `*text*` |
  145. | `<code>text</code>` | `` `text` `` |
  146. | `<a href="url">text</a>` | `[text](url)` |
  147. | `<ul><li>item</li></ul>` | `- item` |
  148. | `<table>...</table>` | GFM Markdown table |
  149. | `<attachment id="...">` | `{attachment:id}` |
  150. | `<systemEventMessage/>` | *(removed)* |
  151. | `<hr>` | `---` |
  152. | `&nbsp;`, `&amp;`, etc. | Decoded to plain characters |
  153. ### Attachment Metadata
  154. Messages that contain file attachments or inline images include an `attachments` array in the response with metadata for each attachment (id, name, contentType, contentUrl, thumbnailUrl). The inline `{attachment:id}` markers in the markdown content correlate with entries in this array, allowing consumers to identify and download attachments via `download_message_hosted_content` or `download_chat_hosted_content`.
  155. ### Example Usage
  156. ```json
  157. {
  158. "chatId": "19:meeting_...",
  159. "limit": 10,
  160. "contentFormat": "markdown"
  161. }
  162. ```
  163. To get the original HTML:
  164. ```json
  165. {
  166. "chatId": "19:meeting_...",
  167. "limit": 10,
  168. "contentFormat": "raw"
  169. }
  170. ```
  171. ## 📦 Installation
  172. ```bash
  173. # Install dependencies
  174. npm install
  175. # Build the project
  176. npm run build
  177. # Set up authentication
  178. npm run auth
  179. ```
  180. ## 🔧 Configuration
  181. ### Prerequisites
  182. - Node.js 18+
  183. - Microsoft 365 account with appropriate permissions
  184. - Microsoft Graph delegated permissions for the scopes below
  185. ### Required Microsoft Graph Permissions
  186. **Full mode (default):**
  187. - `User.Read` - Read user profile
  188. - `User.ReadBasic.All` - Read basic user info
  189. - `Team.ReadBasic.All` - Read team information
  190. - `Channel.ReadBasic.All` - Read channel information
  191. - `ChannelMessage.Read.All` - Read channel messages
  192. - `ChannelMessage.Send` - Send channel messages and replies
  193. - `ChannelMessage.ReadWrite` - Edit and delete channel messages
  194. - `Chat.Read` - Read chat messages (included via read-only scopes)
  195. - `Chat.ReadWrite` - Create and manage chats, send/edit/delete chat messages (supersedes `Chat.Read`)
  196. - `TeamMember.Read.All` - Read team members
  197. - `Files.ReadWrite.All` - Required for file uploads to channels and chats
  198. **Read-only mode** (`TEAMS_MCP_READ_ONLY=true`) — only these scopes are requested:
  199. - `User.Read`
  200. - `User.ReadBasic.All`
  201. - `Team.ReadBasic.All`
  202. - `Channel.ReadBasic.All`
  203. - `ChannelMessage.Read.All`
  204. - `TeamMember.Read.All`
  205. - `Chat.Read`
  206. ### Authentication Modes
  207. **Full access:**
  208. ```bash
  209. npx @floriscornel/teams-mcp@latest authenticate
  210. ```
  211. **Read-only access:**
  212. ```bash
  213. npx @floriscornel/teams-mcp@latest authenticate --read-only
  214. ```
  215. **Direct token injection with an existing Microsoft Graph JWT:**
  216. ```json
  217. {
  218. "mcpServers": {
  219. "teams-mcp": {
  220. "command": "npx",
  221. "args": ["-y", "@floriscornel/teams-mcp@latest"],
  222. "env": {
  223. "AUTH_TOKEN": "<jwt-for-https://graph.microsoft.com>"
  224. }
  225. }
  226. }
  227. }
  228. ```
  229. ### Token Storage
  230. - Auth metadata is stored locally at `~/.msgraph-mcp-auth.json`
  231. - Token cache is stored locally at `~/.teams-mcp-token-cache.json`
  232. ## 🛠️ Usage
  233. ### Starting the Server
  234. ```bash
  235. # Development mode with hot reload
  236. npm run dev
  237. # Production mode
  238. npm run build && node dist/index.js
  239. # Start in read-only mode (disables all write tools)
  240. TEAMS_MCP_READ_ONLY=true node dist/index.js
  241. ```
  242. ### CLI Commands
  243. ```bash
  244. npx @floriscornel/teams-mcp@latest authenticate # Authenticate with full scopes
  245. npx @floriscornel/teams-mcp@latest authenticate --read-only # Authenticate with read-only scopes
  246. npx @floriscornel/teams-mcp@latest check # Check authentication status
  247. npx @floriscornel/teams-mcp@latest logout # Clear authentication
  248. npx @floriscornel/teams-mcp@latest auth # Alias for authenticate
  249. npx @floriscornel/teams-mcp@latest # Start MCP server (default)
  250. ```
  251. ### Environment Variables
  252. - `TEAMS_MCP_READ_ONLY=true` - Start the MCP server in read-only mode
  253. - `AUTH_TOKEN=<jwt>` - Use a pre-existing Microsoft Graph access token instead of MSAL login
  254. - `TEAMS_MCP_CLIENT_ID=<guid>` - Authenticate with your own Azure AD app registration instead of the default Microsoft Graph CLI app
  255. - `TEAMS_MCP_TENANT_ID=<guid-or-domain>` - Pin the authority to a specific tenant (e.g. `contoso.onmicrosoft.com`); required for single-tenant app registrations
  256. - `TEAMS_MCP_SCOPES="User.Read Chat.ReadWrite"` - Override the permission scopes requested during authentication (comma or space separated)
  257. ### Using Your Own Azure AD App Registration
  258. By default the server authenticates through Microsoft's public Graph CLI app. To use your own app registration (for example, when your tenant requires it):
  259. 1. In **App registrations**, set *Authentication* → *Allow public client flows* → **Yes**
  260. 2. Add the required **Delegated** Microsoft Graph permissions (see the list above)
  261. 3. Authenticate with your app pinned to your tenant:
  262. ```bash
  263. TEAMS_MCP_CLIENT_ID=<your-app-id> \
  264. TEAMS_MCP_TENANT_ID=<your-tenant-id> \
  265. npx @floriscornel/teams-mcp@latest authenticate
  266. ```
  267. Set the same environment variables on the MCP server process so it can renew tokens with the same app identity.
  268. ### Admin Consent Troubleshooting
  269. Most Teams permissions (`Team.ReadBasic.All`, `ChannelMessage.*`, `Chat.ReadWrite`, `Files.ReadWrite.All`) require admin consent. If sign-in shows *"Need admin approval"*, an admin must grant consent for the app once — via *Enterprise applications → Permissions → Grant admin consent*, or by opening:
  270. ```
  271. https://login.microsoftonline.com/<tenant-id>/v2.0/adminconsent?client_id=<app-id>&scope=<space-separated scopes>&redirect_uri=<registered-redirect-uri>
  272. ```
  273. After admin consent is granted, `authenticate` completes without prompts. Requesting scopes that are **not configured on the app registration** will always trigger the admin-approval wall — verify the app's *API permissions* list covers every requested scope.
  274. ### Read-Only Mode
  275. The server supports a read-only mode that disables all write operations (sending messages, creating chats, uploading files, editing/deleting messages) and requests only read-permission scopes from Microsoft Graph.
  276. **Enable read-only mode** using either:
  277. - Environment variable: `TEAMS_MCP_READ_ONLY=true`
  278. - CLI flag: `--read-only`
  279. **Authenticate with reduced scopes:**
  280. ```bash
  281. npx @floriscornel/teams-mcp@latest authenticate --read-only
  282. ```
  283. **MCP server configuration (read-only):**
  284. ```json
  285. {
  286. "mcpServers": {
  287. "teams-mcp": {
  288. "command": "npx",
  289. "args": ["-y", "@floriscornel/teams-mcp@latest"],
  290. "env": {
  291. "TEAMS_MCP_READ_ONLY": "true"
  292. }
  293. }
  294. }
  295. }
  296. ```
  297. **Switching modes:** When switching from read-only to full mode, the server detects the scope mismatch and warns you to re-authenticate:
  298. ```bash
  299. npx @floriscornel/teams-mcp@latest authenticate
  300. ```
  301. **Read-only tools (16):**
  302. `auth_status`, `get_current_user`, `search_users`, `get_user`, `list_teams`, `list_channels`, `get_channel_messages`, `get_channel_message_replies`, `list_team_members`, `search_users_for_mentions`, `download_message_hosted_content`, `list_chats`, `get_chat_messages`, `download_chat_hosted_content`, `search_messages`, `get_my_mentions`
  303. **Write tools disabled in read-only mode (15):**
  304. `send_channel_message`, `reply_to_channel_message`, `update_channel_message`, `delete_channel_message`, `send_file_to_channel`, `send_chat_message`, `create_chat`, `add_chat_member`, `update_chat_message`, `delete_chat_message`, `send_file_to_chat`, `set_channel_message_reaction`, `set_chat_message_reaction`, `unset_channel_message_reaction`, `unset_chat_message_reaction`
  305. ### Available MCP Tools
  306. #### Authentication
  307. - `auth_status` - Check current authentication status
  308. #### User Operations
  309. - `get_current_user` - Get authenticated user information
  310. - `search_users` - Search for users by name or email
  311. - `get_user` - Get detailed user information by ID or email
  312. #### Teams Operations
  313. - `list_teams` - List user's joined teams
  314. - `list_channels` - List channels in a specific team
  315. - `get_channel_messages` - Retrieve messages from a team channel with attachment summaries and content format selection
  316. - `get_channel_message_replies` - Get replies to a specific channel message
  317. - `send_channel_message` - Send a message to a team channel with optional mentions, importance, and image attachments
  318. - `reply_to_channel_message` - Reply to an existing channel message
  319. - `update_channel_message` - Edit a previously sent channel message or reply
  320. - `delete_channel_message` - Soft delete a channel message or reply
  321. - `set_channel_message_reaction` - Add a reaction to a channel message
  322. - `unset_channel_message_reaction` - Remove a reaction from a channel message
  323. - `list_team_members` - List members of a specific team
  324. - `search_users_for_mentions` - Search for team members to @mention in messages
  325. - `send_file_to_channel` - Upload a local file and send it as a message to a channel
  326. #### Chat Operations
  327. - `list_chats` - List user's chats (1:1 and group)
  328. - `get_chat_messages` - Retrieve messages from a specific chat with pagination, filters, ordering, and `fetchAll`
  329. - `send_chat_message` - Send a message to a chat
  330. - `create_chat` - Create a new 1:1 or group chat
  331. - `add_chat_member` - Add one or more members to an existing group chat
  332. - `update_chat_message` - Edit a previously sent chat message
  333. - `delete_chat_message` - Soft delete a chat message
  334. - `set_chat_message_reaction` - Add a reaction to a chat message
  335. - `unset_chat_message_reaction` - Remove a reaction from a chat message
  336. - `send_file_to_chat` - Upload a local file and send it as a message to a chat
  337. #### Media Operations
  338. - `download_message_hosted_content` - Download hosted content (images, files) from channel messages
  339. - `download_chat_hosted_content` - Download hosted content (images, files) from chat messages
  340. #### Search Operations
  341. - `search_messages` - Search across all Teams messages using KQL syntax
  342. - `get_my_mentions` - Find recent messages mentioning the current user
  343. ## 📋 Examples
  344. ### Authentication
  345. First, authenticate with Microsoft Graph:
  346. ```bash
  347. # Full access (default)
  348. npx @floriscornel/teams-mcp@latest authenticate
  349. # Read-only (reduced permission scopes)
  350. npx @floriscornel/teams-mcp@latest authenticate --read-only
  351. ```
  352. Check your authentication status:
  353. ```bash
  354. npx @floriscornel/teams-mcp@latest check
  355. ```
  356. Logout if needed:
  357. ```bash
  358. npx @floriscornel/teams-mcp@latest logout
  359. ```
  360. ### Chat Pagination Example
  361. ```json
  362. {
  363. "chatId": "19:meeting_...",
  364. "limit": 100,
  365. "fetchAll": true,
  366. "orderBy": "createdDateTime",
  367. "descending": true,
  368. "contentFormat": "markdown"
  369. }
  370. ```
  371. ### Channel Message with Mentions and Image
  372. ```json
  373. {
  374. "teamId": "team-id",
  375. "channelId": "channel-id",
  376. "message": "Please review **today's update**",
  377. "format": "markdown",
  378. "importance": "high",
  379. "mentions": [
  380. {
  381. "mention": "alex.chen",
  382. "userId": "00000000-0000-0000-0000-000000000000"
  383. }
  384. ],
  385. "imageUrl": "https://example.com/status.png"
  386. }
  387. ```
  388. ### File Upload Example
  389. ```json
  390. {
  391. "chatId": "19:meeting_...",
  392. "filePath": "/absolute/path/to/report.pdf",
  393. "message": "Please review the attached report",
  394. "format": "markdown"
  395. }
  396. ```
  397. ### Integrating with Cursor/Claude
  398. This MCP server is designed to work with AI assistants like Claude/Cursor/VS Code through the Model Context Protocol.
  399. ```json
  400. {
  401. "mcpServers": {
  402. "teams-mcp": {
  403. "command": "npx",
  404. "args": ["-y", "@floriscornel/teams-mcp@latest"]
  405. }
  406. }
  407. }
  408. ```
  409. ## 🔒 Security
  410. - All authentication is handled through Microsoft's OAuth 2.0 flow or a caller-provided Microsoft Graph token
  411. - **Refresh token support**: Access tokens are automatically renewed using cached refresh tokens, so you don't need to re-authenticate every hour
  412. - Token cache is stored locally at `~/.teams-mcp-token-cache.json`
  413. - Auth metadata is stored locally at `~/.msgraph-mcp-auth.json`
  414. - Markdown content is sanitized before sending HTML to Teams
  415. - `AUTH_TOKEN` is validated to ensure it targets `https://graph.microsoft.com`
  416. - No sensitive data is logged or exposed
  417. - Follows Microsoft Graph API security best practices
  418. ## 📝 License
  419. MIT License - see LICENSE file for details
  420. ## 🤝 Contributing
  421. 1. Fork the repository
  422. 2. Create a feature branch
  423. 3. Make your changes
  424. 4. Run build, linting, and tests
  425. 5. Submit a pull request
  426. ## 📞 Support
  427. For issues and questions:
  428. - Check the existing GitHub issues
  429. - Review Microsoft Graph API documentation
  430. - Ensure proper authentication and permissions are configured

Ratings and comments

Sign in to rate this skill.

Sign in

Free to use. If it’s helped, pass it on.