
一个模型上下文协议(MCP)服务器,通过图谱API与Microsoft 365和Office服务交互
概览
一个模型上下文协议(MCP)服务器,通过图谱API与Microsoft 365和Microsoft Office服务交互。 该服务器支持多个 Microsoft 云环境: - Node.js >= 20(推荐)- Node.js 14+ 可能适用于依赖警告 - 通过Microsoft认证库(MSAL)进行认证——全面的Microsoft 365服务集成——支持只读模式以实现安全操作——用于细致访问控制的工具过滤 服务器支持两种可全局配置的输出格式: 标准JSON输出,带有漂亮打印: 高效使用LLM代币的面向代币表示法: - 令牌数量比 JSON 少 30-60% - 最适合统一数组数据(邮件列表、日历事件、文件等)- 适合成本敏感的大规模应用
概述(AI 翻译)
Microsoft 365 MCP 服务器
一个模型上下文协议(MCP)服务器,用于通过图与 Microsoft 365 和 Microsoft Office 服务交互 API。
支持的云
该服务器支持多个 Microsoft 云环境:
| 云端 | 描述 | 认证端点 | 图 API 端点 |
|---|---|---|---|
| 全球(默认) | 国际Microsoft 365 | login.microsoftonline.com | graph.microsoft.com |
| 中国(21Vianet) | Microsoft 365由21Vianet运营 | login.chinacloudapi.cn | microsoftgraph.chinacloudapi.cn |
| GCC高中 | Microsoft 365 美国政府GCC高中 | login.microsoftonline.us | graph.microsoft.us |
GCC High 没有预注册客户端:在你的政府租户注册一个应用,设置 MS365_MCP_CLIENT_ID(和 MS365_MCP_TENANT_ID),然后使用 --cloud gcc-high。
要通过你自己的代理路由 Graph 流量(该代理终止客户端的纯 HTTP 并发起 TLS 给 Microsoft),请将 MS365_MCP_GRAPH_BASE_URL 设置为其基础 URL;请查看 CLI 选项下的环境变量列表,包括仍然绕过该变量的部分。
本页由 AI 翻译,技术细节请以原文为准。
README
以下为原文 README 节选,完整内容请查看原文。
ms-365-mcp-server
Microsoft 365 MCP Server
A Model Context Protocol (MCP) server for interacting with Microsoft 365 and Microsoft Office services through the Graph API.
Supported Clouds
This server supports multiple Microsoft cloud environments:
| Cloud | Description | Auth Endpoint | Graph API Endpoint |
|---|---|---|---|
| Global (default) | International Microsoft 365 | login.microsoftonline.com | graph.microsoft.com |
| China (21Vianet) | Microsoft 365 operated by 21Vianet | login.chinacloudapi.cn | microsoftgraph.chinacloudapi.cn |
| GCC High | Microsoft 365 US Government GCC High | login.microsoftonline.us | graph.microsoft.us |
GCC High has no pre-registered client: register an app in your government tenant and set MS365_MCP_CLIENT_ID (and MS365_MCP_TENANT_ID), then use --cloud gcc-high.
To route Graph traffic through a proxy of your own (one that terminates the client’s plain HTTP and originates TLS to Microsoft), set MS365_MCP_GRAPH_BASE_URL to its base URL; see the environment variable list under CLI Options, including what still bypasses it.
Prerequisites
- Node.js >= 20 (recommended)
- Node.js 14+ may work with dependency warnings
Features
- Authentication via Microsoft Authentication Library (MSAL)
- Comprehensive Microsoft 365 service integration
- Read-only mode support for safe operations
- Tool filtering for granular access control
- Tool presets and dynamic discovery to shrink the tool surface and token usage
Output Format: JSON vs TOON
The server supports two output formats that can be configured globally:
JSON Format (Default)
Standard JSON output with pretty-printing:
{
"value": [
{
"id": "1",
"displayName": "Alice Johnson",
"mail": "[email protected]",
"jobTitle": "Software Engineer"
}
]
}
(experimental) TOON Format
Token-Oriented Object Notation for efficient LLM token usage:
value[1]{id,displayName,mail,jobTitle}:
"1",Alice Johnson,[email protected],Software Engineer
Benefits:
- 30-60% fewer tokens vs JSON
- Best for uniform array data (lists of emails, calendar events, files, etc.)
- Ideal for cost-sensitive applications at scale
Usage:
安装
npx -y @softeria/ms-365-mcp-server --toon配置
{
"mcpServers": {
"ms365": {
"command": "npx",
"args": ["-y", "@softeria/ms-365-mcp-server", "--toon"]
}
}
}