Track
Connect · Expose · Secure · Use
Agents are useful when they can connect to real systems — files, databases, browsers, and APIs. The Model Context Protocol (MCP) is an open standard for AI applications to expose tools, resources, and prompts to LLMs in a structured, discoverable way.
This track covers what MCP is, how it differs from raw function calling, and how to build and secure MCP servers. MCP knowledge is increasingly relevant in agent interviews as more companies adopt the protocol.
MCP follows a client-server architecture: an AI Host connects to MCP Clients, each managing a connection to an MCP Server. Servers expose tools (executable functions), resources (files/data), and prompts (templates). Communication is JSON-RPC over stdio or HTTP.
The architecture: Host (AI app like Claude Desktop) → Client (manages one server connection) → Server (standalone process). Each server runs independently, sandboxed and restartable.
Traditional setup: write a function, wrap in HTTP endpoint, document in API reference. MCP: tool definition, schema, and execution are all part of a standardized server that any MCP client can discover automatically.
Advantages: auto-discovery, standardized error handling, resource access via URIs, security boundaries via sandboxed processes.
Define tools with name/description/inputSchema, write handlers that receive arguments and return content, register with the server. Resources expose data via URI schemes (file://, db://). The server handles capability negotiation and JSON-RPC automatically.
Follow least privilege: never grant more access than needed. Validate all tool inputs. Log all calls. Common vulnerabilities: sensitive files as resources, tools that modify data without validation. Mitigations: file path allowlists, confirmation for destructive actions, containers for untrusted servers.
Concrete Example
# Conceptual MCP server tool registration
# 1. Define the tool
search_tool = {
"name": "search_docs",
"description": "Search documentation by keyword",
"inputSchema": {
"type": "object",
"properties": {
"keyword": {"type": "string", "description": "Search term"},
"max_results": {"type": "integer", "default": 5},
},
"required": ["keyword"],
},
}
# 2. Handler function
async def handle_search(args):
keyword = args["keyword"]
max_results = args.get("max_results", 5)
results = search_index(keyword, max_results)
return {"content": [{"type": "text", "text": "\n".join(results)}]}
# 3. Register with server
server.register_tool(search_tool, handle_search)Three steps to add a tool to an MCP server: define schema, write handler, register. The server handles JSON-RPC framing, error serialization, and capability discovery automatically.
Open standard for AI apps to discover and call tools via JSON-RPC.
Clients learn available tools, schemas, and resources on connect.
Resources provide data (files, DB records); tools perform actions (search, compute).
MCP servers run as separate sandboxed processes with limited permissions.
Error codes and structured responses make failures predictable.
0 problems. Sign in to start solving.
Sign in to open a workspace and solve these problems.