Power Automate via FlowStudio MCP
This skill lets AI agents read, monitor, and operate Microsoft Power Automate
cloud flows programmatically through a FlowStudio MCP server — no browser,
no UI, no manual steps.
Requires: A FlowStudio MCP subscription (or
compatible Power Automate MCP server). You will need:
- - MCP endpoint:
https://mcp.flowstudio.app/mcp (same for all subscribers) - API key / JWT token (
x-api-key header — NOT Bearer) - Power Platform environment name (e.g.
Default-<tenant-guid>)
Source of Truth
| Priority | Source | Covers |
|---|
| 1 | Real API response | Always trust what the server actually returns |
| 2 |
tools/list | Tool names, parameter names, types, required flags |
| 3 |
SKILL docs & reference files | Response shapes, behavioral notes, workflow recipes |
Start every new session with tools/list.
It returns the authoritative, up-to-date schema for every tool — parameter names,
types, and required flags. The SKILL docs cover what tools/list cannot tell you:
response shapes, non-obvious behaviors, and end-to-end workflow patterns.
If any documentation disagrees with tools/list or a real API response,
the API wins.
Recommended Language: Python or Node.js
All examples in this skill and the companion build / debug skills use Python
with urllib.request (stdlib — no pip install needed). Node.js is an
equally valid choice: fetch is built-in from Node 18+, JSON handling is
native, and the async/await model maps cleanly onto the request-response pattern
of MCP tool calls — making it a natural fit for teams already working in a
JavaScript/TypeScript stack.
| Language | Verdict | Notes |
|---|
| Python | ✅ Recommended | Clean JSON handling, no escaping issues, all skill examples use it |
| Node.js (≥ 18) |
✅ Recommended | Native
fetch +
JSON.stringify/
JSON.parse; async/await fits MCP call patterns well; no extra packages needed |
| PowerShell | ⚠️ Avoid for flow operations |
ConvertTo-Json -Depth silently truncates nested definitions; quoting and escaping break complex payloads. Acceptable for a quick
tools/list discovery call but not for building or updating flows. |
| cURL / Bash | ⚠️ Possible but fragile | Shell-escaping nested JSON is error-prone; no native JSON parser |
TL;DR — use the Core MCP Helper (Python or Node.js) below. Both handle
JSON-RPC framing, auth, and response parsing in a single reusable function.
What You Can Do
FlowStudio MCP has two access tiers. FlowStudio for Teams subscribers get
both the fast Azure-table store (cached snapshot data + governance metadata) and
full live Power Automate API access. MCP-only subscribers get the live tools —
more than enough to build, debug, and operate flows.
Live Tools — Available to All MCP Subscribers
| Tool | What it does |
|---|
| INLINECODE15 | List flows in an environment directly from the PA API (always current) |
| INLINECODE16 |
List all Power Platform environments visible to the service account |
|
list_live_connections | List all connections in an environment from the PA API |
|
get_live_flow | Fetch the complete flow definition (triggers, actions, parameters) |
|
get_live_flow_http_schema | Inspect the JSON body schema and response schemas of an HTTP-triggered flow |
|
get_live_flow_trigger_url | Get the current signed callback URL for an HTTP-triggered flow |
|
trigger_live_flow | POST to an HTTP-triggered flow's callback URL (AAD auth handled automatically) |
|
update_live_flow | Create a new flow or patch an existing definition in one call |
|
add_live_flow_to_solution | Migrate a non-solution flow into a solution |
|
get_live_flow_runs | List recent run history with status, start/end times, and errors |
|
get_live_flow_run_error | Get structured error details (per-action) for a failed run |
|
get_live_flow_run_action_outputs | Inspect inputs/outputs of any action (or every foreach iteration) in a run |
|
resubmit_live_flow_run | Re-run a failed or cancelled run using its original trigger payload |
|
cancel_live_flow_run | Cancel a currently running flow execution |
Store Tools — FlowStudio for Teams Subscribers Only
These tools read from (and write to) the FlowStudio Azure table — a monitored
snapshot of your tenant's flows enriched with governance metadata and run statistics.
| Tool | What it does |
|---|
| INLINECODE29 | Search flows from the cache with governance flags, run failure rates, and owner metadata |
| INLINECODE30 |
Get full cached details for a single flow including run stats and governance fields |
|
get_store_flow_trigger_url | Get the trigger URL from the cache (instant, no PA API call) |
|
get_store_flow_runs | Cached run history for the last N days with duration and remediation hints |
|
get_store_flow_errors | Cached failed-only runs with failed action names and remediation hints |
|
get_store_flow_summary | Aggregated stats: success rate, failure count, avg/max duration |
|
set_store_flow_state | Start or stop a flow via the PA API and sync the result back to the store |
|
update_store_flow | Update governance metadata (description, tags, monitor flag, notification rules, business impact) |
|
list_store_environments | List all environments from the cache |
|
list_store_makers | List all makers (citizen developers) from the cache |
|
get_store_maker | Get a maker's flow/app counts and account status |
|
list_store_power_apps | List all Power Apps canvas apps from the cache |
|
list_store_connections | List all Power Platform connections from the cache |
Which Tool Tier to Call First
| Task | Tool | Notes |
|---|
| List flows | INLINECODE42 | Always current — calls PA API directly |
| Read a definition |
get_live_flow | Always fetched live — not cached |
| Debug a failure |
get_live_flow_runs →
get_live_flow_run_error | Use live run data |
⚠️ list_live_flows returns a wrapper object with a flows array — access via result["flows"].
Store tools (list_store_flows, get_store_flow, etc.) are available to FlowStudio for Teams subscribers and provide cached governance metadata. Use live tools when in doubt — they work for all subscription tiers.
Step 0 — Discover Available Tools
Always start by calling tools/list to confirm the server is reachable and see
exactly which tool names are available (names may vary by server version):
CODEBLOCK0
Core MCP Helper (Python)
Use this helper throughout all subsequent operations:
CODEBLOCK1
Common auth errors:
- - HTTP 401/403 → token is missing, expired, or malformed. Get a fresh JWT from mcp.flowstudio.app.
- HTTP 400 → malformed JSON-RPC payload. Check
Content-Type: application/json and body structure. - INLINECODE53 → wrong or missing tool arguments.
Core MCP Helper (Node.js)
Equivalent helper for Node.js 18+ (built-in fetch — no packages required):
CODEBLOCK2
Requires Node.js 18+. For older Node, replace fetch with https.request
from the stdlib or install node-fetch.
List Flows
CODEBLOCK3
Read a Flow Definition
CODEBLOCK4
Check Run History
CODEBLOCK5
Inspect an Action's Output
CODEBLOCK6
Get a Run's Error
CODEBLOCK7
Resubmit a Run
CODEBLOCK8
Cancel a Running Run
CODEBLOCK9
⚠️ Do NOT cancel a run that shows Running because it is waiting for an
adaptive card response. That status is normal — the flow is paused waiting
for a human to respond in Teams. Cancelling it will discard the pending card.
Full Round-Trip Example — Debug and Fix a Failing Flow
CODEBLOCK10
Auth & Connection Notes
| Field | Value |
|---|
| Auth header | INLINECODE59 — not INLINECODE60 |
| Token format |
Plain JWT — do not strip, alter, or prefix it |
| Timeout | Use ≥ 120 s for
get_live_flow_run_action_outputs (large outputs) |
| Environment name |
Default-<tenant-guid> (find it via
list_live_environments or
list_live_flows response) |
Reference Files
More Capabilities
For diagnosing failing flows end-to-end → load the power-automate-debug skill.
For building and deploying new flows → load the power-automate-build skill.
通过FlowStudio MCP实现Power Automate
该技能使AI代理能够通过FlowStudio MCP服务器以编程方式读取、监控和操作Microsoft Power Automate云端流——无需浏览器、无需用户界面、无需手动步骤。
需要: FlowStudio MCP订阅(或兼容的Power Automate MCP服务器)。您需要:
- - MCP端点:https://mcp.flowstudio.app/mcp(所有订阅者相同)
- API密钥/JWT令牌(x-api-key标头——非Bearer)
- Power Platform环境名称(例如 Default-<租户GUID>)
权威来源
| 优先级 | 来源 | 覆盖范围 |
|---|
| 1 | 实际API响应 | 始终信任服务器实际返回的内容 |
| 2 |
tools/list | 工具名称、参数名称、类型、必需标志 |
| 3 |
技能文档和参考文件 | 响应结构、行为说明、工作流模式 |
每次新会话从 tools/list 开始。
它返回每个工具的权威、最新模式——参数名称、类型和必需标志。技能文档涵盖 tools/list 无法告知的内容:响应结构、非显而易见的行为和端到端工作流模式。
如果任何文档与 tools/list 或实际API响应不一致,以API为准。
推荐语言:Python或Node.js
本技能及配套的构建/调试技能中的所有示例均使用带 urllib.request 的Python(标准库——无需 pip install)。Node.js 同样有效:fetch 从Node 18+开始内置,JSON处理原生支持,async/await模型与MCP工具调用的请求-响应模式完美契合——使其成为已在使用JavaScript/TypeScript技术栈的团队的自然选择。
| 语言 | 结论 | 备注 |
|---|
| Python | ✅ 推荐 | 清晰的JSON处理,无转义问题,所有技能示例均使用 |
| Node.js (≥ 18) |
✅ 推荐 | 原生 fetch + JSON.stringify/JSON.parse;async/await适合MCP调用模式;无需额外包 |
| PowerShell | ⚠️ 避免用于流操作 | ConvertTo-Json -Depth 静默截断嵌套定义;引号和转义破坏复杂负载。可用于快速 tools/list 发现调用,但不适用于构建或更新流。 |
| cURL / Bash | ⚠️ 可能但脆弱 | Shell转义嵌套JSON容易出错;无原生JSON解析器 |
TL;DR — 使用下面的核心MCP助手(Python或Node.js)。 两者都在一个可重用函数中处理JSON-RPC框架、认证和响应解析。
您可以做什么
FlowStudio MCP有两个访问层级。FlowStudio for Teams 订阅者可以获得快速Azure表存储(缓存快照数据+治理元数据)和完整的实时Power Automate API访问。仅MCP订阅者 获得实时工具——足以构建、调试和操作流。
实时工具 — 所有MCP订阅者可用
| 工具 | 功能 |
|---|
| listliveflows | 直接从PA API列出环境中的流(始终最新) |
| listliveenvironments |
列出服务账户可见的所有Power Platform环境 |
| list
liveconnections | 从PA API列出环境中的所有连接 |
| get
liveflow | 获取完整的流定义(触发器、操作、参数) |
| get
liveflow
httpschema | 检查HTTP触发流的JSON请求体模式和响应模式 |
| get
liveflow
triggerurl | 获取HTTP触发流的当前签名回调URL |
| trigger
liveflow | POST到HTTP触发流的回调URL(AAD认证自动处理) |
| update
liveflow | 一次调用创建新流或修补现有定义 |
| add
liveflow
tosolution | 将非解决方案流迁移到解决方案中 |
| get
liveflow_runs | 列出最近的运行历史,包含状态、开始/结束时间和错误 |
| get
liveflow
runerror | 获取失败运行的结构化错误详情(按操作) |
| get
liveflow
runaction_outputs | 检查运行中任何操作(或每个foreach迭代)的输入/输出 |
| resubmit
liveflow_run | 使用原始触发器负载重新运行失败或取消的运行 |
| cancel
liveflow_run | 取消当前正在运行的流执行 |
存储工具 — 仅限FlowStudio for Teams订阅者
这些工具从(并写入)FlowStudio Azure表读取——这是您租户流的监控快照,包含治理元数据和运行统计信息。
| 工具 | 功能 |
|---|
| liststoreflows | 从缓存中搜索流,包含治理标志、运行失败率和所有者元数据 |
| getstoreflow |
获取单个流的完整缓存详情,包括运行统计和治理字段 |
| get
storeflow
triggerurl | 从缓存获取触发器URL(即时,无需PA API调用) |
| get
storeflow_runs | 最近N天的缓存运行历史,包含持续时间和修复提示 |
| get
storeflow_errors | 仅缓存的失败运行,包含失败操作名称和修复提示 |
| get
storeflow_summary | 聚合统计:成功率、失败次数、平均/最大持续时间 |
| set
storeflow_state | 通过PA API启动或停止流,并将结果同步回存储 |
| update
storeflow | 更新治理元数据(描述、标签、监控标志、通知规则、业务影响) |
| list
storeenvironments | 从缓存列出所有环境 |
| list
storemakers | 从缓存列出所有制作者(公民开发者) |
| get
storemaker | 获取制作者的流/应用计数和账户状态 |
| list
storepower_apps | 从缓存列出所有Power Apps画布应用 |
| list
storeconnections | 从缓存列出所有Power Platform连接 |
首先调用哪个工具层级
| 任务 | 工具 | 备注 |
|---|
| 列出流 | listliveflows | 始终最新——直接调用PA API |
| 读取定义 |
get
liveflow | 始终实时获取——不缓存 |
| 调试失败 | get
liveflow
runs → getlive
flowrun_error | 使用实时运行数据 |
⚠️ listliveflows 返回一个包装对象,包含 flows 数组——通过 result[flows] 访问。
存储工具(liststoreflows、getstoreflow 等)适用于 FlowStudio for Teams 订阅者,提供缓存的治理元数据。如有疑问,使用实时工具——它们适用于所有订阅层级。
第0步 — 发现可用工具
始终从调用 tools/list 开始,确认服务器可达并查看确切可用的工具名称(名称可能因服务器版本而异):
python
import json, urllib.request
TOKEN = <您的JWT令牌>
MCP = https://mcp.flowstudio.app/mcp
def mcp_raw(method, params=None, cid=1):
payload = {jsonrpc: 2.0, method: method, id: cid}
if params:
payload[params] = params
req = urllib.request.Request(MCP, data=json.dumps(payload).encode(),
headers={x-api-key: TOKEN, Content-Type: application/json,
User-Agent: FlowStudio-MCP/1.0})
try:
resp = urllib.request.urlopen(req, timeout=30)
except urllib.error.HTTPError as e:
raise RuntimeError(fMCP HTTP {e.code} — 检查令牌和端点) from e
return json.loads(resp.read())
raw = mcp_raw(tools/list)
if error in raw:
print(错误:, raw[error]); raise SystemExit(1)
for t in raw[result][tools]:
print(t[name], —, t[description][:60])
核心MCP助手(Python)
在所有后续操作中使用此助手:
python
import json, urllib.request
TOKEN = <您的JWT令牌>
MCP = https://mcp.flowstudio.app/mcp
def mcp(tool, args, cid=1):
payload = {jsonrpc: 2.0, method: tools/call, id: cid,
params: {name: tool, arguments: args}}
req = urllib.request.Request(MCP, data=json.dumps(payload).encode(),
headers={x-api-key: TOKEN,