Click on "Install Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@MCP Server Starter (TypeScript)show me how to add a new tool"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
MCP Server Starter (TypeScript)
A minimal, production-ready TypeScript starter template for building Model Context Protocol (MCP) servers.
π― Motivation
The Model Context Protocol (MCP) is an open protocol that standardizes how AI applications connect to data sources and tools. Think of it as "USB-C for AI" - a universal standard that allows any AI model to connect with any data source or tool through a consistent interface.
This starter template provides:
β Minimal boilerplate to get you started quickly
β Auto-loading architecture for tools, resources, and prompts
β TypeScript best practices with strict typing
β Production-ready structure that scales with your project
β Working example (echo tool) to demonstrate the pattern
Whether you're building integrations for databases, APIs, file systems, or custom business tools, this template helps you create MCP servers that can be used by any MCP-compatible client (like Claude Desktop, IDEs, or custom applications).
π Table of Contents
β¨ Features
π Auto-loading Module System - Drop new tools, resources, or prompts into their directories and they're automatically registered
π οΈ TypeScript First - Full type safety with strict TypeScript configuration
π¦ Minimal Dependencies - Only essential packages included
π§ͺ Built-in Testing - Uses Node.js native test runner
π MCP Inspector Support - Test your server with the official MCP Inspector
π Extensible Architecture - Clear patterns for adding new capabilities
π― Example Implementation - Working echo tool demonstrates the pattern
β‘ Code Generators - Hygen scaffolding for rapid module creation
π Dual Transport Support - Both stdio and HTTP (SSE + JSON-RPC) transports
π³ Docker Ready - Containerized deployment with multi-stage builds
π Prerequisites
Ensure you have Node.js version 20.11.0 or higher installed before proceeding.
Node.js >= 20.11.0
npm or yarn
Basic understanding of TypeScript
Familiarity with the Model Context Protocol concepts
π¦ Installation
Clone and Setup
Using as a Template
You can also use this as a GitHub template:
Click "Use this template" on GitHub
Create your new repository
Clone and start building your MCP server
π Quick Start
Use the MCP Inspector to test your server interactively during development!
Build the server:
npm run buildTest with MCP Inspector:
npm run inspectThis opens the MCP Inspector where you can interact with your server's tools, resources, and prompts.
Run tests:
npm test
π Transport Modes
This server supports two transport modes: stdio (default) and HTTP (Streamable SSE + JSON-RPC).
Stdio Mode (Default)
Traditional stdio transport for local development and desktop clients:
HTTP Mode (SSE + JSON-RPC)
Streamable HTTP transport for web deployments and remote access:
The HTTP transport exposes:
SSE endpoint (GET):
http://localhost:3000/mcp- For server-sent eventsJSON-RPC endpoint (POST):
http://localhost:3000/mcp- For requests
Environment Variables
Configure the server behavior using environment variables:
Variable | Description | Default |
| Transport mode: |
|
| HTTP server port (HTTP mode only) |
|
| CORS allowed origins (HTTP mode only) |
|
Configuration Examples
VS Code (mcp.json or .vscode/mcp.json)
Claude Desktop
Add to your Claude Desktop configuration:
π³ Docker Support
The server includes Docker support for easy deployment:
Quick Start with Docker
Docker Configuration
The Docker container runs in HTTP mode by default. Override settings with environment variables:
Development with Docker
Use the development profile for hot reload:
This mounts your source code and enables live reloading on port 3001.
π Project Structure
How Auto-Loading Works
Simply drop your module files into the appropriate directory (tools/, resources/, or prompts/) and they'll be automatically loaded when the server starts!
π οΈ Development Guide
Using Code Generators
The fastest way to create new modules is using the built-in Hygen generators!
This project includes Hygen scaffolding for rapid module creation. Each generator creates both the implementation file and a corresponding test file.
Generate a New Tool
You'll be prompted for:
Name: Enter in kebab-case (e.g.,
text-transform)Description: Brief description of what the tool does
Generate a New Prompt
You'll be prompted for:
Name: Enter in kebab-case (e.g.,
code-review)Description: Brief description of the prompt template
Generate a New Resource
You'll be prompted for:
Name: Enter in kebab-case (e.g.,
app-status)Description: Brief description of the resource
Command Line Usage
You can also provide parameters directly:
Generated files:
Implementation:
src/{tools|prompts|resources}/[name].tsTest:
tests/[name].test.ts
The auto-loader automatically discovers and registers all generated modules - no additional configuration needed!
Module Types Overview
Adding a New Tool
Tools are functions that can be called by the AI to perform specific actions or computations.
Tools allow your MCP server to perform actions. Create a new file in src/tools/:
Adding a Resource
Resources provide read-only access to data that can be consumed by AI clients.
Resources provide data that can be read by clients. Create a new file in src/resources/:
Adding a Prompt
Prompts are reusable templates that help structure interactions with the AI model.
Prompts are reusable prompt templates. Create a new file in src/prompts/:
π Testing with MCP Inspector
The MCP Inspector is a powerful tool for testing your server:
This command:
Builds your TypeScript code
Launches the MCP Inspector
Connects to your server
Provides an interactive UI to test tools, resources, and prompts
Interactive Development Mode
For rapid testing and development, use the interactive dev mode:
This starts an interactive REPL where you can paste JSON-RPC messages directly and see responses in real-time. Perfect for testing your MCP server during development!
JSON-RPC Examples for Dev Mode
Once you run npm run dev, you can paste these JSON-RPC messages directly.
>MCP Protocol Handshake Required
The MCP protocol requires a specific initialization sequence before you can use tools, resources, or prompts:
Initialize Request - Client sends capabilities and receives server capabilities
Initialized Notification - Client confirms it's ready (no response expected)
Why is the initialized notification needed?
It confirms the client has processed the initialization response and is ready
It enables bidirectional communication - after this, the server can send requests to the client
Without it, the server won't send notifications (like
tools/list_changed) or make requests (likesampling/createMessage)This follows a pattern similar to TCP's handshake, ensuring both parties are ready before actual communication begins
The dev server does NOT automatically perform this handshake. You must send these messages manually first.
1. Initialize Connection (Required First!)
Step 1 - Send initialize request:
Step 2 - After receiving the response, send initialized notification:
Now the server is ready to handle requests!
2. List Available Tools
3. Call the Echo Tool
4. List Resources
5. Read a Resource
6. List Prompts
7. Get a Prompt
>Using Dev Mode:
Run
npm run devto start the interactive serverCopy any JSON-RPC message above and paste it into the terminal
The server will show the response with syntax highlighting
Type
helpfor available commands orexitto quit
Important: Always send the initialize message first to establish the connection!
βοΈ Configuration
TypeScript Configuration
The project uses strict TypeScript settings for maximum type safety. Key configurations in tsconfig.json:
Target: ES2022
Module: ES2022 with Node module resolution
Strict mode enabled
Source maps for debugging
Available Scripts
Command | Description |
| Compile TypeScript to JavaScript |
| Run ESLint checks |
| Auto-fix ESLint issues |
| Type-check without building |
| Run tests |
| Run tests in watch mode |
| Launch MCP Inspector |
| Interactive development mode |
| Generate a new tool with test |
| Generate a new prompt with test |
| Generate a new resource with test |
π Integration
How MCP Integration Works
With VS Code (Recommended)
The easiest way to use your MCP server is through VS Code with MCP support extensions.
Build your server:
npm run buildOpen the project in VS Code:
code .Use the included
The project includes an
mcp.jsonfile that VS Code MCP extensions can use to automatically start your server:{ "servers": { "starter": { "type": "stdio", "command": "node", "args": ["./build/index.js"] } } }Install a VS Code MCP extension:
Open VS Code Extensions (β§βX on macOS, Ctrl+Shift+X on Windows/Linux)
Search for "MCP" or "Model Context Protocol"
Install an MCP-compatible extension
The extension will automatically detect and use your
mcp.jsonconfiguration
Themcp.json file tells VS Code how to start your MCP server. When you open a project with this file, compatible extensions will automatically recognize it as an MCP server project.
With Claude Desktop
Make sure to build your server before configuring Claude Desktop. The server must be compiled to JavaScript.
Build your server:
npm run buildAdd to Claude Desktop configuration:
WARNINGConfiguration file location varies by operating system:
macOS:
~/Library/Application Support/Claude/claude_desktop_config.jsonWindows:
%APPDATA%\Claude\claude_desktop_config.jsonLinux:
~/.config/Claude/claude_desktop_config.json
{ "mcpServers": { "my-server": { "command": "node", "args": ["/path/to/your/server/build/index.js"] } } }Restart Claude Desktop
Always use absolute paths in your configuration. Relative paths may not work correctly.
With Custom Clients
Use the MCP SDK to connect to your server:
π€ Contributing
Contributions are welcome! Please feel free to submit a Pull Request. For major changes, please open an issue first to discuss what you would like to change.
Fork the repository
Create your feature branch (
git checkout -b feature/AmazingFeature)Commit your changes (
git commit -m 'Add some AmazingFeature')Push to the branch (
git push origin feature/AmazingFeature)Open a Pull Request
π License
This project is licensed under the MIT License - see the LICENSE file for details.
π Resources
π Troubleshooting
Common issues and their solutions:
Issue | Solution |
| Ensure you've run |
Server not connecting | Check that you're using absolute paths in configuration |
Tools not loading | Verify your module exports match the |
TypeScript errors | Run |
Auto-loading fails | Check file names and ensure modules are in correct directories |
Development
β Type Safety: Use TypeScript's strict mode for catching errors early
β Modular Design: Keep tools, resources, and prompts focused on single responsibilities
β Error Handling: Always handle errors gracefully and provide meaningful messages
β Validation: Use Zod schemas to validate all inputs
β Testing: Write tests for critical functionality
Built with β€οΈ for the MCP community
Report Issues Β· Request Features Β· Documentation
Project-specific Guide (This Repository)
This project is a Fitness & Nutrition themed MCP server with ready-to-use tools and examples. Use the commands below to build, run, and inspect the server locally.
Included Tools
echo
Description: Echo back the provided text
Example call (Inspector β tools/call):
{ "name": "echo", "arguments": { "text": "Hello, MCP!" } }
generate_workout_plan
Description: Generate a weekly workout plan tailored to your goal and environment
Arguments:
goal: "fatLoss" | "muscleGain" | "boxingSkill" | "endurance"
daysPerWeek: number (2-6)
experienceLevel: "beginner" | "intermediate" | "advanced"
hasGymAccess: boolean
targetBodyParts?: ["chest" | "back" | "legs" | "shoulders" | "arms" | "core" | "fullBody"][]
Example:
{ "name": "generate_workout_plan", "arguments": { "goal": "muscleGain", "daysPerWeek": 3, "experienceLevel": "beginner", "hasGymAccess": true } }
supplement_recommendations
Description: Recommend supplements for your training goal and conditions (KR arguments)
Arguments:
λͺ©ν: "muscleGain" | "fatLoss" | "boxingSkill" | "endurance" | "recovery"
μ£ΌλΉμ΄λνμ: number (2-7)
κ΄μ λΆμν΅μ¦: boolean
νΌλ‘ν볡νμ_μ¬λΆ: boolean
budget?: "low" | "medium" | "high"
Example:
{ "name": "supplement_recommendations", "arguments": { "λͺ©ν": "fatLoss", "μ£ΌλΉ_μ΄λ_νμ": 4, "κ΄μ _λΆμ_ν΅μ¦": false, "νΌλ‘_ν볡_νμ_μ¬λΆ": true, "budget": "medium" } }
Included Resources
timestamp://current/iso
system-info://host/env
Example (Inspector β resources/read):
Included Prompts
generate-readme
code-analyzer
Example (Inspector β prompts/get):
How to Run (Windows/PowerShell)
Prerequisites:
Node.js >= 20.11.0
Build:
Stdio mode (default):
Interactive dev REPL:
HTTP mode (SSE + JSON-RPC):
Using MCP Inspector
Inspect a stdio server:
Inspect an HTTP server:
Windows Notes / Troubleshooting
Error: "AbortController is not defined" when running Inspector
Cause: Running under an older Node version (< 18)
Fix: Use Node 20+ (this repo recommends >= 20.11.0)
Check versions/paths:
node -v where node
νκ΅μ΄ λ²μ
π― λκΈ°(Motivation)
Model Context Protocol(MCP)λ AI μ ν리μΌμ΄μ μ΄ λ°μ΄ν° μμ€μ λꡬμ μ°κ²°νλ λ°©μμ νμ€ννλ κ°λ°©ν νλ‘ν μ½μ λλ€. μ½κ² λ§ν΄, AI μΈκ³μ βUSBβCβμ κ°μμ μ΄λ€ AIλ μΌκ΄λ μΈν°νμ΄μ€λ‘ μ΄λ€ λꡬλ λ°μ΄ν° μμ€μ μ°κ²°ν μ μκ² ν©λλ€.
μ΄ μ€νν° ν νλ¦Ώμ λ€μμ μ 곡ν©λλ€:
β μ΅μνμ 보μΌλ¬νλ μ΄νΈλ‘ λΉ λ₯Έ μμ
β λꡬ/리μμ€/ν둬ννΈ μλ λ‘λ© μν€ν μ²
β μ격ν νμ μ TypeScript λ² μ€νΈ νλν°μ€
β νμ₯ κ°λ₯ν νλ‘λμ μ€λΉ ꡬ쑰
β λμνλ μμ (echo ν΄) ν¬ν¨
MCP μλ²λ λ°μ΄ν°λ² μ΄μ€, API, νμΌ μμ€ν , 컀μ€ν λΉμ¦λμ€ λꡬ λ±κ³Όμ ν΅ν©μ μ ν©νλ©°, Claude Desktopμ΄λ IDE, λλ 컀μ€ν μ ν리μΌμ΄μ λ± MCP νΈν ν΄λΌμ΄μΈνΈμμ μ¬μ©ν μ μμ΅λλ€.
β¨ κΈ°λ₯(Features)
π μλ λ‘λ© λͺ¨λ μμ€ν : λλ ν°λ¦¬μ νμΌμ μΆκ°νλ©΄ μλ λ±λ‘
π οΈ TypeScript First: μ격ν TS μ€μ μΌλ‘ μμ ν νμ μμ μ±
π¦ μ΅μ μμ‘΄μ±
π§ͺ Node.js λ΄μ₯ ν μ€νΈ λ¬λ μ¬μ©
π MCP Inspector μ§μ
π νμ₯ κ°λ₯ν μν€ν μ²
π― λμ μμ μ 곡(echo)
β‘ μ½λ μ λλ μ΄ν°(Hygen) λ΄μ₯
π μ΄μ€ μ μ‘ μ§μ(stdio, HTTP/SSE+JSONβRPC)
π³ Docker μ§μ
π μ¬μ μ€λΉ(Prerequisites)
Node.js >= 20.11.0
npm λλ yarn
κΈ°λ³Έμ μΈ TypeScript μ΄ν΄
MCP κ°λ μ λν μΉμν¨
μ§ν μ Node.js 20.11.0 μ΄μμ΄ μ€μΉλμ΄ μμ΄μΌ ν©λλ€.
π¦ μ€μΉ(Installation)
λλ GitHub ν νλ¦ΏμΌλ‘ μ¬μ©ν μ μμ΅λλ€(βUse this templateβ β μ μ μ₯μ μμ± β ν΄λ‘ ).
π λΉ λ₯Έ μμ(Quick Start)
κ°λ° μ€μλ MCP Inspectorλ‘ μλ²λ₯Ό μνΈμμ© λ°©μμΌλ‘ ν
μ€νΈνμΈμ!
λΉλ:
MCP Inspectorλ‘ ν μ€νΈ:
ν μ€νΈ μ€ν:
π μ μ‘ λͺ¨λ(Transport Modes)
μ΄ μλ²λ λ λͺ¨λλ₯Ό μ§μν©λλ€: κΈ°λ³Έ stdio, κ·Έλ¦¬κ³ HTTP(Streamable SSE + JSONβRPC).
Stdio λͺ¨λ(κΈ°λ³Έ)
HTTP λͺ¨λ(SSE + JSONβRPC)
λ ΈμΆ μλν¬μΈνΈ:
SSE(GET):
http://localhost:3000/mcpJSONβRPC(POST):
http://localhost:3000/mcp
νκ²½ λ³μ(Environment Variables)
λ³μ | μ€λͺ | κΈ°λ³Έκ° |
| μ μ‘ λͺ¨λ: |
|
| HTTP μλ² ν¬νΈ(HTTP λͺ¨λλ§) |
|
| CORS νμ© μ€λ¦¬μ§(HTTP λͺ¨λλ§) |
|
κ΅¬μ± μμ(Configuration Examples)
VS Code (mcp.json λλ .vscode/mcp.json)
Claude Desktop
π³ Docker μ§μ(Docker Support)
λΉ λ₯Έ μμ:
λλ:
νκ²½ λ³μλ‘ μ€μ μ€λ²λΌμ΄λ:
κ°λ° νλ‘ν(ν« λ¦¬λ‘λ):
π νλ‘μ νΈ κ΅¬μ‘°(Project Structure)
μλ λ‘λ© κ°λ :
π οΈ κ°λ° κ°μ΄λ(Development Guide)
μ½λ μ λλ μ΄ν° μ¬μ©(Using Code Generators)
μ§μ νλΌλ―Έν° μ λ¬:
μμ±λ¬Ό:
ꡬν:
src/{tools|prompts|resources}/[name].tsν μ€νΈ:
tests/[name].test.tsμλ λ‘λ©μ΄ μμ μ μλμΌλ‘ λ±λ‘ν©λλ€.
μ ν΄ μΆκ°(Adding a New Tool)
μλ μμμ λμΌν ν¨ν΄μΌλ‘ ꡬν νμΌμ μΆκ°νλ©΄ λ©λλ€(μ½λ λΈλ‘μ μλ¬Έ μ μ§).
리μμ€ μΆκ°(Adding a Resource)
ν둬ννΈ μΆκ°(Adding a Prompt)
π MCP Inspectorλ‘ ν μ€νΈ(Testing with MCP Inspector)
μΈν°λν°λΈ κ°λ° λͺ¨λ:
κ°λ° λͺ¨λμμμ JSONβRPC μμ(νΈλμ °μ΄ν¬ νμ):
Initialize μμ²
Initialized μλ¦Ό
λꡬ λͺ©λ‘:
Echo νΈμΆ:
βοΈ κ΅¬μ±(Configuration)
TypeScript μ£Όμ μ€μ :
Target: ES2022
Module: ES2022 + Node ν΄μ
Strict λͺ¨λ
μμ€λ§΅
μ¬μ© κ°λ₯ν μ€ν¬λ¦½νΈ(Available Scripts)
λͺ λ Ή | μ€λͺ |
| TypeScript μ»΄νμΌ |
| ESLint μ²΄ν¬ |
| ESLint μλ μμ |
| λΉλ μμ΄ νμ μ²΄ν¬ |
| ν μ€νΈ μ€ν |
| μμΉ λͺ¨λ ν μ€νΈ |
| MCP Inspector μ€ν |
| μνΈμμ© κ°λ° λͺ¨λ |
| μ ν΄ μμ± |
| μ ν둬ννΈ μμ± |
| μ 리μμ€ μμ± |
π ν΅ν©(Integration)
λμ κ°μ:
VS Code μ°λ(κΆμ₯)
λΉλ:
νλ‘μ νΈ μ΄κΈ°:
ν¬ν¨λ
mcp.jsonμ¬μ©(μλ μΈμ)MCP νμ₯ μ€μΉ λ° μ¬μ©
Claude Desktop
λΉλ:
μ΄μ체μ λ³ μ€μ νμΌ μμΉμ κ΅¬μ± μΆκ°(μ λκ²½λ‘ κΆμ₯)
μ± μ¬μμ
컀μ€ν ν΄λΌμ΄μΈνΈ
π€ Contributing
κΈ°μ¬λ μΈμ λ νμν©λλ€! ν° λ³κ²½ μ μλ λ¨Όμ μ΄μλ₯Ό μ΄μ΄ λ°©ν₯μ λ Όμν΄ μ£ΌμΈμ.
π License
λ³Έ νλ‘μ νΈλ MIT Licenseλ₯Ό λ°λ¦
λλ€. μμΈν λ΄μ©μ LICENSE νμΌμ μ°Έκ³ νμΈμ.
π μ°Έκ³ μλ£(Resources)
MCP λ¬Έμ:
https://modelcontextprotocol.ioMCP SDK μ μ₯μ:
https://github.com/modelcontextprotocol/sdkMCP μλ² λͺ¨μ:
https://github.com/modelcontextprotocol/serversMCP Inspector:
https://github.com/modelcontextprotocol/inspector
π λ¬Έμ ν΄κ²°(Troubleshooting)
μμ£Ό λ°μνλ μ΄μμ ν΄κ²° λ°©λ²:
μ΄μ | ν΄κ²° λ°©λ² |
| μ€ν μ |
μλ² μ°κ²° μ€ν¨ | μ€μ μ μ λκ²½λ‘ μ¬μ© μ¬λΆ νμΈ |
λκ΅¬κ° λ‘λλμ§ μμ |
|
TypeScript μ€λ₯ |
|
μλ λ‘λ© μ€ν¨ | νμΌλͺ /κ²½λ‘κ° μ¬λ°λ₯Έμ§ νμΈ |
κ°λ° ν:
β νμ μμ μ±: TS strict λͺ¨λ μ κ·Ή νμ©
β λͺ¨λν: ν΄/리μμ€/ν둬ννΈλ λ¨μΌ μ± μ μμΉ
β μλ¬ μ²λ¦¬: μΉμ νκ³ μ μλ―Έν λ©μμ§
β κ²μ¦: λͺ¨λ μ λ ₯μ Zodλ‘ κ²μ¦
β ν μ€νΈ: ν΅μ¬ κΈ°λ₯μλ λ°λμ ν μ€νΈ
νλ‘μ νΈ μ μ© κ°μ΄λ(μμ½)
μ΄ μ μ₯μλ νΌνΈλμ€/μμ ν λ§ MCP μλ²μ λλ€.
ν¬ν¨ λꡬ
echo: μ λ ₯ ν μ€νΈλ₯Ό κ·Έλλ‘ λ°ν
generate_workout_plan: λͺ©ν/μλ ¨λ/μ£ΌλΉ νμ/ν¬μ€μ₯ μ λ¬΄λ‘ λ£¨ν΄ μμ±
supplement_recommendations: λͺ©ν/μμ°/κ΄μ /νΌλ‘ κΈ°μ€ μμμ μΆμ²(μΈμ: νκ΅μ΄ ν€)
ν¬ν¨ 리μμ€
timestamp://current/iso,system-info://host/env
ν¬ν¨ ν둬ννΈ
generate-readme,code-analyzer
μ€ν(Windows/PowerShell):
Inspector:
Windows μ°Έκ³ :
"AbortController is not defined" λ°μ μ Node 20+λ‘ μ ννμΈμ.