[ ABORT TO HUD ]
SEQ. 1
SEQ. 2
SEQ. 3
SEQ. 4

Project Scaffolding

🛠️ Build Your First Server10 min80 BASE XP

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

FilePurpose
src/index.tsServer entry point — creates McpServer, attaches transport
src/tools.tsTool definitions and handler functions
src/resources.tsResource definitions and data providers
src/prompts.tsPrompt templates for UI-driven workflows
tsconfig.jsonTypeScript 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.
SYNAPSE VERIFICATION
QUERY 1 // 3
What package provides the official MCP server SDK?
@anthropic-ai/mcp
@modelcontextprotocol/sdk
mcp-server-core
@claude/mcp
Watch: 139x Rust Speedup
Project Scaffolding | Build Your First Server — MCP Academy