← Develop AI Apps and Agents o… Latent Shelf · Ch.9

Module Study Guide · Path 2 · AI agents

Integrate MCP Tools with Azure AI Agents

Integrate once, discover forever — MCP turns a centralized server into a live catalog your agent reads at runtime.

— the module's shift

Connecting agents to tools the modern way. This module explains the Model Context Protocol and dynamic tool discovery, the client/server architecture, and how an Azure AI agent connects to a remote MCP server through the MCPTool object — with an approval flow.

dynamic discoveryclient/serverMCPTool + approval13 quiz questions
01What MCP is

Dynamic tool discovery

The Model Context Protocol (MCP) is a standard that lets agents discover and use tools from centralized servers without hardcoded integrations. Instead of manually adding each tool, an agent queries an MCP server that acts as a live catalog — tools can be added, updated, or removed centrally, and the agent always uses the latest versions.

Key concept · Why MCP matters

  • Dynamic discovery — "integrate once" instead of re-integrating each API change.
  • Interoperability — works across different LLMs; swap models without reworking integrations.
  • Standardized security — one consistent auth method across many servers.
  • Scalability, modularity, maintainability — tool management shifts from the agent to a dedicated service; agents stay simple and delegate.
02Architecture

Server, client, agent

MCP tool discovery runs on a three-part pipeline.

The MCP three-part pipeline.
RoleWhat it does
MCP serverHosts the tools — functions exposed with the @mcp.tool decorator; a live catalog of capabilities.
MCP clientConnects to the server, fetches available tools dynamically, and generates function wrappers.
Azure AI agentReceives the tool definitions and delegates to the right tool based on the user's request.

This is especially valuable when tools evolve fast, many teams manage different APIs, and agents must act on external systems securely — the agent adapts to changing capabilities in real time.

03Using MCP with agents

The MCPTool and its approval flow

Azure AI Agent Service connects to a remote MCP server through an MCPTool object — no manual client sessions or function wrapping. The tools are invoked automatically during agent runs.

Key concept · Configuring and approving

An MCPTool takes a server_label, a server_url, optional allowed_tools (a whitelist), and require_approval; add auth via custom headers. Approval policy: "always" (default — a developer approves each call) or "never". When approval is required, the agent returns an mcp_approval_request (with a request ID); you reply with an mcp_approval_response (matching id + approve true/false). Connect multiple servers by adding several MCPTool objects; the agent picks the right tool per task.

★Test yourself

Chapter 9 quiz

Thirteen questions on MCP, dynamic discovery, the architecture, and the MCPTool approval flow. Answer first, then expand Show answer.

Part A · Multiple choice

Q1

What does MCP primarily enable for agents?

  • A Faster token generation
  • B Dynamic discovery and use of tools from centralized servers without hardcoded integrations
  • C Model fine-tuning
  • D Image generation
Show answer

B. An "integrate once" model where a server is a live tool catalog.

Q2

In the MCP pipeline, what hosts the tools?

  • A The MCP client
  • B The MCP server
  • C The agent
  • D The LLM
Show answer

B — the MCP server. Tools are exposed with the @mcp.tool decorator.

Q3

What role does the MCP client play?

  • A Hosts tools
  • B Connects to the server, fetches tools, and generates function wrappers
  • C Runs the LLM
  • D Stores conversation state
Show answer

B. It bridges the server's catalog to the agent.

Q4

Which object connects an Azure AI agent to a remote MCP server?

  • A FunctionTool
  • B MCPTool
  • C OpenApiTool
  • D AzureFunctionTool
Show answer

B — MCPTool. No manual client session or function wrapping required.

Q5

What is the default value of require_approval?

  • A "never"
  • B "always" — a developer approves each tool call
  • C "auto"
  • D There is no default
Show answer

B — "always". You can set "never" to skip approval.

Q6

What does allowed_tools do on an MCPTool?

  • A Whitelists specific tools the agent may access
  • B Sets the model
  • C Defines the temperature
  • D Stores the conversation
Show answer

A. An optional whitelist restricting which server tools are available.

Part B · True or false

Q7

With MCP, tools can be updated centrally without changing agent code.

Show answer

True. Agents always get the latest tool versions from the server.

Q8

MCP works only with a single specific LLM.

Show answer

False. Interoperability across LLMs is a core advantage.

Q9

An agent can connect to multiple MCP servers at once.

Show answer

True. Add several MCPTool objects; the agent selects the right tool per task.

Q10

When approval is required, you respond with an mcp_approval_response matching the request ID.

Show answer

True. With an approve boolean.

Part C · Short answer

Q11

Name the three roles in the MCP pipeline.

Show answer

MCP server (hosts tools), MCP client (discovers/wraps), and the Azure AI agent (consumes).

Q12

Name the two required MCPTool parameters.

Show answer

server_label and server_url (optionally allowed_tools and require_approval).

Q13

Give three benefits of dynamic tool discovery with MCP.

Show answer

Any three: scalability, modularity, maintainability, flexibility, and real-time adaptation.