OVTH / 2026 LIVE · V0.4.0
Ø Overthinking Gateway ↗

Build your first MCP server in Node

Five files, one tool, plugs into Claude Desktop. The smallest viable MCP server.

⚡ 7min read intermediate OS · macos · linux · windows vsdk-1.8.0 Last updated May 05, 2026 · by xlrd

Prereq

  • Node.js 20+
  • Claude Desktop 1.5+
  • Basic TypeScript comfort

Steps

01. Scaffold

bash
mkdir hello-mcp && cd hello-mcp
npm init -y
npm install @modelcontextprotocol/sdk zod
npm install -D typescript @types/node tsx

02. Write the server

typescript
// src/index.ts
import { Server } from "@modelcontextprotocol/sdk/server/index.js";
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
import { z } from "zod";

const server = new Server(
{ name: "hello-mcp", version: "0.1.0" },
{ capabilities: { tools: {} } }
);

server.setRequestHandler("tools/list", async () => ({
tools: [{
  name: "echo",
  description: "Echo a message back",
  inputSchema: { type: "object", properties: { msg: { type: "string" } } }
}]
}));

server.setRequestHandler("tools/call", async (req) => {
const { msg } = z.object({ msg: z.string() }).parse(req.params.arguments);
return { content: [{ type: "text", text: `echo: ${msg}` }] };
});

await server.connect(new StdioServerTransport());

03. Run it locally

bash
npx tsx src/index.ts
# should sit silent waiting on stdin — that's correct

04. Register in Claude Desktop

json
// ~/Library/Application Support/Claude/claude_desktop_config.json
{
"mcpServers": {
  "hello": {
    "command": "npx",
    "args": ["tsx", "/absolute/path/to/hello-mcp/src/index.ts"]
  }
}
}

Restart Claude Desktop. You should see a tool icon in the input bar.

05. Invoke it

In Claude Desktop chat: “Use the echo tool with msg = ‘working’”. You’ll see the JSON-RPC round trip in the UI.

Next

  • Expose filesystem tools via the official filesystem MCP
  • Deploy an SSE MCP server behind Cloudflare
Feedback · anonymous
Was this helpful?