Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions docs/README.skills.md
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,7 @@ See [CONTRIBUTING.md](../CONTRIBUTING.md#adding-skills) for guidelines on how to
| [kotlin-springboot](../skills/kotlin-springboot/SKILL.md)<br />`gh skills install github/awesome-copilot kotlin-springboot` | Get best practices for developing applications with Spring Boot and Kotlin. | None |
| [legacy-circuit-mockups](../skills/legacy-circuit-mockups/SKILL.md)<br />`gh skills install github/awesome-copilot legacy-circuit-mockups` | Generate breadboard circuit mockups and visual diagrams using HTML5 Canvas drawing techniques. Use when asked to create circuit layouts, visualize electronic component placements, draw breadboard diagrams, mockup 6502 builds, generate retro computer schematics, or design vintage electronics projects. Supports 555 timers, W65C02S microprocessors, 28C256 EEPROMs, W65C22 VIA chips, 7400-series logic gates, LEDs, resistors, capacitors, switches, buttons, crystals, and wires. | `references/28256-eeprom.md`<br />`references/555.md`<br />`references/6502.md`<br />`references/6522.md`<br />`references/6C62256.md`<br />`references/7400-series.md`<br />`references/assembly-compiler.md`<br />`references/assembly-language.md`<br />`references/basic-electronic-components.md`<br />`references/breadboard.md`<br />`references/common-breadboard-components.md`<br />`references/connecting-electronic-components.md`<br />`references/emulator-28256-eeprom.md`<br />`references/emulator-6502.md`<br />`references/emulator-6522.md`<br />`references/emulator-6C62256.md`<br />`references/emulator-lcd.md`<br />`references/lcd.md`<br />`references/minipro.md`<br />`references/t48eeprom-programmer.md` |
| [linkedin-post-formatter](../skills/linkedin-post-formatter/SKILL.md)<br />`gh skills install github/awesome-copilot linkedin-post-formatter` | Format and draft compelling LinkedIn posts using Unicode bold/italic styling, visual separators, structured sections, and engagement-optimized patterns. USE FOR: draft LinkedIn post, format text for LinkedIn, create social media post, write thought leadership post, convert content to LinkedIn format, LinkedIn carousel text, Unicode bold italic formatting. | `references/unicode-charmap.md` |
| [local-power-automate-mcp](../skills/local-power-automate-mcp/SKILL.md)<br />`gh skills install github/awesome-copilot local-power-automate-mcp` | Foundation skill for driving Microsoft Power Automate from an AI agent through a self-hosted, privacy-first local MCP server that authenticates with the operator's own Azure CLI (az login) identity — no third-party SaaS, no API keys, and no tenant flow data leaving the machine. Covers stdio registration for GitHub Copilot CLI, VS Code, and Claude; the az login auth model and token scopes; the 11 read/write tools (Flow REST + Dataverse Web API); the confirm-guarded write-safety pattern; sovereign/government-cloud configuration; and oversized-response handling. Load this when the user needs Power Automate automation but cannot route tenant data through a hosted vendor. Reference implementation (MIT): https://github.com/prasadgd9022/power-automate-mcp | None |
Comment thread
prasadgd9022 marked this conversation as resolved.
Outdated
| [lsp-setup](../skills/lsp-setup/SKILL.md)<br />`gh skills install github/awesome-copilot lsp-setup` | Enable code intelligence (go-to-definition, find-references, hover, type info) for any programming language by installing and configuring an LSP server for Copilot CLI. Detects the OS, installs the right server, and generates the JSON configuration (user-level or repo-level). Use when you need deeper code understanding and no LSP server is configured, or when the user asks to set up, install, or configure an LSP server. | `references/lsp-servers.md` |
| [make-repo-contribution](../skills/make-repo-contribution/SKILL.md)<br />`gh skills install github/awesome-copilot make-repo-contribution` | All changes to code must follow the guidance documented in the repository. Before any issue is filed, branch is made, commits generated, or pull request (or PR) created, a search must be done to ensure the right steps are followed. Whenever asked to create an issue, commit messages, to push code, or create a PR, use this skill so everything is done correctly. | `assets/issue-template.md`<br />`assets/pr-template.md` |
| [markdown-to-html](../skills/markdown-to-html/SKILL.md)<br />`gh skills install github/awesome-copilot markdown-to-html` | Convert Markdown files to HTML similar to `marked.js`, `pandoc`, `gomarkdown/markdown`, or similar tools; or writing custom script to convert markdown to html and/or working on web template systems like `jekyll/jekyll`, `gohugoio/hugo`, or similar web templating systems that utilize markdown documents, converting them to html. Use when asked to "convert markdown to html", "transform md to html", "render markdown", "generate html from markdown", or when working with .md files and/or web a templating system that converts markdown to HTML output. Supports CLI and Node.js workflows with GFM, CommonMark, and standard Markdown flavors. | `references/basic-markdown-to-html.md`<br />`references/basic-markdown.md`<br />`references/code-blocks-to-html.md`<br />`references/code-blocks.md`<br />`references/collapsed-sections-to-html.md`<br />`references/collapsed-sections.md`<br />`references/gomarkdown.md`<br />`references/hugo.md`<br />`references/jekyll.md`<br />`references/marked.md`<br />`references/pandoc.md`<br />`references/tables-to-html.md`<br />`references/tables.md`<br />`references/writing-mathematical-expressions-to-html.md`<br />`references/writing-mathematical-expressions.md` |
Expand Down
248 changes: 248 additions & 0 deletions skills/local-power-automate-mcp/SKILL.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,248 @@
---
Comment thread
prasadgd9022 marked this conversation as resolved.
name: local-power-automate-mcp
description: 'Foundation skill for driving Microsoft Power Automate from an AI agent through a self-hosted, privacy-first local MCP server that authenticates with the operator''s own Azure CLI (az login) identity — no third-party SaaS, no API keys, and no tenant flow data leaving the machine. Covers stdio registration for GitHub Copilot CLI, VS Code, and Claude; the az login auth model and token scopes; the 11 read/write tools (Flow REST + Dataverse Web API); the confirm-guarded write-safety pattern; sovereign/government-cloud configuration; and oversized-response handling. Load this when the user needs Power Automate automation but cannot route tenant data through a hosted vendor. Reference implementation (MIT): https://github.com/prasadgd9022/power-automate-mcp'
Comment thread
prasadgd9022 marked this conversation as resolved.
Outdated
---

# Local Power Automate MCP — Privacy-First Foundation

This skill is the **self-hosted counterpart** to hosted Power Automate MCP
offerings. It connects an agent to a **local stdio MCP server** that talks
directly to Microsoft's own APIs using the operator's **existing Azure identity**,
so tenant flow data never transits a third-party cloud.

> **When to prefer this over a hosted MCP:** regulated tenants, data-residency
> or data-sovereignty requirements, air-gapped/BYO-identity policies, or anyone
> who simply does not want an external vendor brokering their Power Platform
> traffic. If a hosted MCP is acceptable, the `flowstudio-power-automate-*`
> skills cover that path.
Comment thread
prasadgd9022 marked this conversation as resolved.
Outdated

> **Requires:**
> - Python 3.10+ on `PATH`
> - Azure CLI installed and signed in (`az login`)
> - The reference server (`server.py`) cloned locally —
> `git clone https://github.com/prasadgd9022/power-automate-mcp`
Comment thread
prasadgd9022 marked this conversation as resolved.
> - Python packages: `mcp`, `azure-identity`, `requests`

---

## Why This Is Different (Trust & Data-Flow Model)

| Dimension | Hosted MCP (e.g. FlowStudio) | This local server |
|---|---|---|
| Where it runs | Vendor cloud, remote HTTP endpoint | **Your machine**, stdio subprocess of the host |
| Auth | Portal-issued JWT via `x-api-key` header | **Your `az login` session** (Azure CLI credential) |
| Identity used | Service/API-key identity | **The signed-in user's own identity + RBAC** |
| Data path | Tenant data traverses the vendor's cloud | **Direct** to `api.flow.microsoft.com` + Dataverse over HTTPS |
| Subscription | Paid tiers | **None** — open source (MIT) |
| Write safety | (host-defined) | **`confirm=True` dry-run guard** on Dataverse writes |

**Design rule:** nothing runs at import time. The server starts instantly and
only acquires a token on the **first** tool call — so registration succeeds even
before `az login`, and an auth failure is always a sign-in issue, never a setup
issue.
Comment thread
prasadgd9022 marked this conversation as resolved.
Outdated

---

## Auth Model — `az login`, Not API Keys

The server uses `azure-identity` to mint bearer tokens from the local Azure CLI
session (falling back to interactive browser sign-in). There is **no key to
paste** and no secret in any config file.

```bash
az login
# Windows only — warm the cache to avoid a first-call timeout:
az account get-access-token --scope https://service.flow.microsoft.com/.default
```

Two token audiences are used, both from the same session:

| API | Scope | Used by |
|---|---|---|
| Power Automate REST | `https://service.flow.microsoft.com/.default` | environments, flows, runs, on/off |
| Dataverse Web API | `https://<org>.crm.dynamics.com/.default` (org-scoped) | env vars, raw flow definitions |

> **Auth troubleshooting:** `Could not acquire a token` → run `az login` again.
> A `403 Forbidden` from Dataverse is **not** a bug — it means the signed-in
> user lacks RBAC on that environment's Dataverse org (expected for environments
> you cannot administer). Because auth is the user's own identity, every tool
> call is bounded by that user's real Power Platform permissions.

