# cli-microsoft365-mcp-server [Health: Active]

**Category:** 🏢 Workplace & Productivity  
**Repository:** https://github.com/pnp/cli-microsoft365-mcp-server  
**GitHub Stars:** 135  
**npm Downloads (last month):** 3198  
**Views:** 1  
**Installs:** 0  
**Upvotes:** 0  
**Directory Page:** https://allmcps.com/mcp/cli-microsoft365-mcp-server

## Description
MCP server for CLI for Microsoft 365 to manage your tenant using natural language

## Tools
Capabilities this server exposes over MCP:

- **m365_search_commands** — Searches CLI for Microsoft 365 commands using fuzzy search based on a query string. Use this tool first to find relevant commands before getting full command documentation.
- **m365_get_command_docs** — Gets documentation for a specified CLI for Microsoft 365 command to be used by the Model Context Protocol to provide detailed information about the command along with examples, use cases, and option descriptions
- **m365_run_command** — Runs a specified CLI for Microsoft 365 command to be used by the Model Context Protocol to execute the command and return the result and reason over the response
- **m365_get_best_practices** — Gets best practices for using CLI for Microsoft 365 in scripts, including guidance on authentication checking, error handling, output handling, and configuration

## Claude Desktop Quick Installation
Install path detected from listing signals. Uses `npx` (confidence: high):

```json
"mcpServers": {
  "cli-microsoft365-mcp-server": {
    "command": "npx",
    "args": ["-y","@pnp/cli-microsoft365-mcp-server@latest"]
  }
}
```

## Documentation

## What cli-microsoft365-mcp-server MCP server does

The cli-microsoft365-mcp-server MCP server exposes the CLI for Microsoft 365 to MCP-compatible AI clients. An agent can interpret a natural-language request and execute one or more CLI commands to complete it. This supports administration across a broad set of Microsoft 365 areas, including Entra ID, OneDrive, OneNote, Outlook, Planner, Power Apps, Power Automate, Power Platform, SharePoint Embedded, SharePoint Online, Teams, and Viva Engage.

The server is intended for tasks that would otherwise require manually finding and assembling CLI commands. For example, a request can ask for a SharePoint list to be created, configured, and populated, or for a Teams team to be created with an initial post.

## How it works

The package runs as a local stdio MCP server. MCP clients start it with `npx -y @pnp/cli-microsoft365-mcp-server@latest`, and the server delegates requests to the globally installed CLI for Microsoft 365. Complex prompts may result in a chain of CLI commands rather than a single command.

Authentication happens outside the MCP server. After the CLI is installed and configured, you sign in with `m365 login`; subsequent MCP operations reuse that CLI authentication context. The server itself does not perform the login flow.

Because the agent generates commands from natural language, prompts should identify that CLI for Microsoft 365 should be used. The project recommends Claude Sonnet 4 or Claude Sonnet 3.7 for best results, but the documented setup also covers VS Code, Claude Desktop, and Cursor.

## Setup and configuration

Install Node.js 20 or newer and install the CLI globally:

```bash
npm i -g @pnp/cli-microsoft365
```

Run the CLI setup, authenticate, and adjust its output settings before starting the MCP server:

```bash
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 full
```

These settings provide text output and more complete help and error information for the MCP process. Add the server to an MCP client as a local command server using `npx` and the package argument. In VS Code, the resulting configuration uses `type: "stdio"`; Claude Desktop and Cursor use equivalent local command configurations. Restart Claude Desktop after configuration changes so it reloads the server.

## Tools and capabilities

The cli-microsoft365-mcp-server MCP server can:

- Execute CLI for Microsoft 365 commands from natural-language instructions.
- Chain multiple CLI commands to address a compound request.
- Manage SharePoint Online content such as lists, columns, views, and items.
- Create Microsoft Teams resources and add content to a channel.
- Work with Microsoft 365 services represented by the underlying CLI, including identity, files, mail, planning, automation, and collaboration workloads.

The actual operations available depend on the installed CLI for Microsoft 365 version and the permissions of the authenticated account.

## Limitations and notes

The server does not install the CLI for Microsoft 365, log in to Microsoft 365, or establish authentication on your behalf. Both the CLI and its authenticated session must be ready before the MCP client invokes it.

Operations run with the permissions associated with the CLI login, so requests that change tenant or service data should be reviewed carefully. The server requires Node.js 20.x or later and a globally installed CLI for Microsoft 365.

_Full upstream README: https://allmcps.com/mcp/cli-microsoft365-mcp-server/readme_

