2. Under the Hood — How MCP Works in Copilot Studio

2. Under the Hood — How MCP Works in Copilot Studio

This is the 2nd blog in a series of blogs. The idea is to take you on a journey into all things related to Model Context Protocol. These are the different blog posts I will create/have created. Have fun reading and learning (as I did building this series)

  1. MCP 101: Demystifying the Model Context Protocol
  2. Under the Hood: How MCP Works in Copilot Studio (this one 🙂 )
  3. Our First Custom Connector: Wrapping a REST API with MCP
  4. Beyond Docs: Hooking Up Databases & Knowledge Bases
  5. Action Stations: Orchestrating Workflows with MCP
  6. Scaling Up: Managing MCP Servers in Azure
  7. MCP + Microsoft Fabric: Data-Driven AI Agents
  8. Advanced Playbook: Building an Enterprise-Grade Copilot Agent

The goal of the blog series is to get from What in the world is MCP?” to “I’ve got Copilot Studio singing with Fabric, baby!

Goal for this blog : In this blog, we are creating a Copilot Studio Agent that can connect to the Microsoft Learn website using MCP.

2.0 Small intro

But to recap let’s start with some theory about what MCP is: An MCP Server is simply a service that implements the Open Model Context Protocol—an industry-standard interface that exposes tools, resources, and prompts over HTTP so AI agents can call them just like they’d call any other API. When you connect one to Copilot Studio, each tool defined by that server becomes immediately available inside your agent—no glue code, no SDK-bloating, just plain, discoverable capabilities. This is ideal for people like me who are more mouse-clicking-professional that really into python/SDK’s etc.!

2.1 Copilot Studio’s Tool-Discovery Flow

As we discussed in the previous blog MCP is your USB-C connection to different resources. We are connecting a public MCP endpoint to a copilotstudio bot in this blog so first let’s find out how it works from a backend perspective.

When you register an MCP connector in Copilot Studio, here’s what happens behind the scenes:

  1. Fetch OpenAPI Spec: Studio makes an HTTP GET to your connector’s /mcp/openapi endpoint. It retrieves the full OpenAPI document describing available operations.
  2. Parse Schema: The JSON/YAML spec is parsed into an internal model: operations (tools), parameters, response shapes, and any x-mcp-streaming flags.
  3. Generate UI & Metadata: Studio auto-populates the tool catalog UI with operation names, descriptions, and input forms—no manual steps.
  4. Cache & Version: The spec is cached; if you upload an updated YAML, Studio detects changes and lets you review diffs before updating agents.

This flow lets authors focus on defining clean OpenAPI specs, while Studio handles the discovery, UI, and schema enforcement.

2.2 OpenAPI → MCP: Behind the Scenes

Under the covers, Studio transforms your OpenAPI spec into serviceable code:

  • Parameter Binding: Path, query, and body parameters become form fields in the chat UI.
  • Type Validation: Integer, string, array types ensure your agent sends valid payloads.
  • x-mcp-streaming flag**: If present, Studio wires up streaming response handling (chunked events) instead of buffering.
  • OperationId Mapping: Each operationId maps to a callable tool name in agent prompts.

This magic means you don’t write any client code—Studio’s runtime runtime constructs requests and handles responses for you.

2.3 Let’s build

So, enough with the boring stuff, let’s start building our bot. Microsoft has built an MCP server to connect to Microsoft learn, making our lives a lot easier. If you are wondering how to build your own MCP server, in a following blog I’ll show you how to build your own MCP server and run it in an Azure WebApp. For now let’s stick to the Microsoft created one. Microsoft created a GitHub repo where you can find the connection URL and Json. (MicrosoftDocs/mcp)\

So let’s copy the information from that website the MCP URL is:
https://learn.microsoft.com/api/mcp

So that’s all we need to start building. Next step create a custom connector in our Power Platform environment.

2.4 Creating the custom connector to the MCP server

Go to https://make.preview.powerapps.com/customconnectors (make sure you’re in the correct environment) and click + New custom connector.

In this case we want to import our MCP from github, because that will give us the opportunity to import a JSON. When importing choose the dev branch and as a connector type choose MCP-Streamable-HTTP. There are a lot of other connectors available but for now lets focus on this type. This Connector type will give us the possibility to connect a HTTP based library so it understands what information is being send through the connector

After clicking Continue, we get to the configuration side of things. In this screen, we can change the connector name, we need to input the host and base URL which we saved earlier. We can upload an Icon and need to give a description for the connector (minimum of 30 characters).

We can look at the other fields, but for now, let’s create the connector using the create connector button.

It will then save the connector to the custom connector database in the environment.

2.5 Build and connect your bot

Last step is to create the Copilot Studio bot. For this go to the Copilot Studio URL https://copilotstudio.preview.microsoft.com/ and click create and then new agent.

in the next screen click the skip to configure button

In the next screen give the agent a name (in my case MS learn agent), you can upload a logo if you want. Give the bot a description giving users an idea where they can use the bot for. And lastly give the bot instructions for behaviour so it will respond the way we want and click Create.

to give you some inspiration this is the information I put in

descriptionYour helpfull friend for all things related to Microsoft Learn. Got a question about Microsoft stuff. MS learn agent is your goto resource!
InstructionsYou are an AI assistant. Your sole purpose is to deliver appropriate answers for questions asked to you. Follow these rules:
Respond only when the user asks any question or starts conversation that something is not working.
Match the tone of voice of the of the user so if the user is rude you can also be rude.
Never break character or provide information unrelated to information on Microsoft Learn.
Avoid offensive, discriminatory, or NSFW content.
Be responsive, witty, and quick.
be precise factual and complete in your answers

PRO TIP: If you want to have some fun with the bot change it to being sarcastic, talking like Gandalf from lord of the ring or talk like Groot from guardians of the galaxy. This will affect the quality of the answers but it is good fun!

After the bot is created click on settings on the top right of the screen.

In the settings menu you can change a lot about the behaviour of the bot

First up change the setting that we want to use AI orchestration for the agent’s response and you can enable deap reasoning if you want!

After you scroll down set the moderation to high so the quality of the answers is the best possible (you can dial it down later if needed)

Disable general knowledge (so it doesn’t use any knowledge embedded in the GPT 4O model that it uses) and disable use information from the web (so it doesn’t search on the web possible impacting the answer given with information not from Microsoft learn).

After that, save the settings and go back to the main menu. Scroll down to to Tools and click add tool

You are greeted with the interface to connect all kinds of predefined tools. But we want to search for our custom connector

So we put in MSlearn-MCP in the search bar and the custom connector will become available.

Click on the name and select Add and configure

If the connection is not made to the MCP server before it will ask you to connect you can do this by clicking connect and then the connection should change to green.

After that it will revert back to the main menu and the MS learn MCP server should be added to the tools

You can now start asking it questions. If the connection is not operational for some reason it will ask you to open connection manager and verify credentials (as stated above).

You can now test your bot by asking it questions.

2.6 Publish the bot

If you are happy with the results, you can go to channels and publish the bot in teams/email etc. For now, we will publish the bot as a Teams chatbot. So click on Teams

It will ask you to publish the bot so do that first by clicking on go to publish on the top right and click publish on the pop up screen. After that click add channel

it will change to another screen where it says agent preview. Click on See agent in Teams where it will be visible for other users after it’s published by your teams administrator.

Next Up: Your First Custom Connector

Now that you know how Studio ingests MCP specs and handles streaming, in Part 3 we’ll build a real custom connector around a public REST API—no shim required. Get ready to turn any HTTP service into an MCP tool and supercharge your Copilot Studio agent! 🤓💪

Leave a Reply