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": "**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"
}
**text**)、斜体 (_text_)、删除线 (~~text~~)。[text](url)。- item) 和有序列表 (1. item)。`code` 和代码块 code。# H1 到 ###### H6。
标签。> quoted text。# 安装依赖
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 - 创建新的一对一或群组聊天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 服务器旨在通过模型上下文协议与 Claude/Cursor/VS Code 等 AI 助手配合使用。
{
"mcpServers": {
"teams-mcp": {
"command": "npx",
"args": ["-y", "@floriscornel/teams-mcp@latest"]
}
}
}
本项目采用 MIT 许可证,详情请参阅 LICENSE 文件。
若遇到问题或有疑问: