Teams MCP Server
Enables Claude to read, send, and search messages across Microsoft Teams, including channels, chats, and profiles, using your own Microsoft 365 work account with one-click OAuth sign-in.
README
Teams MCP Server
The first open-source Microsoft Teams connector for Claude. Any Microsoft 365 user can connect — just sign in with your work account. No setup, no credentials, no self-hosting required.
Read messages, list channels, search across Teams, send messages — all from Claude Code, Claude Desktop, or Claude Cowork.
Built by SurgeEnterpriseAI.
How It Works
┌─────────────┐ 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 │ │
│ └────────────────┘ │
└──────────────────────┘
The user connects their own Microsoft 365 account. They see their own teams, their own channels, their own messages. Each user's tokens are isolated. The server is the bridge — it never stores messages, just passes them through.
Features
- One-click connect — visit
/connect, sign in with Microsoft, done - Multi-tenant — any Microsoft 365 organization, any user
- 11 tools — teams, channels, messages, chats, search, profile
- Dual transport — STDIO for Claude Code, HTTP/SSE for Cowork & remote
- Multi-user — each session gets isolated OAuth tokens
- Auto-detect — picks the right transport based on launch method
- Token caching — silent refresh, no re-login every session
- Retry logic — automatic retries on throttled Graph API calls
- TypeScript — fully typed, clean architecture, MIT licensed
For Users: Connect in 1 Click
If someone is already hosting this server (e.g., on https://teams-mcp.surgeai.com):
- Claude asks you to connect Microsoft Teams
- You click the auth link
- Sign in with your Microsoft work account
- Done — Claude can now read your Teams
No API keys, no Azure portal, no setup.
For Developers: Self-Host
1. Clone & Install
git clone https://github.com/SurgeEnterpriseAI/teams-mcp-server.git
cd teams-mcp-server
npm install
npm run build
2. Azure AD App Registration
- Go to Azure Portal → App registrations → New registration
- Name:
Teams MCP Server - Supported account types: "Accounts in any organizational directory (Any Azure AD directory - Multitenant)"
- Redirect URI: Web →
https://your-server.com/auth/callback - Click Register
Configure:
- Certificates & secrets → New client secret → copy the Value
- API Permissions → Add Delegated (Microsoft Graph):
ChannelMessage.Read.All,ChannelMessage.SendChat.Read,Chat.ReadWrite,ChatMessage.SendTeam.ReadBasic.All,Channel.ReadBasic.AllUser.Read
- Click Grant admin consent (for your own tenant; other tenants consent on first login)
3. Configure & Deploy
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)
Deploy to Railway, Render, Azure App Service, or any Node.js host:
# 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. Submit to MCP Registry
Once deployed and tested, submit your server URL to Anthropic's MCP connector registry. Users will then see "Microsoft Teams" as a connect option in Claude Cowork — just like Slack and Gmail.
For Claude Code Users: Local STDIO Mode
Add to your .mcp.json:
{
"mcpServers": {
"teams": {
"command": "node",
"args": ["/path/to/teams-mcp-server/dist/index.js"],
"cwd": "/path/to/teams-mcp-server"
}
}
}
First run will open your browser for Microsoft login. After that, tokens are cached.
Available Tools
| Tool | What it does |
|---|---|
teams_list_teams |
List all your Teams |
teams_list_channels |
List channels in a team |
teams_read_channel_messages |
Read recent channel messages |
teams_send_channel_message |
Send a message to a channel |
teams_reply_to_message |
Reply in a channel thread |
teams_read_message_replies |
Read thread replies |
teams_list_chats |
List your DMs and group chats |
teams_read_chat_messages |
Read messages from a chat |
teams_send_chat_message |
Send a direct/group chat message |
teams_search_messages |
Search messages across all Teams |
teams_get_profile |
Get your Microsoft 365 profile |
Architecture
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)
Environment Variables
| Variable | Required | Default | Description |
|---|---|---|---|
TEAMS_CLIENT_ID |
Yes | — | Azure AD app client ID |
TEAMS_CLIENT_SECRET |
Yes | — | Azure AD client secret |
TEAMS_AUTHORITY |
No | common |
common for multi-tenant, or a specific tenant ID |
TRANSPORT_MODE |
No | auto |
auto, stdio, or http |
PORT |
No | 3000 |
HTTP server port |
BASE_URL |
No | http://localhost:3000 |
Public URL |
REDIRECT_URI |
No | {BASE_URL}/auth/callback |
OAuth callback URL |
TOKEN_STORE_PATH |
No | ./.data/tokens |
Token cache directory |
LOG_LEVEL |
No | info |
Logging level |
License
MIT — LICENSE
Contributing
Issues and PRs welcome. Built by SurgeEnterpriseAI.
推荐服务器
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 模型以安全和受控的方式获取实时的网络信息。