---

## Registering the Server (stdio)

The launch command is identical everywhere:

```
python <ABSOLUTE_PATH>/power-automate-mcp/server.py --transport stdio
```

On **Windows, escape backslashes in JSON** (`C:\\Users\\you\\...\\server.py`).
Always **merge** the `power-automate` entry into any existing config rather than
overwriting the file.

### GitHub Copilot CLI — `~/.copilot/mcp-config.json`
```jsonc
{
"mcpServers": {
"power-automate": {
"type": "stdio",
"tools": ["*"],
"command": "python",
"args": ["<ABSOLUTE_PATH>/power-automate-mcp/server.py", "--transport", "stdio"]
}
}
}
```

### VS Code (Copilot Chat, Agent mode) — `.vscode/mcp.json`
Note the key is **`servers`**, not `mcpServers`:
```jsonc
{
"servers": {
"power-automate": {
"type": "stdio",
"command": "python",
"args": ["<ABSOLUTE_PATH>/power-automate-mcp/server.py", "--transport", "stdio"]
}
}
}
```

### Claude Desktop — `claude_desktop_config.json`
(`%APPDATA%\Claude\...` on Windows; `~/Library/Application Support/Claude/...` on macOS)
```jsonc
{
"mcpServers": {
"power-automate": {
"command": "python",
"args": ["<ABSOLUTE_PATH>/power-automate-mcp/server.py", "--transport", "stdio"]
}
}
}
```

