Skip to main content
Glama

Teams MCP Server

首个面向 Claude 的开源 Microsoft Teams 连接器。任何 Microsoft 365 用户都可以连接——只需使用你的工作账户登录。无需设置、无需凭据、无需自托管。

读取消息、列出频道、跨 Teams 搜索、发送消息——全部可在 Claude Code、Claude Desktop 或 Claude Cowork 中完成。

SurgeEnterpriseAI 构建。

工作原理

┌─────────────┐     Click "Connect"     ┌──────────────────────┐
│ Claude User  │ ──────────────────────► │ Teams MCP Server     │
│ (Cowork/     │                         │ (hosted by Surge)    │
│  Desktop/    │     SSE/MCP Protocol    │                      │
│  Code)       │ ◄─────────────────────► │  ┌────────────────┐  │
└─────────────┘                          │  │ OAuth (common)  │  │
                                         │  │ Any M365 user   │  │
       User signs in with their          │  │ can sign in     │  │
       own Microsoft account             │  └───────┬────────┘  │
       ─────────────────────►            │          │           │
                                         │  ┌───────▼────────┐  │
                                         │  │ Microsoft       │  │
                                         │  │ Graph API       │  │
                                         │  └────────────────┘  │
                                         └──────────────────────┘

用户连接自己的 Microsoft 365 账户。 他们看到自己的团队、自己的频道、自己的消息。每个用户的令牌都是隔离的。服务器是桥梁——它从不存储消息,只是传递它们。

Related MCP server: Microsoft 365 MCP Server

功能特性

  • 一键连接 — 访问 /connect,使用 Microsoft 登录,完成

  • 多租户 — 任何 Microsoft 365 组织,任何用户

  • 11 个工具 — 团队、频道、消息、聊天、搜索、个人资料

  • 双传输 — 用于 Claude Code 的 STDIO,用于 Cowork 和远程的 HTTP/SSE

  • 多用户 — 每个会话获得隔离的 OAuth 令牌

  • 自动检测 — 根据启动方式选择正确的传输

  • 令牌缓存 — 静默刷新,无需每次会话重新登录

  • 重试逻辑 — 对受限的 Graph API 调用自动重试

  • TypeScript — 完全类型化,架构清晰,MIT 许可

对于用户:一键连接

如果已经有人托管此服务器(例如在 https://teams-mcp.surgeai.com 上):

  1. Claude 要求你连接 Microsoft Teams

  2. 你点击认证链接

  3. 使用你的 Microsoft 工作账户登录

  4. 完成 — Claude 现在可以读取你的 Teams

无需 API 密钥,无需 Azure 门户,无需设置。

对于开发者:自托管

1. 克隆并安装

git clone https://github.com/SurgeEnterpriseAI/teams-mcp-server.git
cd teams-mcp-server
npm install
npm run build

2. Azure AD 应用注册

  1. 转到 Azure 门户应用注册新注册

  2. 名称:Teams MCP Server

  3. 支持的账户类型:“任何组织目录中的账户(任何 Azure AD 目录 - 多租户)”

  4. 重定向 URI:Webhttps://your-server.com/auth/callback

  5. 点击注册

配置:

  • 证书和机密 → 新建客户端机密 → 复制值

  • API 权限 → 添加委派(Microsoft Graph):

    • ChannelMessage.Read.All, ChannelMessage.Send

    • Chat.Read, Chat.ReadWrite, ChatMessage.Send

    • Team.ReadBasic.All, Channel.ReadBasic.All

    • User.Read

  • 点击授予管理员同意(对于你自己的租户;其他租户在首次登录时同意)

3. 配置并部署

cp .env.example .env
# Set TEAMS_CLIENT_ID, TEAMS_CLIENT_SECRET
# Set BASE_URL and REDIRECT_URI to your production URL
# TEAMS_AUTHORITY=common (multi-tenant, default)

部署到 Railway、Render、Azure App Service 或任何 Node.js 主机:

# Railway
railway login && railway init && railway up

# Or Azure
az webapp up --name teams-mcp-server --runtime "NODE:20-lts"

# Or just run directly
TRANSPORT_MODE=http node dist/index.js

4. 提交到 MCP 注册表

部署并测试后,将你的服务器 URL 提交到 Anthropic 的 MCP 连接器注册表。用户随后会在 Claude Cowork 中看到“Microsoft Teams”作为连接选项——就像 Slack 和 Gmail 一样。

对于 Claude Code 用户:本地 STDIO 模式

添加到你的 .mcp.json

{
  "mcpServers": {
    "teams": {
      "command": "node",
      "args": ["/path/to/teams-mcp-server/dist/index.js"],
      "cwd": "/path/to/teams-mcp-server"
    }
  }
}

首次运行将打开你的浏览器进行 Microsoft 登录。之后,令牌会被缓存。

可用工具

Tool

功能描述

teams_list_teams

列出你的所有团队

teams_list_channels

列出团队中的频道

teams_read_channel_messages

读取最近的频道消息

teams_send_channel_message

向频道发送消息

teams_reply_to_message

在频道线程中回复

teams_read_message_replies

读取线程回复

teams_list_chats

列出你的私聊和群聊

teams_read_chat_messages

读取聊天中的消息

teams_send_chat_message

发送私聊/群聊消息

teams_search_messages

跨所有 Teams 搜索消息

teams_get_profile

获取你的 Microsoft 365 个人资料

架构

src/
├── index.ts               Main entry (auto-detects transport)
├── config.ts              Central configuration
├── logger.ts              Structured logging
├── types.ts               TypeScript interfaces
├── sessions.ts            Multi-user session manager
├── auth/
│   ├── oauth.ts           MSAL OAuth (multi-tenant, per-user)
│   └── token-store.ts     Persistent token cache
├── graph/
│   ├── client.ts          Graph HTTP client with retries
│   ├── teams.ts           Teams & channels API
│   ├── messages.ts        Channel messages API
│   ├── chats.ts           DM & group chat API
│   └── search.ts          Search & profile API
├── mcp/
│   ├── server.ts          MCP server factory
│   └── tools/             11 tool definitions
├── transport/
│   ├── stdio.ts           STDIO (Claude Code)
│   └── http.ts            Express + SSE (Cowork / remote)

环境变量

变量

必需

默认值

描述

TEAMS_CLIENT_ID

Azure AD 应用客户端 ID

TEAMS_CLIENT_SECRET

Azure AD 客户端机密

TEAMS_AUTHORITY

common

common 用于多租户,或特定租户 ID

TRANSPORT_MODE

auto

autostdiohttp

PORT

3000

HTTP 服务器端口

BASE_URL

http://localhost:3000

公共 URL

REDIRECT_URI

{BASE_URL}/auth/callback

OAuth 回调 URL

TOKEN_STORE_PATH

./.data/tokens

令牌缓存目录

LOG_LEVEL

info

日志级别

许可证

MIT — LICENSE

贡献

欢迎提交 Issue 和 PR。由 SurgeEnterpriseAI 构建。

A
license - permissive license
Not graded
quality - not tested
D
maintenance

Maintenance

Maintainers
Response time
Release cycle
Releases (12mo)
Commit activity

Resources

Unclaimed servers have limited discoverability.

Looking for Admin?

If you are the server author, to access and configure the admin panel.

Related MCP Servers

View all related MCP servers

Related MCP Connectors

  • Drive your real WhatsApp inbox from Claude — send, reply, label, assign, and triage via TimelinesAI.

  • Connect Claude to Fathom meeting recordings, transcripts, and summaries

  • WHOOP recovery, strain, sleep and workouts in Claude via official WHOOP OAuth. Free, open source.

View all MCP Connectors

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/SurgeEnterpriseAI/teams-mcp-server'

If you have feedback or need assistance with the MCP directory API, please join our Discord server