본문으로 건너뛰기
Skillpedia
일반 코딩40k · #7456

typescript-mcp-server-generator

하는 일

이 생성기는 Model Context Protocol(MCP)을 사용해 통신하는 완전한 TypeScript 서버 프로젝트를 만듭니다. 최신 SDK 버전을 사용해 서버가 올바르게 작동하도록 필요한 도구와 구조를 설정합니다.

사용하는 경우

  • ✓새 TypeScript MCP 서버 프로젝트를 시작할 때.
  • ✓모범 사례와 최신 의존성으로 구성된 MCP 서버가 필요할 때.
  • ✓데이터 검증을 포함해 MCP 서버와 상호작용하는 도구를 만들고 싶을 때.

스킬 링크

https://github.com/github/awesome-copilot/blob/main/skills/typescript-mcp-server-generator/SKILL.md

복사해서 AI(Claude, ChatGPT, Cursor)에 붙여넣고 지침을 따르도록 요청하세요.

사용 방법

가장 쉬운 방법입니다. 메시지를 복사해 AI에 붙여넣으세요. AI가 스킬을 읽고 지침을 따릅니다.

바로 붙여넣을 수 있는 메시지

Use this skill to help me: https://github.com/github/awesome-copilot/blob/main/skills/typescript-mcp-server-generator/SKILL.md Read the SKILL.md file at that link and follow its instructions for my task.
AI가 이런 스킬을 알아서 찾아 쓰길 원하시나요?무료 Skillpedia MCP를 설치하세요. 한 줄이면 작업마다 스킬 15,000+개 중에서 검색합니다.1분 만에 설치 →

AI에게 요청하는 예시

“Express와 함께 HTTP 전송 방식을 사용하는 TypeScript MCP 서버를 생성하고, 사용자에게 인사하는 도구를 포함해 주세요.”

매주 새 스킬 5개. 읽는 데 1분.

작동 방식

Node.js 프로젝트를 TypeScript로 설정하고, 올바른 MCP v2 라이브러리를 설치한 뒤 서버의 기본 구조를 정의합니다. HTTP 서버와 표준 입출력(stdio)으로 통신하는 서버 중에서 고를 수 있습니다.

기술 내용 (원본 SKILL.md)

작성자의 영어 원문을 GitHub에서 그대로 가져왔습니다.

Generate TypeScript MCP Server

Create a complete Model Context Protocol (MCP) server in TypeScript using the MCP TypeScript SDK v2 with the following specifications:

Requirements

  1. Project Structure: Create a new TypeScript/Node.js project with proper directory structure
  2. NPM Packages: The v1 monolithic @modelcontextprotocol/sdk package is retired. Use the focused v2 packages:
    • @modelcontextprotocol/server — server implementation (stdio transport via the @modelcontextprotocol/server/stdio subpath)
    • @modelcontextprotocol/node — Node HTTP transport (NodeStreamableHTTPServerTransport), or a framework adapter: @modelcontextprotocol/express, @modelcontextprotocol/hono, @modelcontextprotocol/fastify — each adapter requires its peer framework to be installed alongside it (e.g. @modelcontextprotocol/express + express)
    • @modelcontextprotocol/core — shared protocol schemas (import *Schema constants from here, not from sdk/types.js)
    • zod@^4.2 — v2 requires Zod 4.2+; do not use zod@3
  3. Runtime: Node.js 20+ (v2 minimum); ESM-first with "type": "module" (a CommonJS build is also shipped, so require() works if needed)
  4. Server Type: Choose between HTTP (Streamable HTTP transport) or stdio-based server. SSE and WebSocket transports were removed in v2 — do not generate them.
  5. Tools: Create at least one useful tool with proper schema validation
  6. Error Handling: Include comprehensive error handling and validation

Implementation Details

