
Build Your First MCP Server in 20 Minutes (TypeScript)
MCP (Model Context Protocol) lets AI assistants call external tools. Instead of copy-pasting data into Claude, the AI calls your tool directly. I built an MCP server that extracts structured data from text. Here's exactly how, step by step. What We're Building An MCP server that exposes one tool: extract_structured_data . When an AI assistant needs to parse a receipt, invoice, or email, it calls this tool automatically. Prerequisites Node.js 18+ TypeScript An MCP-compatible client (Claude Desktop, Cursor, etc.) Step 1: Set Up the Project mkdir my-mcp-server && cd my-mcp-server npm init -y npm install @modelcontextprotocol/sdk zod npm install -D typescript @types/node Create tsconfig.json : { "compilerOptions" : { "target" : "ES2022" , "module" : "Node16" , "moduleResolution" : "Node16" , "outDir" : "./dist" , "rootDir" : "./src" , "strict" : true , "esModuleInterop" : true , "declaration" : true }, "include" : [ "src/**/*" ] } Important: Use module: "Node16" and moduleResolution: "Node
Continue reading on Dev.to Tutorial
Opens in a new tab



