Overview
The Model Context Protocol (MCP) is an open standard for connecting AI applications to tools and data. Before MCP, every AI app wrote its own integration for every system, such as GitHub, a database, or a file system. With MCP, a system is wrapped once as an MCP server, and any MCP-capable client (a chat app, an IDE, or an agent) can discover and use it. It is often compared to USB-C for AI integrations.
MCP uses a client-server model over JSON-RPC. The host application (for example an IDE) runs one MCP client per server connection. Servers expose three kinds of capabilities. Tools are actions the model can call, resources are data the app can read, and prompts are reusable templates. Servers run locally over standard input and output, or remotely over HTTP.
Travelers used to carry a different charger for every device. USB-C replaced them with one plug. MCP is that plug for AI apps. A tool provider builds one MCP server, and every compatible AI app can plug into it.
When to use it
- Giving an AI assistant access to internal systems in a reusable way.
- Building tools once and using them across several AI clients.
- Standardizing how agents discover and call capabilities.
Where it shows up in interviews
Recognize it when: many AI clients need the same integrations.
- Design AI Agent Platform
- Design an AI coding assistant
Where it is used in real software
Coding assistants connect to MCP servers for repositories, issue trackers, databases, and browsers.
Users add MCP servers so the assistant can read local files or query their tools.
Companies wrap internal APIs as MCP servers so any approved agent can use them with consistent auth and logging.
Key terms
- Host
- The AI application the user interacts with, such as an IDE or chat app.
- MCP client
- The connector inside the host that talks to one MCP server.
- MCP server
- A program that exposes tools, resources, and prompts for a system.
- Tool
- A callable action with a name, description, and JSON input schema.
- Transport
- How messages travel, such as standard input and output locally or streamable HTTP remotely.
How it works, step by step
- 1Connect
The host starts or connects to a server and the two negotiate protocol version and capabilities.
- 2Discover
The client lists the server's tools, resources, and prompts.
- 3Offer to the model
The host includes tool descriptions in the model's context.
- 4Call
When the model chooses a tool, the client sends a tools/call request with JSON arguments, often after user approval.
- 5Return results
The server runs the action and returns content that the host feeds back to the model.
STEP 1User asks the IDE assistant "Open an issue for this bug."
Integrations with and without MCP
4 AI apps each need 5 integrations.
| Approach | Integrations to build | Who maintains them |
|---|---|---|
| Custom per app | 4 x 5 = 20 | Every app team |
| MCP | 5 servers + 4 clients | Each system owner once |
NOWApproach: Custom per app | Integrations to build: 4 x 5 = 20 | Who maintains them: Every app team
MCP turns an N x M integration problem into N + M.
Implementation
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";import { z } from "zod"; const server = new McpServer({ name: "orders", version: "1.0.0" }); server.tool( "get_order", "Look up an order by ID", { id: z.string().describe("Order ID") }, async ({ id }) => { const order = await ordersDb.find(id); return { content: [{ type: "text", text: JSON.stringify(order) }] }; },); await server.connect(new StdioServerTransport());Complexity and performance
N systems, M AI clients.
Local servers add almost no latency.
Trade-offs
MCP gives reuse and discovery, but adds a protocol layer. For one app with one integration, a direct function call is simpler.
Local servers are easy and private but run with the user's machine permissions. Remote servers centralize auth and logging but need OAuth and network security.
Variants and related techniques
Hosted over HTTP with OAuth so many users share a managed server.
A central proxy that applies policy, auth, and audit across many servers.
Common mistakes
- Installing untrusted MCP servers.
Fix: Treat servers like dependencies with code access; review, pin versions, and run with least privilege.
- Vague tool descriptions.
Fix: Write clear names, descriptions, and schemas, since the model chooses tools from them.
- Auto-approving destructive tools.
Fix: Require user confirmation for writes, deletes, and payments.
Interview questions
What problem does MCP solve?
It standardizes how AI apps connect to tools and data. Each system is wrapped once as a server and any compatible client can discover and call it, instead of building custom integrations for every app and system pair.
What are tools, resources, and prompts in MCP?
Tools are actions the model can invoke with arguments. Resources are readable data the host can pull into context. Prompts are reusable templates the user or app can select.
Practice problems
| Problem | Difficulty | What it trains |
|---|---|---|
| Build an MCP server that exposes one read tool and one resource | Easy | Server basics. |
| Design a company-wide MCP gateway with auth and audit logging | Hard | Security and governance. |