Get the FREE Ultimate OpenClaw Setup Guide โ†’

mcp-starter-template-ts

TypeScript starter template for building Model Context Protocol (MCP) servers, designed to help developers create secure and robust AI-agent-compatible services.

Installation
Run this command in your terminal to add the MCP server to Claude Code.
Run in terminal:
Command
claude mcp add --transport stdio onamfc-mcp-starter-template-ts node dist/server.js \
  --env HOST="Server host address (default localhost)" \
  --env PORT="Server port number (default 3000)" \
  --env NODE_ENV="Environment (development, production, test) (default development)" \
  --env LOG_LEVEL="Logging level (error, warn, info, debug) (default info)" \
  --env CORS_ORIGINS="Allowed CORS origins (comma-separated) (default *)" \
  --env MAX_REQUEST_SIZE="Maximum request body size (e.g., 10mb) (default 10mb)" \
  --env ENABLE_HEALTH_CHECK="Enable health check endpoint (true|false) (default true)"

How to use

This MCP server template provides a TypeScript-based foundation for building MCP servers. It exposes a set of prepared tools (such as calculator, filesystem, text-processing, and weather) that you can use to perform common tasks within the MCP ecosystem, along with resources for configuration, logs, and documentation. After building the project, start the server and interact with the built-in tools through the MCP API or CLI by sending structured tool invocation payloads. The project emphasizes type safety, robust validation, health checks, and observability, making it suitable for production-ready development and extension.

How to install

Prerequisites:

  • Node.js 18.0.0 or higher
  • npm 8.0.0 or higher (or yarn/pnpm equivalent)

Installation steps:

  1. Clone the repository git clone https://github.com/onamfc/mcp-starter-template-ts.git
  2. Navigate into the project cd mcp-starter-template-ts
  3. Install dependencies npm install

    or: yarn install or pnpm install

  4. Build the project npm run build
  5. Start the server (production) npm start
  6. (Optional) Run in development with hot reload npm run dev

Notes:

  • The server is configured via environment variables. You can create a .env file in the project root to customize PORT, HOST, LOG_LEVEL, and other settings before starting in your environment.

Additional notes

Tips and common considerations:

  • After building, the entry point is typically dist/server.js; ensure your build outputs are up to date before starting in production.
  • Environment variables control health checks, request size, and CORS behavior. Adjust ENABLE_HEALTH_CHECK, MAX_REQUEST_SIZE, and CORS_ORIGINS as needed for your deployment.
  • The template includes tooling such as calculator, filesystem, text-processing, and weather. You can extend/add new tools by following the documented patterns and registering them in the setup files.
  • Run npm test to execute unit tests and verify coverage before deploying.
  • If using Docker or other container setups, ensure the built dist directory is available inside the container image and that the entry point matches dist/server.js.

Related MCP Servers

Sponsor this space

Reach thousands of developers โ†—