CLI for Microsoft 365
An MCP server that enables running CLI for Microsoft 365 commands through GitHub Copilot Agent, allowing users to interact with Microsoft 365 services using natural language.
What is CLI for Microsoft 365?
CLI for Microsoft 365 is a Model Context Protocol (MCP) server that allows AI assistants like Claude, Cursor, and VS Code to mcp server that enables running cli for microsoft 365 commands through github copilot agent, allowing users to interact with microsoft 365 services using natural language.
An MCP server that enables running CLI for Microsoft 365 commands through GitHub Copilot Agent, allowing users to interact with Microsoft 365 services using natural language.
This server falls under the Business Applications category on MCPgee, the world's largest MCP server directory with 33,000+ servers.
Features
- An MCP server that enables running CLI for Microsoft 365 com
Use Cases
Maintainer
Works with
Installation
NPM
npx -y @pnp/cli-microsoft365-mcp-serverManual Installation
npx -y @pnp/cli-microsoft365-mcp-serverConfiguration
Configuration Details
claude_desktop_config.json
Performance
Response Metrics
Resource Usage
How to Set Up and Use CLI for Microsoft 365
The CLI for Microsoft 365 MCP Server wraps the open-source CLI for Microsoft 365 (m365) tool behind four MCP tools, letting AI assistants search M365 commands, retrieve documentation, and execute real operations against SharePoint Online, Teams, Exchange Online, and the broader Microsoft 365 ecosystem using natural language. Built and maintained by the PnP community, it connects seamlessly to GitHub Copilot Agent and other MCP clients, turning verbose CLI syntax into simple conversational instructions. Administrators and developers use it to automate tenant management, site provisioning, Teams setup, and Power Automate flow control without memorising dozens of m365 subcommands.
Prerequisites
- Node.js 20.x or later
- CLI for Microsoft 365 installed globally: npm i -g @pnp/cli-microsoft365
- A Microsoft 365 account with sufficient permissions for the operations you want to perform
- An MCP-compatible client such as GitHub Copilot, Claude Desktop, or Claude Code
- Initial m365 login completed: run m365 login and authenticate
Install CLI for Microsoft 365 globally
The MCP server delegates all execution to the m365 CLI, so it must be installed and accessible on your PATH before the server will work.
npm i -g @pnp/cli-microsoft365Run initial m365 setup and login
Configure the CLI for non-interactive use (required for MCP) and authenticate with your Microsoft 365 tenant.
m365 setup
m365 login
m365 cli config set --key prompt --value false
m365 cli config set --key output --value text
m365 cli config set --key helpMode --value fullAdd the MCP server to your client config
Edit claude_desktop_config.json (or your client's equivalent) to register the server. No additional environment variables are needed beyond what the m365 CLI stores after login.
{
"mcpServers": {
"CLI-Microsoft365": {
"command": "npx",
"args": ["-y", "@pnp/cli-microsoft365-mcp-server@latest"]
}
}
}Restart your MCP client
Save the configuration and restart Claude Desktop or reload the MCP server list in your client so the server is discovered.
Verify the connection
Ask the AI to list available M365 commands or retrieve your tenant information to confirm the server is running and authenticated correctly.
CLI for Microsoft 365 Examples
Client configuration
Add this block to claude_desktop_config.json to connect Claude Desktop to the CLI for Microsoft 365 MCP server.
{
"mcpServers": {
"CLI-Microsoft365": {
"command": "npx",
"args": ["-y", "@pnp/cli-microsoft365-mcp-server@latest"]
}
}
}Prompts to try
Natural-language prompts that the server translates to m365 CLI commands and executes.
- "Create a new SharePoint list on https://contoso.sharepoint.com/sites/hr with title 'Benefits Requests' and a text description column"
- "Create a new Microsoft Teams team called 'Project Phoenix' and post a welcome message in the General channel"
- "Check if the HoursReportingReminder Power Automate flow exists and disable it if it does"
- "List all SharePoint sites in the tenant and export the results"
- "Add the user [email protected] as a site owner to the Marketing site"Troubleshooting CLI for Microsoft 365
MCP server returns 'not logged in' or authentication errors
Run m365 login in your terminal to re-authenticate. The CLI for Microsoft 365 stores credentials locally; if they expire, you must log in again outside the MCP context.
Commands time out or return permission denied errors
Ensure your Microsoft 365 account has the required permissions for the operations you are requesting (e.g., SharePoint admin for site creation). Some operations require Global Admin or specific role assignments.
npx download is slow or fails in corporate environments
Pre-install the server globally with npm i -g @pnp/cli-microsoft365-mcp-server, then change the command in your config from 'npx' to 'cli-microsoft365-mcp-server' (or the resolved binary path) to avoid the download step.
Frequently Asked Questions about CLI for Microsoft 365
What is CLI for Microsoft 365?
CLI for Microsoft 365 is a Model Context Protocol (MCP) server that mcp server that enables running cli for microsoft 365 commands through github copilot agent, allowing users to interact with microsoft 365 services using natural language. It connects AI assistants to external tools and data sources through a standardized interface.
How do I install CLI for Microsoft 365?
Install via npm with the command: npx -y @pnp/cli-microsoft365-mcp-server. Then add the server configuration to your AI client's JSON config file (e.g., claude_desktop_config.json or .cursor/mcp.json).
Which AI clients work with CLI for Microsoft 365?
CLI for Microsoft 365 works with all major MCP-compatible AI clients including Claude Desktop, Claude Code, Cursor, VS Code (GitHub Copilot), Windsurf, and Cline.
Is CLI for Microsoft 365 free to use?
Yes, CLI for Microsoft 365 is open source and available under the MIT License license. You can use it freely in both personal and commercial projects.
CLI for Microsoft 365 Alternatives — Similar Business Applications Servers
Looking for alternatives to CLI for Microsoft 365? Here are other popular business applications servers you can use with Claude, Cursor, and VS Code.
n8n
★ 189.1kA comprehensive MCP server that provides full control over n8n automation workflows through natural language. It offers 43 tools for managing workflows, executions, credentials, and data tables, with safety features like write-mode protection and dou
LobeHub
★ 77.5k🤯 LobeHub is your Chief Agent Operator, organizing your agents into 7×24 operations by hiring, scheduling, and reporting on your entire AI team.
Jeecgboot
★ 46.4kAI 低代码平台,「低代码 + 零代码」双模式驱动:低代码一键生成前后端代码,零代码 5 分钟搭建系统,AI Skills 一句话画流程、设计表单、生成整套系统。内置 AI聊天、知识库、流程编排、MCP插件等,兼容主流大模型。引领「AI 生成 → 在线配置 → 代码生成 → 手工合并->AI修改」开发模式,消除 Java 项目 80% 的重复工作,提效而不失灵活。
CowAgent
★ 44.7kCowAgent (chatgpt-on-wechat) 是基于大模型的超级AI助理,能主动思考和任务规划、访问操作系统和外部资源、创造和执行Skills、通过长期记忆和知识库不断成长,比OpenClaw更轻量和便捷。同时支持微信、飞书、钉钉、企微、QQ、公众号、网页等接入,可选择DeepSeek/OpenAI/Claude/Gemini/ MiniMax/Qwen/GLM/LinkAI,能处理文本、语音、图片和文件,可快速搭建个人AI助理和企业数字员工。
Minds Platform
★ 39.2kPlatform dedicated to building an open foundation for applied Artificial Intelligence, designed for people seeking production-ready AI systems they can truly control, extend and deploy anywhere.
Astrbot
★ 32.8kAI Agent Assistant & development framework that integrates lots of IM platforms, LLMs, plugins and AI feature, and can be your openclaw alternative. ✨
Browse More Business Applications MCP Servers
Explore all business applications servers available in the MCPgee directory. Each server includes setup guides for Claude, Cursor, and VS Code.
Set Up CLI for Microsoft 365 in Your Editor
Choose your AI client for step-by-step setup instructions.
Quick Config Preview
Add this to your claude_desktop_config.json or .cursor/mcp.json
Ready to use CLI for Microsoft 365?
Browse our complete directory of 33,000+ MCP servers, read setup guides for your editor, and start building with the Model Context Protocol.