# Building MCP servers for Claude & Cursor? Here's a starting point.

> Source: <https://dev.to/qmmughal/building-mcp-servers-for-claude-cursor-heres-a-starting-point-2flm>
> Published: 2026-07-26 06:21:09+00:00

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:

``` js
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
