Home / Market / typescript mcp server generator

typescript mcp server generator

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

skill★ 4179412146 dlskills.shMITInstall in CosmosUpstream Source

Documentation & Preview

--- 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:
  1. Runtime: Node.js 20+ (v2 minimum); ESM-first with "type": "module" (a CommonJS build is also shipped, so require() works if needed)
  2. Server Type: Choose between HTTP (Streamable HTTP transport) or stdio-based server. SSE and WebSocket transports were removed in v2 — do not generate them.
  3. Tools: Create at least one useful tool with proper schema validation
  4. 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.