Power Automate Mcp Server

io.github.sapientsai由 GitHub 帳號 sapientsai 發布v0.2.4更新於 Oct 24, 2026

Inspect, operate, and author Microsoft Power Automate cloud flows from an agent context.

概覽

AI 產生的概覽

一個本機 MCP 伺服器,讓助理透過非官方 Flow API 檢視、操作和撰寫 Microsoft Power Automate 雲端流程。

可以做什麼
列出環境、流程和流程擁有者,並檢視流程的定義與連線參考。檢視流程執行記錄和執行詳情,包括首次失敗資訊和原始屬性,方便排查問題。檢查連線及其狀態和到期時間。啟用寫入操作後,可建立、更新、刪除、啟用或停用流程。還可取消或重新提交執行,以及新增或移除流程擁有者。回報伺服器資訊,並將意見反應作為 GitHub 問題提交。
適用情境
適合需要稽核或排查 Power Automate 流程、檢查執行失敗和連線,或在命令列或代理環境中以程式方式修改流程的情境。README 指出,撰寫複雜流程邏輯仍以入口網站的可視化設計工具為佳。
執行需求
透過 stdio 在本機執行,通常用 npx 搭配 Node.js。需要一個具有 Microsoft Flow Service 委派權限的 Entra 應用程式註冊和 AZURE_CLIENT_ID;Flow 對象需要 AZURE_TENANT_ID。預設使用互動式裝置代碼登入;clientCredentials 模式需要 AZURE_CLIENT_SECRET 和已取得管理員同意的應用程式權限。選用設定包括 DEFAULT_ENVIRONMENT、FLOW_SCOPES 和 ENABLE_WRITE_OPS。
安裝前請注意
使用 Microsoft 標示為不受支援的非官方 API。寫入工具預設關閉,僅在 ENABLE_WRITE_OPS=true 時執行;它們可建立、更新、刪除、啟用或停用流程,取消或重新提交執行,以及變更擁有者。clientCredentials 模式需要用戶端密碼,且通常看不到個人流程。HTTP 傳輸為單一操作者模式:所有呼叫端共用同一個 Power Automate 身分,不要向多位使用者開放。

安裝

在 SourceWeft 中

  1. 開啟 儀表板中的 Power Automate Mcp Server,將其新增到工作區。
  2. 為需要使用其工具的對話啟用該服務。

Desktop only,透過 STDIO。 STDIO 服務會啟動本機處理程序,因此需要 SourceWeft 桌面主機。

其他 MCP 客戶端

參照 儲存庫 中的啟動說明。

README

power-automate-mcp-server

[Node.js CI] [npm version] [npm downloads] [License: MIT]

An MCP server that lets agents inspect, operate, and author Microsoft Power Automate cloud flows from a CLI/agent context — list and inspect flows, debug runs, check connections and owners, and (when explicitly enabled) enable/disable flows, cancel/resubmit runs, manage owners, and create/update/delete flows.

Primarily a management surface — the Power Automate portal's visual designer remains the better place to author complex flow logic — but create_flow/update_flow/delete_flow are also available (write-gated) for programmatic authoring. Built on SomaMCP (telemetry, health/info/ dashboard, error classification) over FastMCP.

⚠️ Unofficial API. v1 targets api.flow.microsoft.com — the surface the Power Automate portal itself uses. Microsoft labels it "isn't supported. Customers should instead use the Dataverse Web APIs." It is stable in practice and, unlike Dataverse, sees all flows (including personal "My Flows") and works on M365‑seeded entitlements (no Premium license). Every tool's description carries this disclaimer. A supported Dataverse backend is stubbed for the future (see src/backend/dataverse/README.md).

Quick start

bash
pnpm installcp .env.example .env          # set AZURE_CLIENT_ID (see "App registration" below)pnpm buildpnpm dev:stdio                # local agent over stdio (device-code sign-in to stderr)

On first use the server prints a device-code prompt to stderr; open https://microsoft.com/devicelogin, enter the code, and sign in. The token is cached (TOKEN_CACHE_PATH, mode 0600) and silently refreshed thereafter.

Add to an MCP client (stdio)

jsonc
{  "mcpServers": {    "power-automate": {      "command": "npx",      "args": ["-y", "power-automate-mcp-server", "--stdio"],      "env": { "AZURE_CLIENT_ID": "<your-app-registration-client-id>" },    },  },}

