Skip to content

Build Power Automate flows with AI agents using Flow Studio MCP

A worked 3-step example showing how an AI agent reads, constructs, and deploys a real Power Automate cloud flow using Flow Studio MCP, with sample prompts you can copy.

AI agent build Power Automate guide

AI agent build Power Automate works in three steps with Flow Studio MCP: discover the connections in your environment, construct a valid Workflow Definition Language JSON, deploy via the update_live_flow tool. The agent does not need environment IDs, flow GUIDs, or connection IDs; it looks them up by name.

For the full agent install matrix across Copilot Studio, Codex, and other agents, see Install Flow Studio MCP for Power Automate.

What an AI agent does to build a Power Automate flow

An AI agent that has Flow Studio MCP installed can build a Power Automate cloud flow without you opening the Power Automate portal. You describe what you want in plain English. The agent then does three things: it discovers the connections available in your environment, it constructs a valid Microsoft Workflow Definition Language (WDL) JSON for the flow, and it deploys the flow using a single MCP tool call. The agent does not need you to provide environment IDs, flow GUIDs, or connection IDs. It looks them up by name.

Flow Studio MCP is an MCP server for Power Automate. It exposes 30+ tools to any MCP-compatible AI agent (GitHub Copilot, Claude, Microsoft Copilot Studio, OpenAI Codex, and others). The 3 tools that matter for build are list_live_connections, describe_live_connector, and update_live_flow.

A worked 3-step example: build an HR Onboarding notifier

Suppose you want to build a flow that runs every weekday at 9 AM, reads new employees from a SharePoint list, sends each one a welcome email, and posts a summary to a Teams channel.

You ask your agent:

Build a Power Automate flow in my Default environment.
Every weekday at 9 AM, read new items from the SharePoint list "HR_Onboarding"
on the johnliu365 site, send each new hire a welcome email via Outlook,
and post a summary to the #onboarding Teams channel. Call it HR Onboarding Notifier.
Step 1: Discover the connections

The agent calls list_live_environments to find your Default environment, then calls list_live_connections with that environment ID to discover which connectors are available. The agent confirms it has SharePoint, Outlook (Office 365), and Microsoft Teams connections, and captures the connection ID for each.

If a connector parameter takes a dropdown value (a SharePoint site ID, a Teams channel ID), the agent uses describe_live_connector with the operation ID, then get_live_dynamic_options to resolve the dropdown. This is the part that usually fails in older agentic flow builders. Flow Studio MCP exposes the dynamic-options metadata that the Power Automate API hides behind a UI.

Step 2: Construct the flow definition

The agent generates a Workflow Definition Language (WDL) JSON describing the flow. The structure includes a recurrence trigger (weekdays 9 AM), a Get Items action (SharePoint), an Apply to each loop, a Send Email action (Outlook), and a Post Message action (Teams). The agent assembles connection references using the IDs from Step 1, fills in dynamic parameters using the resolved dropdown values, and includes proper expression syntax for any column references.

You do not have to look at the JSON. The agent prepares it internally. If you want to inspect it before deploy, ask your agent: "show me the flow definition before deploying".

Step 3: Deploy the flow

The agent calls update_live_flow with the constructed WDL. Power Automate validates the definition, returns the new flow ID, and the agent reports back. Total time, from your initial prompt to a deployed flow: roughly 30 seconds.

If validation fails (a connector reference is wrong, an expression has a typo, a trigger argument is invalid), the agent reads the error response, fixes the issue, and retries. This is the loop that is impossible without an MCP server: the agent sees the actual validation error from Power Automate, not a generic top-level status code.

Sample prompts you can copy
  • "List my Power Automate flows in Default environment"
  • "Build a flow that triggers on new SharePoint list items in my Issues list and posts a card to the #issues channel in Teams"
  • "Create an approval flow: when a new file lands in the Contracts library, send approval to my manager, and on approval move the file to the Approved folder"
  • "Build a flow that runs every Monday at 8 AM, reads my Outlook calendar for the week, and posts the summary to my Teams chat"
  • "Modify the HR Onboarding flow to also create a Microsoft 365 group for new hires"
What works today across each agent
Claude Code for Power Automate

Claude (via the Claude Code VS Code extension or the CLI) handles all 3 steps reliably. Add the power-automate-build skill bundle from Flow Studio MCP and Claude follows a curated build recipe: discover, construct, deploy, validate. See the Claude install guide.

GitHub Copilot for Power Automate

GitHub Copilot Chat in VS Code handles build with the same pattern. Install the Power Automate MCP Server VS Code extension and Copilot Chat picks up the MCP server automatically. The 5 bundled skills (build, debug, monitor, discover, governance) are available as agent skills.

Microsoft Copilot Studio for Power Automate

A Copilot Studio agent with Flow Studio MCP wired in (see the Copilot Studio install guide) can build flows for any M365 Copilot user in your tenant directly from Teams chat. Build is slower than Claude or GitHub Copilot because of the chat-orchestration model, but it works.

OpenAI Codex for Power Automate

Codex Desktop and Codex CLI both work. The Codex CLI requires you to add mcp.flowstudio.app to the network allow-list (Codex blocks network by default). See the Codex install guide.

What a Power Automate flow definition looks like

Power Automate flows are stored as JSON. Understanding the structure helps you verify what your AI agent builds. Here is a simple flow with a manual trigger, a Compose action, and a Send Email action:

{
  "definition": {
    "triggers": {
      "manual": {
        "type": "Request",
        "kind": "Button",
        "inputs": { "schema": {} }
      }
    },
    "actions": {
      "Compose_Summary": {
        "type": "Compose",
        "inputs": "Monthly report generated on @{utcNow()}",
        "runAfter": {}
      },
      "Send_Email": {
        "type": "ApiConnection",
        "inputs": {
          "host": { "connection": { "name": "@parameters('$connections')['office365']['connectionId']" } },
          "method": "post",
          "path": "/v2/Mail",
          "body": {
            "To": "finance@contoso.com",
            "Subject": "Monthly Report",
            "Body": "@{outputs('Compose_Summary')}"
          }
        },
        "runAfter": { "Compose_Summary": [ "Succeeded" ] }
      }
    }
  }
}

Key parts to know:

  • triggers: what starts the flow. Every flow has exactly one trigger.
  • actions: the steps the flow runs. Each action has a type (Compose, ApiConnection, Http, etc.) and inputs.
  • runAfter: controls execution order. {} means the action runs first; { "Compose_Summary": [ "Succeeded" ] } means it waits for that action to succeed.
  • @parameters('$connections'): references to authenticated connectors in your environment.

You do not need to write this JSON yourself. Your AI agent constructs it from your natural language description. Recognising the structure lets you spot mistakes before deploying.

Common Power Automate connectors

These are the connectors AI agents work with most frequently when building Power Automate flows:

Connector Common actions
SharePointGet items, Create item, Update item, Get file content
Outlook / Office 365Send email, Get emails, Create event
Microsoft TeamsPost message to channel, Post adaptive card, Chat with Flow bot
ApprovalsStart and wait for an approval, Create approval
OneDrive for BusinessGet file content, Create file, List files
Excel OnlineList rows, Add row, Update row
Microsoft DataverseList rows, Get row, Add row, Update row
HTTPCall any external REST API, no authenticated connection needed
Build reference notes
If a Power Automate connection is missing

Connections require OAuth consent in a browser. No API can create them, including the AI agent. If your agent reports a missing connection, you will need to create it manually:

  1. Open make.powerautomate.com/connections.
  2. Select the correct environment from the top-right picker.
  3. Click + New connection for the missing connector.
  4. Sign in and authorise when prompted.
  5. Tell your agent when done. It will re-check and continue.
Power Automate deployment notes
  • New flows are created in a Stopped state by default. Ask your agent to start the flow after verifying the definition looks correct.
  • To start or stop a flow, the agent uses set_live_flow_state, not update_live_flow.
  • A description is always required when creating or updating a flow. Your agent generates this automatically based on your prompt; you do not need to provide one manually.
  • If your organisation requires flows to be part of a Dataverse solution, ask your agent to add it after deployment: "Add this flow to the [solution name] solution."
Power Automate expression syntax gotchas

Power Automate expressions have quirks that trip up both humans and AI agents. If your agent-built flow fails with expression errors, check for these common mistakes:

  • @triggerOutputs() vs @triggerBody(): @triggerOutputs() returns the full trigger output including headers; @triggerBody() returns just the body payload. Most flows want @triggerBody() for data access.
  • Referencing other actions: use @actions('ActionName')?['outputs'] to get outputs from a previous action. The action name must match exactly, including spaces and underscores.
  • Type conversion: @json() parses a string into an object; @string() converts an object to a string. Mismatched types cause silent failures or cryptic errors.
  • Nested scope references: actions inside an Apply_to_each or Scope block cannot be referenced directly from outside. Use @result('Scope_Name') to access the collected outputs.
  • Single quotes inside expressions: single quotes must be doubled, for example @equals(variables('status'), 'it''s done'). Missing the doubled quote breaks the entire expression.

Your agent handles most of these automatically, but knowing the patterns helps you troubleshoot when a deployed flow does not behave as expected.

Test the deployed Power Automate flow

After deployment, verify the flow works. Ask your agent: "Trigger a test run of the flow and check the result." For HTTP-triggered flows, the agent can call the trigger URL directly. For other triggers, you may need to trigger it manually and then ask the agent to check the run history. For a full debugging workflow, see Debug Power Automate Flows.

Frequently asked questions
Can an AI agent really build a Power Automate flow without me opening the portal?

Yes. With Flow Studio MCP installed, your agent uses the update_live_flow MCP tool to deploy a complete flow definition directly to Power Automate. The flow appears in your portal already deployed.

Does this work with custom connectors?

Yes. describe_live_connector works against any connector you have access to in your environment, including custom HTTP connectors and certified third-party connectors.

What happens if the AI agent generates an invalid flow?

Power Automate returns a validation error with the specific issue (invalid expression, unknown column, missing required parameter). Flow Studio MCP exposes this error to the agent via get_live_flow_run_error and get_live_flow_run_action_outputs, so the agent can fix it and retry. Microsoft Graph API only returns top-level status, which is why agents without Flow Studio MCP often get stuck in a build loop.

Can I use this with Microsoft Copilot Studio agents that already exist?

Yes. Wire Flow Studio MCP into an existing Copilot Studio agent and the build skill becomes available to every M365 Copilot user in your tenant. No per-user install required.

Is Flow Studio MCP a Microsoft product?

No. Flow Studio MCP is an independent MCP server made by Flow Studio. It is not affiliated with, endorsed by, or sponsored by Microsoft Corporation. It calls the Power Platform API on your behalf using your API key.

How do I get an AI agent to build a Power Automate flow from natural language?

Install Flow Studio MCP, an MCP server for Power Automate, in your AI agent (GitHub Copilot, Claude, Microsoft Copilot Studio, OpenAI Codex). Describe what you want in plain English. The agent calls list_live_connections to discover connectors in your environment, describe_live_connector and get_live_dynamic_options to resolve dropdown values such as SharePoint site IDs and Teams channel IDs, then constructs the Workflow Definition Language JSON and deploys via update_live_flow. Total round-trip is roughly 30 seconds from prompt to deployed flow.

Next steps

Flow Studio is an independent product and is not affiliated with, endorsed by, or sponsored by Microsoft Corporation. Microsoft, Power Automate, Power Platform, and Copilot are trademarks of the Microsoft group of companies. Claude is a trademark of Anthropic. GitHub Copilot is a trademark of GitHub, Inc. (a Microsoft subsidiary).