
Teams MCP
A Model Context Protocol server that provides AI assistants with access to Microsoft Teams, enabling interaction with teams, channels, chats, and organizational data through Microsoft Graph APIs.
README
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, 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"]
}
}
}
🚀 Features
🔐 Authentication
- OAuth 2.0 authentication flow with Microsoft Graph
- Secure token management and refresh
- Authentication status checking
👥 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
- Send messages to team channels
- Support for message importance levels (normal, high, urgent)
-
Team Members
- List team members and their roles
- Access member information
💬 Chat & Messaging
- 1:1 and Group Chats
- List user's chats
- Create new 1:1 or group conversations
- Retrieve chat message history with filtering and pagination
- Send messages to existing chats
🔍 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, importance, and date ranges
- Get recent messages with advanced filtering options
- Find messages mentioning specific users
Rich Message Formatting Support
The following tools now support rich message formatting in Teams channels and chats:
send_channel_message
send_chat_message
reply_to_channel_message
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"
}
{
"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 (href, target, src, alt, title, width, height)
- 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 blocks - Headings:
# H1
through###### H6
- Line breaks: Automatic conversion of newlines to
<br>
tags - Blockquotes:
> quoted text
- Tables: GitHub-flavored markdown tables
📦 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
- Azure App Registration with Microsoft Graph permissions
Required Microsoft Graph Permissions
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 messagesChat.Read
- Read chat messagesChat.ReadWrite
- Create and manage chatsMail.Read
- Required for Microsoft Search APICalendars.Read
- Required for Microsoft Search APIFiles.Read.All
- Required for Microsoft Search APISites.Read.All
- Required for Microsoft Search API
🛠️ Usage
Starting the Server
# Development mode with hot reload
npm run dev
# Production mode
npm run build && node dist/index.js
Available MCP Tools
Authentication
authenticate
- Initiate OAuth authentication flowlogout
- Clear authentication tokensget_current_user
- Get authenticated user information
User Operations
search_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 pagination and filteringsend_channel_message
- Send a message to a team channellist_team_members
- List members of a specific team
Chat Operations
list_chats
- List user's chats (1:1 and group)get_chat_messages
- Retrieve messages from a specific chat with pagination and filteringsend_chat_message
- Send a message to a chatcreate_chat
- Create a new 1:1 or group chat
Search Operations
search_messages
- Search across all Teams messages using KQL syntaxget_recent_messages
- Get recent messages with advanced filtering optionsget_my_mentions
- Find messages mentioning the current user
📋 Examples
Authentication
First, authenticate with Microsoft Graph:
npx @floriscornel/teams-mcp@latest authenticate
Check your authentication status:
npx @floriscornel/teams-mcp@latest check
Logout if needed:
npx @floriscornel/teams-mcp@latest logout
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
- Tokens are securely stored and automatically refreshed
- No 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 linting and formatting
- 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
推荐服务器

Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。