Developing on this repo? It ships a project-scoped .mcp.json (stdio, local dist/bin.js). After pnpm build, export AZURE_CLIENT_ID and open the repo in Claude Code — the power-automate server loads automatically (complete the device-code sign-in once; the cached token is then reused).

App registration

This server ships no default client id — you register your own (one‑time):

  1. Azure Portal → Microsoft Entra ID → App registrations → New registration.
  2. Name it (e.g. power-automate-mcp). Supported account types: multitenant (or single‑tenant if you'll only ever use one org).
  3. Authentication → Add a platform → Mobile and desktop applications. Add redirect URI http://localhost (unused by device code, but required to register the platform). Set "Allow public client flows" = Yes.
  4. API permissions → Add a permission. You need a delegated permission for the Power Automate / Microsoft Flow Service API. If it isn't in the picker, see "Token audience" below — this is the known friction point.
  5. Copy the Application (client) ID → AZURE_CLIENT_ID.

For unattended clientCredentials mode instead: add a client secret, grant application permissions with admin consent, and set AZURE_AUTH_MODE=clientCredentials, AZURE_TENANT_ID=<your tenant>, AZURE_CLIENT_SECRET=.... Note app‑only has limited Flow reach (it generally cannot see personal "My Flows").

Verified working setup ⚠️

Confirmed against a real tenant. Interactive Flow auth needs all four of these — each one, if missing, fails with a different cryptic AADSTS… (details in docs/api-notes.md):

  1. A specific tenant — AZURE_TENANT_ID=<your-tenant-GUID>, not common. common + a resource scope → AADSTS50059 (and MSAL hides it as an empty device-code response).
  2. The Microsoft Flow Service delegated permission on the app (resource app id 7df0a125-d3be-4c96-aa54-591f83ff541c). Missing → AADSTS650057.
  3. Specific scopes, not .default, when reusing an app that has other (incrementally consented) permissions — .default validates the whole app and can fail with AADSTS650051. A dedicated app may use .default. Pin via FLOW_SCOPES.
  4. "Allow public client flows" = Yes (isFallbackPublicClient=true). Off → token redemption fails with invalid_client.

Verified FLOW_SCOPES: https://service.flow.microsoft.com/Flows.Read.All,https://service.flow.microsoft.com/Flows.Manage.All

Configure an existing app via az
bash
APP=<your-app-client-id>; FLOW=7df0a125-d3be-4c96-aa54-591f83ff541c# Flows.Read.All + Flows.Manage.All (delegated), then tenant-wide consent:az ad app permission add --id "$APP" --api "$FLOW" --api-permissions \  e45c5562-459d-4d1b-8148-83eb1b6dcf83=Scope 30b2d850-00c3-4802-b7ae-ece9af9de5c6=Scopeaz ad app permission admin-consent --id "$APP"# enable device-code (public client flows):az ad app update --id "$APP" --set isFallbackPublicClient=true

Recommended: a dedicated public-client app with only the Flow delegated permissions avoids the .default/shared-app pitfalls (#3) entirely — cleaner than reusing a Graph app.

Tools

All tools are read‑only by default. Write tools are registered but refuse unless ENABLE_WRITE_OPS=true.

Read-only (always enabled)

ToolParametersReturns
list_environments—{ id, name, displayName, location, isDefault }[]
list_flowsenvironment?, owner?{ name, displayName, state, createdTime, lastModifiedTime, owner }[]
get_flowenvironment?, flowfull flow incl. definition, connectionReferences, trigger/action names
list_flow_runsenvironment?, flow, top? (≤100), status?{ name, status, startTime, endTime, durationMs, triggerName, error }[]
get_flow_runenvironment?, flow, runrun detail + first‑failure + raw properties (debugging)
list_connectionsenvironment?{ name, apiName, displayName, status, accountName, expiresAt }[]
list_flow_ownersenvironment?, flow{ principalId, principalType, roleName, principalDisplayName }[]

Write (require ENABLE_WRITE_OPS=true)

ToolParameters
create_flowenvironment?, displayName, definition, connectionReferences?, state?
update_flowenvironment?, flow, any of displayName / definition / state / connectionReferences
delete_flowenvironment?, flow, confirm (must be true)
enable_flow / disable_flowenvironment?, flow
cancel_flow_runenvironment?, flow, run
resubmit_flow_runenvironment?, flow, run, trigger
add_flow_ownerenvironment?, flow, principalId, roleName (CanEdit|CanView)
remove_flow_ownerenvironment?, flow, principalId

Authoring (create_flow/update_flow): definition is the raw Logic Apps-style workflow JSON (see get_flow output as a template). The visual designer is better for complex logic; for edits, get_flow → modify the definition → pass it back to update_flow.

When environment is omitted, tools use DEFAULT_ENVIRONMENT if set, else the discovered default environment (isDefault: true).

Built-in (from SomaMCP)

  • info MCP tool — server name, version, git SHA, capability counts.
  • report_feedback — file API‑drift/bug reports as GitHub issues (FEEDBACK_GITHUB_REPO, GITHUB_TOKEN).
  • HTTP endpoints /health, /health/detail, /info, /dashboard (the detailed ones are protected by MCP_API_KEY when set).

Configuration

See .env.example for the full list. Highlights: AZURE_CLIENT_ID (required), AZURE_TENANT_ID (common), AZURE_AUTH_MODE, TRANSPORT (stdio|http), PORT, ENABLE_WRITE_OPS, DEFAULT_ENVIRONMENT, MCP_API_KEY, TELEMETRY, TOKEN_CACHE_PATH.

Transports & deployment

ScenarioTransportAuthNotes
Local agentstdiodevice-codePrimary. Full reach. pnpm dev:stdio.
Docker, single operatorhttpdevice-code + mounted token volumeAuth once via docker logs; persists. Full reach. docker compose up.
Docker, unattendedhttpclientCredentialsNo human, but no personal flows; verify it can mint a Flow token at all.

[!WARNING] The HTTP transport is single-operator. Every caller shares one Power Automate identity: the server holds a single process-wide token (one device-code sign-in, or one app identity), and MCP_API_KEY is a shared static bearer that gates access, not identity. Do not expose the HTTP endpoint to multiple users expecting per-user separation — they would all see and mutate the same person's flows. For per-user isolation, run stdio (one process per user, how Claude Desktop already runs it) or wait for the v2 per-user OAuth path (#9).

v2: per‑user browser OAuth over HTTP via FastMCP's AzureProvider + disk token cache (the upstream token surfaces on the session). Reachable through SomaMCP's backendOptions passthrough without a fork — not wired in v1.

bash
# Docker (single-operator device-code with a persisted token volume)AZURE_CLIENT_ID=... docker compose up --builddocker compose logs -f          # grab the device code on first runcurl -s http://localhost:3333/health

Development

bash
pnpm validate        # format + lint + typecheck + test + buildpnpm test            # vitest (unit)pnpm dev             # http transport, watchpnpm dev:stdio       # stdio transport, watchpnpm build           # tsdown -> dist/

Integration tests that hit a real tenant live under test/integration/ and run only with INTEGRATION=1 (see that folder's README). CI runs unit tests only.

Troubleshooting

  • Device code never grants a token / "device-code sign-in failed for all scope candidates" → the Flow audience isn't grantable to your app. See "Token audience" and docs/api-notes.md.
  • auth error on every call → token cache stale; restart to re‑auth, or delete TOKEN_CACHE_PATH.
  • not found on a known flow → wrong environment; run list_environments / list_flows first. The flow name is the GUID, not the display name.
  • forbidden → the signed‑in user lacks permission on that flow.
  • Empty list_flows in clientCredentials mode → app‑only can't see personal flows; use interactive.
  • An endpoint 404/410s unexpectedly → Microsoft may have moved the api‑version; check the portal's network tab and pin a newer api-version (see docs/api-notes.md).

License

MIT.


Sponsored by [SapientsAI] SapientsAI — Building agentic AI for businesses

來源:README.md,提交 461a1a1

工具

0
SourceWeft 尚未在沙箱中啟動過該軟體包,因此其工具未知。

版本歷史

1
  1. v0.2.4最新Sep 16, 2026

評分

已滿足適用檢查項的 50%

該評分衡量此收錄條目的完整程度,依據註冊中心條目、端點與公開來源計算得出。它不是對伺服器本身的評價,也不表示伺服器安全或目前可用:可連通性是帶日期的檢查結果,評分也不包含安裝量或使用者評價。

  • 近 30 天內可連通25 分

    請保持端點能夠回應 MCP 握手;SourceWeft 每 30 天探測一次。

  • 已宣告認證方式10 分

    請在註冊中心條目中宣告憑證請求標頭,或保持端點能夠回應探測,以便判定其認證方式。

  • 已列出工具15 分

    請讓伺服器在無憑證時回應 tools/list,或發布可在沙箱中無憑證啟動的軟體包。

  • 描述必需15 分
  • 圖示10 分
  • 文件15 分
  • 授權條款10 分