> ## Documentation Index
> Fetch the complete documentation index at: https://docs.skybridge.tech/llms.txt
> Use this file to discover all available pages before exploring further.

# CLI Reference

> 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 theme={null}
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. |

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

```bash theme={null}
PORT=8080 skybridge dev
```

***

### skybridge build

Build your views and MCP server for production deployment.

```bash theme={null}
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 theme={null}
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 theme={null}
npm create skybridge@latest [directory]
```

Or with other package managers:

<CodeGroup>
  ```bash npm theme={null}
  npm create skybridge@latest
  ```

  ```bash pnpm theme={null}
  pnpm create skybridge@latest
  ```

  ```bash yarn theme={null}
  yarn create skybridge
  ```

  ```bash bun theme={null}
  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 theme={null}
npm create skybridge@latest
```

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

```bash theme={null}
npm create skybridge@latest my-app
```

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

```bash theme={null}
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 theme={null}
  npm run dev
  npm run build
  npm start
  ```

  ```bash pnpm theme={null}
  pnpm dev
  pnpm build
  pnpm start
  ```

  ```bash yarn theme={null}
  yarn dev
  yarn build
  yarn start
  ```

  ```bash bun theme={null}
  bun dev
  bun build
  bun start
  ```

  ```bash deno theme={null}
  deno task dev
  deno task build
  deno task start
  ```
</CodeGroup>
