What MCP is and how it's built
TipThe official analogy is a USB-C port for AI apps. One connector fits many devices.
2026-07-28 the core is stateless. Each request carries its own version and capabilities, so any replica can answer.TipThe official analogy is a USB-C port for AI apps. One connector fits many devices.
TrapMCP doesn't replace function calling. The host still turns MCP tools into the model's own tool format.
TipPut anything with side effects in a tool, so the host can ask the user first.
TrapSampling, roots and elicitation are client features. Servers don't offer them.
Asked in interviews
AskedWhat are the three server primitives in MCP, and who controls each one?tools/listEach has a name, a description and an inputSchema.tools/callSend its name and arguments. Content blocks come back.nextCursor back as cursor. None means the last page.TrapA cursor is opaque. Never parse or build one, and you can't choose the page size.
resources/readA URI like file:///app/schema.sql . The host decides what to attach.resources/templates/list completion/complete RFC 6570 templates, like repo://{owner}. Completion suggests values.subscriptions/listen Updates carry only the URI. Before 2026-07-28, use resources/subscribe .TipThink of a resource as GET and a tool as POST.
TrapSome hosts ignore resources. If the model must fetch the data itself, ship a tool too.
prompts/listprompts/getIt returns messages, each with a role and content.TipA prompt can embed resources, so one pick pulls in files and instructions.
Asked in interviews
AskedWhat are MCP prompts, and how do they show up in a host application?id. The reply repeats it with result or error.id, and the receiver must not reply.2025-06-18 revision removed batching.TrapAn id is a string or an integer, never null. Don't reuse one that's still waiting for a reply.
_meta carries your version and capabilities.server/discoverUnsupportedProtocolVersionError The error lists the versions the server supports. Retry with one.initializenotifications/initialized Send initialize, get the reply, then send initialized.TipA version is a date like 2026-07-28. It changes only for breaking changes.
notifications/tools/list_changed The client calls tools/list again.notifications/progress Keyed to the client's progressToken. The value must only go up.notifications/cancelled On stdio, send it with the requestId. Over HTTP since 2026-07-28, close the stream instead.tasks/getUse the Tasks extension. You get a task id back and poll it.TipSince 2026-07-28, change notices reach only clients with an open subscriptions/ stream.
TrapNothing acknowledges a notification. A missed one is lost, and a cancelled request may still reply.
TipA local server runs as your OS user. A remote one checks OAuth 2.1 tokens.
TrapHTTP+SSE is deprecated. To reach an old server, POST first. Fall back to GET on a 400, 404 or 405 with no modern error.
print("msg", file=sys.stderr, flush=True)console.error("msg") TipEach message is one line of JSON-RPC. Flush every write, or the client seems to hang.
TrapOne stray print() on stdout corrupts the stream, and the client drops the connection.
Asked in interviews
AskedDescribe the stdio transport precisely. What rules trip people up?POST /mcpMCP-Protocol-Version: 2026-07-28One endpoint. The server answers with JSON or an SSE stream.Mcp-Method: tools/callMcp-Name: get_weatherMcp-Session-IdRemoved in 2026-07-28. Pass state as handles in tool arguments.2026-07-28 has no sessions.TrapA proxy that strips Mcp-Method or Mcp-Name gets every request rejected with HTTP 400.
pip install "mcp[cli]"TrapSDK v2 renamed FastMCP to MCPServer. Old mcp. imports fail, so pin mcp<2 until you migrate.
Asked in interviews
AskedHow would you build a minimal MCP server in Python? What is FastMCP?npm install @modelcontextprotocol/server zodserver.registerTool(name, config, handler)await server.connect(new StdioServerTransport()) TipThe official codemod rewrites v1's @modelcontextprotocol/ imports.
Trapv2 needs Zod 4. A Zod 3 range installs cleanly, then fails at runtime.
npx @modelcontextprotocol/inspector node build/index.jsNo model in the loop. Add --cli for scripted checks.InMemoryTransport.createLinkedPair() A real client and server, with no process or socket.TipIf a tool fails in the Inspector, the bug is in your server, not in the host or the model.
Trapcreate connects only 2025-era instances. To test 2026-07-28 in one process, use create.
mcpServers in Settings, Developer, Edit Config. Then quit the app fully.claude mcp add <name> -- <command>The default scope. It wins over project and user.claude mcp add -s project <name> -- <command>It goes in .mcp.json. Use ${VAR} for keys.claude mcp add -s user -t http <name> <url>TipIf a server doesn't show up, read the mcp*.log files in ~/ on a Mac.
TrapClaude Desktop doesn't inherit your shell PATH. Give command an absolute path.
mcp-publisher publishIt sends a server.json of metadata. The registry stores no code.TipHosts don't read the registry directly. Curated subregistries sync from it, and hosts read those.
Asked in interviews
AskedDescribe the MCP ecosystem and how the official registry works.search_issues. Say when to use it, and when not.enum and ranges instead of prose.readOnlyHintdestructiveHintidempotentHintPlus openWorldHint. Destructive and open-world default to true.TrapNothing verifies a hint. A hostile server can mark a destructive tool read-only to slip past auto-approval.
outputSchemastructuredContent Declare the schema, and every result must carry matching content.content text block.2026-07-28. Keep the object wrapper for older clients."isError": trueReturn it in a normal result, so the model can read it and retry.isError, since 2025-11-25, so the model can fix them.-32602-32601JSON-RPC errors. The host handles them, and the model rarely sees them.TrapError text reaches the model. Leave out stack traces, secrets and internal paths.
InputRequiredResult The client answers by re-sending the call with inputResponses.requestStateAn opaque string the client echoes back unchanged.TipMRTR replaced every server-to-client request, including elicitation, sampling and roots/list.
TrapThe client can change requestState. When it affects access, protect it, for example with an HMAC.
elicitation/create A message and a flat schema of simple fields. Added in 2025-06-18.accept, decline or cancel. A decline isn't a cancel.2025-11-25. Form mode must never ask for secrets.TrapThe call fails unless the client declared the elicitation capability.
sampling/createMessage Deprecated in 2026-07-28. New servers call a model API directly.includeContext as none and clamp maxTokens.roots/listDeprecated. New servers take paths as tool parameters or config.TipRoots don't enforce anything. The server must check paths, and real isolation needs a sandbox.
/.well-known/oauth-protected-resource The 401 response points here. It lists authorization_servers .resource to bind the token to this server.Authorization: Bearer <token>On every request, over HTTPS. Never in a query string.TipThe MCP server is only a resource server. It checks tokens and never issues them.
TrapDon't rely on dynamic client registration. 2026-07-28 deprecated it, and many enterprise identity providers disable it.
resource. The server rejects tokens whose aud isn't itself.redirect_uri exactly.TrapNever forward the client's token downstream. It skips the audience check, so one leak opens every service.
TipShow users each tool's full description, and treat it as untrusted data.
TrapTelling the model to ignore instructions in tool results is not a control. Enforce limits in code.
Origin and answer 403 if it's bad. Bind local servers to 127.0.0.1.TrapA valid token says who called, not what they may touch. Check permissions inside each tool.
tools/list by each request's auth, and key caches by tenant.github__create_issue Prefix each tool with its server's name.TipTrack how often the model picks the right tool. Latency alone won't show bad picks.
TrapOne query that misses its tenant filter leaks data across customers.
Asked in interviews
AskedDesign a multi-tenant remote MCP server for a SaaS product. What are the hard problems?AskedYour platform team wants agents to use 50 MCP servers with hundreds of tools efficiently. How do you architect this?AskedWhat happens when an MCP server is also an MCP client? Discuss composition patterns and their risks.id, method, HTTP status and instance on both sides.error is protocol, and isError is the tool.notifications/message Deprecated in 2026-07-28. Use stderr and OpenTelemetry instead.TipCommon causes are proxy idle timeouts, expired tokens and, on 2025-era servers, lost sticky routing.
2025-03-26 addedStreamable HTTP, OAuth 2.1, tool annotations and batching.2025-06-18 changedIt added elicitation and structured output, and removed batching.2026-07-28 changedA stateless core with no handshake or sessions, plus MRTR and extensions.io.modelcontextprotocol/tasks ._meta go stateless. An initialize gets the old path.Mcp-Session-Id. Read identity from the token, and state from a shared store.subscriptions/listen , and server requests to MRTR.TrapHandlers that aren't idempotent break. Any retry can land on a different replica.
Nothing matches. Try a shorter word, or clear the search.
With Pro, you can:
Already have Pro? Sign in