AI Agents for Beginners - 11. Using Agentic Protocols (MCP, A2A and NLWeb)
MCP, A2A, and NLWeb — three agentic protocols for standardized tool access, agent-to-agent collaboration, and natural language interfaces on the web.
June 9, 2026
AI Agents for Beginners - 11. Using Agentic Protocols (MCP, A2A and NLWeb)
This article summarizes key takeaways based on Lesson 11 of Microsoft's AI Agents for Beginners course.
As the use of AI Agents grows, the need for protocols supporting standardization, security, and open innovation is becoming increasingly critical.
This lesson covers three protocols:
This lesson covers three protocols:
| Protocol | Role |
|---|---|
| MCP (Model Context Protocol) | Standardized access to external tools and data for AI Agents |
| A2A (Agent-to-Agent) | Facilitates communication and collaboration between different AI Agents |
| NLWeb (Natural Language Web) | Adds natural language interfaces to websites for AI Agents to explore and interact with content |
Model Context Protocol
The Model Context Protocol (MCP) is an open standard that allows applications to provide context and tools to LLMs in a standardized way.
It acts as a "universal adapter" to connect consistently to diverse data sources and tools.
It acts as a "universal adapter" to connect consistently to diverse data sources and tools.
MCP Core Components
MCP operates on a client-server architecture, and its core components are as follows:
| Component | Description |
|---|---|
| Hosts | LLM applications (e.g., VSCode) that initiate connections to MCP servers |
| Clients | Components within the host application maintaining a 1 connection with servers |
| Servers | Lightweight programs exposing specific capabilities |
The three core primitives of an MCP Server:
| Primitive | Description |
|---|---|
| Tools | Discrete actions and functions that agents can invoke (e.g., "get weather", "purchase product"). Advertises names, descriptions, and schemas |
| Resources | Read-only data provided by the MCP server (file contents, database records, logs). Text or binary |
| Prompts | Pre-defined prompt templates designed for more complex workflows |
MCP Client-Server ArchitectureMermaid%%{init: {'look': 'handDrawn'}}%% flowchart LR subgraph Host["Host Application"] direction TB LLM["LLM"] Client["MCP Client"] LLM <--> Client end subgraph Server["MCP Server"] direction TB Tools["Tools\n(Actions)"] Resources["Resources\n(Data)"] Prompts["Prompts\n(Templates)"] end Client -->|"discover capabilities"| Server Server -->|"tool list + schemas"| Client Client -->|"call_tool(name, params)"| Server Server -->|"tool result"| Client
Benefits of MCP
| Benefit | Description |
|---|---|
| Dynamic Tool Discovery | Agents dynamically receive the list of available tools from the server. No static coding required unlike traditional APIs — an "integrate once" approach |
| Interoperability Across LLMs | Works across various LLMs, enabling flexible transitions to better-performing models |
| Standardized Security | Includes standard authentication methods — eliminates managing different keys and auth schemes when adding various MCP servers |
MCP Example
A scenario where a user books a flight using an MCP-based AI assistant:
-
Connection: The AI assistant (MCP client) connects to an MCP server provided by an airline.
-
Tool Discovery: The client asks the airline's MCP server, "What tools do you have?" The server responds with a list of tools such as
search_flightsandbook_flights. -
Tool Invocation: When requested to "Search for flights from Portland to Honolulu," the AI assistant uses the LLM to determine that it needs to call the
search_flightstool and passes the relevant parameters (origin, destination) to the MCP server. -
Execution and Response: Acting as a wrapper, the MCP server calls the airline's internal booking API. It receives the flight information (JSON data) and returns it to the AI assistant.
-
Further Interaction: The AI assistant presents flight options. Once a flight is selected, the assistant calls the
book_flighttool on the same MCP server to complete the booking.
MCP Example: Flight BookingMermaid%%{init: {'look': 'handDrawn'}}%% flowchart LR User(["User"]) Agent["AI\nAgent"] MCP["MCP\nServer"] API["Booking\nAPI"] User -->|"③ Request search_flights"| Agent Agent -->|"① Connection"| MCP Agent <-->|"② Tool Discovery\nsearch_flights, book_flights"| MCP MCP -->|"④ Execution\nCall internal API"| API API -->|"④ Response\nFlight JSON"| MCP MCP -->|"④ Returns\nFlight Options"| Agent Agent -->|"④ Shows\nFlight Options"| User User -->|"⑤ Selects Flight\n→ Call book_flight"| Agent
Code: MCP-Style Tool Discovery
In production, tools are dynamically discovered from an MCP server. The example below simulates an MCP-connected accommodation service:
setup.pypython
mcp_tools.pypython
mcp_agent.pypython
MCP Agent: Tool Discovery FlowMermaidflowchart LR User["User Query\n'Tokyo 5 nights, culture & food'"] --> Agent["AccommodationAgent\n(MCP Client)"] Agent -->|"discover tools"| MCP["MCP Server\n(Simulated)"] MCP -->|"tool list + schemas"| Agent Agent --> T1["search_accommodations\n(Tokyo, April, 2 guests)"] Agent --> T2["get_local_experiences\n(Tokyo, culture + food)"] T1 & T2 --> LLM["LLM\nSynthesize & compare results"] LLM --> Response["Personalized accommodation\n& experience recommendations"] Response --> User
Agent-to-Agent Protocol (A2A)
While MCP focuses on connecting LLMs to tools, the Agent-to-Agent (A2A) protocol enables communication and collaboration between different AI Agents.
A2A connects agents across diverse organizations, environments, and technology stacks to accomplish joint tasks.
A2A connects agents across diverse organizations, environments, and technology stacks to accomplish joint tasks.
A2A Core Components
| Component | Role |
|---|---|
| Agent Card | Advertises the agent's name, description, skill list, endpoint URL, version, and capabilities. Helps other agents determine when and why to invoke it |
| Agent Executor | Passes the user chat context to a remote agent. The remote agent parses the request with its own LLM and executes it using internal tools |
| Artifact | Output generated after the remote agent completes a task. Includes task results, explanations, and textual context. The connection closes once delivered |
| Event Queue | Processes updates and delivers messages. Ensures connections remain intact until task completion. Crucial for long-running tasks |
A2A Core ComponentsMermaidflowchart TD Orch["Orchestrator Agent\n(Travel Agent)"] Orch -->|"Look up Agent Card"| Registry["Agent Card Registry\nName · Skills · Endpoints"] Registry -->|"Discovered agents list"| Orch Orch -->|"Pass context"| AE["Agent Executor\nExecute remote agent"] AE -->|"Task complete"| Art["Artifact\nOutput · Explanations · Text"] Art --> Orch AE <-->|"Progress updates"| EQ["Event Queue\nMaintain connection · Message delivery"]
Benefits of A2A
| Benefit | Description |
|---|---|
| Enhanced Collaboration | Enables agents from different vendors and platforms to interact, share context, and collaborate |
| Model Selection Flexibility | Each A2A agent chooses its own LLM — enabling the use of models optimized or fine-tuned for specific agent roles |
| Built-in Authentication | Authentication is directly integrated into the A2A protocol, providing a robust security framework for agent interactions |
A2A Example
The travel booking scenario expanded into A2A across 5 stages:
A2A Example: Full Trip BookingMermaidflowchart TD User["User\n'Book round-trip flight + hotel + car rental for Honolulu'"] --> TA["Travel Agent\n(A2A Orchestrator)\nAnalyze task with LLM"] TA -->|"A2A Protocol"| AA["Airline Agent\n(Different company)\nSearch & book flights"] TA -->|"A2A Protocol"| HA["Hotel Agent\n(Different company)\nBook hotel"] TA -->|"A2A Protocol"| CA["Car Rental Agent\n(Different company)\nBook rental car"] AA & HA & CA -->|"Return Artifact"| TA TA -->|"Aggregate results"| Response["Consolidated Travel Confirmation\nIntegrated flight, hotel, and car rental"] Response --> User
Code: A2A Multi-Agent Workflow
Sequentially connecting three specialist agents using A2A message passing:
a2a_agents.pypython
a2a_workflow.pypython
A2A Workflow: 3-Agent PipelineMermaidflowchart LR User["User\n'1-week trip to Tokyo\nInterested in food, temples, technology'"] --> CE["CurrencyExchangeAgent\nExchange rates & currency guide\nBest timing & tips"] CE -->|"Pass context"| AP["ActivityPlannerAgent\nRecommend attractions, stays, dining\nTailored to traveler interests"] AP -->|"Pass context"| TM["TravelManagerAgent\nSynthesize full itinerary\nGenerate structured travel brief"] TM --> Response["Final Travel Plan\nExchange rates + Activities + Comprehensive brief"] Response --> User
Key capabilities in an A2A production environment:
| Capability | Description |
|---|---|
| Cross-framework interop | Agents built with different frameworks delegate tasks to A2A-compliant agents |
| Service boundaries | Agents collaborate across distinct microservices, cloud regions, and external organizations |
| Dynamic discovery | Orchestrators discover the best specialist agents at runtime from an Agent Card registry |
| Streaming & push notifications | Delivers real-time progress updates via SSE (Server-Sent Events) and push notifications for long-running tasks |
Natural Language Web (NLWeb)
Websites have long served as the primary means for users to access information across the internet.
NLWeb adds a natural language interface to every website, enabling AI Agents to explore and interact with content.
NLWeb adds a natural language interface to every website, enabling AI Agents to explore and interact with content.
Components of NLWeb
| Component | Role |
|---|---|
| NLWeb Application | The core service handling natural language questions. Connects various parts of the platform to generate responses — the "engine" of natural language capabilities |
| NLWeb Protocol | The baseline set of rules for natural language interaction with websites. Provides JSON-formatted responses (leveraging Schema.org). The foundation for the "AI Web", just as HTML enabled document sharing |
| MCP Server | Each NLWeb setup also functions as an MCP server. Shares tools and data like the ask method with other AI systems — turning the website into a participant in the "agent ecosystem" |
| Embedding Models | Converts website content into vectors (numerical representations). Stores semantic meaning in a form computers can compare and search |
| Vector Database | Stores embeddings of website content. Rapidly retrieves relevant information upon receiving a query. Supports Qdrant, Snowflake, Milvus, Azure AI Search, Elasticsearch, etc. |
NLWeb ArchitectureMermaidflowchart TD Content["Website Content\n(Schema.org / RSS Feeds)"] --> Ingest["NLWeb Application\nData ingestion & processing"] --> Embed["Embedding Model\nConvert content → vectors"] --> VDB["Vector Database\n(Qdrant / Azure AI Search, etc.)"] Query["Natural Language Query\n(User or AI Agent)"] --> NLP["LLM\nQuery understanding & interpretation"] --> Search["Vector Search\nRetrieve relevant embeddings"] Search --> VDB VDB -->|"Return similar results"| NLP NLP --> Response["Natural Language Response\n(Grounded in real DB data)"] NLWeb_MCP["NLWeb as MCP Server\n'ask' method"] -->|"Called by AI Agent"| Search
NLWeb by Example
A scenario of a travel booking website powered by NLWeb:
-
Data Ingestion: The travel website's existing product catalog (flight listings, hotel descriptions, tour packages, etc.) is formatted into Schema.org structures or ingested via RSS feeds. An NLWeb tool converts this structured data into embeddings and stores them in a local or remote vector database.
-
Natural Language Query: Instead of navigating through menus, a user visiting the website types into a chat interface: "Find a family-friendly hotel in Honolulu with a pool for next week."
-
NLWeb Processing: The NLWeb application receives the query. It sends the query to an LLM to comprehend its intent while simultaneously querying the vector database for relevant hotel listings.
-
Accurate Results: The LLM interprets the database search results, selects optimal matches based on "family-friendly", "pool", and "Honolulu", and generates a natural language response. Because it references actual hotels from the website's catalog, hallucinations are avoided.
-
AI Agent Interaction: Since NLWeb also functions as an MCP server, external AI travel agents can connect directly to the website's NLWeb instance. It queries directly via the
askMCP method:ask("Are there any hotel-recommended vegan restaurants in Honolulu?")→ NLWeb processes this and returns a structured JSON response.
Five steps of applying NLWeb to a travel booking website:
NLWeb Example: Travel Booking SiteMermaidflowchart TD S1["1. Data Ingestion\nFormat flights, hotels, & tour packages\nusing Schema.org/RSS\nGenerate embeddings → Store in Vector DB"] --> S2["2. Natural Language Query\nUser: 'Family-friendly Hawaii hotel with pool'\nChat input without menu navigation"] --> S3["3. NLWeb Processing\nLLM: Understand query\nVector DB: Search relevant hotels"] --> S4["4. Accurate Results\nLLM interprets results & selects best matches\nResponse based on real catalog\n(No hallucinations)"] --> S5["5. AI Agent Interaction\nConnect external AI Agent via MCP 'ask' method\nask('Hawaii vegan restaurants?')\n→ Structured JSON response"]
Summary
Lesson 11 Summary: Three Agentic ProtocolsMermaidflowchart LR Root["Agentic\nProtocols"] Root --> MCP["MCP\nModel Context Protocol"] Root --> A2A["A2A\nAgent-to-Agent"] Root --> NLW["NLWeb\nNatural Language Web"] MCP --> M1["Standardized Tool Access"] MCP --> M2["Dynamic Discovery"] MCP --> M3["Tools · Resources · Prompts"] A2A --> A1["Agent-to-Agent Collaboration"] A2A --> A2["Agent Card · Artifact"] A2A --> A3["Cross-framework Interop"] NLW --> N1["Websites + Natural Language Interface"] NLW --> N2["Vector DB-based Search"] NLW --> N3["Also Functions as an MCP Server"]
- MCP serves as a "universal adapter" that grants AI Agents standardized access to external tools and data, allowing dynamic discovery of new capabilities without altering agent code.
- A2A enables agents from different organizations and frameworks to discover one another via Agent Cards and collaborate to complete complex tasks.
- NLWeb adds a natural language interface to websites and functions as an MCP server, empowering external AI Agents to query web content directly via the
askmethod. - The three protocols complement one another: MCP handles tool integration, A2A drives agent-to-agent collaboration, and NLWeb bridges web ecosystems with AI Agents.