SM

sammorrowdrums/mcp-typescript-starter

开发工具

本页由 AI 翻译,技术细节请以原文为准。 查看原文

8 stars 19 forks 质量 78 趋势 36MIT

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

概览

A feature-complete Model Context Protocol (MCP) server template in TypeScript. This starter demonstrates all major MCP features with clean, production-ready code. - Model Context Protocol - TypeScript SDK - Building MCP Servers 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 1. Install the Dev Containers extension 2. Open command palette: "Dev Containers: Reopen in Container" 3. Everything is pre-configured and ready to use! The npm run dev command uses tsx watch for instant reloads during development. Changes to any .ts file will automatically restart the server. The MCP Inspector is an essential development tool for testing and debugging MCP servers.

README

以下为原文 README 节选,完整内容请查看原文。

MCP TypeScript Starter

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.)
在 GitHub 查看完整 README

安装

npx @modelcontextprotocol/inspector -- npx tsx src/stdio.ts
新手?先看 mcpskill.org 教程 →