How to Build Your First MCP Server in 10 Minutes
You keep hearing about MCP servers but every tutorial throws you into multi-agent swarms and complex architectures. Here's the simplest possible MCP server -- one file, one tool, fully runnable in ...

Source: DEV Community
You keep hearing about MCP servers but every tutorial throws you into multi-agent swarms and complex architectures. Here's the simplest possible MCP server -- one file, one tool, fully runnable in 10 minutes. The Code Create a new project and install the SDK: mkdir my-mcp-server && cd my-mcp-server npm init -y npm install @modelcontextprotocol/sdk zod Create server.ts: import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js"; import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js"; import { z } from "zod"; const server = new McpServer({ name: "weather-server", version: "1.0.0", }); server.registerTool( "get-weather", { title: "Get Weather", description: "Get current weather for a city", inputSchema: z.object({ city: z.string().describe("City name"), }), }, async ({ city }) => { const res = await fetch( `https://wttr.in/${encodeURIComponent(city)}?format=j1` ); const data = await res.json(); const current = data.current_condition[0]; return