
Security News
Vite+ Joins the Push to Consolidate JavaScript Tooling
Evan You announces Vite+, a commercial, Rust-powered toolchain built on the Vite ecosystem to unify JavaScript development and fund open source.
@pnp/cli-microsoft365-mcp-server
Advanced tools
Model Context Protocol (MCP) server for CLI for Microsoft 365 that allows to use natural language to manage your Microsoft 365 tenant.
This MCP server allows the use of natural language to execute any CLI for Microsoft 365 commands. It may handle complex prompts that will be executed as a chain of CLI for Microsoft 365 commands that will try to fulfill the user's request. Thanks to this, you may manage many different areas of Microsoft 365, for example: Entra ID, OneDrive, OneNote, Outlook, Planner, Power Apps, Power Automate, Power Platform, SharePoint Embedded, SharePoint Online, Teams, Viva Engage, and many more...
For best results, use it with Claude Sonnet 4 or Claude Sonnet 3.7.
npm i -g @pnp/cli-microsoft365
)This MCP server uses the globally installed CLI for Microsoft 365 that you need to install globally using npm i -g @pnp/cli-microsoft365
.
After you install the CLI for Microsoft 365 perform the initial setup by running the:
m365 setup
For more information, please follow the Log in to Microsoft 365
After you set up the CLI for Microsoft 365, please update its configuration using the following commands:
m365 cli config set --key prompt --value false
m365 cli config set --key output --value text
m365 cli config set --key helpMode --value full
This will ensure that the MCP server will get as much information as possible from the CLI for Microsoft 365 when an error occurs or when a command is not executed properly.
The MCP server will not do any authentication for you. You will need to first authenticate using CLI for Microsoft 365 using m365 login command. Once you are authenticated, the MCP server will use the same authentication context when running any tool.
Lastly, install the MCP server on your preferred MCP client, referring to the instructions of the picked MCP host. Below, you may find guidance for VS Code.
There are multiple ways to add the MCP server to VS Code. The most common way is to:
Open the Command Palette (Ctrl+Shift+P or Cmd+Shift+P on macOS) and type MCP: Add Server
.
Select Command (stdio)
as the server type.
Enter the command to run the MCP server, which is:
npx -y @pnp/cli-microsoft365-mcp-server@latest
Name the server (e.g., CLI for Microsoft 365 MCP Server
).
As a result, you should have the following configuration in your .vscode/mcp.json
file:
{
"servers": {
"CLI for Microsoft 365 MCP Server": {
"type": "stdio",
"command": "npx",
"args": [
"-y",
"@pnp/cli-microsoft365-mcp-server@latest"
]
}
}
}
Now when you open the GitHub Copilot chat in VS Code, you should be able to select the CLI for Microsoft 365 MCP Server
from the list of available MCP servers and start using it to manage Microsoft 365 using natural language. In the prompt specify that "Using CLI for Microsoft 365, I want you to..." and GitHub Copilot Agent will use the MCP server to execute your request.
If you are using GitHub Copilot CLI, you may add the CLI for Microsoft 365 MCP server to Copilot by doing the following:
copilot
/mcp add
cli-microsoft365-mcp-server
Local
npx
"-y", "@pnp/cli-microsoft365-mcp-server@latest"
Rest of the fields you may leave with default values.After that click on Ctrl+S
to save the MCP server and q
to exit the MCP form.
Now you should be able to use the CLI for Microsoft 365 MCP server in GitHub Copilot CLI by specifying it in your prompt, e.g. "Using CLI for Microsoft 365, I want you to...".
Ctrl + ,
)claude_desktop_config.json
in your favorite text editor.
Add the following configuration to the file.{
"mcpServers": {
"CLI-Microsoft365": {
"command": "npx",
"args": ["-y", "@pnp/cli-microsoft365-mcp-server@latest"]
}
}
}
Note: In Windows, Claude doesn't exit when you close the window, it runs in the background. You can find it in the system tray. Right-click on the icon and select Quit to exit the application completely.
For best results, use it with Claude Sonnet 4 or Claude Sonnet 3.7.
The below uses cases are only a few example how you may use this MCP server. It is capable of handling many different tasks, so feel free to experiment with it and basically manage all of Microsoft 365 using natural language.
Also you may check the CLI for Microsoft 365 wiki to find more scenarios how ClI for Microsoft 365 can be used to manage Microsoft 365.
In the following example, the MCP server created a SharePoint list with new columns and populated it with a few test items.
prompt: "Add a new list to this site with title "awesome ducks". Then add new columns to that list including them in the default view. The first should be a text description columns and the second one should be a user column. Then add 3 items to this list with some funny jokes about docs added in the description column and adding my user in the user column. use emojis 🙂"
The following example shows how to create a new Microsoft Teams team and add a welcome post to the General channel.
prompt: "Create a new Team on Teams with name "Awesome Ducks" and in the General channel adda a welcome post"
In the example, the MCP server disables a Power Automate flow.
prompt: "can you check if I have HoursReportingReminder flow and if so disable it"
In the following example, the MCP server creates a new Planner plan with sample buckets and tasks.
prompt: "can you create a new plan in planner to manage work for the awesome ducks. I need some sample buckets and tasks to get started"
Tool | Description |
---|---|
m365GetCommands | Gets all CLI for Microsoft 365 commands to be used by the Model Context Protocol to pick the right command for a given task |
m365GetCommandDocs | 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 |
m365RunCommand | 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 |
Before anything, first run npm install
to install all dependencies.
Then, in order to build the project run:
npm run build
It is also possible to run the MCP server in VS Code from your local build so that it may be used by GitHub Copilot Agent. First, start the CLI for Microsoft 365 MCP server using the command:
npm run start
Now go to VS Code GitHub Copilot Agent mode click on the tools icon, and select Add more tools
. Then select Add MCP server
and then Command (stdio)
and enter the following command:
node FULL_PATH_TO_YOUR_PROJECT/dist/index.js
Click Enter and name it however you like. It is recommended to add it to workspace
scope for testing. After that, open up your .vscode/mcp.json
file and modify it so pass the environment variables needed for auth.
{
"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
]
}
}
}
One of the ways to test the CLI for Microsoft 365 MCP server is by using the MCP Inspector. Mostly, this setup is used for debugging purposes and to test the MCP server locally. First, start the MCP server using the command:
npm run start
Now, in order to run the inspector for your MCP server, you need run the following command in the repo root folder location:
npx @modelcontextprotocol/inspector node dist/index.js
After that, wait for the inspector to start and open the inspector in your browser. You should see the MCP server running, and you should be able to query the tools and execute them locally.
FAQs
Model Context Protocol (MCP) server for CLI for Microsoft 365 that allows to use natural language to manage your Microsoft 365 tenant.
The npm package @pnp/cli-microsoft365-mcp-server receives a total of 281 weekly downloads. As such, @pnp/cli-microsoft365-mcp-server popularity was classified as not popular.
We found that @pnp/cli-microsoft365-mcp-server demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 9 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Evan You announces Vite+, a commercial, Rust-powered toolchain built on the Vite ecosystem to unify JavaScript development and fund open source.
Security News
Ruby Central’s incident report on the RubyGems.org access dispute sparks backlash from former maintainers and renewed debate over project governance.
Research
/Security News
Socket researchers uncover how threat actors weaponize Discord across the npm, PyPI, and RubyGems ecosystems to exfiltrate sensitive data.