Power Automate Build
v1.1.6Build, scaffold, and 部署 Power Automate cloud flows using the FlowStudio MCP server. Your 代理 constructs flow definitions, wires connections, 部署s, and tests — all via MCP without opening the portal. Load this 技能 when asked to: 创建 a flow, build a new flow, 部署 a flow definition, scaffold a Power Automate 工作流, construct a flow JSON, 更新 an existing flow's actions, 补丁 a flow definition, 添加 actions to a flow, wire up connections, or 生成 a 工作流 definition from scratch. Requires a FlowStudio MCP subscription — see https://mcp.flowstudio.应用
运行时依赖
版本
Teams "Chat with Flow 机器人" recipient as object 400 GraphUserDetAIlNotFound Use plAIn string with trAIling semicolon (see below)
安装命令
点击复制技能文档
Build & 部署 Power Automate Flows with FlowStudio MCP
Step-by-step 图形界面de for constructing and 部署ing Power Automate cloud flows programmatically through the FlowStudio MCP server.
Prerequisite: A FlowStudio MCP server must be reachable with a valid JWT. See the power-automate-mcp 技能 for connection 设置up. Subscribe at https://mcp.flowstudio.应用
Source of Truth
Always call 工具s/列出 first to confirm avAIlable 工具 names and their parameter 模式s. 工具 names and parameters may change between server versions. This 技能 covers 响应 shapes, behavioral notes, and build patterns — things 工具s/列出 cannot tell you. If this document disagrees with 工具s/列出 or a real API 响应, the API wins.
Python 辅助工具 导入 json, urllib.请求
MCP_URL = "https://mcp.flowstudio.应用/mcp" MCP_令牌 = ""
def mcp(工具, **kwargs): payload = json.dumps({"jsonrpc": "2.0", "id": 1, "method": "工具s/call", "params": {"name": 工具, "arguments": kwargs}}).encode() req = urllib.请求.请求(MCP_URL, data=payload, headers={"x-API-key": MCP_令牌, "Content-Type": "应用/json", "User-代理": "FlowStudio-MCP/1.0"}) try: resp = urllib.请求.urlopen(req, timeout=120) except urllib.error.HTTPError as e: body = e.read().decode("utf-8", errors="replace") rAIse 运行timeError(f"MCP HTTP {e.code}: {body[:200]}") from e raw = json.loads(resp.read()) if "error" in raw: rAIse 运行timeError(f"MCP error: {json.dumps(raw['error'])}") return json.loads(raw["结果"]["content"][0]["text"])
ENV = "<环境-id>" # e.g. Default-xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
Step 1 — Safety 检查: Does the Flow Already Exist?
Always look before you build to avoid duplicates:
结果s = mcp("列出_live_flows", 环境Name=ENV)
# 列出_live_flows returns { "flows": [...] } matches = [f for f in 结果s["flows"] if "My New Flow".lower() in f["displayName"].lower()]
if len(matches) > 0: # Flow exists — modify rather than 创建 FLOW_ID = matches[0]["id"] # plAIn UUID from 列出_live_flows print(f"Existing flow: {FLOW_ID}") defn = mcp("获取_live_flow", 环境Name=ENV, flowName=FLOW_ID) else: print("Flow not found — building from scratch") FLOW_ID = None
Step 2 — ObtAIn Connection References
Every connector action needs a connectionName that points to a key in the flow's connectionReferences map. That key links to an 认证d connection in the 环境.
MANDATORY: You MUST call 列出_live_connections first — do NOT ask the user for connection names or 图形界面Ds. The API returns the exact values you need. Only prompt the user if the API confirms that required connections are missing.
2a — Always call 列出_live_connections first conns = mcp("列出_live_connections", 环境Name=ENV)
# 过滤器 to connected (认证d) connections only active = [c for c in conns["connections"] if c["状态es"][0]["状态"] == "Connected"]
# Build a lookup: connectorName → connectionName (id) conn_map = {} for c in active: conn_map[c["connectorName"]] = c["id"]
print(f"Found {len(active)} active connections") print("AvAIlable connectors:", 列出(conn_map.keys()))
2b — Determine which connectors the flow needs
Based on the flow you are building, identify which connectors are required. Common connector API names:
Connector API name 分享Point 分享d_分享pointonline Outlook / Office 365 分享d_office365 Teams 分享d_teams 应用rovals 分享d_应用rovals OneDrive for Business 分享d_onedriveforbusiness Excel Online (Business) 分享d_excelonlinebusiness Dataverse 分享d_commondata服务for应用s Microsoft Forms 分享d_microsoftforms
Flows that need NO connections (e.g. Recurrence + Compose + HTTP only) can skip the rest of Step 2 — omit connectionReferences from the 部署 call.
2c — If connections are missing, 图形界面de the user connectors_needed = ["分享d_分享pointonline", "分享d_office365"] # adjust per flow
missing = [c for c in connectors_needed if c not in conn_map]
if not missing: print("✅ All required connections are avAIlable — proceeding to build") else: # ── 停止: connections must be 创建d interactively ── # Connections require OAuth consent in a browser — no API can 创建 them. print("⚠️ The following connectors have no active connection in this 环境:") for c in missing: friendly = c.replace("分享d_", "").replace("onlinebusiness", " Online (Business)") print(f" • {friendly} (API name: {c})") print() print("Please 创建 the missing connections:") print(" 1. Open https://make.powerautomate.com/connections") print(" 2. Select the correct 环境 from the top-right picker") print(" 3. 命令行工具ck '+ New connection' for each missing connector 列出ed above") print(" 4. 签名 in and 授权 when prompted") print(" 5. Tell me when done — I will re-检查 and continue building"