Most MCP servers I see in the wild start as a quick script and stay that way โ no validation, no structured logging, no tests, and a deploy story that means shipping node_modules around.
I got tired of rebuilding the same scaffolding every time a client project needed a Model Context Protocol server, so I open-sourced the template I now start every one from: ๐ mcp-server-template
It's a production-ready TypeScript/Node.js foundation for building MCP servers that connect AI agents like Claude Desktop and Cursor to your tools, data, and workflows.
๐๐ฒ๐๐๐ถ๐ป๐ด ๐๐๐ฎ๐ฟ๐๐ฒ๐ฑ ๐๐ฎ๐ธ๐ฒ๐ ๐ณ๐ผ๐๐ฟ ๐ฐ๐ผ๐บ๐บ๐ฎ๐ป๐ฑ๐:
git clone https://github.com/qmmughal/mcp-server-template.git
cd mcp-server-template && npm install
cp .env.example .env
npm run dev
That spins up a working server in watch mode. npm test runs the Vitest suite, npm run build bundles everything into a single dist/index.js with esbuild โ no node_modules to deploy.
๐ช๐ต๐ฎ๐ ๐ฎ ๐๐ผ๐ผ๐น ๐ฎ๐ฐ๐๐๐ฎ๐น๐น๐ ๐น๐ผ๐ผ๐ธ๐ ๐น๐ถ๐ธ๐ฒ:
Every tool gets a Zod schema, a definition, and a handler โ so a malformed AI payload gets rejected with a clean error instead of crashing your process:
const schema = z.object({
text: z.string().describe("The text to process"),
repeat: z.number().int().min(1).max(10).optional()
});
export async function handleExampleTool(args: unknown, service: ExampleService) {
return withErrorHandling("process_text", async () => {
const { text, repeat } = validateArgs(schema, args);
const result = await service.processText(text, repeat);
return { content: [{ type: "text", text: result }] };
});
}
๐๐ ๐๐ฒ๐ป๐ฑ๐ถ๐ป๐ด ๐ถ๐ ๐ณ๐ผ๐ฟ ๐๐ผ๐๐ฟ ๐ผ๐๐ป ๐๐ผ๐ผ๐น๐:
Structured pino logging routes safely to stderr throughout, so it never corrupts the MCP stdio transport regardless of what you add.
When you're ready to ship, tag a release and a GitHub Actions workflow publishes to both npm and the MCP Registry automatically:
git tag v1.0.0 && git push origin v1.0.0
The goal is simple โ spend your time on the logic that makes your MCP server useful, not on re-solving logging, validation, and bundling for the fifth time.
It's MIT licensed and live on GitHub now. If you're building agentic AI integrations, I'd love feedback or a star:
๐ github.com/qmmughal/mcp-server-template