Menu

How to build your first MCP server in 10 minutes
📰

How to build your first MCP server in 10 minutes

DEV Community: tutorial·GrahamduesCN·about 10 hours ago
#Li5t4UQG
#devtotutorial#devto#dev#server#tool
Reading 0:00
15s threshold

I built my first MCP server last week and it was way simpler than I expected. Here is exactly how, no fluff.

Prerequisites

Node.js 20+

10 minutes

Step 1: Scaffold

npx create-mcp-server my-first-server cd my-first-server npm install

Enter fullscreen mode

Exit fullscreen mode

This generates a complete TypeScript project with one example tool.

Step 2: Add your tool

Open src/index.ts . Replace the hello tool with whatever you want:

server . setRequestHandler ( CallToolRequestSchema , async ( request ) => { const { name , arguments : args } = request . params ;

if ( name === ' current_time ' ) { return { content : [{ type : ' text ' , text : new Date (). toISOString () }] }; }

throw new Error ( `Unknown tool: ${ name } ` ); });

Enter fullscreen mode

Exit fullscreen mode

Step 3: Build and connect

npm run build npm start

Enter fullscreen mode

Exit fullscreen mode

Add to Claude Desktop config and you are done.

The whole thing took me 8 minutes.…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.