MCP Server Starter
A production-ready starter kit for building Model Context Protocol servers in TypeScript with validated config, modular structure, and full test suite.
README
MCP Server Starter (TypeScript)
A production-ready starter kit for building Model Context Protocol (MCP) servers in TypeScript. Clone it, add your tools, ship. Everything you'd otherwise spend a day wiring up is already here:
- ✅ Typed, validated config from environment variables (zod) — fails fast on bad input
- ✅ Clean modular structure for tools, resources and prompts — add a file, register it, done
- ✅ Three reference tools (
echo,calculator,fetch_url) showing input validation, error handling, and safe network I/O with a timeout + host allowlist - ✅ Resource and prompt examples wired end to end
- ✅ stderr-only structured logger (never corrupts the stdio JSON-RPC stream — a common footgun)
- ✅ Full test suite (Vitest) including an in-memory client↔server round-trip test
- ✅ Docker multi-stage build and GitHub Actions CI across Node 18/20/22
- ✅ Graceful shutdown on SIGINT/SIGTERM
- ✅ MIT licensed — use it in commercial projects freely
Quick start
npm install
npm run build
npm start # runs the MCP server over stdio
Develop with hot reload:
npm run dev
Run the test suite and type checks:
npm test
npm run typecheck
Inspect it interactively with the official MCP Inspector:
npm run inspect
Use it with Claude Desktop / any MCP client
After npm run build, add this to your client's MCP config (e.g. Claude Desktop's claude_desktop_config.json):
{
"mcpServers": {
"starter": {
"command": "node",
"args": ["/absolute/path/to/mcp-server-starter/dist/index.js"]
}
}
}
Project layout
src/
index.ts # entrypoint: loads config, wires stdio transport, handles shutdown
server.ts # builds the McpServer and registers everything
config.ts # zod-validated environment config
logger.ts # structured stderr logger
tools/ # one file per tool + a registrar (index.ts)
resources/ # read-only content exposed to the client
prompts/ # reusable prompt templates
test/ # vitest unit + end-to-end tests
Dockerfile # multi-stage production image
.github/workflows/ # CI
Add your own tool
- Create
src/tools/myTool.tsexporting aToolModule(copyecho.ts). - Add it to the
toolsarray insrc/tools/index.ts. - Add a test in
test/tools.test.ts.
That's the whole loop. The ToolModule type keeps the input schema, metadata and handler together and type-checked.
Configuration
All settings are optional and read from the environment (see .env.example):
| Variable | Default | Description |
|---|---|---|
MCP_SERVER_NAME |
mcp-server-starter |
Name reported to clients |
MCP_SERVER_VERSION |
1.0.0 |
Version reported to clients |
LOG_LEVEL |
info |
debug | info | warn | error |
HTTP_TIMEOUT_MS |
10000 |
Timeout for the fetch_url tool |
ALLOWED_FETCH_HOSTS |
(empty = all) | Comma-separated host allowlist for fetch_url |
Docker
docker build -t mcp-server-starter .
docker run --rm -i mcp-server-starter
License
MIT — see LICENSE.
Recommended Servers
playwright-mcp
A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.
Audiense Insights MCP Server
Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.
Magic Component Platform (MCP)
An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.
VeyraX MCP
Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.
graphlit-mcp-server
The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.
Kagi MCP Server
An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.
Neon Database
MCP server for interacting with Neon Management API and databases
Exa Search
A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.
Qdrant Server
This repository is an example of how to create a MCP server for Qdrant, a vector search engine.
E2B
Using MCP to run code via e2b.