編輯

共用方式為


Use Power Platform CLI with built-in MCP server

Applies to: Windows Linux macOS

Prerequisites

You must have .NET 10.0 or higher installed.

Use built-in MCP server

The Power Platform CLI (PAC CLI) features an integrated Model Context Protocol (MCP) server designed for local development and testing purposes. This server lets you interact with Power Platform in natural language using MCP-compatible tools like Microsoft Visual Studio, VS Code, and Claude Code.

Invoke PAC CLI commands with natural language

It isn't necessary to memorize all the PAC CLI commands and parameters or constantly refer to the help command when you use natural language to invoke PAC CLI commands. It's easier to use the PAC CLI integrated MCP server invoke the commands using natural language.

Before you begin, you need to start the built-in MCP server.

Start the MCP Server

To start the built-in MCP server, use the copilot mcp cli command with the --run option:

pac copilot mcp --run

Or you can start the MCP server with .NET dnx command without installing PAC CLI.

dnx Microsoft.PowerApps.CLI.Tool --yes copilot mcp --run

Learn more about how to use the Power Platform CLI without installing it

Register the MCP Server

After the server is running, register it with your MCP-compatible tool so it can discover and communicate with PAC CLI. Registration points your IDE or editor to the running server. Choose your tool in the following sections for guided steps, or use the manual configuration example.

Visual Studio

To register the MCP server with Visual Studio, follow steps outlined in the Use MCP servers for Visual Studio.

If you're editing mcp.json file manually, MCP server registration should look like this:

{
  "servers": {
    "pac-mcp": {
      "type": "stdio",
      "command": "dnx",
      "args": ["Microsoft.PowerApps.CLI.Tool", "--yes", "copilot", "mcp", "--run"]
    },
  }
}

Visual Studio Code

To register the MCP server with VS Code, follow steps outlined in the Use MCP servers in VS Code.

Claude Code

To register the MCP server with Claude Code, follow steps outlined in the Connect Claude Code to tools via MCP.

To register the MCP server manually, you can run claude mcp add-json command:

claude mcp add-json pac-cli '{"type":"stdio","command":"dnx","args":["Microsoft.PowerApps.CLI.Tool","--yes","copilot","mcp","--run"]}'

Interact with the MCP Server

Once the MCP server is registered with your MCP-compatible tool, you can start interacting with it using natural language. Here are a couple of examples:

show me AI related tenant settings
Create MD file with table listing all Dataverse environments

See full list of available commands in the Power Platform CLI reference.