MR
Mayur Rathi
@github
⭐ 34.1k GitHub stars

Typescript-Mcp-Server-Generator

Typescript-Mcp-Server-Generator is an code AI skill with a core value of Generate a complete MCP server project in TypeScript with tools, resources, and proper configuration. It helps developers solve real-world problems in the code domain, boosting efficiency, automating repetitive tasks, and optimizing workflows.

Generate a complete MCP server project in TypeScript with tools, resources, and proper configuration

Last verified on: 2026-10-01

Quick Facts

Category code
Works With Claude, GitHub Copilot
Source github/awesome-copilot
Stars ⭐ 34.1k
Last Verified 2026-10-01
Risk Level Low
mkdir -p ./skills/typescript-mcp-server-generator && curl -sfL https://raw.githubusercontent.com/github/awesome-copilot/main/skills/typescript-mcp-server-generator/SKILL.md -o ./skills/typescript-mcp-server-generator/SKILL.md

Run in terminal / PowerShell. Requires curl (Unix) or PowerShell 5+ (Windows).

Skill Content

# 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:

```typescript

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

🎯 Best For

  • Developers scaffolding new projects
  • Prototype builders
  • Claude users
  • GitHub Copilot users
  • Software engineers

💡 Use Cases

  • Bootstrapping React components
  • Creating API route handlers
  • TypeScript type safety checking
  • Module refactoring

📖 How to Use This Skill

  1. 1

    Install the Skill

    Copy the install command from the Terminal tab and run it. The SKILL.md file downloads to your local skills directory.

  2. 2

    Load into Your AI Assistant

    Open Claude or GitHub Copilot and reference the skill. Paste the SKILL.md content or use the system prompt tab.

  3. 3

    Apply Typescript-Mcp-Server-Generator to Your Work

    Open your project in the AI assistant and ask it to apply the skill. Start with a small module to verify the output quality.

  4. 4

    Review and Refine

    Review AI suggestions before committing. Run tests, check for regressions, and iterate on the skill output.

❓ Frequently Asked Questions

Can I customize the generated output?

Yes — modify the skill's prompt instructions to match your project conventions and coding style.

Is Typescript-Mcp-Server-Generator compatible with Cursor and VS Code?

Yes — this skill works with any AI coding assistant including Cursor, VS Code with Copilot, and JetBrains IDEs.

Do I need specific dependencies for Typescript-Mcp-Server-Generator?

Check the install command and Works With section. Most code skills only require the AI assistant and your codebase.

How do I install Typescript-Mcp-Server-Generator?

Copy the install command from the Terminal tab and run it. The skill downloads to ./skills/typescript-mcp-server-generator/SKILL.md, ready to use.

Can I customize this skill for my team?

Absolutely. Edit the SKILL.md file to add team-specific instructions, examples, or workflows.

⚠️ Common Mistakes to Avoid

Using generated code without understanding

Understand what generated code does before shipping it to production.

Skipping validation

Always test AI-generated code changes, even for simple refactors.

Missing dependency updates

Check if the skill requires updated dependencies or new packages.

🔗 Related Skills