[
](https://www.npmjs.com/package/@floriscornel/
teams-mcp)
一个模型上下文协议(MCP)服务器,提供与Microsoft Graph API的无缝集成,使AI助手能够与Microsoft Teams、用户和组织数据进行交互。
要在Cursor/Claude/VS Code中使用此MCP服务器,请添加以下配置:
{
"mcpServers": {
"teams-mcp": {
"command": "npx",
"args": ["-y", "@floriscornel/teams-mcp@latest"]
}
}
}
团队管理
频道操作
团队成员
以下工具现在支持在Teams频道和聊天中的富文本消息格式:
send_channel_messagesend_chat_messagereply_to_channel_message您可以指定format参数来控制消息格式:
text(默认):纯文本markdown:Markdown格式化(粗体、斜体、列表、链接、代码等)- 转换为经过清理的HTML当format设置为markdown时,消息内容会通过安全的Markdown解析器转换为HTML并进行清理以移除潜在危险的内容,然后再发送到Teams。
如果未指定format,消息将以纯文本形式发送。
{
"teamId": "...",
"channelId": "...",
"message": "**粗体文本** 和 _斜体文本_\n\n- 列表项1\n- 列表项2\n\n[链接](https://example.com)",
"format": "markdown"
}
{
"chatId": "...",
"message": "简单的纯文本消息",
"format": "text"
}
**文本**)、斜体(_文本_)、删除线(~~文本~~)[文本](网址)- 项目)和有序列表(1. 项目)`代码`和代码块 代码 # H1至###### H6<br>标签> 引用文本# 安装依赖
npm install
# 构建项目
npm run build
# 设置认证
npm run auth
User.Read - 读取用户资料User.ReadBasic.All - 读取基本用户信息Team.ReadBasic.All - 读取团队信息Channel.ReadBasic.All - 读取频道信息ChannelMessage.Read.All - 读取频道消息ChannelMessage.Send - 发送频道消息Chat.Read - 读取聊天消息Chat.ReadWrite - 创建和管理聊天Mail.Read - 使用Microsoft Search API所需Calendars.Read - 使用Microsoft Search API所需Files.Read.All - 使用Microsoft Search API所需Sites.Read.All - 使用Microsoft Search API所需# 开发模式,带热重载
npm run dev
# 生产模式
npm run build && node dist/index.js
authenticate - 启动OAuth认证流程logout - 清除认证令牌get_current_user - 获取已认证的用户信息search_users - 按姓名或电子邮件搜索用户get_user - 通过ID或电子邮件获取详细用户信息list_teams - 列出用户加入的团队list_channels - 列出特定团队中的频道get_channel_messages - 从团队频道中检索消息,支持分页和过滤send_channel_message - 向团队频道发送消息list_team_members - 列出特定团队的成员list_chats - 列出用户的聊天(一对一和群聊)get_chat_messages - 从特定聊天中检索消息,支持分页和过滤send_chat_message - 向聊天发送消息create_chat - 创建新的1:1或群聊search_messages - 使用KQL语法跨所有Teams消息进行搜索get_recent_messages - 获取带有高级过滤选项的最近消息get_my_mentions - 查找提到当前用户的邮件首先,使用Microsoft Graph进行认证:
npx @floriscornel/teams-mcp@latest authenticate
检查您的认证状态:
npx @floriscornel/teams-mcp@latest check
如需注销:
npx @floriscornel/teams-mcp@latest logout
此MCP服务器旨在通过模型上下文协议与AI助手(如Claude/Cursor/VS Code)配合使用。
{
"mcpServers": {
"teams-mcp": {
"command": "npx",
"args": ["-y", "@floriscornel/teams-mcp@latest"]
}
}
}
MIT许可证 - 详情见LICENSE文件
对于问题和疑问: