We build Copilot Studio agents in the Copilot Studio portal by adding Instructions, Tools, Knowledge manually. With Copilot Studio MCP, we can now create and test agents from any coding agent that supports MCP.

In this article, lets see how to set up Copilot Studio MCP, create a simple agent, test it and publish it. I am using ‘GitHub Copilot CLI’ as the coding agent.

What is Copilot Studio MCP?

  • MCP (Model Context Protocol) is a standard way for AI assistants to call outside tools.
  • Copilot Studio MCP is an MCP server from Microsoft, shipped as the npm package @microsoft/copilot-studio-mcp.
  • It lets clients like GitHub Copilot CLI and Claude Code work with Copilot Studio.
  • It adds tools to create, test and publish agents, find resources and check credit usage.

Why Copilot Studio MCP?

With the MCP, we describe the agent in plain words and Copilot CLI builds it. We can review, validate and test the agent before anything is saved.

Prerequisites

  • Node.js 22.18 or later, with npm and npx.
  • GitHub Copilot CLI installed.
  • Access to Copilot Studio and a Power Platform environment.
  • Copilot Credits in the environment. Building and testing agents uses credits.

Lets confirm Node.js, npm and npx are installed. Run the following commands in a terminal.

node --version
npm --version
npx --version

Now we have the prerequisites ready. Lets add the Copilot Studio MCP server to GitHub Copilot CLI.

Add the MCP server to GitHub Copilot CLI

  • Open a terminal and start GitHub Copilot CLI by running copilot command.
  • Type /mcp add and press ‘Enter’.
  • Fill the ‘Add MCP Server’ form as below.
SettingValue
Server Namecopilot-studio-mcp
Server TypeSTDIO
Commandnpx -y @microsoft/copilot-studio-mcp@latest
Tools*
  • Press ‘Ctrl+S’ to save.

Note: STDIO means Copilot CLI starts the server on your machine and talks to it directly.

Tip: We can also add the server from the terminal by running copilot mcp add copilot-studio-mcp -- npx -y @microsoft/copilot-studio-mcp@latest.

Now we have the MCP server added. Next we will sign in and pick an environment.

Sign in and connect to an environment

  • In Copilot CLI, enter the following prompt.
Connect to Copilot Studio MCP and show my available environments so I can choose one. Don't create, publish, run, or repair anything.
  • Copilot CLI asks for approval to use the ‘Sign in to Copilot Studio’ tool. Select ‘Yes’.
  • Complete the sign-in in the browser window that opens.
  • After sign-in, Copilot CLI lists the environments we have access to.
  • Pick which environment to use. We will use the ‘RPDev’ environment.
  • Approve the ‘Connect to an environment’ tool call.

Note: Copilot CLI asks for approval before each tool call. Read what the tool is about to do before selecting ‘Yes’.

Now we are connected to the ‘RPDev’ environment. Before creating an agent, lets check what the MCP can do.

Explore the MCP capabilities

  • Ask Copilot CLI to list the capabilities with the following prompt (This is optional step to get an idea of MCP of tools).
Show the Copilot Studio MCP capabilities available in this connection and confirm the target environment. Don't change anything.
  • The MCP returns five tools:
    • ‘manage_agents’: Create, validate, test and publish agents.
    • ‘manage_workflows’: Work with workflows in the environment.
    • ‘discover_resources’: Find connectors, tools and knowledge we can add to an agent.
    • ‘get_consumption’: Check Copilot Credit usage.
    • ‘get_copilot_studio_skills’: Load authoring guidance for Copilot CLI.

Important: The MCP can only create agents that use the GitHub Copilot harness. Classic agents can be listed and read, but not changed.

Now we know what the MCP offers. Lets create our first agent.

Create the ‘Learning Buddy’ agent

We will create an agent named ‘Learning Buddy’. It answers Copilot Studio questions using only the Microsoft Learn docs.

  • Enter the following prompt. Notice that we ask Copilot CLI to show and validate the agent before saving it.
Create a Copilot Studio agent called "Learning Buddy" that helps people learn Microsoft Copilot Studio. It should answer questions using only the Microsoft Learn Copilot Studio docs at https://learn.microsoft.com/en-us/microsoft-copilot-studio/. Keep answers short and simple, give steps where they help, and include the link to the page used. If the answer isn't in the docs, it should say so instead of guessing. Before saving anything, show me the agent's instructions and setup, and check that it's valid. Wait for me to say "create" before you save it as a draft. Don't publish it.
  • Copilot CLI calls ‘manage_agents’ with the ‘validate’ action. Approve the tool call.
  • Copilot CLI shows the agent setup and the validation result. In my case, it passed with no findings.
SettingValue
NameLearning Buddy
HarnessGitHub Copilot
ModelAuto
KnowledgeMicrosoft Learn Copilot Studio docs only
General web searchOff
Action toolsNone
Save modeDraft
  • Review the instructions and type ‘create’.
  • Copilot CLI saves the agent as a draft. Nothing is published yet.
  • Open the Copilot Studio portal and go to ‘Agents’. ‘Learning Buddy’ shows with status ‘Draft’ and ‘Powered by GitHub Copilot’.

Tip: Asking for a review before saving is a good habit. We can fix the instructions before anything is created.

Now we have the ‘Learning Buddy’ draft created. Next we will test it from Copilot CLI.

Test the agent from Copilot CLI

  • Enter a prompt with three questions. Two are about Copilot Studio. The third is off topic, to check that the agent doesn’t guess.
Test the Learning Buddy draft with these questions:
1. How do I add a website as a knowledge source?
2. What is the difference between a standard agent and a GitHub Copilot harness agent?
3. What is the best pizza topping?
For each answer, tell me whether it stayed within the Microsoft Learn docs and included a link. Don't change or publish the agent.
  • Approve the ‘manage_agents’ calls with the ‘test’ action. Copilot CLI sends each question to the draft agent.
  • The first two answers came from the Microsoft Learn docs and included links.
  • For the pizza question, the agent replied that it couldn’t find the answer in the docs. This is the result we wanted.

Note: GitHub Copilot harness agents use Copilot Credits. Building, testing and evaluating all use credits. Use the ‘get_consumption’ tool to check usage.

Now we have tested the agent and it stays within the docs. Lets review it in the Copilot Studio portal and publish it.

Review and publish the agent

  • Open ‘Learning Buddy’ in the Copilot Studio portal. The ‘Build’ tab shows the instructions and the knowledge source that the MCP added.
  • Click ‘Publish’ at the top right and confirm.

Summary

Copilot Studio MCP lets us build Copilot Studio agents from any coding agent that supports MCP. Using GitHub Copilot CLI, we added the MCP server, signed in, created a draft agent, tested it and published it. Every step asked for our approval before it ran.

🙂

Leave a Reply

Discover more from Rajeev Pentyala – Technical Blog on Power Platform, Azure and AI

Subscribe now to keep reading and get access to the full archive.

Continue reading