LoopAI-103

Use Azure AI agents with MCP servers

Unit 4 of 6 · Module 9: Integrate MCP Tools with Azure AI Agents

Go deeper

Unlocks when you've watched the lesson.

0 of 1 watched · about 2 min
Read this lesson

Remote MCP servers

MCP servers give your Foundry agent tools and context beyond its built-in functions. And the Foundry Agent Service supports remote MCP servers directly. That means you don't build an MCP client session, and you don't add function wrappers yourself. Instead, you create an MCP tool object that points at the server, and the service handles the connection. You need two things: a remote MCP server endpoint, like the GitHub Copilot MCP server, and a Foundry agent configured to use the MCP tool. Want tools from several servers? Add each server as its own MCP tool.

Configuring the MCP tool

Each MCP tool takes a few settings. The server label is a unique name for the server, like GitHub. The server URL is its address. Allowed tools, which is optional, lists exactly which of the server's tools the agent may use, so you can keep it to what it needs. And require approval decides whether a person must approve each tool call. If the server needs a key or a token, you don't paste it into your code: you store it in a project connection, and point the MCP tool at it with its project connection ID, and Foundry adds the credentials to each call.

Running and approving

You don't wrap functions or call call tool yourself; the service invokes MCP tools automatically during an agent run. So: create the MCP tool with a server label and URL, point it at a project connection if it needs credentials, and set require approval. Always means a developer approves every call, and it's the default if you don't set it. Never means calls go through without approval. Add the MCP tool to the agent's tools, send a prompt, and the tool results show up in the response. If approval is required, the response includes an MCP approval request instead, telling you which tool the model wants to call, and with what. You decide, then send back an MCP approval response, with the approval request ID and approve set to true or false. As the MCP ecosystem grows, you'll be able to bring more and more specialized tools into your agents this way.

Facts from Microsoft's documentation: Connect agents to MCP server endpoints; What is Microsoft Foundry Agent Service? (CC BY 4.0), rewritten in Loop's own words and examples. Narration, animation, and quiz by Loop. Microsoft, Azure, and Microsoft Foundry are trademarks of Microsoft. Loop is independent and not affiliated with or endorsed by Microsoft.