Lab 012: What is MCP? Anatomy of the ProtocolΒΆ
What You'll LearnΒΆ
- What MCP is and why it was created
- The three MCP primitives: Tools, Resources, and Prompts
- MCP transport options: stdio vs HTTP/SSE
- How to explore MCP servers with the MCP Inspector
- How MCP integrates with GitHub Copilot, Foundry, Claude, and other agents
IntroductionΒΆ
The problem MCP solvesΒΆ
Before MCP, if you wanted to connect an AI agent to a database, you had to write custom integration code for every combination of agent + data source. N agents Γ M data sources = NΓM custom integrations.
MCP solves this with a standard protocol:
MCP was created by Anthropic in 2024 and quickly adopted by Microsoft, OpenAI, Google, and others as the industry standard.
The Three MCP PrimitivesΒΆ
1. π§ ToolsΒΆ
Functions the LLM can call β the most common primitive.
{
"name": "search_products",
"description": "Search products by keyword or semantic similarity",
"inputSchema": {
"type": "object",
"properties": {
"query": { "type": "string", "description": "Search term" },
"max_results": { "type": "integer", "default": 10 }
},
"required": ["query"]
}
}
The LLM reads the description and decides when to call this tool.
2. π ResourcesΒΆ
Data the LLM can read β like files, URLs, or database records.
3. π¬ PromptsΒΆ
Reusable prompt templates the LLM can use.
{
"name": "summarize_sales_report",
"description": "Summarize a monthly sales report in 3 bullet points",
"arguments": [
{ "name": "month", "required": true }
]
}
Transport OptionsΒΆ
MCP communicates over two transports:
| Transport | Use case | How it works |
|---|---|---|
| stdio | Local tools, CLI agents | Parent process spawns MCP server as child; communicates via stdin/stdout |
| HTTP/SSE | Remote servers, cloud agents | MCP server exposes HTTP endpoints; agent connects via Server-Sent Events |
In this hub's labs, we use HTTP/SSE so cloud-hosted agents (like Foundry Agent Service) can reach your MCP server.
MCP Message FlowΒΆ
When an agent calls a tool, here's what happens:
1. User asks: "Find me waterproof outdoor tools"
β
βΌ
2. LLM reads available tools from MCP server
(tools/list response)
β
βΌ
3. LLM decides to call: search_products("waterproof outdoor tools")
β
βΌ
4. Agent sends: tools/call { name: "search_products", arguments: {...} }
β
βΌ
5. MCP Server executes the function
(queries database, calls API, reads file...)
β
βΌ
6. MCP Server returns result as text/JSON
β
βΌ
7. LLM incorporates result into its response
β
βΌ
8. User sees: "Here are waterproof outdoor tools: ..."
Using the MCP InspectorΒΆ
The MCP Inspector is a browser-based tool for exploring any MCP server without writing code.
Try it now β no install needed
Run this command (requires Node.js):
Or visit inspector.modelcontextprotocol.io in your browser.With the inspector you can:
- Connect to any MCP server (local or remote)
- Browse available tools, resources, and prompts
- Call tools manually and see the JSON responses
- Debug your own MCP servers
MCP in the Microsoft EcosystemΒΆ
| Product | MCP support |
|---|---|
| GitHub Copilot (VS Code) | β
Connect MCP servers in .vscode/mcp.json |
| Microsoft Foundry Agent Service | β Connect MCP servers as agent tools |
| Semantic Kernel | β MCP plugin adapter available |
| Claude Desktop | β Native MCP support |
| Azure MCP Server | β Microsoft-hosted MCP server for Azure services |
VS Code MCP configuration (.vscode/mcp.json)ΒΆ
Once configured, GitHub Copilot in VS Code can call your MCP server's tools from chat.
SummaryΒΆ
MCP is an open standard that lets any AI agent connect to any tool or data source via a consistent protocol. It has three primitives (Tools, Resources, Prompts) and two transports (stdio and HTTP/SSE). The MCP Inspector lets you explore servers without writing code.
Next StepsΒΆ
Ready to build your own MCP server?
- Python: β Lab 020 β Build an MCP Server in Python
- C#: β Lab 021 β Build an MCP Server in C#