### Claude Code (CLI) — one command
```bash
claude mcp add power-automate -- python <ABSOLUTE_PATH>/power-automate-mcp/server.py --transport stdio
```

**Restart the host** after editing config (Claude Desktop must be fully quit,
not just closed). Verify with `/mcp` (Copilot/Claude CLI) or **MCP: List
Servers** (VS Code).

---

## Verify the Connection

```bash
python probe.py
```

Expected:

```text
TOOLS: ['check_auth', 'list_environments', 'list_flows', 'get_flow', 'get_flow_runs', 'get_flow_run_details', 'set_flow_state', 'get_environment_variable', 'update_environment_variable', 'get_flow_definition', 'update_flow_definition']
CHECK_AUTH_OK: { ... "authenticated": true, "environmentCount": N ... }
```

If `TOOLS` prints but auth fails, the server is registered correctly — run
`az login` and retry. Inside an agent, the equivalent first call is
`check_auth`; always run it before anything else.

---

## Tool Map (11 tools — 8 read, 3 write)

All `environment` args are optional (omit → default environment).

### Read-only
| Tool | Purpose |
|---|---|
| `check_auth` | Confirm auth + list reachable environments. **Run first.** |
| `list_environments` | Every Power Platform environment visible to the account. |
| `list_flows` | Cloud flows you **own or are shared with** in an environment. |
| `get_flow` | Full flow definition from the Flow REST API (triggers/actions/connections). |
| `get_flow_runs` | Recent run history (status, times, error codes) — triage entry point. |
| `get_flow_run_details` | Full detail of one run, including the error payload. |
| `get_environment_variable` | Definition + **default value** + per-environment **current value** (Dataverse). |
| `get_flow_definition` | Raw Dataverse `workflow` row incl. the `clientdata` JSON. |

