CLI for Microsoft 365 MCP Server
Microsoft 365 MCP 服务器的 CLI
💡 描述
目前,这是一项正在进行的工作,更多的是 POC,而不是解决方案。
Related MCP server: Microsoft MCP
📦先决条件
Node.js 20.x 或更高版本
🚀 如何构建和运行
首先运行npm install来安装所有依赖项。
然后为了构建项目运行:
npm run build此 MCP 服务器使用全局安装的Microsoft 365 CLI ,您需要使用npm i -g @pnp/cli-microsoft365全局安装。
MCP 服务器不会为您执行任何身份验证。您需要先使用m365 login命令通过 Microsoft 365 的 CLI 进行身份验证。身份验证通过后,MCP 服务器在运行任何工具时都会使用相同的身份验证上下文。
使用检查器运行 MCP
测试 Microsoft 365 MCP 服务器 CLI 的方法之一是使用MCP 检查器。首先使用以下命令启动 MCP 服务器:
npm run start现在,为了运行 MCP 服务器的检查器,您需要在 repo 根文件夹位置运行以下命令:
npx @modelcontextprotocol/inspector node dist/index.js之后等待检查器启动并在浏览器中打开它。您应该看到 MCP 服务器正在运行,并且能够查询工具并在本地执行它们。

在 VS Code 中运行 MCP
您也可以在 VS Code 中从本地构建运行 MCP 服务器,以便 GitHub Copilot Agent 可以使用它。首先使用以下命令启动 Microsoft 365 MCP 服务器的 CLI:
npm run start现在进入 VS Code GitHub Copilot Agent 模式,点击工具图标,选择Add more tools 。然后选择“ Add MCP server ,再选择Command (stdio) ,并输入以下命令:
node FULL_PATH_TO_YOUR_PROJECT/dist/index.js点击 Enter 并随意命名。建议将其添加到workspace范围进行测试。之后,打开.vscode/mcp.json文件并修改它,以便传递身份验证所需的环境变量。
{
"servers": {
"m365-mcp-server": {
"type": "stdio",
"command": "node",
"args": [
"FULL_PATH_TO_YOUR_PROJECT/dist/index.js" // e.g. C:/workspace/repo/microsoft-365-mcp-server/dist/index.js
]
}
}
}点击“开始”,您将看到 358 个新工具添加到您的 GitHub Copilot Agent。快来测试一下吧。为了获得最佳效果,建议使用Claude 3.5 Sonnet作为 AI 模型。

🔗 资源
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Tools
Related MCP Servers
- AlicenseNot gradedqualityCmaintenanceLokka ia an MCP server for the Microsoft Graph API and can be used to query and update all resources in your Microsoft 365 tenant. This MCP server supports all Microsoft Graph APIs including update operations (limited by the permissions you grant to the app).288MIT
- FlicenseCqualityFmaintenanceA powerful MCP server that enables AI assistants to interact with Microsoft Graph API for managing Outlook emails, Calendar events, OneDrive files, and Contacts through natural language commands.3554
- AlicenseNot gradedqualityAmaintenanceA production-ready MCP server that provides secure, delegated access to Microsoft 365 services including Email, SharePoint, OneDrive, and Calendar. It enables AI models to search messages, browse files, manage calendar events, and parse document contents using OAuth 2.1 authentication.MIT
- AlicenseCqualityNot gradedmaintenanceAn MCP server that enables interaction with Microsoft 365 services like Outlook, OneDrive, Teams, and SharePoint via the Microsoft Graph API. It supports comprehensive operations including email management, file access, and organizational collaboration for personal and work accounts.78
Related MCP Connectors
Official Microsoft MCP Server to query Microsoft Entra data using natural language
MCP server for generating rough-draft project plans from natural-language prompts.
MCP server for AI dialogue using various LLM models via AceDataCloud
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
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/pnp/cli-microsoft365-mcp-server'
If you have feedback or need assistance with the MCP directory API, please join our Discord server