typescript-mcp-server-generator

人工智能 / Agent Agent 与技能管理 1 文件 EN 原文

'Generate a complete MCP server project in TypeS

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

说明语言:英文

来源githubawesome-copilot ↗ 查看原文件 ↗版权归原作者,请遵循原仓库许可
安装
npx skills add https://github.com/github/awesome-copilot --skill typescript-mcp-server-generator

需要已安装 skills CLI。也可以直接从源仓库 clone。

在星云中查看 ↗
SKILL.md 原文

name: typescript-mcp-server-generator description: 'Generate a complete MCP server project in TypeScript using the MCP TypeScript SDK v2 (@modelcontextprotocol/server) with tools, resources, and proper configuration' ---

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:
  3. @modelcontextprotocol/server — server implementation (stdio transport via the @modelcontextprotocol/server/stdio subpath)
  4. @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)
  5. @modelcontextprotocol/core — shared protocol schemas (import *Schema constants from here, not from sdk/types.js)
  6. zod@^4.2 — v2 requires Zod 4.2+; do not use zod@3
  7. Runtime: Node.js 20+ (v2 minimum); ESM-first with "type": "module" (a CommonJS build is also shipped, so require() works if needed)
  8. Server Type: Choose between HTTP (Streamable HTTP transport) or stdio-based server. SSE and WebSocket transports were removed in v2 — do not generate them.
  9. Tools: Create at least one useful tool with proper schema validation
  10. Error Handling: Include comprehensive error handling and validation

Implementation Details

Project Setup

Server Configuration

Tool Implementation

  server.registerTool('greet', {
    description: 'Greet user',
    inputSchema: z.object({ name: z.string() })
  }, async ({ name }, ctx) => {
    return { content: [{ type: 'text', text: `Hello, ${name}!` }] };
  });

Resource/Prompt Setup (Optional)

Code Quality

Example Tool Types to Consider

Configuration Options

Migrating an Existing v1 Server

Testing Guidance

Additional Features to Consider

Generate a complete, production-ready MCP server with comprehensive documentation, type safety, and error handling.

同类技能
add-new-opc-skillagent-architectureagent-browseragent-governanceagent-owasp-complianceagent-skill-stackagent-supply-chainagentcore
本页内容来自开源项目 github, 版权归原作者所有。
本站仅作技能索引与分享,所有 Skill 版权归其原作者所有。