cli-microsoft365
Manage Microsoft 365 using MCP server
claude mcp add --transport stdio pnp-cli-microsoft365-mcp-server npx -y @pnp/cli-microsoft365-mcp-server@latest
How to use
This MCP server lets you interact with the CLI for Microsoft 365 using natural language prompts. It acts as a bridge that translates your request into a sequence of CLI for Microsoft 365 commands, handling complex prompts and chaining commands as needed to fulfill your intent. The server is capable of managing a wide range of Microsoft 365 areas, including Entra ID, OneDrive, OneNote, Outlook, Planner, Power Apps, Power Automate, Power Platform, SharePoint (Embedded and Online), Teams, Viva Engage, and more. To get started, you first authenticate with the real CLI, since the MCP server will reuse your CLI authentication context when executing commands. Then you can instruct the MCP server in natural language, e.g., “Create a new SharePoint site for the HR team and invite the HR group,” and it will break that down into the necessary CLI commands.
Tools available through this MCP server are the standard CLI for Microsoft 365 commands accessible via the globally installed @pnp/cli-microsoft365 package. You can perform actions such as user management, group and license operations, mailbox and calendar tasks, SharePoint site creation, Power Platform administration, and more. The MCP server will attempt to maximize context from the CLI when there are errors, and will present you with results and next steps to continue your workflow.
How to install
Prerequisites:
- Node.js 20.x or higher
- npm (comes with Node.js)
-
Install the CLI for Microsoft 365 globally
npm i -g @pnp/cli-microsoft365 -
Authenticate to Microsoft 365 (one-time per environment)
m365 loginThis step creates the authentication context that the MCP server will reuse when executing commands.
-
Install the MCP server (Node.js) via npx The README recommends running the MCP server with npx and the latest package version:
npx -y @pnp/cli-microsoft365-mcp-server@latestThis runs the MCP server as a local process or through your MCP client configuration.
-
Optional: add the MCP server to your MCP client (VS Code, Copilot CLI, Claude, etc.)
- VS Code: use the provided configuration example in the README
- Copilot CLI: run the steps described in the Copilot integration section
- Claude Desktop: follow the .mcpb file or JSON configuration guidance from the README
Additional notes
Tips and notes:
- The MCP server relies on your existing m365 authentication context. If you sign out or the session expires, you may need to run m365 login again.
- If commands fail to execute as expected, the MCP server will often present the underlying CLI output; use this to refine prompts or adjust prompt configuration.
- Recommended CLI behavior tweaks from the guide include setting prompt to false, output to text, and enabling full help mode to provide rich error information when needed: m365 cli config set --key prompt --value false m365 cli config set --key output --value text m365 cli config set --key helpMode --value full
- Ensure your environment allows CLI tool execution from the MCP host (some restricted environments may block child process execution).
- This MCP server does not perform authentication itself; you must authenticate with the CLI first and the server will reuse that context for subsequent commands.
Related MCP Servers
supermemory
Your memories are in ChatGPT... But nowhere else. Universal Memory MCP makes your memories available to every single LLM. No logins or paywall. One command to set it up.
obsidian -tools
Add Obsidian integrations like semantic search and custom Templater prompts to Claude or any MCP client.
Security-Detections
MCP to help Defenders Detection Engineer Harder and Smarter
mcp
Octopus Deploy Official MCP Server
furi
CLI & API for MCP management
bc-webclient
MCP server for Microsoft Dynamics 365 Business Central via reverse-engineered WebUI protocol. Enables AI assistants like Claude to interact with BC through the native WebSocket interface.