Untitled Lesson
Skill Matrix
UNLOCK NODES BY LEARNING NEW TAGS.
What core problem does the Model Context Protocol (MCP) solve for connecting AI applications to external tools and data sources?
💻 Code Challenge | +75 XP
Build a simple MCP server exposing a "getOrderStatus" tool that validates its input with Zod, checks the requesting user owns the order before returning data, and returns the order status as text content.
An MCP tool exposing order data was found during a security review to have no authorization check, allowing any connected AI client to retrieve any order regardless of ownership. Reorder the steps to fix this.
Task: Reorder the blocks in logical sequence to solve the problem.
A.D.A. Interface
Adaptive Didactic Assistant

Pascual Vila
Frontend Instructor // Code Syllabus
The Error //
Exposing an MCP tool that reads or modifies sensitive data with no authorization check
// Wrong: no authorization check, same gap as an unprotected API endpoint
server.tool("getOrder", { orderId: z.string() }, async ({ orderId }) => {
return await orderRepository.findById(orderId); // any caller, any order
});
// Correct: same rigor as any API
server.tool("getOrder", { orderId: z.string(), userId: z.string() },
async ({ orderId, userId }) => {
const order = await orderRepository.findById(orderId);
if (order.userId !== userId) throw new Error("Unauthorized");
return order;
});The Solution //
An MCP server is functionally another API surface, regardless of the fact that it's designed to be called by an AI client rather than a traditional HTTP client — it needs the exact same authorization discipline as any other endpoint, verifying the requester actually has permission for the specific resource or action being requested.
The Error //
Choosing the wrong transport mechanism for where the MCP server actually runs relative to its client
// Wrong for a remote server: stdio only works for a local subprocess
// Correct: choose the transport matching your actual deployment
// Local subprocess → stdio transport
// Remote, network-accessible server → HTTP-based transportThe Solution //
A stdio transport is designed for a local tool spawned as a subprocess on the same machine as the AI client, and won't work correctly for a server that needs to be reached over a network from a remote client, which requires an HTTP-based transport instead — matching the transport to the actual deployment topology matters.