---
title: "CLI Reference"
description: "Complete reference for Skybridge CLI commands"
---

Skybridge provides two CLI tools: the main `skybridge` CLI for development and production workflows, and `create-skybridge` for bootstrapping new projects.

## Skybridge CLI

The main CLI is available as both `skybridge` and `sb` commands after installing `skybridge` in your project.

### skybridge dev

Start the development server with hot module reloading and DevTools.

```bash
skybridge dev
```

**What it does:**
- Starts a development server at `http://localhost:3000/`
- Opens DevTools for local testing at `http://localhost:3000/`
- Exposes MCP server at `http://localhost:3000/mcp`
- Enables file watching with automatic server restart
- Enables Hot Module Reloading (HMR) for views

#### Flags

| Flag | Description |
|------|-------------|
| `-p, --port <number>` | Port to run the server on. Defaults to `3000`, or the next available port if `3000` is in use. |
| `--tunnel` | Open an Alpic tunnel for remote testing. |
| `--no-open` | Don't open DevTools in the browser when the server is ready. |
| `-v, --verbose` | Show tunnel logs. |

You can also set the port via the `PORT` environment variable:

```bash
PORT=8080 skybridge dev
```

If you'd rather never have DevTools opened automatically, export `SKYBRIDGE_OPEN=false` at the shell level (e.g. in your `~/.zshrc`, `~/.bashrc`, or shell profile). It's equivalent to passing `--no-open` on every run, but lets you opt out once globally instead of per-invocation:

```bash
# one-off
SKYBRIDGE_OPEN=false skybridge dev

# persistent (add to your shell profile)
export SKYBRIDGE_OPEN=false
```

---

### skybridge build

Build your views and MCP server for production deployment.

```bash
skybridge build
```

**What it does:**

1. **Building views** - Compiles your React views using Vite
2. **Compiling server** - Transpiles TypeScript server code
3. **Copying static assets** - Moves built assets to the `dist/` directory

The output is placed in the `dist/` directory, ready for production deployment.

---

### skybridge start

Start the production server.

```bash
skybridge start
```

**Requirements:**
- Must run `skybridge build` first
- Requires `dist/index.js` to exist

**What it does:**
- Runs the compiled server from `dist/index.js`
- Sets `NODE_ENV=production`
- Serves the MCP endpoint at `http://localhost:3000/mcp`
- Serves pre-built view assets from `/assets`

---

## create-skybridge

A standalone CLI for bootstrapping new Skybridge projects.

```bash
npm create skybridge@latest [directory]
```

Or with other package managers:

<CodeGroup>
```bash npm
npm create skybridge@latest
```
```bash pnpm
pnpm create skybridge@latest
```
```bash yarn
yarn create skybridge
```
```bash bun
bun create skybridge
```
</CodeGroup>

### Arguments

| Argument | Description |
|----------|-------------|
| `[directory]` | Target directory for the new project. If not specified, you'll be prompted to enter a project name. Use `.` to create in the current directory. |

### Options

| Option | Description |
|--------|-------------|
| `-h, --help` | Show help message |
| `--overwrite` | Remove existing files in target directory without prompting |
| `--immediate` | Install dependencies and start the development server automatically after scaffolding |

### Examples

**Create a new project interactively:**

```bash
npm create skybridge@latest
```

**Create a project in a specific directory:**

```bash
npm create skybridge@latest my-app
```

**Create in current directory, overwrite existing files, and start immediately:**

```bash
npm create skybridge@latest . --overwrite --immediate
```

### What it creates

The scaffolder copies a starter template that includes:

- `server/index.ts` - MCP server with example tools
- `web/` - React views with example components
- `package.json` - Pre-configured with all dependencies
- `tsconfig.json` files - TypeScript configuration
- `vite.config.ts` - Vite configuration for view bundling
- `nodemon.json` - File watching configuration for development

---

## Package Manager Scripts

When you create a new Skybridge project, the `package.json` includes these scripts:

| Script | Command | Description |
|--------|---------|-------------|
| `dev` | `skybridge dev` | Start development server |
| `build` | `skybridge build` | Build for production |
| `start` | `skybridge start` | Start production server |

Run them with your package manager:

<CodeGroup>
```bash npm
npm run dev
npm run build
npm start
```
```bash pnpm
pnpm dev
pnpm build
pnpm start
```
```bash yarn
yarn dev
yarn build
yarn start
```
```bash bun
bun dev
bun build
bun start
```
```bash deno
deno task dev
deno task build
deno task start
```
</CodeGroup>
