Hands-on practice for this lecture. Work through the exercises and quizzes to reinforce what you've learned.
Interactive Workshop
Create an MCP server from scratch and register your first tool — an add function that sums two numbers.
Initialize a Node.js project with the MCP SDK and Zod for schema validation.
1{
2 "name": "my-mcp-server",
3 "version": "1.0.0",
4 "type": "module",
5 "scripts": {
6 "build": "tsc",
7 "start": "node dist/index.js"
8 },
9 "dependencies": {
10 "@modelcontextprotocol/sdk": "^1.0.0",
11 "zod": "^3.22.0"
12 },
13 "devDependencies": {
14 "typescript": "^5.3.0",
15 "@types/node": "^20.0.0"
16 }
17}my-mcp-serveraddAdd two numbers together and return the sum
Multiple choice — select an answer to see the explanation.
What is Zod used for in an MCP server?