### Write (mutating)
| Tool | Purpose | Guard |
|---|---|---|
| `set_flow_state` | Enable (`start`) / disable (`stop`) a flow. | none (easily reversible) |
Comment thread
prasadgd9022 marked this conversation as resolved.
Outdated
| `update_environment_variable` | Update a variable's **current value only** (per-environment override; shared default untouched). | **`confirm=True`** |
| `update_flow_definition` | **Advanced** — overwrite a flow's entire `clientdata` JSON. | **`confirm=True`** |

---

## Write-Safety Pattern (Non-Obvious — Read Before Mutating)

The two Dataverse writes are **guarded**. Called with the default
`confirm=False` they perform a **dry-run**: they return an old→new preview (or a
JSON-validity check) and change **nothing**. Only `confirm=True` applies.

Recommended edit loop for `update_flow_definition`:

1. `get_flow_definition` → keep the returned `clientdata`.
2. Make your **minimal** edit to that JSON.
3. Call with `confirm=False` → preview / validate the JSON round-trips.
Comment thread
prasadgd9022 marked this conversation as resolved.
Outdated
4. Call with `confirm=True` → apply.

Prefer `update_environment_variable` over editing a flow whenever you only need
to **repoint a URL / connection string**: it touches only the *current value*
for the target environment, leaving the shared *default* — and therefore
Production and every other environment — untouched. This is the safest way to
rewire an endpoint per-environment.

---

## Sovereign / Government Cloud & Other Config

All optional (defaults suit commercial M365). Set as environment variables:

| Variable | Default | Purpose |
|---|---|---|
| `PA_MCP_API_HOST` | `https://api.flow.microsoft.com` | Flow API host — **change for sovereign clouds** (GCC High, DoD, China). |
| `PA_MCP_SCOPE` | `https://service.flow.microsoft.com/.default` | Flow API token scope. |
Comment thread
prasadgd9022 marked this conversation as resolved.
| `PA_MCP_API_VERSION` | `2016-11-01` | Flow REST API version. |
| `PA_MCP_DATAVERSE_API_VERSION` | `v9.2` | Dataverse Web API version. |
| `PA_MCP_ACCESS_TOKEN` | – | Raw bearer token (skips CLI/browser) — CI/advanced only. |
Comment thread
prasadgd9022 marked this conversation as resolved.
Outdated
| `PA_MCP_HTTP_TIMEOUT` | `60` | HTTP timeout (s). |
| `PA_MCP_MAX_RESPONSE_CHARS` | `60000` | Truncate oversized tool payloads. |

---

## Handling Oversized Responses

`get_flow` / `get_flow_definition` on deeply nested flows, and `list_flows` on
large tenants, can overflow context. The server truncates any payload larger
than `PA_MCP_MAX_RESPONSE_CHARS`.
Comment thread
prasadgd9022 marked this conversation as resolved.
Outdated

1. **Extract, don't echo.** Pull the one field you need (a single action, one
run's error) and discard the rest before reasoning.
2. **Summarize for the user.** Echo `name + state + trigger` for flow lists and
`actionName + status + code` for run errors — not raw JSON, unless asked.
3. **Reach unlistable flows by id.** `list_flows` only returns flows you own or
are shared with; for service-account-owned flows, go direct with `get_flow` /
`get_flow_definition` using the flow id.

---

## Example Prompts

- "List my Power Automate environments." → `check_auth` / `list_environments`
- "Show the last 10 runs for flow `<id>` and explain the failures." → `get_flow_runs` → `get_flow_run_details`
- "Read `contoso_ApiBaseUrl` in my dev environment." → `get_environment_variable`
- "Repoint `contoso_ApiBaseUrl` to `https://new/...` — preview first, then apply." → `update_environment_variable` (confirm=False → confirm=True)
- "Disable flow `<id>`." → `set_flow_state` (stop)

---

## Reference

- Server + full docs (MIT): https://github.com/prasadgd9022/power-automate-mcp
- `SETUP.md` in that repo is written for an agent to perform registration automatically.
- Model Context Protocol: https://modelcontextprotocol.io
Loading