Template MCP

v1.0.0Developer Toolsstable

A TypeScript MCP server template with Zod validation, dual transport (stdio/HTTP), and modular architecture for building MCP-compatible tools, resources, and prompts.

agentboilerplatemcpmcp-servermcp-server-template
Share:
76
Stars
0
Downloads
0
Weekly
0/5

What is Template MCP?

Template MCP is a Model Context Protocol (MCP) server that allows AI assistants like Claude, Cursor, and VS Code to typescript mcp server template with zod validation, dual transport (stdio/http), and modular architecture for building mcp-compatible tools, resources, and prompts.

A TypeScript MCP server template with Zod validation, dual transport (stdio/HTTP), and modular architecture for building MCP-compatible tools, resources, and prompts.

This server falls under the Developer Tools category on MCPgee, the world's largest MCP server directory with 33,000+ servers.

Features

  • A TypeScript MCP server template with Zod validation, dual t

Use Cases

Use as a template for building MCP servers with Zod validation.
Support dual transport (stdio/HTTP) with modular architecture.
Freddymhs

Maintainer

LicenseMIT
Languagepython
Versionv1.0.0
UpdatedMay 10, 2026
Statushealthy
Maintenanceactive

Works with

ClaudeOpenAIwindowsmacoslinux

Installation

Manual Installation

npx template

Configuration

Configuration Details

Config File

claude_desktop_config.json

Performance

Response Metrics

Response Time< 200ms
ThroughputMedium

Resource Usage

Memory UsageLow
CPU UsageLow

How to Set Up and Use Template MCP

template-mcp is a production-ready TypeScript starter kit for building Model Context Protocol servers from scratch, providing everything needed to scaffold a new MCP server in minutes rather than hours. It ships with dual transport support (stdio for local clients and Streamable HTTP for remote clients), strict TypeScript with ESM modules, Zod for tool input validation, Joi for environment variable validation at startup, Pino for stderr-safe logging, and a full test suite using Vitest with the MCP SDK in-memory transport. It is intended as a fork-and-extend template rather than a running server — developers clone it and add their own tools, resources, and prompts following the modular architecture.

Prerequisites

  • Node.js 22 or higher
  • pnpm package manager installed (npm install -g pnpm)
  • Git to clone the repository
  • An MCP-compatible client for testing (Claude Desktop, Claude Code, Cursor, VS Code Copilot)
1

Clone the template repository

Fork or clone the template-mcp repository to start your new MCP server project. This gives you the full project structure with all tooling pre-configured.

git clone https://github.com/Freddymhs/template-mcp my-mcp-server
cd my-mcp-server
2

Install dependencies

Install all project dependencies using pnpm. The project uses pnpm workspaces and lockfile for reproducible installs.

pnpm install
3

Configure environment variables

Copy the example environment file to .env and adjust the transport type, port (for HTTP mode), log level, and Node.js environment as needed.

cp .env.example .env
# Edit .env:
# MCP_TRANSPORT=stdio   # or 'http' for remote clients
# PORT=3000
# LOG_LEVEL=info
# NODE_ENV=development
4

Add your own tools to the server

Create a new tool file under src/tools/ following the existing pattern with Zod input schema, then register it in src/tools/index.ts. Each tool is a self-contained module.

# Example: src/tools/my-tool.tool.ts
# Then in src/tools/index.ts:
# import { registerMyTool } from './my-tool.tool.js';
# registerMyTool(server);
5

Build and configure your MCP client

Compile the TypeScript source and point your MCP client at the compiled output. Use the absolute path to dist/main.js in the client config.

pnpm build
6

Run tests to verify everything works

The template includes a full Vitest test suite with MCP SDK in-memory transport for testing tools without a live client. Run tests after adding new tools.

pnpm test

Template MCP Examples

Client configuration

claude_desktop_config.json entry for a server built from template-mcp, pointing at the compiled dist/main.js output.

{
  "mcpServers": {
    "template-mcp": {
      "command": "node",
      "args": ["/absolute/path/to/my-mcp-server/dist/main.js"]
    }
  }
}

Prompts to try

The template ships with a greet example tool. After adding your own tools, prompts will match your implementation.

- "Use the greet tool to say hello to Alice."
- "What tools are available in the template-mcp server?"
- "Call my_tool with param set to 'test value'."
- "List all MCP resources exposed by this server."

Troubleshooting Template MCP

pnpm build fails with TypeScript errors

Run pnpm type-check to see detailed errors. The template uses strict TypeScript so all types must be explicit. Ensure you are on Node.js 22+ and that pnpm install completed without errors before building.

MCP client cannot find the server after build

Use an absolute path to dist/main.js in the client config, not a relative path. Confirm the build succeeded and dist/main.js exists. If using HTTP transport (MCP_TRANSPORT=http), ensure the PORT is reachable and not blocked by a firewall.

Env validation fails at startup with Joi error

The template uses Joi to validate environment variables at startup and will exit immediately if required vars are missing or invalid. Check your .env file against .env.example and ensure MCP_TRANSPORT is set to either 'stdio' or 'http'.

Frequently Asked Questions about Template MCP

What is Template MCP?

Template MCP is a Model Context Protocol (MCP) server that typescript mcp server template with zod validation, dual transport (stdio/http), and modular architecture for building mcp-compatible tools, resources, and prompts. It connects AI assistants to external tools and data sources through a standardized interface.

How do I install Template MCP?

Follow the installation instructions on the Template MCP GitHub repository. Clone the repo, install dependencies, and add the server config to your AI client.

Which AI clients work with Template MCP?

Template MCP works with all major MCP-compatible AI clients including Claude Desktop, Claude Code, Cursor, VS Code (GitHub Copilot), Windsurf, and Cline.

Is Template MCP free to use?

Yes, Template MCP is open source and available under the MIT license. You can use it freely in both personal and commercial projects.

Browse More Developer Tools MCP Servers

Explore all developer tools servers available in the MCPgee directory. Each server includes setup guides for Claude, Cursor, and VS Code.

Quick Config Preview

{ "mcpServers": { "template": { "command": "npx", "args": ["-y", "template"] } } }

Add this to your claude_desktop_config.json or .cursor/mcp.json

Read the full setup guide →

Ready to use Template MCP?

Browse our complete directory of 33,000+ MCP servers, read setup guides for your editor, and start building with the Model Context Protocol.

33,000+ ServersFree & Open SourceStep-by-Step Guides