SamMorrowDrums

MCP TypeScript Starter

Community SamMorrowDrums
Updated

A minimal Model Context Protocol (MCP) server in TypeScript with hello tool, markdown resource, and prompt. Includes VS Code/devcontainer setup and documentation.

MCP TypeScript Starter

CITypeScriptNode.jsLicense: MITMCP

A feature-complete Model Context Protocol (MCP) server template in TypeScript. This starter demonstrates all major MCP features with clean, production-ready code.

๐Ÿ“š Documentation

โœจ Features

Category Feature Description
Tools hello Basic tool with annotations
get_weather Tool with structured output schema
ask_llm Tool that invokes LLM sampling
long_task Tool with 5-second progress updates
load_bonus_tool Dynamically loads a new tool
Resources info://about Static informational resource
file://example.md File-based markdown resource
Templates greeting://{name} Personalized greeting
data://items/{id} Data lookup by ID
Prompts greet Greeting in various styles
code_review Code review with focus areas

๐Ÿš€ Quick Start

Prerequisites

Installation

# Clone the repository
git clone https://github.com/SamMorrowDrums/mcp-typescript-starter.git
cd mcp-typescript-starter

# Install dependencies
npm install

# Build
npm run build

Running the Server

stdio transport (for local development):

npm run start:stdio

HTTP transport (for remote/web deployment):

npm run start:http
# Server runs on http://localhost:3000

๐Ÿ”ง VS Code Integration

This project includes VS Code configuration for seamless development:

  1. Open the project in VS Code
  2. The MCP configuration is in .vscode/mcp.json
  3. Build with Ctrl+Shift+B (or Cmd+Shift+B on Mac)
  4. Test the server using VS Code's MCP tools

Using DevContainers

  1. Install the Dev Containers extension
  2. Open command palette: "Dev Containers: Reopen in Container"
  3. Everything is pre-configured and ready to use!

๐Ÿ“ Project Structure

.
โ”œโ”€โ”€ src/
โ”‚   โ”œโ”€โ”€ tools.ts       # Tool definitions (hello, get_weather, ask_llm, etc.)
โ”‚   โ”œโ”€โ”€ resources.ts   # Resource and template definitions
โ”‚   โ”œโ”€โ”€ prompts.ts     # Prompt definitions
โ”‚   โ”œโ”€โ”€ server.ts      # Server orchestration (combines all modules)
โ”‚   โ”œโ”€โ”€ stdio.ts       # stdio transport entrypoint
โ”‚   โ””โ”€โ”€ http.ts        # HTTP transport entrypoint
โ”œโ”€โ”€ .vscode/
โ”‚   โ”œโ”€โ”€ mcp.json       # MCP server configuration
โ”‚   โ”œโ”€โ”€ tasks.json     # Build/run tasks
โ”‚   โ””โ”€โ”€ extensions.json
โ”œโ”€โ”€ .devcontainer/
โ”‚   โ””โ”€โ”€ devcontainer.json
โ”œโ”€โ”€ package.json
โ”œโ”€โ”€ tsconfig.json
โ”œโ”€โ”€ .prettierrc        # Prettier configuration
โ””โ”€โ”€ eslint.config.js

๐Ÿ› ๏ธ Development

# Development mode with live reload
npm run dev

# Build for production
npm run build

# Format code
npm run format

# Lint
npm run lint

# Clean build
npm run clean && npm run build

Live Reload

The npm run dev command uses tsx watch for instant reloads during development.Changes to any .ts file will automatically restart the server.

๐Ÿ” MCP Inspector

The MCP Inspector is an essential development tool for testing and debugging MCP servers.

Running Inspector

npx @modelcontextprotocol/inspector -- npx tsx src/stdio.ts

What Inspector Provides

  • Tools Tab: List and invoke all registered tools with parameters
  • Resources Tab: Browse and read resources and templates
  • Prompts Tab: View and test prompt templates
  • Logs Tab: See JSON-RPC messages between client and server
  • Schema Validation: Verify tool input/output schemas

Debugging Tips

  1. Start Inspector before connecting your IDE/client
  2. Use the "Logs" tab to see exact request/response payloads
  3. Test tool annotations are exposed correctly
  4. Verify progress notifications appear for long_task

๐Ÿ“– Feature Examples

Tool with Annotations

server.tool(
  "hello",
  {
    title: "Say Hello",
    description: "A friendly greeting tool",
    annotations: { readOnlyHint: true },
  },
  { name: z.string() },
  async ({ name }) => ({
    content: [{ type: "text", text: `Hello, ${name}!` }],
  })
);

Resource Template

server.resourceTemplate(
  "greeting://{name}",
  { name: "Personalized Greeting", mimeType: "text/plain" },
  async ({ name }) => ({
    contents: [{
      uri: `greeting://${name}`,
      text: `Hello, ${name}!`,
    }],
  })
);

Tool with Progress Updates

server.tool(
  "long_task",
  { title: "Long Task" },
  { taskName: z.string() },
  async ({ taskName }, { sendProgress }) => {
    for (let i = 0; i < 5; i++) {
      await sendProgress({ progress: i / 5, total: 1.0 });
      await sleep(1000);
    }
    return { content: [{ type: "text", text: "Done!" }] };
  }
);

๐Ÿ” Environment Variables

Copy .env.example to .env and configure:

cp .env.example .env
Variable Description Default
PORT HTTP server port 3000

๐Ÿค Contributing

Contributions welcome! Please ensure your changes maintain feature parity with other language starters.

๐Ÿ“„ License

MIT License - see LICENSE for details.

MCP Server ยท Populars

MCP Server ยท New

    reticlehq

    reticle

    AI agents can generate code, but still struggle to understand what they build. Reticle brings Jev-style machine-native runtime perception to web & desktop applications.

    Community reticlehq
    tubeagentkit

    YouTube MCP Server: Transcripts, Search, Channels & Playlists

    YouTube MCP server: get YouTube video transcripts, search YouTube, browse channels and playlists from Claude, ChatGPT, Cursor and VS Code. Remote, free tier.

    Community tubeagentkit
    lrvx

    lrvx

    Framework for building trading systems

    Community lrvx
    koda-ai-studio

    agent-bom

    Open security scanner and self-hosted control plane for AI, MCP, and cloud. One evidence model โ€” run scans in your environment, centralize findings, govern in your VPC.

    Community koda-ai-studio
    DenRakEiw

    Scumble

    Free, open-source desktop editor for AI inpainting: select, prompt, get a colour-matched layer. FLUX 3 Image, FLUX.2, GPT Image, Nano Banana, Seedream and Qwen through your API key or your own ComfyUI. Layers, PSD export, MCP.

    Community DenRakEiw