AI Engineering Interview Questions: Agents & MCP
Reviewed by Mark Dickie · Last updated
AI engineering is the discipline of building production systems that use large language models, tool-calling agents, and external integrations to accomplish real tasks. For interviews focused on the agent and Model Context Protocol (MCP) layer, you need to understand how LLM-based agents decide when to call tools, how MCP standardizes the connection between models and external resources, and what can go wrong at the boundary between a model's reasoning and a live system. The core areas are agent architecture (planning, tool selection, memory), the MCP client-server model, and the practical failure modes that interviewers probe — context limits, tool-call hallucination, and security of exposed endpoints. Below is a quick map of the areas a typical interview covers, followed by the specific questions candidates should be ready to answer.
| Area | What you should know |
|---|---|
| Agent loops | How a model plans, calls a tool, observes the result, and decides whether to stop or continue |
| MCP architecture | The client-server split: MCP servers expose resources, tools, and prompts; clients (Claude Desktop, IDEs, custom apps) consume them over stdio or HTTP |
| Tool definitions | How JSON Schema describes tool parameters, and why precise descriptions matter for model accuracy |
| Context management | Token budgeting, summarization between turns, and when to offload state to external stores |
| Security & permissions | Sandboxing server processes, scoping tool access, and preventing prompt-injection through tool outputs |
What does an MCP server expose to an AI agent?
An MCP server exposes three primitive types: resources (readable data like file contents or database rows), tools (callable functions the model invokes to take action), and prompts (pre-written templates the client can present to the user or model). Resources are pull-based — the client reads them. Tools are push-based — the model calls them during generation. Prompts are static text the server authors once and ships with the server. Interviewers often ask you to draw this split and explain why resources and tools are separate: resources give the model context without side effects, while tools let it change state in the outside world.
How do agent tool-calling loops work with MCP?
- The client sends the conversation plus available tool definitions to the model.
- The model returns either a normal text response or a structured tool-call request (function name + arguments).
- The client routes the tool call to the matching MCP server, which executes it and returns a result.
- The client appends the tool result to the conversation and sends it back to the model.
- The model either calls another tool or produces a final answer, terminating the loop. The loop continues until the model stops emitting tool calls or a step-limit guard fires. Interviewers may ask what goes wrong: models can hallucinate tool arguments that fail validation, call the wrong tool when definitions are ambiguous, or get stuck in infinite loops when the environment never satisfies the stopping condition.
What are the most common interview questions about MCP and agents?
Expect questions on the client-server boundary, how tools differ from resources, transport options (stdio vs. SSE/HTTP), context window pressure from large tool outputs, and security concerns when a server exposes file-system or network access. You should also be able to explain how agent frameworks like LangGraph, AutoGen, or Claude's built-in tool use relate to MCP — MCP is the wire protocol, while those frameworks are the orchestration layer that decides how to run the loop. The live quiz below covers these areas across difficulty levels so you can check your readiness before the real thing.
Key facts
- Tarmac has 46 AI Engineering interview questions on this topic, 25 of them on this page, at difficulty 1–5 of 5.
- Tarmac tracked 4,175 job postings asking for AI Engineering in August 2026.
- Roles asking for AI Engineering advertise a median base salary of US$180,000, across 773 job postings as of August 2026.
- Tarmac last reviewed these AI Engineering interview questions on 31 August 2026.
At a glance
| Questions | 25 shown · 46 in the bank |
|---|---|
| Difficulty | 1–5 of 5 |
| Formats | Multiple choice, True / false, Fill in the blank, Flashcard, Ordering, Short answer, Multiple answer, Find the bug |
What you'll review
- mcp
Practice questions
Try one before you open the answer. Pick an option and press Check; it's marked on the spot.
AI Engineering/agents/mcp
In the Model Context Protocol (MCP), what is the primary purpose of a tool that an AI agent can call?#
Options
Show answer
A tool in MCP (Model Context Protocol) is an executable action or function that the AI model can invoke to interact with external systems — for example, calling a REST API, querying a database, or writing a file. This differs from resources (static readable data) and prompts (reusable template definitions). Tools are the core mechanism that gives AI agents the ability to act on the world.
In MCP, tools are executable functions exposed by an MCP server that allow the AI model to perform actions and interact with external systems (e.g., calling an API, running a query, writing a file). This is distinct from resources (read-only data like files or DB records) and prompts (reusable prompt templates). Tools follow a request/response pattern and are the primary mechanism for giving agents 'agency' to affect the world.
AI Engineering/agents/mcp
True or False: In an MCP-based AI agent architecture, the MCP client is the component that hosts and exposes tools and resources, while the MCP server is the component that connects the AI model to those capabilities.#
Options
Show answer
This is false — the roles are reversed. In MCP, the server is the component that hosts and exposes tools, resources, and prompts to the outside world. The client is the component embedded in the AI application that connects to MCP servers and makes their capabilities available to the AI model. Servers are capability providers; clients are capability consumers.
This statement has the roles reversed. In MCP, the server is the component that hosts and exposes tools, resources, and prompts. The client (typically embedded in the AI application or agent framework) connects to one or more MCP servers and relays their capabilities to the AI model. Think of servers as 'capability providers' and clients as 'capability consumers'.
AI Engineering/agents/mcp
Complete the following description of the MCP request lifecycle:#
Show answer
Complete the following description of the MCP request lifecycle:
When an AI agent wants to call a tool via MCP, it first sends a **tools/list** request to discover what tools are available on the server. After the user or agent selects a tool to run, it sends a **tools/call** request with the tool name and arguments to execute it.
MCP defines a structured JSON-RPC lifecycle for tool usage. An agent first calls tools/list to enumerate all tools exposed by the server (receiving their names, descriptions, and input schemas). Once the model decides which tool to invoke, it sends a tools/call request with the chosen tool name and the required arguments. This two-step pattern — discover then invoke — is fundamental to how MCP agents operate.
AI Engineering/agents/mcp
In an MCP-based agentic system, the AI agent (client) initiates every interaction by calling tools on the MCP server — the MCP server can never proactively push notifications or events to the client without being asked first.#
Options
Show answer
This is false. MCP is not strictly one-directional. While the client typically initiates tool calls, the MCP specification supports server-to-client notifications — for example, progress updates on long-running operations and log messages. The server can proactively push these messages without waiting for a new request from the client.
This statement is false. While the request/response pattern is the most common interaction, MCP supports server-to-client notifications. For example, an MCP server can send progress notifications for long-running tool calls and emit log messages proactively. The protocol defines server-initiated messages alongside the client-request/server-response model, so it is not strictly one-directional.
AI Engineering/agents/mcp
Complete the following description of MCP's three core primitive types:#
Show answer
Complete the following description of MCP's three core primitive types:
An MCP server can expose three primitives to AI agents: Tools (callable actions that can have side-effects), Resources (read-only contextual data identified by a URI), and Prompts (reusable, parameterized prompt templates that the client can request and inject into a conversation).
The Model Context Protocol defines exactly three server-side primitives: Tools (callable functions that may produce side-effects, like writing to a database), Resources (read-only data exposed via URIs, like files or API responses), and Prompts (parameterized templates the client can retrieve and insert into a conversation). Knowing all three and their distinctions is foundational for MCP-based AI agent development.
AI Engineering/agents/mcp
An MCP host can connect to multiple MCP servers at once and combine their tools, resources, and prompts into a single unified set the model can use, rather than being limited to one server's offerings per conversation.#
Options
Show answer
True. An MCP host typically connects to several servers at once — a filesystem server, a Git server, a ticketing-system server, and so on — each through its own client under the hood, and merges everything they expose into one combined registry the model sees as a single flat set of available tools, resources, and prompts. The model itself doesn't need to know or care which underlying server a given tool came from.
This is exactly why MCP scales the way it does in practice — a host like an IDE or a coding assistant typically maintains connections to several servers simultaneously (a filesystem server, a Git server, a ticketing-system server, and so on), each represented by its own client under the hood, and merges everything they expose into one combined registry the model sees as a single flat set of available tools. The model itself doesn't need to know or care which underlying server a given tool came from.
AI Engineering/agents/mcp
What wire format and message pattern does MCP use underneath, regardless of which transport (stdio or Streamable HTTP) carries it?#
Show answer
JSON-RPC 2.0. Every MCP exchange — capability negotiation, listing tools/resources/prompts, invoking a tool, sending a notification — is a JSON-RPC request/response pair or a one-way notification message. The transport only changes how those JSON-RPC messages are physically delivered (raw lines over stdin/stdout for stdio, HTTP POST plus optional server-sent events for Streamable HTTP); the message structure and semantics above that layer are identical either way, which is exactly what lets the same client and server logic work unmodified over either transport.
Separating the message format (JSON-RPC 2.0) from the transport (stdio or Streamable HTTP) is what makes MCP's two transports genuinely interchangeable from the protocol's point of view — a server author writes one set of request/response handlers and the transport is a deployment choice, not a rewrite.
AI Engineering/agents/mcp
In the Model Context Protocol (MCP) architecture, which statement correctly describes the relationship between the three core roles?#
Options
Show answer
All three statements are correct. In MCP: (1) the Host is the user-facing application managing multiple Client instances; (2) each Client instance holds a 1:1 connection to exactly one Server; and (3) Servers can send client-unsolicited notifications — such as progress updates (notifications/progress) and resource-change events (notifications/resources/list_changed) — as explicitly defined in the MCP specification.
All three statements accurately reflect the MCP specification. Statement 1 is correct: the Host is the user-facing application (e.g., Claude Desktop, an IDE extension) that owns and manages multiple MCP Client instances. Statement 2 is correct: each individual MCP Client instance maintains a 1:1 connection with exactly one MCP Server — a Host achieves multi-server connectivity by spawning multiple Clients, not by multiplexing within one Client. Statement 3 is correct: MCP Servers are not purely passive — the spec explicitly defines server-initiated notifications such as notifications/progress (progress updates), notifications/resources/updated (resource change events), and notifications/resources/list_changed (capability list changes). These allow a Server to push information to a Client without waiting for a per-message request. Option (b) is therefore wrong because it mischaracterizes servers as purely request-driven. Option (c) is wrong because a single Client instance maps to one Server. Option (d) is wrong because the Host and Client are distinct architectural roles.
AI Engineering/agents/mcp
Place the following steps of an MCP agent tool-call turn in the correct chronological order, from first to last.#
Put these in order
Show answer
The correct order is: (1) Host delivers the user message to the LLM → (2) LLM responds with a structured tool-call request → (3) MCP Client sends a tools/call request to the MCP Server → (4) MCP Server executes the tool and returns a result → (5) Host forwards the updated context (with the tool result) back to the LLM for a final response. This reflects MCP's client-driven, request-response flow where the Host orchestrates each step.
The correct lifecycle order for an MCP agent turn is: (1) The host forwards the user message to the LLM. (2) The LLM decides to call a Tool and returns a structured tool-call request. (3) The MCP Client sends a tools/call request to the appropriate MCP Server. (4) The Server executes the tool and returns a result to the Client. (5) The Client delivers the result back to the Host, which appends it to the conversation context. (6) The Host sends the updated context (including tool result) back to the LLM for the final response. This ordering reflects the request-response, client-driven nature of MCP and the role of the host in managing LLM interactions.
AI Engineering/agents/mcp
What problem does the Model Context Protocol (MCP) solve, and what does it standardize?#
Show answer
MCP is an open protocol that standardizes how LLM applications connect to external tools, data sources, and prompts through a uniform client/server interface. Instead of writing a bespoke integration for every tool and every model host, you build an MCP server that exposes capabilities — tools (callable functions), resources (readable data/context), and prompts (reusable templates) — and any MCP-compatible client (host app) can discover and use them. It decouples integrations from any single vendor: write the server once, reuse it across hosts.
MCP is essentially "USB-C for tools": a common wire format so the M×N problem of wiring M apps to N tools collapses to M+N. It standardizes capability discovery and invocation (tools/resources/prompts), keeping integrations portable across model hosts.
AI Engineering/agents/mcp
When would an MCP server use the stdio transport instead of Streamable HTTP, and what does each choice give up or gain?#
Show answer
Stdio fits a server that runs as a local subprocess of its one host application on the same machine — it communicates over standard input/output, has essentially no network overhead, and needs no separate auth story because the process was already launched with the local user's own permissions. The tradeoff is that it can only serve that one local client; it's not reachable remotely or by multiple clients at once. Streamable HTTP fits a server that runs independently — a hosted integration, a shared team service — and needs to serve one or many remote clients over the network. It gains reachability and shareability across clients, but has to add a real authentication layer (bearer tokens, OAuth) and accept normal network latency and reliability concerns that a local stdio process never has to deal with.
The choice tracks directly to deployment shape: stdio is for a server that lives and dies with its one local host process, trading reachability for zero network overhead and no auth machinery; Streamable HTTP is for a server that exists independently of any one client, trading the simplicity of a local process for the ability to serve multiple remote clients at the cost of a real network and authentication story. Picking the wrong one either forces unnecessary auth/network complexity onto a purely local integration, or makes a genuinely shared service impossible to reach from more than one place.
AI Engineering/agents/mcp
How does an MCP client find out what tools, resources, and prompts a server actually offers, and how does it stay current if that changes mid-session?#
Show answer
Discovery happens through per-primitive list methods — tools/list, resources/list, prompts/list — which a client calls to enumerate what's available, each entry including enough detail (like a tool's JSON-schema input definition) to use it correctly. This happens after the connection's capability negotiation, which tells the client which primitive types and features the server supports at all, so it knows which list calls are even worth making. Because a server's offerings can change during a session (a tool becomes unavailable, a new one appears), servers that support it can send a change notification, and a well-behaved client responds by re-issuing the relevant list call rather than trusting its original, possibly stale, snapshot.
Discovery is deliberately dynamic rather than a one-time handshake: capability negotiation establishes what kinds of things are worth listing, the list methods enumerate the current specifics, and change notifications keep a long-lived session from silently drifting out of sync with what the server actually offers.
AI Engineering/agents/mcp
Order the lifecycle of an MCP client connecting to and using a server, from opening the connection to reacting to a later change.#
Put these in order
Show answer
The MCP connection lifecycle runs in this order:
- The transport connection opens — a local subprocess launches for stdio, or an HTTP connection is established for Streamable HTTP
- Client and server negotiate protocol version and capabilities, so the client knows which primitives the server supports
- The client calls the relevant list method to enumerate the server's specific offerings and their schemas
- The client invokes a specific tool or reads a specific resource using what it just discovered
- If the server's offerings change later, it sends a change notification and the client re-lists to refresh its view
The lifecycle moves from transport, to capability negotiation, to enumerating the specifics, to actual use, and finally to staying current: you can't negotiate capabilities before the connection exists (a before b), you can't usefully call tools/list before you know the server even supports the tools primitive (b before c), you can't invoke a tool by name before you've discovered what it's called and how to call it (c before d), and change notifications are by definition something that happens after the initial discovery-and-use cycle is already underway (e last).
AI Engineering/agents/mcp
Which of the following statements most accurately describes the communication model in the Model Context Protocol (MCP)?#
Options
Show answer
The MCP client inside the host mediates all communication — the LLM never directly calls an MCP server. Instead, when the model outputs a tool-call intent, the host's MCP client routes the JSON-RPC request to the appropriate server, receives the result, and appends it to the context window before triggering the next model inference. MCP sessions are stateful, not stateless, and the transport is JSON-RPC 2.0, not REST.
The Model Context Protocol (MCP) defines a strict client-server architecture where the host application (e.g., an IDE or chat client) spawns or connects to MCP servers. The LLM itself never directly calls MCP servers; instead, the MCP client (embedded in the host) mediates all communication. Tool results flow back to the host, which appends them to the context before re-querying the model. Option C is incorrect because MCP servers expose capabilities via JSON-RPC 2.0, not REST. Option D is incorrect because MCP servers are stateful — they maintain a session with the client. Option A is the only accurate statement.
AI Engineering/agents/mcp
An MCP server can advertise several capability primitives to connected clients. Which of the following are valid, first-class MCP server capability primitives as defined in the MCP specification?#
Options
Pick every one that applies.
Show answer
The three first-class MCP server capability primitives are Tools (invokable functions with potential side effects), Resources (URI-addressed read-only data attached to context), and Prompts (reusable prompt templates). 'Samplers' is not a server primitive — sampling in MCP refers to a client-side capability allowing a server to request LLM completions from the host, and it does not define inference hyperparameters like temperature.
In MCP, a server advertises three distinct capability primitives: Tools (callable functions/actions the model can invoke with side effects), Resources (read-only contextual data the host can attach to the context, URI-addressed), and Prompts (reusable prompt templates or workflows the server exposes). 'Samplers' is not an MCP server primitive — sampling refers to the client-side capability that allows a server to request the host to perform an LLM completion on its behalf (a server-initiated inference request). Knowing all three correct primitives and distinguishing them from sampling is essential for MCP architecture design.
AI Engineering/agents/mcp
The following Python snippet implements the MCP (Model Context Protocol) initialization handshake for a custom MCP client. The client intends to open a session with an MCP server, discover its capabilities, and then send the confirmation notification.#
import json
def initialize_mcp_session(transport):
# Step 1: Notify the server that we are initialized
init_notification = {
"jsonrpc": "2.0",
"method": "notifications/initialized",
"params": {}
}
transport.send(json.dumps(init_notification))
# Step 2: Send the initialize request
init_request = {
"jsonrpc": "2.0",
"id": 1,
"method": "initialize",
"params": {
"protocolVersion": "2024-11-05",
"capabilities": {"roots": {"listChanged": True}},
"clientInfo": {"name": "my-client", "version": "1.0.0"}
}
}
transport.send(json.dumps(init_request))
response = json.loads(transport.receive())
return response.get("result", {})Show answer
The bug is on line 6.
The bug is on line 6, where "method": "notifications/initialized" is assigned inside init_notification. This entire block (lines 5–9) constructs and sends the notifications/initialized notification before the initialize request is ever sent (lines 13–23). According to the MCP protocol, the correct handshake order is: (1) client sends initialize, (2) server replies with its capabilities, (3) client sends notifications/initialized to confirm it has processed the response. Sending notifications/initialized first violates the protocol handshake sequence — the server has not yet established a session and will reject or ignore the premature notification, causing the subsequent initialize request to fail. The fix is to move the initialize request block before the notifications/initialized notification block and wait for the server's response in between.
AI Engineering/agents/mcp
Which of these statements about MCP's transport layer are accurate? Select all that apply.#
Options
Pick every one that applies.
Show answer
Accurate statements are that stdio transport communicates over standard input/output between local processes and typically serves a single client with no network overhead, that Streamable HTTP supports remote server communication with standard HTTP authentication like bearer tokens and OAuth-issued tokens, that both transports carry the same underlying JSON-RPC 2.0 message format with the transport only changing how messages are physically delivered, and that the plain HTTP-plus-SSE transport used earlier has been superseded by Streamable HTTP for remote servers. MCP does not require gRPC for anything — its two defined transports are stdio and Streamable HTTP.
Stdio (a) and Streamable HTTP (b) are MCP's two transports, matching the local-single-client and remote-multi-client use cases respectively, with Streamable HTTP adding real network auth since it can be reached over the internet. Underneath either one, MCP messages are JSON-RPC 2.0 (c) — the transport is purely how the bytes move, not what they say. Streamable HTTP is explicitly the successor to the older combination of separate HTTP POST and SSE streams for remote connections (d). MCP never requires gRPC (e) — its two defined transports are stdio and Streamable HTTP, full stop.
AI Engineering/agents/mcp
This config wires up a filesystem MCP server so an assistant can read files in one project's directory. Which line is a security misconfiguration?#
{
"mcpServers": {
"project-files": {
"command": "mcp-server-filesystem",
"args": ["--root", "/"]
}
}
}Show answer
The bug is on line 5.
Rooting the filesystem server at / means every tool call it exposes — read_file, write_file, list_directory, whatever the server provides — can reach anywhere on disk the host OS user can, far beyond the one project directory the assistant actually needs. Least privilege means scoping --root to the specific project path, so even if a call is manipulated by injected content or a bug in the assistant, the blast radius is bounded to that one directory instead of the whole machine.
AI Engineering/agents/mcp
You're deciding whether to connect a third-party MCP server to your team's AI coding assistant. Given MCP's actual security model, what do you need to check before connecting it?#
Show answer
MCP itself doesn't sandbox a server — once connected, a server runs with exactly the access and credentials you grant it (a filesystem path, an API scope, a database connection string), and anything it returns, including tool descriptions and resource content, enters the model's context as untrusted input the model can't reliably separate from real instructions. So before connecting: scope its access to the minimum the task needs rather than granting broad convenience access; check whether it's a maintained, trustworthy source (official/well-known vs an unvetted random repo); check what transport and auth it uses (a remote HTTP server needs a real credential story, not a bare token dropped in a config file); and treat any content it returns as untrusted data subject to the same prompt-injection scrutiny you'd apply to any other external input the model reads.
MCP standardizes the wire protocol for connecting a server, not the trust or safety of what's on the other end of it — those are still the integrator's job. The consequence is that connecting a server is a genuine security decision, not a config toggle: it grants that server whatever access it's configured with, and its output flows straight into the model's context as untrusted data. Least privilege, provenance/trust review, and treating server output like any other untrusted input are the concrete checks that follow from that.
AI Engineering/agents/mcp
In the Model Context Protocol (MCP) sampling flow, a server needs an LLM completion to continue its tool execution. Arrange the following events in the correct protocol order from first to last.#
Put these in order
Show answer
The correct order is: (1) MCP server sends sampling/createMessage to the client → (2) Client injects its system prompt and model preferences → (3) Client selects a model and calls the LLM provider → (4) LLM returns the completion to the client → (5) Client relays the result back to the server. This flow preserves client-side control over model selection and prompt governance, a core MCP design principle.
The Model Context Protocol (MCP) defines a strict lifecycle for server-to-client sampling requests. The correct order is: (1) The MCP server calls sampling/createMessage on the client, (2) The client applies its own system prompt injection and model preferences, (3) The client selects a model and issues the actual LLM call, (4) The LLM response is returned to the client, and (5) The client forwards the completion result back to the server as the sampling/createMessage response. This design is intentional — the client retains control over model selection and prompt augmentation, preventing servers from directly driving arbitrary LLM calls without user-side oversight.
AI Engineering/agents/mcp
An MCP server handles a tools/call request and tries to return the tool's result. The agent host hangs indefinitely after the tool executes successfully. Identify the buggy line.#
import json, sys
def handle_request(raw: str) -> None:
req = json.loads(raw)
method = req.get("method")
if method == "tools/call":
tool_name = req["params"]["name"]
result = run_tool(tool_name, req["params"].get("arguments", {}))
response = {"jsonrpc": "2.0", "method": "notifications/message", "params": {"content": result}}
sys.stdout.write(json.dumps(response) + "\n")
sys.stdout.flush()
def run_tool(name: str, args: dict) -> str:
return f"Tool '{name}' executed with args {args}"Show answer
The bug is on line 9.
This code has a critical bug on line 9. The tool result is being sent back using notifications/message (a one-way notification) instead of a proper JSON-RPC response. In MCP, tool call results MUST be returned as a JSON-RPC response object with the same id as the original request (i.e., via a tools/call response), not as a notification. Notifications have no id field and are fire-and-forget; using one here means the client can never correlate the result with its pending request, causing the agent to hang indefinitely waiting for a response that will never arrive. Line 9 should construct a proper JSON-RPC result response using the original request's id.
AI Engineering/agents/mcp
An MCP client manages a multi-root workspace (e.g., a VS Code window with multiple open folders). The user adds a new workspace folder at runtime. According to the MCP specification's roots capability, what is the correct mechanism for propagating this change to a connected MCP server?#
Options
Show answer
The correct mechanism is for the client to send a notifications/roots/list_changed notification to the server; the server then issues a roots/list request to retrieve the updated list of roots. MCP roots are owned by the client, so changes are pushed via notification rather than polled or synced through a dedicated delta method. Re-initializing the session is unnecessary and not prescribed by the spec.
MCP's roots capability allows clients to expose filesystem or URI namespaces to servers, and the protocol mandates that when the set of roots changes (e.g., the user adds or removes a workspace folder), the client MUST send a notifications/roots/list_changed notification to each connected server. Servers that declared roots support in their capabilities can then call roots/list to re-fetch the updated list. Option A is wrong because servers cannot push root changes — roots are owned by the client. Option C is wrong because there is no roots/sync method in the spec. Option D is wrong because re-initializing the entire session is not required or correct — a lightweight notification suffices.
AI Engineering/agents/mcp
Your team is evaluating the Model Context Protocol (MCP) for connecting LLM applications to tools and data. Which statements about MCP are accurate?#
Options
Pick every one that applies.
Show answer
The accurate statements are that MCP is an open protocol standardizing how applications expose tools, resources, and prompts to LLM clients, that you build a tool or data server once and reuse it across any MCP-compatible host, and that an MCP server still runs with the privileges you grant it, so an untrusted server is a real security and injection risk. MCP does not replace function calling — it is the transport for it — and it gives no guarantee against malicious server content misleading the model.
MCP is an open, client-server protocol that gives a uniform way to expose tools, resources, and prompts to LLM hosts (a), and its central payoff is write-once/reuse-everywhere interoperability across compatible clients (b). It does not remove the security burden: a server runs with whatever access you give it and the data it returns enters the model's context, so an untrusted or compromised server is a genuine injection/exfiltration risk (c) — least privilege and review still apply. MCP does not replace function calling (d); it is the transport/standard through which tool definitions and calls flow — the model still decides which tool to invoke. And it offers no guarantee against malicious server output misleading the model (e); content returned over MCP is untrusted data like any other.
AI Engineering/agents/mcp
Which of these are genuine, commonly-seen failure modes when operating MCP servers in production? Select all that apply.#
Options
Pick every one that applies.
Show answer
Genuine failure modes are a stdio-based server writing ordinary debug output to stdout instead of stderr, which corrupts the JSON-RPC message stream since stdout is reserved for protocol messages on that transport; granting a server broader access than the task needs, which turns a single compromised or buggy server into a much larger blast radius; a client that never re-lists a server's tools after being told the list changed, leaving it acting on stale tool names and schemas; and a client and server that disagree on supported capabilities discovering that mismatch as a confusing runtime error instead of negotiating it at connection time. MCP does not guarantee exactly-once, lossless delivery of every notification — that is a documented best-effort limitation, not a guarantee a client can rely on.
Writing plain logs to stdout on a stdio server (a) is a very real, easy-to-hit bug, because that channel is reserved for the protocol's own JSON-RPC messages — any stray print statement can corrupt the stream. Over-broad scope grants (b) are a classic least-privilege failure that magnifies the impact of any single compromised server. Skipping the re-list after a change notification (c) leaves a client silently out of sync with what the server actually offers. Capability mismatches are meant to be negotiated explicitly at connection time (e), not discovered as confusing runtime failures. The protocol explicitly does not promise guaranteed notification delivery (d) — that's a documented best-effort limitation, and code that assumes otherwise will eventually miss an update.
AI Engineering/agents/mcp
This is a stdio-transport MCP server's request handler. It works in local testing but the client intermittently fails to parse its responses. Which line is the bug?#
function handleToolCall(request) {
console.log("received tool call:", request.method);
const result = performAction(request.params);
process.stdout.write(JSON.stringify({ jsonrpc: "2.0", id: request.id, result }) + "\n");
return result;
}Show answer
The bug is on line 2.
On the stdio transport, stdout is the wire — every line written there is expected to be a well-formed JSON-RPC message the client will try to parse. The console.log debug line on line 2 also writes to stdout, so it gets interleaved with the real protocol output on line 4, breaking message framing: the client either fails to parse the log line as JSON-RPC or gets confused about where one message ends and the next begins. The fix is to send anything that isn't a protocol message to stderr (console.error) instead, which stdio-transport clients don't treat as protocol data.
Related interview questions
Job market
See ai-engineering salaries and hiring demand from live job postings.
The other 21 questions
This page shows 25 and marks what you pick. That's as far as a page can go. A free account opens the other 21 and keeps every answer. What you miss comes back until it's right: after a day, then at longer gaps.
Free · the whole bank · 100 marked answers per 30 days · written feedback on the paid plan