Model Context Protocol (MCP) interview questions and answers
10 questions from the Model Context Protocol (MCP) Interview Mock practice bank, spread across its domains. Pick your answer, then open the explanation to see why each option is right or wrong.
- Question 1Server and Client Features
A refund tool asks the user to confirm through elicitation. Its
InputRequiredResultcarries arequestStatethat is plain base64 of{"orderId": "A17", "refundCents": 5000}. On the retry the server decodes the state and refundsrefundCents. What is the problem?- A
Base64 is not allowed, because
requestStatemust be a JSON object rather than a string - B
It drives business logic without integrity protection, so a client can edit the amount
- C
Nothing is wrong: clients MUST NOT modify
requestState, so the server can trust it exactly as it was sent - D
The server should keep the amount in memory keyed by the first request's JSON-RPC id instead
Show the answer and explanation
Answer: B
Servers MUST treat
requestStateas attacker-controlled. When it influences authorization, resource access or business logic, servers MUST protect its integrity (for example HMAC or AEAD) and MUST reject state that fails verification. Integrity protection may be skipped only when tampering can cause nothing worse than a failed request.Why the other options are wrong
A. It is the reverse:
requestStateis an opaque string, and servers may encode it however they like.C. The client rule does not bind a malicious or compromised client; the server MUST treat the state as attacker-controlled.
D. The retry has a new JSON-RPC id, and in-memory state breaks when another instance serves the retry.
- A
- Question 2Building and Integrating Servers
Which statements about
MCPServerstructured output are true? (Choose two.)Choose 2.
- A
A tool annotated
-> dict[str, float]publishes an object schema and is not wrapped in{"result": ...} - B
A tool annotated
-> list[Book]returning two books puts two text blocks incontent - C
A tool annotated
-> dict[int, float]is rejected at import because JSON keys must be strings - D
structured_output=Falsekeeps the output schema but skips validation - E
Returning a plain
dictfrom a tool annotated-> Bookalways fails, because the Python type differs
Show the answer and explanation
Answer: A and B
Scalars, lists, tuples and unions are wrapped as
{"result": ...}; models,TypedDicts, dataclasses, annotated classes anddict[str, ...]are not.dict[int, ...]cannot be a JSON object, so it is wrapped. Whatever you return is validated against the published schema, and a mismatch becomes a tool error.Why the other options are wrong
C. It is accepted; it just falls back to the
{"result": ...}wrapper.D. Opting out removes the output schema, wrapping and validation;
structured_contentisNone.E. Validation is on the value: a dict with the right fields passes.
- A
- Question 3Protocol Foundations
MCP is described as two layers: a data layer and a transport layer. Which of these belong to the data layer? (Choose two.)
Choose 2.
- A
The
tools/listandtools/callmethods and their result shapes - B
Version and capability discovery through
server/discover - C
Choosing between a single JSON body and an SSE stream for a reply
- D
Newline-delimited framing of messages over stdin and stdout
- E
Sending a bearer token in the HTTP
Authorizationheader
Show the answer and explanation
Answer: A and B
The data layer defines the JSON-RPC protocol: discovery, server features (tools, resources, prompts), client features and utilities such as notifications and progress. The transport layer defines channels: connection setup, framing (stdio lines or HTTP POST/SSE) and authorization. The same data-layer messages work unchanged on every transport.
Why the other options are wrong
C. That is a Streamable HTTP transport decision.
D. Message framing is a transport concern (the stdio binding).
E. Authorization for HTTP is handled by the transport layer.
- A
- Question 4Authorization, Security and Operations
Which statements about the RFC 8707
resourceparameter are requirements on MCP clients? (Choose two.)Choose 2.
- A
It MUST be sent in both the authorization request and the token request
- B
It MUST identify the MCP server using that server's canonical URI
- C
It is sent only when the authorization server advertises support for resource indicators
- D
It names the authorization server's issuer URL
- E
It replaces the need for the MCP server to check the token audience
Show the answer and explanation
Answer: A and B
Resource indicators bind a token to its intended audience. Clients MUST include
resourcein authorization and token requests, MUST use the canonical URI of the MCP server, and MUST send it even if the authorization server does not support it. Binding only protects anyone if the MCP server also rejects tokens whose audience is not itself.Why the other options are wrong
C. Clients MUST send it regardless of whether the authorization server supports it.
D. It names the protected resource (the MCP server), not the authorization server.
E. Servers MUST still validate that tokens were issued for them; the parameter only lets the authorization server bind the audience.
- A
- Question 5Server and Client Features
Which of these capabilities is best exposed as a tool rather than a resource?
- A
Creating a Jira ticket from the conversation
- B
A log file at a fixed URI that the user can pin to the chat
- C
The project's README, which the host attaches as background context
- D
The database schema, so the model knows the table names
Show the answer and explanation
Answer: A
Ask two questions: does it act on the world, and who decides when it happens? Actions with side effects that the model chooses are tools. Read-only data identified by a URI and included at the application's discretion is a resource.
Why the other options are wrong
B. Fixed, addressable data selected by the user or app is a resource.
C. Read-only context chosen by the application is the classic resource.
D. Static descriptive data the app can attach; a resource fits.
- A
- Question 6Building and Integrating Servers
You deploy
app = mcp.streamable_http_app()behindhttps://mcp.example.com. Every request, even a plaincurl, gets421 Misdirected Request. What fixes it properly?- A
Pass
host="mcp.example.com"tostreamable_http_app()so that this hostname is added to the Host header allowlist - B
Run uvicorn with
--proxy-headersso the Host header is rewritten - C
Pass
transport_security=TransportSecuritySettings(allowed_hosts=[...])listing your real hostname - D
Set
json_response=Trueso responses are plain JSON instead of SSE
Show the answer and explanation
Answer: C
With no
transport_security=, the app arms DNS-rebinding protection for localhost only, so a request whoseHostis your real domain is refused with 421 (and a badOriginwith 403) before MCP code runs. List both the bare host andhost:*. Behind a proxy that already controlsHost,enable_dns_rebinding_protection=Falseis the honest alternative.Why the other options are wrong
A. A non-localhost
host=does not allowlist it; it only stops the protection from arming, leaving every Host accepted.B. Proxy headers fix scheme detection for redirects; they do not change the Host allowlist.
D. The 421 is returned before any MCP handling, regardless of response format.
- A
- Question 7Protocol Foundations
A client's SSE response stream for a
tools/call(id 41) drops halfway through, after two progress notifications. Under 2026-07-28, what should the client do?- A
Re-issue the request as a new request with a new ID
- B
Wait, because the server will redeliver the response for id 41 on the next POST
- C
Open a GET stream to the MCP endpoint to collect the pending response
- D
Reconnect with
Last-Event-IDto resume from the last progress event
Show the answer and explanation
Answer: A
Revision 2026-07-28 removed stream resumability and redelivery. For the server, closing the response stream counts as cancellation of that request. The client MUST re-issue it as a new request with a new ID. For non-idempotent tools, design for retries, for example with idempotency keys in the arguments.
Why the other options are wrong
B. Message redelivery was removed; nothing will arrive for id 41.
C. The GET stream no longer exists; modern servers answer GET with 405.
D. SSE resumability and
Last-Event-IDwere removed in 2026-07-28.
- A
- Question 8Authorization, Security and Operations
An MCP proxy server uses one static client ID with a third-party authorization server that sets a consent cookie, and it lets MCP clients register dynamically. What MUST the proxy implement to prevent the confused deputy attack?
- A
Token passthrough, so the third-party API sees the real client
- B
A different static client ID per MCP tool
- C
Its own per-client consent, checked before the third-party redirect
- D
A longer consent cookie lifetime at the third-party authorization server
Show the answer and explanation
Answer: C
In the attack, an attacker dynamically registers a client with an attacker-controlled
redirect_uriand sends the victim a crafted link. The third-party authorization server sees its consent cookie for the proxy's static client ID and skips consent, and the proxy forwards the resulting MCP authorization code to the attacker. The fix is a proxy-owned consent page per MCP client, run before the third-party redirect, with exact redirect URI matching.Why the other options are wrong
A. Passthrough is itself forbidden and does nothing about the stolen authorization code.
B. Splitting client IDs by tool does not stop an attacker-registered client from riding an existing consent.
D. The third party's consent cookie is what lets the attacker skip consent; extending it makes things worse.
- A
- Question 9Server and Client Features
Under RFC 6570, what does the URI template
file:///{path}expand to whenpathissrc/main.rs?- A
Expansion fails because
/is not allowed in a variable value - B
file:///src/main.rs - C
file:///src%2Fmain.rs - D
file:///{src/main.rs}
Show the answer and explanation
Answer: C
Simple string expansion (
{var}) percent-encodes everything outside the unreserved set, so/becomes%2F. Reserved expansion ({+var}) keeps reserved characters such as/. For multi-segment paths,{+path}is usually what you want, and matching code must agree on which form the template uses.Why the other options are wrong
A. Any string is allowed; reserved characters are percent-encoded rather than rejected.
B. That is what reserved expansion,
{+path}, produces; simple expansion encodes the slash.D. Expansion replaces the whole expression, braces included.
- A
- Question 10Building and Integrating Servers
What does the client see when it calls
whoamiwith no arguments?server.registerTool('whoami', { description: 'Debug helper' }, async (args) => ({ content: [{ type: 'text', text: Object.keys(args).sort().join(',') }] }));- A
An empty string, because a tool with no
inputSchemareceives{} - B
A TypeScript compile error, because the handler must declare two parameters
- C
http,mcpReq,sessionId: the first parameter is the context - D
A validation error, because the call sent no
argumentsobject
Show the answer and explanation
Answer: C
When
inputSchema(or a prompt'sargsSchema) is omitted, the callback's single parameter is the context (ctx), not an args object. Running this printshttp,mcpReq,sessionId. Name itctxto avoid confusion; the advertised input schema for such a tool is{ type: 'object', properties: {} }.Why the other options are wrong
A. Without an
inputSchemathere are no arguments to pass, so the first parameter is something else.B. A one-parameter callback type-checks; that is exactly why the mistake is easy to make.
D. A schema-less tool accepts calls without arguments; nothing is validated.
- A
Practise all 450 Model Context Protocol (MCP) questions
Start with the free 15-question diagnostic. It shows where to focus, and your results carry over if you sign up.