Teams MCP
This MCP server integrates with Microsoft Graph to let AI assistants read and send Microsoft Teams, chat, channel, user, and search data.
Authenticate and check status; get current user profile.
Search users and fetch user details by ID/email.
List joined teams, team channels, and team members; search users for @mentions.
Read channel messages and message replies; send channel messages or replies with markdown, mentions, importance, and image attachments.
List chats and read chat messages with filters (limit, since/until, orderBy, fromUser, descending).
Send chat messages and create 1:1 or group chats.
Search Teams messages with KQL, scope, and top results; get recent messages with time/scope/team/channel/user/attachment/importance filters; find messages mentioning the current user.
Shows code coverage metrics for the project through integration badges
Provides repository status tracking through badges for GitHub projects, displaying information like stars count
Supports formatting Teams messages using markdown syntax, with features like bold text, lists, and links
Required runtime environment for the MCP server with version 18+ needed for proper operation
Package distribution platform where the MCP server is published and can be installed from
Provides dynamic badges showing npm version, downloads, license, and other project metrics
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@Teams MCP list my recent channel messages from the 'Project Alpha' team"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
Teams MCP
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.
📦 Installation
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"]
}
}
}Related MCP server: Microsoft Graph MCP Server
🚀 Features
🔐 Authentication
OAuth 2.0 device code authentication flow with Microsoft Graph
Secure token management, cache persistence, and refresh token renewal
Authentication status checking and logout support
Read-only mode with reduced scopes
Direct
AUTH_TOKENsupport for pre-issued Microsoft Graph access tokens
👥 User Management
Get current user information
Search users by name or email
Retrieve detailed user profiles
Access organizational directory data
🏢 Microsoft Teams Integration
Teams Management
List user's joined teams
Access team details and metadata
Channel Operations
List channels within teams
Retrieve channel messages and replies
Send messages to team channels
Reply to existing channel threads
Edit and soft delete channel messages and replies
Support for message importance levels (
normal,high,urgent)Support for inline image attachments via URL or base64 data
Team Members
List team members and their roles
Access member information
Search users for
@mentions
💬 Chat & Messaging
1:1 and Group Chats
List user's chats
Create new 1:1 or group conversations
Retrieve chat message history with filtering, ordering, and pagination
Fetch all available messages via
@odata.nextLinkpaginationSend messages to existing chats
Edit previously sent chat messages
Soft delete chat messages
✏️ Message Management
Edit & Delete
Update (edit) sent messages in chats and channels
Soft delete messages in chats and channels (marks as deleted without permanent removal)
Only message senders can update/delete their own messages
Support for Markdown formatting, mentions, and importance levels on edits
📎 Media & Attachments
Hosted Content
Download hosted content (images, files) from chat and channel messages
Access inline images and attachments shared in conversations
Optionally save hosted content directly to disk
File Upload
Upload and send any file type (PDF, DOCX, XLSX, ZIP, images, etc.) to channels and chats
Large file support (>4 MB) via resumable upload sessions
Channel uploads go to SharePoint and chat uploads go to OneDrive
Optional message text, custom filename, formatting, and importance levels
🔍 Advanced Search & Discovery
Message Search
Search across all Teams channels and chats using Microsoft Search API
Support for KQL (Keyword Query Language) syntax
Filter by sender, mentions, attachments, read state, and date ranges
Get recent messages with advanced filtering options
Find messages mentioning the current user
Rich Message Formatting Support
The following tools support rich message formatting in Teams channels and chats:
send_channel_messagesend_chat_messagereply_to_channel_messageupdate_channel_messageupdate_chat_messagesend_file_to_channelsend_file_to_chat
Format Options
You can specify the format parameter to control the message formatting:
text(default): Plain textmarkdown: Markdown formatting (bold, italic, lists, links, code, etc.) converted to sanitized HTML
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.
If format is not specified, the message will be sent as plain text.
Example Usage
{
"teamId": "...",
"channelId": "...",
"message": "**Bold text** and _italic text_\n\n- List item 1\n- List item 2\n\n[Link](https://example.com)",
"format": "markdown",
"importance": "high"
}{
"chatId": "...",
"message": "Simple plain text message",
"format": "text"
}Security Features
HTML Sanitization: All markdown content is converted to HTML and sanitized to remove potentially dangerous elements (scripts, event handlers, etc.)
Allowed Tags: Only safe HTML tags are permitted (p, strong, em, a, ul, ol, li, h1-h6, code, pre, etc.)
Safe Attributes: Only safe attributes are allowed
XSS Prevention: Content is automatically sanitized to prevent cross-site scripting attacks
Supported Markdown Features
Text formatting: Bold (
**text**), italic (_text_), strikethrough (~~text~~)Links:
[text](url)Lists: Bulleted (
- item) and numbered (1. item)Code: Inline
`code`and fenced code blocksHeadings:
# H1through###### H6Blockquotes:
> quoted textTables: GitHub-flavored markdown tables
LLM-Friendly Content Format
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:
get_chat_messagesget_channel_messagesget_channel_message_repliessearch_messagesget_my_mentions
Content Format Options
Use the contentFormat parameter to control how message content is returned:
markdown(default): Converts Teams HTML to clean Markdown, optimized for LLM consumptionraw: Returns the original HTML from the Microsoft Graph API
What Gets Converted
HTML Element | Markdown Output |
|
|
|
|
|
|
|
|
|
|
|
|
| GFM Markdown table |
|
|
| (removed) |
|
|
| Decoded to plain characters |
Attachment Metadata
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.
Example Usage
{
"chatId": "19:meeting_...",
"limit": 10,
"contentFormat": "markdown"
}To get the original HTML:
{
"chatId": "19:meeting_...",
"limit": 10,
"contentFormat": "raw"
}📦 Installation
# Install dependencies
npm install
# Build the project
npm run build
# Set up authentication
npm run auth🔧 Configuration
Prerequisites
Node.js 18+
Microsoft 365 account with appropriate permissions
Microsoft Graph delegated permissions for the scopes below
Required Microsoft Graph Permissions
Full mode (default):
User.Read- Read user profileUser.ReadBasic.All- Read basic user infoTeam.ReadBasic.All- Read team informationChannel.ReadBasic.All- Read channel informationChannelMessage.Read.All- Read channel messagesChannelMessage.Send- Send channel messages and repliesChannelMessage.ReadWrite- Edit and delete channel messagesChat.Read- Read chat messages (included via read-only scopes)Chat.ReadWrite- Create and manage chats, send/edit/delete chat messages (supersedesChat.Read)TeamMember.Read.All- Read team membersFiles.ReadWrite.All- Required for file uploads to channels and chats
Read-only mode (TEAMS_MCP_READ_ONLY=true) — only these scopes are requested:
User.ReadUser.ReadBasic.AllTeam.ReadBasic.AllChannel.ReadBasic.AllChannelMessage.Read.AllTeamMember.Read.AllChat.Read
Authentication Modes
Full access:
npx @floriscornel/teams-mcp@latest authenticateRead-only access:
npx @floriscornel/teams-mcp@latest authenticate --read-onlyDirect token injection with an existing Microsoft Graph JWT:
{
"mcpServers": {
"teams-mcp": {
"command": "npx",
"args": ["-y", "@floriscornel/teams-mcp@latest"],
"env": {
"AUTH_TOKEN": "<jwt-for-https://graph.microsoft.com>"
}
}
}
}Token Storage
Auth metadata is stored locally at
~/.msgraph-mcp-auth.jsonToken cache is stored locally at
~/.teams-mcp-token-cache.json
🛠️ Usage
Starting the Server
# Development mode with hot reload
npm run dev
# Production mode
npm run build && node dist/index.js
# Start in read-only mode (disables all write tools)
TEAMS_MCP_READ_ONLY=true node dist/index.jsCLI Commands
npx @floriscornel/teams-mcp@latest authenticate # Authenticate with full scopes
npx @floriscornel/teams-mcp@latest authenticate --read-only # Authenticate with read-only scopes
npx @floriscornel/teams-mcp@latest check # Check authentication status
npx @floriscornel/teams-mcp@latest logout # Clear authentication
npx @floriscornel/teams-mcp@latest auth # Alias for authenticate
npx @floriscornel/teams-mcp@latest # Start MCP server (default)Environment Variables
TEAMS_MCP_READ_ONLY=true- Start the MCP server in read-only modeAUTH_TOKEN=<jwt>- Use a pre-existing Microsoft Graph access token instead of MSAL loginTEAMS_MCP_CLIENT_ID=<guid>- Authenticate with your own Azure AD app registration instead of the default Microsoft Graph CLI appTEAMS_MCP_TENANT_ID=<guid-or-domain>- Pin the authority to a specific tenant (e.g.contoso.onmicrosoft.com); required for single-tenant app registrationsTEAMS_MCP_SCOPES="User.Read Chat.ReadWrite"- Override the permission scopes requested during authentication (comma or space separated)
Using Your Own Azure AD App Registration
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):
In App registrations, set Authentication → Allow public client flows → Yes
Add the required Delegated Microsoft Graph permissions (see the list above)
Authenticate with your app pinned to your tenant:
TEAMS_MCP_CLIENT_ID=<your-app-id> \
TEAMS_MCP_TENANT_ID=<your-tenant-id> \
npx @floriscornel/teams-mcp@latest authenticateSet the same environment variables on the MCP server process so it can renew tokens with the same app identity.
Admin Consent Troubleshooting
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:
https://login.microsoftonline.com/<tenant-id>/v2.0/adminconsent?client_id=<app-id>&scope=<space-separated scopes>&redirect_uri=<registered-redirect-uri>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.
Read-Only Mode
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.
Enable read-only mode using either:
Environment variable:
TEAMS_MCP_READ_ONLY=trueCLI flag:
--read-only
Authenticate with reduced scopes:
npx @floriscornel/teams-mcp@latest authenticate --read-onlyMCP server configuration (read-only):
{
"mcpServers": {
"teams-mcp": {
"command": "npx",
"args": ["-y", "@floriscornel/teams-mcp@latest"],
"env": {
"TEAMS_MCP_READ_ONLY": "true"
}
}
}
}Switching modes: When switching from read-only to full mode, the server detects the scope mismatch and warns you to re-authenticate:
npx @floriscornel/teams-mcp@latest authenticateRead-only tools (16):
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
Write tools disabled in read-only mode (15):
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
Available MCP Tools
Authentication
auth_status- Check current authentication status
User Operations
get_current_user- Get authenticated user informationsearch_users- Search for users by name or emailget_user- Get detailed user information by ID or email
Teams Operations
list_teams- List user's joined teamslist_channels- List channels in a specific teamget_channel_messages- Retrieve messages from a team channel with attachment summaries and content format selectionget_channel_message_replies- Get replies to a specific channel messagesend_channel_message- Send a message to a team channel with optional mentions, importance, and image attachmentsreply_to_channel_message- Reply to an existing channel messageupdate_channel_message- Edit a previously sent channel message or replydelete_channel_message- Soft delete a channel message or replyset_channel_message_reaction- Add a reaction to a channel messageunset_channel_message_reaction- Remove a reaction from a channel messagelist_team_members- List members of a specific teamsearch_users_for_mentions- Search for team members to @mention in messagessend_file_to_channel- Upload a local file and send it as a message to a channel
Chat Operations
list_chats- List user's chats (1:1 and group)get_chat_messages- Retrieve messages from a specific chat with pagination, filters, ordering, andfetchAllsend_chat_message- Send a message to a chatcreate_chat- Create a new 1:1 or group chatadd_chat_member- Add one or more members to an existing group chatupdate_chat_message- Edit a previously sent chat messagedelete_chat_message- Soft delete a chat messageset_chat_message_reaction- Add a reaction to a chat messageunset_chat_message_reaction- Remove a reaction from a chat messagesend_file_to_chat- Upload a local file and send it as a message to a chat
Media Operations
download_message_hosted_content- Download hosted content (images, files) from channel messagesdownload_chat_hosted_content- Download hosted content (images, files) from chat messages
Search Operations
search_messages- Search across all Teams messages using KQL syntaxget_my_mentions- Find recent messages mentioning the current user
📋 Examples
Authentication
First, authenticate with Microsoft Graph:
# Full access (default)
npx @floriscornel/teams-mcp@latest authenticate
# Read-only (reduced permission scopes)
npx @floriscornel/teams-mcp@latest authenticate --read-onlyCheck your authentication status:
npx @floriscornel/teams-mcp@latest checkLogout if needed:
npx @floriscornel/teams-mcp@latest logoutChat Pagination Example
{
"chatId": "19:meeting_...",
"limit": 100,
"fetchAll": true,
"orderBy": "createdDateTime",
"descending": true,
"contentFormat": "markdown"
}Channel Message with Mentions and Image
{
"teamId": "team-id",
"channelId": "channel-id",
"message": "Please review **today's update**",
"format": "markdown",
"importance": "high",
"mentions": [
{
"mention": "alex.chen",
"userId": "00000000-0000-0000-0000-000000000000"
}
],
"imageUrl": "https://example.com/status.png"
}File Upload Example
{
"chatId": "19:meeting_...",
"filePath": "/absolute/path/to/report.pdf",
"message": "Please review the attached report",
"format": "markdown"
}Integrating with Cursor/Claude
This MCP server is designed to work with AI assistants like Claude/Cursor/VS Code through the Model Context Protocol.
{
"mcpServers": {
"teams-mcp": {
"command": "npx",
"args": ["-y", "@floriscornel/teams-mcp@latest"]
}
}
}🔒 Security
All authentication is handled through Microsoft's OAuth 2.0 flow or a caller-provided Microsoft Graph token
Refresh token support: Access tokens are automatically renewed using cached refresh tokens, so you don't need to re-authenticate every hour
Token cache is stored locally at
~/.teams-mcp-token-cache.jsonAuth metadata is stored locally at
~/.msgraph-mcp-auth.jsonMarkdown content is sanitized before sending HTML to Teams
AUTH_TOKENis validated to ensure it targetshttps://graph.microsoft.comNo sensitive data is logged or exposed
Follows Microsoft Graph API security best practices
📝 License
MIT License - see LICENSE file for details
🤝 Contributing
Fork the repository
Create a feature branch
Make your changes
Run build, linting, and tests
Submit a pull request
📞 Support
For issues and questions:
Check the existing GitHub issues
Review Microsoft Graph API documentation
Ensure proper authentication and permissions are configured
Available Tools
19 toolsauth_statusA
Check the authentication status of the Microsoft Graph connection. Returns whether the user is authenticated and shows their basic profile information.
Inputs: no named parameters.
create_chatC
Create a new chat conversation. Can be a 1:1 chat (with one other user) or a group chat (with multiple users). Group chats can optionally have a topic.
Inputs: userEmails (required), topic.
get_channel_message_repliesC
Get all replies to a specific message in a channel. Returns reply content, sender information, and timestamps.
Inputs: teamId (required), channelId (required), messageId (required), limit.
get_channel_messagesC
Retrieve recent messages from a specific channel in a Microsoft Team. Returns message content, sender information, and timestamps.
Inputs: teamId (required), channelId (required), limit.
get_chat_messagesB
Retrieve recent messages from a specific chat conversation. Returns message content, sender information, and timestamps.
Inputs: chatId (required), limit, since, until, +3 more.
get_current_userA
Get the current authenticated user's profile information including display name, email, job title, and department.
Inputs: no named parameters.
get_my_mentionsA
Find all recent messages where the current user was mentioned (@mentioned) across Teams channels and chats.
Inputs: hours, limit, scope.
get_recent_messagesC
Get recent messages from across Teams with advanced filtering options. Can filter by time range, scope (channels vs chats), teams, channels, and users.
Inputs: hours, limit, mentionsUser, fromUser, +6 more.
get_userC
Get detailed information about a specific user by their ID or email address. Returns profile information including name, email, job title, and department.
Inputs: userId (required).
list_channelsB
List all channels in a specific Microsoft Team. Returns channel names, descriptions, types, and IDs for the specified team.
Inputs: teamId (required).
list_chatsB
List all recent chats (1:1 conversations and group chats) that the current user participates in. Returns chat topics, types, and participant information.
Inputs: no named parameters.
list_team_membersB
List all members of a specific Microsoft Team. Returns member names, email addresses, roles, and IDs.
Inputs: teamId (required).
list_teamsA
List all Microsoft Teams that the current user is a member of. Returns team names, descriptions, and IDs.
Inputs: no named parameters.
reply_to_channel_messageB
Reply to a specific message in a channel. Supports text and markdown formatting, mentions, and importance levels.
Inputs: teamId (required), channelId (required), messageId (required), message (required), +7 more.
search_messagesA
Search for messages across all Microsoft Teams channels and chats using Microsoft Search API. Supports advanced KQL syntax for filtering by sender, mentions, attachments, and more.
Inputs: query (required), scope, limit, enableTopResults.
search_usersA
Search for users in the organization by name or email address. Returns matching users with their basic profile information.
Inputs: query (required).
search_users_for_mentionsA
Search for users to mention in messages. Returns users with their display names, email addresses, and mention IDs.
Inputs: query (required), limit.
send_channel_messageC
Send a message to a specific channel in a Microsoft Team. Supports text and markdown formatting, mentions, and importance levels.
Inputs: teamId (required), channelId (required), message (required), importance, +6 more.
send_chat_messageC
Send a message to a specific chat conversation. Supports text and markdown formatting, mentions, and importance levels.
Inputs: chatId (required), message (required), importance, format, +1 more.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 19 tools
Most tools have distinct purposes targeting specific resources like channels, chats, users, or messages, but there is some overlap: get_recent_messages and search_messages both retrieve messages with filtering, which could cause confusion. However, descriptions clarify that get_recent_messages focuses on recent messages with time/scope filters, while search_messages uses advanced KQL syntax, helping to differentiate them.
Tool names follow a highly consistent verb_noun pattern throughout, such as list_teams, get_channel_messages, send_chat_message, and search_users. All tools use snake_case with clear verbs like get, list, create, send, reply, and search, making the set predictable and easy to understand.
With 19 tools, the count is slightly high but reasonable for a comprehensive Teams integration covering authentication, chats, channels, messages, users, and search. It provides broad functionality without being overwhelming, though it could be streamlined by merging some overlapping tools like get_recent_messages and search_messages.
The toolset offers complete coverage for Microsoft Teams interactions, including CRUD operations for messages (send, reply, get), resource listing (teams, channels, chats, members), user management (get, search), and authentication. There are no obvious gaps; agents can perform core workflows like messaging, searching, and team management effectively.
Maintenance
Related MCP Connectors
A comprehensive Model Context Protocol (MCP) server that enables AI assistants to interact with yo…
The Telnyx MCP server is an official implementation of the Model Context Protocol that enables AI clients (like Claude Desktop, Cursor, and OpenAI Agents) to interact with Telnyx's telephony, messaging, and AI assistant APIs. It provides comprehensive capabilities including making and managing phone calls, sending SMS/MMS messages, purchasing and configuring phone numbers, creating AI assistants with custom instructions, managing cloud storage buckets, scraping and embedding website content, and handling integration secrets. The server exists as both a local implementation and a remotely hosted version, allowing developers to integrate real-world communication infrastructure directly into AI applications.
One MCP server for the services your AI needs: memory, files, Microsoft 365, kanban and more.
MCP server connecting AI agents to 100+ apps (Gmail, Slack, Notion, GitHub) via one-click OAuth.
Related MCP Servers
- AlicenseBqualityAmaintenanceA Model Context Protocol server that enables interaction with Microsoft 365 services (Excel, Calendar, Mail, OneDrive, Teams, etc.) through the Graph API, allowing AI assistants to manage Microsoft 365 resources via natural language.20388,164 npm1,132MIT
- AlicenseNot gradedqualityDmaintenanceA comprehensive server that enables AI applications to interact with Microsoft 365 and Azure AD services through standardized Model Context Protocol interfaces.3MIT
- AlicenseNot gradedqualityDmaintenanceModel Context Protocol servers for Microsoft 365, enabling AI assistants to interact with Calendar, Contacts, OneDrive, Outlook, and SharePoint via the Microsoft Graph API.MIT
- AlicenseNot gradedqualityDmaintenanceA Model Context Protocol server enabling AI assistants to interact with Microsoft Teams, users, chats, and organizational data via Microsoft Graph APIs.1,622 npmMIT