power-automate-desktop-mcp
by Roy6T9
README.md
# power-automate-desktop-mcp
A local MCP server that lets AI agents run and monitor Power Automate Desktop flows (RPA).
- **Small.** One file, no dependencies. You can read all of it in a few minutes: [`server/index.mjs`](server/index.mjs).
- **Local.** It runs on the PC where Power Automate Desktop is installed. It makes no network calls.
- **No sign-in.** It never asks for, reads or stores a Microsoft login.
> **Status: early version (0.1.0).** Starting flows and reading run folders work in the
> project's tests. `get_run` currently returns the raw log lines rather than a tidy
> "succeeded / failed". See [What is and isn't tested](#what-is-and-isnt-tested).
## What the agent can do
| Tool | What it does |
| --- | --- |
| `run_flow` | Starts a flow by name or ID, with optional input values. Returns a `run_id`. |
| `get_run` | Shows how a run went, from the log folder Power Automate writes on the PC. |
| `list_runs` | Lists recent runs on this PC, newest first. |
| `list_flows` | Lists the flows this PC has a record of. |
| `check_setup` | Checks the PC is ready: Power Automate installed, run link registered, app open. |
## What it can't do
- **It can't create or edit flows.** Microsoft provides no supported way to change a desktop
flow's steps from outside the designer.
- **It can't list every flow in your account.** That list lives in your Microsoft account, and
this server doesn't sign in. It lists flows that have run on this PC. Any flow can still be
started by its exact name.
- **It can't see runs on other machines**, or runs started by cloud flows elsewhere.
## Requirements
- Windows, with [Power Automate Desktop](https://learn.microsoft.com/power-automate/desktop-flows/install) installed, open and signed in.
- A Power Automate Premium licence (or a pay-as-you-go environment). This is Microsoft's rule
for starting flows from outside the app, not this project's.
- [Node.js](https://nodejs.org) 18 or newer.
## Install
### Claude Code (terminal, desktop app Code tab, VS Code)
```
claude plugin marketplace add Roy6T9/power-automate-desktop-mcp
claude plugin install power-automate-desktop-mcp@power-automate-desktop-mcp
```
Then start a new session and ask: *"Check my Power Automate setup."*
### Gemini CLI
```
gemini extensions install https://github.com/Roy6T9/power-automate-desktop-mcp
```
### ChatGPT desktop app and Codex
Add this to `~/.codex/config.toml`:
```toml
[mcp_servers.pad]
command = "npx"
args = ["-y", "github:Roy6T9/power-automate-desktop-mcp"]
```
### Claude Desktop and any other MCP app
Add this to the app's MCP settings (for Claude Desktop: `claude_desktop_config.json`):
```json
{
"mcpServers": {
"pad": {
"command": "npx",
"args": ["-y", "github:Roy6T9/power-automate-desktop-mcp"]
}
}
}
```
Or clone this repo and point the app at the file directly: `node C:\path\to\server\index.mjs`.
## The confirmation pop-up
By default, Power Automate asks the person at the PC to confirm every flow started from
outside the app. That is a safety feature: it stops a flow running without anyone noticing.
**This project never turns it off for you.** If you want hands-free runs, you can switch it off
yourself in the Power Automate console settings (*Display confirmation dialog when invoking
flows externally*). Read
[Microsoft's warning](https://learn.microsoft.com/power-automate/desktop-flows/run-desktop-flows-url-shortcuts)
first, and only do it on a PC where you trust every flow.
## How it works
1. `run_flow` builds Microsoft's documented run link,
`ms-powerautomate:/console/flow/run?workflowName=...&runId=...`, and opens it. The `runId` is a
fresh GUID made for that run.
2. Because of the `runId`, Power Automate writes that run's logs to
`%LOCALAPPDATA%\Microsoft\Power Automate Desktop\Console\Scripts\<flow id>\Runs\<run id>`.
3. `get_run` finds that folder and reads it.
Details: [Run desktop flows via URL or desktop shortcuts](https://learn.microsoft.com/power-automate/desktop-flows/run-desktop-flows-url-shortcuts) (Microsoft Learn).
Good to know:
- Only one flow can run at a time in attended mode. If one is already running, a new start is skipped.
- `run_flow` only *requests* a start. An agent should always follow it with `get_run`.
- Inputs can be text, numbers or true/false.
## Privacy and safety
- No network calls, no telemetry, no sign-in.
- The server remembers the runs it started in
`%LOCALAPPDATA%\power-automate-desktop-mcp\state.json`: flow name, run ID, start time and the
*names* of any inputs. It never saves input values.
- Flow names and input values are URL-encoded, and the run link is handed to Windows through an
environment variable, so nothing an agent sends is ever pasted into a command line.
- `get_run` returns log lines from your own PC to your own AI app. Those logs can contain
whatever your flow logs, so think about that before pointing it at flows that handle secrets.
## What is and isn't tested
Tested:
- The MCP conversation, every tool's input checks, link building and run-folder reading
(`npm test`, in dry-run mode against a made-up logs folder).
- `check_setup` and `list_flows` against a real Power Automate Desktop install (Microsoft Store
version) on Windows 11.
- The plugin files, with `claude plugin validate`.
Not yet tested:
- A real flow start to finish, including flow inputs.
- The Gemini CLI, ChatGPT desktop and Claude Desktop installs above.
- The MSI (non-Store) install of Power Automate Desktop.
## Development
```
npm test
```
Environment variables:
| Variable | What it does |
| --- | --- |
| `PAD_MCP_DRY_RUN=1` | Builds the run link and returns it without starting anything. |
| `PAD_MCP_SCRIPTS_DIR` | Use a different folder as Power Automate's `Scripts` folder. |
| `PAD_MCP_STATE_DIR` | Use a different folder for this server's `state.json`. |
## Licence
[MIT](LICENSE). Not affiliated with or endorsed by Microsoft. "Power Automate" is a Microsoft trademark.