Project Setup

  • Initialize with npm init and create package.json
  • Install dependencies: @modelcontextprotocol/server, zod@^4.2, and the transport package — @modelcontextprotocol/node for plain Node HTTP, or a framework adapter together with its peer framework (e.g. npm install @modelcontextprotocol/express express)
  • Configure TypeScript with ES modules: "type": "module" in package.json
  • Add dev dependencies: tsx or ts-node for development
  • Create proper .gitignore file

Server Configuration

  • Use McpServer class from @modelcontextprotocol/server for high-level implementation
  • Set server name and version
  • Choose the appropriate transport:
    • HTTP (Node): NodeStreamableHTTPServerTransport from @modelcontextprotocol/node
    • HTTP (Web Standard runtimes): WebStandardStreamableHTTPServerTransport from @modelcontextprotocol/server
    • stdio: StdioServerTransport from @modelcontextprotocol/server/stdio
  • For HTTP: prefer a framework adapter (@modelcontextprotocol/express, etc.) with proper middleware and error handling
  • Note that v2 uses Web Standard Headers/Request types; read headers with ctx.http?.req?.headers.get('x-custom')

Tool Implementation

  • Use registerTool() with a config object — v1 variadic .tool() signatures are gone:
    server.registerTool('greet', {
      description: 'Greet user',
      inputSchema: z.object({ name: z.string() })
    }, async ({ name }, ctx) => {
      return { content: [{ type: 'text', text: `Hello, ${name}!` }] };
    });
    
  • Schemas must be full Zod objects (z.object({...})) — raw shape objects ({ name: z.string() }) are deprecated
  • Provide clear title and description fields
  • Return both content and structuredContent in results
  • The handler's second parameter is a structured ctx object (replaces v1 extra): ctx.mcpReq.signal, ctx.mcpReq.id, ctx.mcpReq.send(...), ctx.mcpReq.notify(...)
  • Implement proper error handling with try-catch blocks; use the v2 error hierarchy (ProtocolError, SdkError, SdkHttpError with .status) instead of v1 McpError/StreamableHTTPError
  • Support async operations where appropriate

Resource/Prompt Setup (Optional)

  • Add resources using registerResource() with ResourceTemplate for dynamic URIs
  • Add prompts using registerPrompt() with argument schemas (same config-object style as registerTool())
  • Consider adding completion support for better UX; note the v2 completable() wrapper order: completable(z.string(), callback).optional() (optional applied outside)

Code Quality

  • Use TypeScript for type safety
  • Follow async/await patterns consistently
  • Implement proper cleanup on transport close events
  • Use environment variables for configuration
  • Add inline comments for complex logic
  • Structure code with clear separation of concerns

Example Tool Types to Consider

  • Data processing and transformation

…

자주 묻는 질문

MCP란 무엇인가요?

MCP(Model Context Protocol)는 시스템의 서로 다른 부분이 정보를 주고받고 작업을 수행하도록 하는 통신 프로토콜입니다.

HTTP 전송과 stdio 전송의 차이는 무엇인가요?

HTTP 전송은 표준 웹 요청으로 통신하고, stdio는 운영체제의 표준 입출력을 사용합니다. HTTP는 웹 애플리케이션에, stdio는 명령줄 도구에 더 흔히 쓰입니다.

이 맥락에서 '도구'란 무엇인가요?

데이터를 가져오거나 계산하는 등 MCP 서버가 수행할 수 있는 특정 기능입니다. 명확한 설명과 검증 기능을 갖춰 올바른 데이터를 받도록 합니다.

상세 정보

작성자의 원본 설명

Generate a complete MCP server project in TypeScript using the MCP TypeScript SDK v2 (@modelcontextprotocol/server) with tools, resources, and proper configuration

repo: github/awesome-copilot

인기도

GitHub 스타
40k
순위
#7456
라이선스
MIT
업데이트
2026. 10. 15.

이 스킬이 유용한가요?

0

로그인 투표하려면 로그인하세요.

댓글

  • …

이 저장소의 다른 스킬

비슷한 스킬