
MCP server for PnP PowerShell
概览
This MCP server allows the use of natural language to run PnP PowerShell commands and to author complex PnP PowerShell scripts. It may handle complex prompts that are executed as a chain of PnP PowerShell cmdlets that try to fulfill the user's request, and it can search the community's PnP Script Samples library for ready-to-adapt scripts. This way you can manage many different areas of Microsoft 365 — SharePoint Online, Microsoft Teams, Entra ID, OneDrive, Planner, Power Platform, Microsoft 365 Groups, taxonomy, search, and tenant administration — straight from your MCP client, and use it as a jump-start for writing your own automation scripts. - .NET 10 SDK (only required to build/run from source — published tool releases are self-contained) - PowerShell 7.4 or above (pwsh) installed and available on PATH - The PnP.PowerShell module installed: This MCP server shells out to the locally installed PnP PowerShell module — it does not do any authentication for you.
README
以下为原文 README 节选,完整内容请查看原文。
PnP PowerShell MCP Server
💡 Description
This MCP server allows the use of natural language to run PnP PowerShell commands and to author complex PnP PowerShell scripts. It may handle complex prompts that are executed as a chain of PnP PowerShell cmdlets that try to fulfill the user’s request, and it can search the community’s PnP Script Samples library for ready-to-adapt scripts. This way you can manage many different areas of Microsoft 365 — SharePoint Online, Microsoft Teams, Entra ID, OneDrive, Planner, Power Platform, Microsoft 365 Groups, taxonomy, search, and tenant administration — straight from your MCP client, and use it as a jump-start for writing your own automation scripts.
📦 Prerequisites
-
.NET 10 SDK (only required to build/run from source — published tool releases are self-contained)
-
PowerShell 7.4 or above (
pwsh) installed and available onPATH -
The
PnP.PowerShellmodule installed:Install-Module -Name PnP.PowerShell -Scope CurrentUser -Force -AllowClobber
🚀 Installation & Usage
This MCP server shells out to the locally installed PnP PowerShell module — it does not do any authentication for you. Authenticate first using Connect-PnPOnline (see Best Practices for the recommended auth methods), then the MCP server will reuse the same PnP PowerShell connection context.
- TYPE:
Local(stdio)
安装
npx @modelcontextprotocol/inspector dotnet run --project ./PnPPowerShell.MCPServer.csproj配置
{
"mcpServers": {
"PnP-PowerShell": {
"command": "pnp-powershell-mcp-server"
}
}
}