← Back to Dashboard
1. Project Scaffolding2. Registering Tools3. Adding Resources & Prompts4. Connecting & Publishing
Project Scaffolding
From Zero to Running Server in 10 Minutes
Let's build a real MCP server from scratch. Forget abstractions - by the end of this module, you'll have a working server that any MCP client can connect to.
Step 1: Initialize the Project
mkdir my-mcp-server && cd my-mcp-server npm init -y npm install @modelcontextprotocol/sdk zod npm install -D typescript @types/node tsx
Step 2: TypeScript Configuration
// tsconfig.json
{
"compilerOptions": {
"target": "ES2022",
"module": "Node16",
"moduleResolution": "Node16",
"outDir": "./dist",
"rootDir": "./src",
"strict": true,
"esModuleInterop": true,
"skipLibCheck": true,
"declaration": true
},
"include": ["src/**/*"]
}
Step 3: Package.json Scripts
{
"type": "module",
"bin": { "my-mcp-server": "./dist/index.js" },
"scripts": {
"build": "tsc",
"dev": "tsx src/index.ts",
"inspect": "npx @modelcontextprotocol/inspector tsx src/index.ts"
}
}
Project Structure
| File | Purpose |
|---|---|
src/index.ts | Server entry point - creates McpServer, attaches transport |
src/tools.ts | Tool definitions and handler functions |
src/resources.ts | Resource definitions and data providers |
src/prompts.ts | Prompt templates for UI-driven workflows |
tsconfig.json | TypeScript compiler configuration |
🎯 Pro Tip: Always set
"type": "module" in package.json. The MCP SDK uses ES modules exclusively - CommonJS imports will fail with cryptic errors.⌨ HANDS-ON LABScaffold Your MCP Server Project
⭐ +150 XPEvery MCP server starts the same way: an npm project with the official SDK and zod for schema validation. Set it up.
1Initialize a new npm project (skip the questionnaire).
2Install the official MCP SDK plus zod.
OBJECTIVE 1 / 2 — type "hint" if stuck
🧪 Knowledge Check
Press 1-4 to select1 of 3
What package provides the official MCP server SDK?
@anthropic-ai/mcp
@modelcontextprotocol/sdk
mcp-server-core
@claude/mcp