npm package: @ralf9090/create-mcpserver
Description: Scaffold a new MCP (Model Context Protocol) server in seconds
Author: ralf9090
Latest version: 1.0.0

# create-mcpserver

Scaffold a new **MCP (Model Context Protocol)** server in seconds.

The official `@modelcontextprotocol/create-server` is deprecated. This is its modern replacement — fast, interactive, and built for the MCP SDK v1.27+.

```bash
npx create-mcpserver
```

## Features

- **Interactive CLI** — Beautiful prompts powered by [@clack/prompts](https://github.com/bombshell-dev/clack)
- **4 Templates** — Basic, Tools, Resources, Full (kitchen sink)
- **Transport Choice** — stdio (Claude Desktop & Claude Code) or Streamable HTTP
- **Testing Setup** — Optional Vitest configuration out of the box
- **Modern API** — Uses `registerTool` / `registerResource` / `registerPrompt` (not deprecated `server.tool()`)
- **MCP SDK v1.27+** — Latest SDK with `McpServer` class, Zod validation, and more
- **Fast** — Embedded templates, no git clone. Scaffolds in <1 second
- **Package Manager Detection** — Works with npm, pnpm, yarn, and bun

## Quick Start

```bash
# Interactive mode
npx create-mcpserver

# With project name
npx create-mcpserver my-weather-server

# Accept all defaults
npx create-mcpserver my-server --yes

# Specify template
npx create-mcpserver my-server --template full
```

## Interactive Flow

```
  create-mcpserver v1.0.0

  ◆ What is your server name?
  │ my-weather-server
  │
  ◆ Which template would you like?
  │ ○ Basic - Minimal server with one example tool
  │ ● Tools - Multiple tools with input validation (Recommended)
  │ ○ Resources - Static and dynamic resource examples
  │ ○ Full - Tools + Resources + Prompts (kitchen sink)
  │
  ◆ Which transport?
  │ ● stdio (Recommended - works with Claude Desktop & Claude Code)
  │ ○ Streamable HTTP (for web deployment)
  │
  ◆ Include testing setup?
  │ ● Yes (Recommended)
  │ ○ No
  │
  ◆ Install dependencies now?
  │ ● Yes
  │ ○ No

  ✔ Created my-weather-server/
  ✔ Dependencies installed

  Next steps:
    cd my-weather-server
    npm run dev          # Start with hot reload
    npm run build        # Build for production
    npm run inspect      # Test with MCP Inspector
```

## Templates

### Basic

Minimal MCP server with a single example tool. Perfect for getting started.

### Tools (Recommended)

Multiple tools with Zod input validation:
- `hello` — Greet a user
- `calculate` — Math operations (add, subtract, multiply, divide)
- `get-timestamp` — Current time in ISO, Unix, or human-readable format
- `generate-uuid` — Generate a random UUID v4

### Resources

Static and dynamic resource examples:
- `info://server` — Server information (static)
- `greeting://{name}` — Dynamic greeting by name
- `config://default` — Default configuration (static)
- `env://{key}` — Environment variable lookup (dynamic)

### Full (Kitchen Sink)

Everything — tools, resources, and prompts:
- All tools from the Tools template
- All resources from the Resources template
- `summarize` — Prompt to summarize text
- `code-review` — Prompt to review code
- `explain` — Prompt to explain a topic at different levels

## Transport Options

### stdio (Default)

Works with **Claude Desktop** and **Claude Code**. The server communicates over standard input/output.

```json
{
  "mcpServers": {
    "my-server": {
      "command": "node",
      "args": ["path/to/my-server/dist/index.js"]
    }
  }
}
```

### Streamable HTTP

For **web deployment**. The server runs as an Express HTTP server.

```bash
PORT=3000 npm start
```

```json
{
  "mcpServers": {
    "my-server": {
      "url": "http://localhost:3000/mcp"
    }
  }
}
```

## CLI Options

| Option | Alias | Description |
|--------|-------|-------------|
| `--template <name>` | `-t` | Template: `basic`, `tools`, `resources`, `full` |
| `--yes` | `-y` | Accept all defaults (tools template, stdio, with tests) |
| `--version` | `-v` | Show version |
| `--help` | `-h` | Show help |

## Development

After scaffolding, your project includes:

```bash
npm run dev          # Start with hot reload (tsx watch)
npm run build        # Build TypeScript to dist/
npm run inspect      # Open MCP Inspector for testing
npm start            # Run the built server
npm test             # Run tests (if testing enabled)
```

## Why This Exists

The MCP ecosystem has exploded — the [reference repo](https://github.com/modelcontextprotocol/servers) has 79k+ stars and there are 17,000+ MCP servers. But the official scaffolding tool (`@modelcontextprotocol/create-server`) was deprecated at v0.3.1.

`create-mcpserver` fills that gap with:
- Modern interactive UX (not just boring prompts)
- Up-to-date MCP SDK support (v1.27+ with latest `registerTool` API)
- Transport choice (stdio + HTTP)
- Testing setup out of the box
- Sub-second scaffolding (embedded templates, no git clone)

## License

MIT