MCP Server Template MCP Server

1

Add it to Claude Code

Run this in a terminal.

Run in terminal
claude mcp add mcp-server-template-4b79 -- npx -y my-mcp-server
README.md

A starter template for building MCP servers in TypeScript

MCP Server Template

A starter template for building MCP (Model Context Protocol) servers in TypeScript

What You Get

  • A working MCP server with an example hello tool
  • TypeScript with ES modules
  • Testing with Vitest
  • Linting (ESLint) and formatting (Prettier)
  • CI pipeline and npm publishing workflow
  • VS Code, Claude Desktop, and Cursor configuration examples
┌─────────────────┐     ┌────────────┐     ┌──────────────────┐
│  AI Assistant    │────▶│ MCP Client │────▶│ Your MCP Server  │
│ (Copilot/Claude) │◀────│            │◀────│                  │
└─────────────────┘     └────────────┘     └──────────────────┘

Quick Start

1. Create your project

npx -y degit matracey/mcp-server-template my-mcp-server
cd my-mcp-server
npm install

2. Customize

  • Update name, description, and bin in package.json
  • Replace the example hello tool in src/server.ts with your own tools
  • Update the server name/version in src/server.ts

3. Build and test

npm run build
npm test

4. Run locally

npm run dev    # Run with auto-restart on file changes
npm start      # Run the built version

Adding Tools

Edit src/server.ts and register a new tool:

server.tool(
  'my_tool',
  'Description of what this tool does.',
  {
    param: z.string().describe('Parameter description'),
  },
  async ({ param }) => {
    return {
      content: [{ type: 'text' as const, text: `Result: ${param}` }],
    }
  }
)

The template includes an example hello tool to demonstrate the pattern.

Client Configuration

Once published (or running locally), configure your AI client:

VS Code (GitHub Copilot)

Add to .vscode/mcp.json:

{
  "servers": {
    "my-server": {
      "type": "stdio",
      "command": "npx",
      "args": ["-y", "my-mcp-server"]
    }
  }
}

Claude Desktop

Add to claude_desktop_config.json:

{
  "mcpServers": {
    "my-server": {
      "command": "npx",
      "args": ["-y", "my-mcp-server"]
    }
  }
}

Cursor

Add to .cursor/mcp.json:

{
  "mcpServers": {
    "my-server": {
      "command": "npx",
      "args": ["-y", "my-mcp-server"]
    }
  }
}

Replace my-mcp-server with your published package name.

Project Structure

src/
├── index.ts          # Entry point — stdio transport setup
├── server.ts         # MCP server & tool definitions
├── __tests__/        # Tests (vitest)
└── data/             # Static data (if needed)
scripts/              # Dev-time scripts

Development

Prerequisites

  • Node.js >= 20
  • npm

Commands

npm run build           # TypeScript compilation
npm test                # Run tests
npm run test:watch      # Watch mode
npm run test:coverage   # With coverage report
npm run dev             # Run with auto-restart on changes
npm run validate        # Run all CI checks (format, lint, build, test)

Contributing

Contributions are welcome! Please see CONTRIBUTING.md for guidelines.

License

MIT — see LICENSE for details.

Tools (1)

helloAn example tool to demonstrate the pattern.

Configuration

claude_desktop_config.json
{"mcpServers": {"my-server": {"command": "npx", "args": ["-y", "my-mcp-server"]}}}

Try it

Run the hello tool to verify the server is working.
Help me modify the server.ts file to add a new tool for file system access.
How do I run the tests for this MCP server using vitest?

Frequently Asked Questions

What are the key features of MCP Server Template?

TypeScript support with ES modules. Built-in testing with Vitest. Linting and formatting with ESLint and Prettier. CI pipeline and npm publishing workflow. Pre-configured for Claude Desktop, VS Code, and Cursor.

What can I use MCP Server Template for?

Rapidly prototyping new MCP server ideas in TypeScript. Standardizing development workflows for AI assistant integrations. Creating custom tools for Claude Desktop or Cursor.

How do I install MCP Server Template?

Install MCP Server Template by running: npx -y degit matracey/mcp-server-template my-mcp-server

What MCP clients work with MCP Server Template?

MCP Server Template works with any MCP-compatible client including Claude Desktop, Claude Code, Cursor, and other editors with MCP support.

Turn this server into reusable context

Keep MCP Server Template docs, env vars, and workflow notes in Conare so your agent carries them across sessions.

Need the old visual installer? Open Conare IDE.
Open Conare