PrepStack › AI › Model Context Protocol
Model Context Protocol interview cheat sheet
Hosts, clients & servers, JSON-RPC, tools/resources/prompts, transports, OAuth & security
MCP questions now show up in AI-engineering, platform and backend interviews. Interviewers check that you can explain why MCP exists (the N×M integration problem), the host / client / server split, the JSON-RPC message shapes, the three server primitives, the transports, and above all the security model (consent, OAuth for remote servers, tool poisoning, token passthrough). The spec moves fast: the current revision is 2026-07-28, which made the protocol stateless, while most deployed servers still speak the handshake-based 2025-11-25 revision, so know both. Read the 15-minute revision, then use Quiz mode.
15-minute revision
- MCP is an open protocol (introduced by Anthropic in Nov 2024, now under the Linux Foundation's Agentic AI Foundation) that standardises how AI apps connect to tools and data. It turns an N×M integration problem into N+M.
- Three roles: the host (the AI app the user talks to), one client per server inside the host (a 1:1 connection), and the server that exposes capabilities. Servers never talk to the model directly.
- Messages are JSON-RPC 2.0: requests (with an
id, nevernullin MCP), responses (resultorerror) and notifications (noid, no reply). - Server primitives and who controls them: tools (model-controlled actions), resources (application-controlled read-only data by URI), prompts (user-controlled templates, e.g. slash commands).
- Client features: elicitation (ask the user via a form or a URL). Sampling (server asks the host's LLM) and roots (workspace folders) are deprecated in 2026-07-28 but still work.
- Legacy lifecycle (2025-11-25 and earlier):
initialize→ result with negotiated version + capabilities →notifications/initialized→ normal traffic → shutdown by closing the transport. - Modern lifecycle (2026-07-28): no handshake. Every request carries
protocolVersionandclientCapabilitiesinparams._meta; servers must implementserver/discover; a wrong version gets error-32022. - Transports: stdio (host spawns a local process; newline-delimited JSON on stdin/stdout; logs go to stderr) and Streamable HTTP (one
/mcpendpoint, POST per message, JSON or SSE reply). The old HTTP+SSE transport is deprecated. - A tool has a
name,description,inputSchema(JSON Schema, default dialect 2020-12), optionaloutputSchema(then the result carriesstructuredContent) and annotations likereadOnlyHint/destructiveHint, which are hints only and untrusted. - Two error channels for tools: protocol errors (JSON-RPC
error, e.g. unknown tool-32602) and tool execution errors (isError: truein the result) that the model can read and self-correct from. - Notifications:
list_changedfor tools/resources/prompts,notifications/progress(needs aprogressToken),notifications/cancelled, andnotifications/messagefor logging. In 2026-07-28 change notifications flow on asubscriptions/listenstream. - List methods paginate with an opaque cursor: the result has
nextCursor, the client sends it back ascursor. The server picks the page size. - Remote (HTTP) servers use OAuth 2.1: the server is a resource server, publishes Protected Resource Metadata (RFC 9728), clients use PKCE (S256) and the
resourceindicator (RFC 8707). stdio servers take credentials from the environment instead. - Big security risks: tool poisoning / prompt injection through descriptions and results, rug-pull definition changes, the confused deputy in OAuth proxies, token passthrough (forbidden), SSRF, and over-broad scopes. Answer: human consent, least privilege, pinning, sandboxing.
- Test servers with the MCP Inspector (
npx @modelcontextprotocol/inspector <command>). Find and publish servers with the MCP Registry (mcp-publisher, names likeio.github.user/server). - MCP vs function calling vs A2A: function calling is how a model asks for a call inside one provider's API; MCP is how an app discovers and invokes tools/data from any server; A2A is how agents delegate tasks to other agents.
Foundations
What MCP is & the N×M problem
MCP is a standard plug between AI applications and external tools/data, like USB-C or LSP for AI.
- Before MCP, every AI app wrote custom glue for every tool: N apps × M integrations. With a shared protocol each app implements one client and each tool ships one server: N + M.
- It was released by Anthropic in November 2024 as an open spec with SDKs. It is now adopted by Claude, ChatGPT, VS Code/GitHub Copilot, Cursor, Gemini tooling and many others, and is governed under the Linux Foundation's Agentic AI Foundation.
- MCP borrows its design from the Language Server Protocol: JSON-RPC messages, capability negotiation, and one server reusable across many editors (here, many AI hosts).
- MCP standardises context and actions, not the model. The host still owns the LLM, the prompt and the user experience; servers just describe what they can do.
- Versions are dates (
YYYY-MM-DD) marking the last backwards-incompatible change: 2024-11-05, 2025-03-26, 2025-06-18, 2025-11-25 and the current 2026-07-28.
Interview questions
- What is the Model Context Protocol and what problem does it solve?
- Why is MCP often compared to USB-C or LSP?
- Does the LLM talk to the MCP server directly?
- How is MCP versioned?
Architecture: host, client, server
One host runs many clients; each client holds exactly one connection to one server.
- Host: the LLM application (Claude Desktop, VS Code with Copilot, Copilot CLI, Cursor, your agent). It manages clients, enforces consent and security, and aggregates context for the model.
- Client: a connector inside the host with a 1:1 relationship to one server. It handles the protocol, capability checks and message routing for that server.
- Server: a program exposing tools, resources and prompts. It can be local (spawned over stdio) or remote (Streamable HTTP). It should be focused and composable.
- Isolation is a design goal: a server cannot see other servers or the whole conversation. The host decides what crosses the boundary.
- Two layers: the data layer (JSON-RPC messages and primitives) and the transport layer (stdio or HTTP framing, auth headers).
Interview questions
- Explain the host, client and server roles in MCP.
- Why does MCP use one client per server instead of one shared client?
- What is the difference between a local and a remote MCP server?
Spec revisions & the 2026-07-28 changes
2026-07-28 removed sessions and the initialize handshake; each request now carries its own version and capabilities.
- 2025-03-26 added Streamable HTTP, OAuth 2.1 authorization and tool annotations. 2025-06-18 added structured tool output, elicitation, resource links, the
MCP-Protocol-Versionheader, and removed JSON-RPC batching. - 2025-11-25 added URL-mode elicitation, icons, Client ID Metadata Documents and experimental tasks. It is the last handshake-based (legacy) revision.
- 2026-07-28 made MCP stateless: no
initialize, noMcp-Session-Id, noping, nologging/setLevel. Every request carriesio.modelcontextprotocol/protocolVersionand.../clientCapabilitiesin_meta. - Servers must implement
server/discover(versions, capabilities, identity). Server-to-client requests are replaced by Multi Round-Trip Requests (resultType: 'input_required'). Change notifications move tosubscriptions/listen. - Every result now has
resultType('complete'or'input_required'); clients treat a missing field as'complete'. Roots, sampling, logging and Dynamic Client Registration are deprecated; tasks moved to an official extension.
Interview questions
- What changed in MCP 2026-07-28 and why?
- How does a new client talk to an old server, and vice versa?
- If sessions are gone, how does a server keep state such as a shopping cart?
Protocol core
JSON-RPC 2.0 base messages
Requests have an id and expect a reply; notifications have no id and get none.
- Request:
jsonrpc: '2.0',id(string or integer, never null in MCP, unique among in-flight requests),method, optionalparams. - Response: the same
idplus eitherresult(an object; in 2026-07-28 it must includeresultType) orerrorwith integercode,messageand optionaldata. - Notification:
methodandparams, noid. The receiver must not reply. Examples:notifications/progress,notifications/cancelled. - Standard codes:
-32700parse error,-32600invalid request,-32601method not found,-32602invalid params,-32603internal error. - MCP codes (2026-07-28):
-32020HeaderMismatch,-32021MissingRequiredClientCapability,-32022UnsupportedProtocolVersion. Older servers used-32002for 'resource not found'; it is now-32602. params._metais reserved for protocol metadata such asprogressToken, protocol version and OpenTelemetrytraceparent. Keys underio.modelcontextprotocol/are reserved.
Interview questions
- What is the difference between a request and a notification in MCP?
- How does MCP differ from plain JSON-RPC 2.0?
- A tools/call names a tool that doesn't exist. What should the server return?
Lifecycle & capability negotiation
Legacy: initialize → initialized → operate → close. Modern: every request declares its version and capabilities.
- Legacy initialize (≤ 2025-11-25): the client sends
protocolVersion,capabilitiesandclientInfo. The server answers with the version it will use, itscapabilities,serverInfoand optionalinstructions. - Version rule: if the server supports the requested version it returns the same one; otherwise it returns another version it supports (usually its latest) and the client disconnects if it can't speak it.
- The client then sends
notifications/initialized. Before that, only pings (and logging) are allowed. Shutdown has no message: on stdio the client closes stdin, waits, then sends SIGTERM / SIGKILL; on HTTP it closes connections (and could DELETE the session). - Capabilities gate features: server
tools,resources(subscribe,listChanged),prompts,completions,logging; clientelicitation,sampling,roots. Neither side may use a feature the other did not declare. - Modern (2026-07-28): no handshake. Each request carries version and capabilities in
_meta. The server answers or returns-32022with itssupportedlist; if a request needs a client capability that wasn't declared, it returns-32021.
Interview questions
- Walk me through the MCP initialization handshake.
- What happens if the client and server support different protocol versions?
- Why negotiate capabilities at all?
- How does an MCP connection shut down?
Transports: stdio, Streamable HTTP, HTTP+SSE
stdio for local child processes, Streamable HTTP for remote servers; HTTP+SSE is deprecated.
- stdio: the client spawns the server; messages are newline-delimited JSON on stdin/stdout with no embedded newlines. The server may log to stderr but must write nothing else to stdout.
- Streamable HTTP (since 2025-03-26): one endpoint such as
https://example.com/mcp. Each client message is a POST withAccept: application/json, text/event-stream. The server replies with one JSON body or an SSE stream scoped to that request (progress first, final response last). - 2026-07-28 HTTP rules: POSTs carry
MCP-Protocol-Version,Mcp-MethodandMcp-Nameheaders (so gateways can route without parsing JSON); the GET stream, sessions andLast-Event-IDresumability are gone; unknown methods return 404 with-32601. - Notifications sent by POST get 202 Accepted. Cancellation on HTTP is simply closing the response stream; on stdio the client sends
notifications/cancelled. - Security: validate the Origin header (403 if bad) to stop DNS rebinding, bind local servers to 127.0.0.1, and authenticate every request.
- HTTP+SSE (2024-11-05) used a GET SSE stream plus a separate POST endpoint. It is deprecated; clients may fall back to it only for very old servers.
Interview questions
- Compare the stdio and Streamable HTTP transports.
- Why was HTTP+SSE replaced by Streamable HTTP?
- How is a request cancelled on each transport?
- What is a DNS rebinding attack on a local MCP server and how do you stop it?
Notifications, progress, cancellation, logging & pagination
Cross-cutting utilities: change events, progress tokens, cancellation, logs and opaque-cursor paging.
- list_changed:
notifications/tools/list_changed,.../prompts/list_changed,.../resources/list_changedtell the client to re-list. Servers declarelistChanged: true.notifications/resources/updatedsignals a subscribed resource changed. - In 2026-07-28 clients opt in with
subscriptions/listenand a filter (toolsListChanged,promptsListChanged,resourcesListChanged,resourceSubscriptions: [uris]). The server first sendsnotifications/subscriptions/acknowledged. - Progress: the requester puts a unique
progressTokenin_meta; the server sendsnotifications/progresswithprogress(must increase), optionaltotalandmessage. - Cancellation:
notifications/cancelledwithrequestIdandreason. It is racy: the response may already be on the wire, so receivers ignore late replies. Use timeouts on every request. - Logging (
notifications/message, syslog levels debug…emergency) is deprecated in 2026-07-28: the level is set per request via_meta, and the advice is to log to stderr or OpenTelemetry instead. - Pagination:
tools/list,resources/list,resources/templates/list,prompts/listreturnnextCursor; the client sends it back ascursor. Cursors are opaque and the page size is the server's choice.
Interview questions
- How does a client find out that a server's tool list changed?
- How do progress notifications work?
- Why does MCP use cursors instead of page numbers?
- Is cancellation guaranteed to stop the work?
Server primitives
Tools: list, call, results, errors
Tools are model-controlled functions: discovered with tools/list and invoked with tools/call.
- Model-controlled: the LLM decides when to call a tool, but the spec says there should always be a human in the loop who can deny calls.
tools/listreturns definitions (paginated).tools/callsendsname+argumentsand gets back a result with acontentarray.- Content block types:
text,imageandaudio(base64data+mimeType),resource_link(a URI the client can read later) and embeddedresource(contents inline). - Errors: unknown tool or malformed request → JSON-RPC error. API failure, bad input values or business-rule failures → result with
isError: trueso the model can read it and retry. - Names should be 1–128 chars from
A-Z a-z 0-9 _ - ., case-sensitive and unique per server. Hosts aggregating several servers should prefix names to avoid clashes. - Servers must validate inputs, enforce access control, rate-limit and sanitise outputs. Clients should confirm sensitive calls, show inputs to the user, and set timeouts.
Interview questions
- What is an MCP tool and who decides to call it?
- What is the difference between a protocol error and a tool execution error?
- Two servers both expose a tool called
search. What happens? - What content types can a tool return?
Tool definitions: inputSchema, outputSchema, annotations
JSON Schema describes inputs and (optionally) outputs; annotations describe behaviour but are only hints.
inputSchemamust be a JSON Schema object (not null). Default dialect is 2020-12 unless$schemasays otherwise. For no parameters use{ type: 'object', additionalProperties: false }.outputSchema(since 2025-06-18) declares the shape ofstructuredContent. If present, the server must return conforming data and clients should validate it. In 2026-07-28 it may be any JSON value, e.g. an array.- For backwards compatibility a tool with structured output should also put the serialised JSON in a
textblock, for clients that ignorestructuredContent. - Annotations:
readOnlyHint(default false),destructiveHint(default true),idempotentHint(default false),openWorldHint(default true), plustitle. The last three matter only whenreadOnlyHintis false. - Clients must treat annotations as untrusted unless the server is trusted. They help UX (auto-approve read-only tools, warn on destructive ones) but are not a security control.
- Implementations must not auto-fetch network
$refs in schemas and should bound composition keywords (anyOf,oneOf) to avoid validator DoS.
Interview questions
- What is
outputSchemaand why was it added? - Can a client rely on
readOnlyHint: trueto skip user confirmation? - How do you design a good tool schema?
Resources, templates & prompts
Resources are app-controlled data by URI; prompts are user-invoked message templates.
- Resources expose read-only context identified by a URI (
file://,https://,git://or custom likenotes://). Methods:resources/list,resources/read(returnscontentswithtextor base64blob),resources/templates/list. - Resource templates use RFC 6570 URI templates such as
users://{userId}/profilefor parameterised data; argument completion (completion/complete) can suggest values. - Resources are application-controlled: the host or user decides what to attach (file pickers, @-mentions, auto-inclusion). Annotations
audience,priority(0–1) andlastModifiedhelp it choose. - Subscriptions: a client can watch specific URIs and get
notifications/resources/updated(legacyresources/subscribe; 2026-07-28subscriptions/listenwithresourceSubscriptions). - Prompts are user-controlled templates:
prompts/listshows names and arguments,prompts/getreturns filled-inmessages(role + content). Hosts surface them as slash commands or menu items. - Unknown resource:
-32602in 2026-07-28 (older servers used-32002; clients should accept both).
Interview questions
- What is the difference between a resource and a tool?
- What are resource templates?
- When would you expose a prompt instead of a tool?
Client features & advanced patterns
Client features: elicitation, sampling, roots
Servers can ask the user for input (elicitation); sampling and roots still exist but are deprecated.
- Elicitation lets a server ask the user for information mid-operation. Form mode sends a message plus a flat JSON Schema (strings, numbers, booleans, enums). The user's answer has
action:accept(withcontent),declineorcancel. - URL mode (2025-11-25) sends the user to a URL for sensitive steps: third-party OAuth, payments, API keys. The data never passes through the MCP client. Servers must not use form mode for passwords, tokens or card numbers.
- Clients must show which server is asking, let users review/edit and decline, and show the target domain before opening a URL.
- Sampling (
sampling/createMessage) lets a server ask the host's LLM for a completion, withmodelPreferenceshints; the user should approve both prompt and output. Deprecated in 2026-07-28: call an LLM provider directly instead. - Roots tell a server which folders/URIs it may work in (
roots/list). Deprecated in 2026-07-28: pass paths as tool arguments or server config instead. - In 2026-07-28 all of these travel through MRTR: the server returns
input_requiredwithinputRequests, it no longer sends its own JSON-RPC request.
Interview questions
- What is elicitation and when would a server use it?
- Why can't a server use form elicitation to ask for an API key?
- What was sampling for, and why is it deprecated?
Multi Round-Trip Requests & stateless design
Instead of calling the client back, the server returns input_required and the client retries with the answers.
- Old pattern: during a
tools/call, the server sent its ownelicitation/createrequest to the client and waited. That needs a live, sticky connection back to the same server instance. - MRTR (2026-07-28): the server returns a result with
resultType: 'input_required', aninputRequestsmap (key → elicitation / sampling / roots request) and an optional opaquerequestState. - The client fulfils each request (asking the user, etc.) and retries the original call with a new JSON-RPC id, adding
inputResponses(same keys) andrequestStateunchanged. - The client must never inspect or modify
requestState. The server should treat it as untrusted (sign or encrypt it) because it comes back from the client. - Because all state rides on the retry, any server replica can finish the request: no shared session store, no sticky load balancing.
requestStatealone (noinputRequests) is also allowed, e.g. for load shedding: 'come back later with this state'.
Interview questions
- What problem does MRTR solve?
- Why must the retry use a new JSON-RPC id?
requestStatecomes back from the client. What are the security concerns?
Building & using servers
Building a server in TypeScript
SDK v2: McpServer + registerTool/registerResource/registerPrompt with Zod schemas, served by serveStdio or createMcpHandler.
- TypeScript SDK v2 (stable since July 2026, implements 2026-07-28) ships split packages:
@modelcontextprotocol/serverand@modelcontextprotocol/client, plus thin adapters like@modelcontextprotocol/nodeand@modelcontextprotocol/express. It is ESM-only. - v1 lives on as
@modelcontextprotocol/sdk(bug and security fixes). v2 renamedtool()/resource()/prompt()toregisterTool/registerResource/registerPrompt; a codemod helps migrate. inputSchemais a Zod object (any Standard Schema library works). The SDK derives the JSON Schema, validates arguments before your handler runs, and returns validation failures asisError: trueresults.- With
outputSchemathe SDK type-checks and runtime-validatesstructuredContent. - stdio:
serveStdio(createServer). HTTP:createMcpHandler(factory)builds a fresh server per request (stateless), exposes a web-standardfetch, and is mounted withtoNodeHandlerbehind Host/Origin validation. - Never write to stdout in a stdio server; use
console.error.
Interview questions
- How do you build a minimal MCP server in TypeScript?
- Why does the v2 HTTP handler build a new McpServer per request?
- What are common mistakes when writing an MCP server?
Building a server in Python (FastMCP / MCPServer)
Decorate plain typed functions; type hints become JSON Schema and docstrings become descriptions.
- The official Python SDK is the
mcppackage. In v1 the high-level class wasFastMCP(from mcp.server.fastmcp import FastMCP). In v2 it was renamedMCPServer(from mcp.server import MCPServer); the decorators are unchanged. @mcp.tool(),@mcp.resource('uri://{param}')and@mcp.prompt()register primitives. Parameter type hints become the input schema, the docstring becomes the description.- Return types drive structured output: returning an
int, adict, aTypedDictor a Pydantic model produces bothcontentandstructured_contentplus an output schema. - Add a
ctx: Contextparameter to get request helpers such asawait ctx.report_progress(done, total=n, message=...). mcp.run()serves stdio by default;mcp.run(transport='streamable-http', port=3001)serves HTTP at/mcp. Transport options go torun(), not the constructor (v2).- CLI:
uv run mcp dev server.pyopens the Inspector;uv run mcp install server.pywrites a Claude Desktop entry. v2 needs Python 3.11+. A separate community package,fastmcp, continues the original FastMCP project.
Interview questions
- How does FastMCP / MCPServer generate a tool's schema?
- What is the difference between FastMCP and MCPServer?
- How would you report progress from a long Python tool?
Configuring servers in clients & the MCP Inspector
Hosts just need the command to launch a local server or the URL of a remote one.
- Claude Desktop:
claude_desktop_config.json(macOS~/Library/Application Support/Claude/, Windows%APPDATA%\Claude\) with a top-levelmcpServersmap ofcommand,args,env. Restart the app fully after editing. - VS Code:
.vscode/mcp.json(workspace) with top-levelservers; each entry hastype(stdioorhttp). Aninputsarray can prompt for secrets referenced as${input:id}. Tools run in Copilot Chat agent mode. - GitHub Copilot CLI:
~/.copilot/mcp-config.json(user) plus workspace.mcp.jsonor.github/mcp.json, all withmcpServers; entries usetype: 'local'(command/args/env) ortype: 'http'(url/headers). Manage with/mcporcopilot mcp add. - Cursor uses
.cursor/mcp.jsonwithmcpServers; Claude Code usesclaude mcp add <name> -- <command>. - MCP Inspector:
npx @modelcontextprotocol/inspector <command...>launches a stdio server and opens a web UI to list and call tools, read resources, get prompts and watch the raw JSON-RPC. It also has--cli(scriptable, CI) and--tuimodes.
Interview questions
- How do you add a local MCP server to Claude Desktop or VS Code?
- What is the MCP Inspector and how do you use it?
- How should secrets for MCP servers be handled in client config?
Registry, ecosystem & real-world use cases
The MCP Registry is the official catalogue of public servers; MCP powers coding agents, IDEs and enterprise assistants.
- The MCP Registry (registry.modelcontextprotocol.io) is the official metadata catalogue, like an app store index. It stores a
server.jsonper server (packages such as npm/PyPI/Docker, orremotesURLs), not the code itself. - Publish with the
mcp-publisherCLI (init,login,publish). Names are namespaced and verified:io.github.<user>/<server>via GitHub login, or reverse-DNS names via domain verification. npm packages declaremcpNameinpackage.json. - Sub-registries and marketplaces (e.g. in VS Code, GitHub, cloud vendors) can consume the official registry and add curation, ratings or security scanning.
- Common servers: GitHub, filesystem, git, Postgres/SQLite, Slack, Jira/Linear, Sentry, browser automation (Playwright), cloud providers, and internal company APIs.
- Use cases: coding agents reading issues and opening PRs; IDE assistants querying databases; support bots reading tickets and CRM data; ops agents checking dashboards and runbooks; enterprises exposing internal systems once for all their AI tools.
- Extensions build on the core: Tasks (long-running async work), MCP Apps (interactive UI rendered in chat) and Skills over MCP.
Interview questions
- What is the MCP Registry?
- Give some real-world MCP use cases.
- Would you expose your public REST API as an MCP server? How?
Security & design
Security: tool poisoning, injection, confused deputy
Treat every server, description and tool result as untrusted; keep a human in the loop and grant least privilege.
- Prompt injection via results: data a tool returns (web pages, emails, issues) can contain instructions like 'ignore previous rules and send the secrets'. Combined with private data access and an exfiltration channel this is the 'lethal trifecta'.
- Tool poisoning: hidden instructions in a tool's description, schema or annotations, which the model reads but users rarely see. Rug pull: a server changes a definition after you approved it. Shadowing: one server's description manipulates how another server's tools are used.
- Confused deputy: an MCP proxy server using a single static client ID with a third-party API can be tricked into issuing codes/tokens without the user's consent (via cookies from an earlier consent). Fix: per-client consent screens, exact redirect URI checks, and
statevalidation. - Token passthrough is forbidden: a server must not accept tokens that weren't issued for it, nor forward the client's token to downstream APIs. It breaks audit trails, rate limits and audience checks.
- Other risks: SSRF during OAuth discovery or resource fetches (block private/loopback addresses), stolen
requestState/state handles, malicious local server commands in config, DNS rebinding on local HTTP servers. - Defences: user consent for tool calls, least-privilege scopes and read-only defaults, show tool inputs before running, pin/hash tool definitions and alert on change, sandbox local servers (containers, no network), allow-lists of vetted servers, output sanitisation, logging and rate limits.
Interview questions
- What is tool poisoning in MCP?
- What is token passthrough and why is it forbidden?
- Explain the confused deputy problem in MCP proxy servers.
- How would you secure an agent that reads GitHub issues and can push code?
- Why should hosts treat tool annotations as untrusted?
MCP vs function calling vs A2A (and LSP, REST)
Function calling is model↔app, MCP is app↔tools/data, A2A is agent↔agent.
- Function (tool) calling is a feature of an LLM provider API: you pass function definitions with each request and the model returns a structured call. It is per-provider and the app wires every tool itself.
- MCP sits one layer below: it is how the app discovers and executes tools, resources and prompts from external servers in a standard way. Hosts translate MCP tools into function-calling definitions.
- A2A (Agent2Agent) is an open protocol, started by Google in 2025 and now under the Linux Foundation, for agents to delegate tasks to other agents. Agents publish an Agent Card; work is a stateful task with messages and artifacts, over JSON-RPC/HTTP with streaming.
- MCP treats the other side as a tool (no autonomy); A2A treats it as a peer agent that may plan, ask questions and run for a long time. They are complementary: an A2A agent often uses MCP servers internally.
- LSP inspired MCP's design but standardises editor ↔ language-server features. REST/OpenAPI describes APIs for programs; MCP adds runtime discovery, LLM-oriented descriptions, consent rules and streaming notifications.
Interview questions
- What is the difference between MCP and function calling?
- How does MCP compare to Google's A2A protocol?
- Why not just give the model an OpenAPI spec instead of MCP?
Design scenarios & production concerns
Production MCP is about tool design, statelessness, auth, observability and blast-radius control.
- Tool design: task-level tools, few and focused; precise descriptions; small, paginated outputs;
outputSchemafor data meant for code; actionableisErrortext; deterministic ordering. - Scaling: with 2026-07-28 servers are stateless; run replicas behind a plain load balancer, keep cross-call state in explicit handles stored in Redis/DB, and use cache hints (
ttlMs,cacheScope). - Gateways: an MCP gateway or proxy can centralise OAuth, allow-lists, tool filtering, audit logs and rate limits, and can route on
Mcp-Method/Mcp-Nameheaders. - Observability: propagate OpenTelemetry
traceparentin_meta, log every tool call with caller and arguments (redacted), and track latency and error rates (the Inspector has a load-testing mode). - Context budget: every tool definition costs tokens; hosts may filter tools per task and servers should avoid 50+ tools or giant schemas.
- Long-running work: return quickly with progress notifications, or use the Tasks extension with polling, instead of holding connections open for minutes.
Interview questions
- Design an MCP server that lets an assistant query a company's Postgres database.
- How do you scale a remote MCP server to thousands of users?
- A host connects to 30 MCP servers and the model starts choosing the wrong tools. What do you do?
- How would you test an MCP server?