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

# Anvil CLI Overview: Commands for Building Anvil Apps

> The anvil CLI is the primary interface for developing, building, and running Anvil apps — covering dev, build, MCP serving, lint, eval, and replay.

The `anvil` CLI is the primary entry point for all Anvil development workflows. Once you install the package, the `anvil` command is available in your project's `node_modules/.bin` and, when using a package manager with `bin` hoisting, on your `PATH`. Every workflow — scaffolding, local development, production builds, MCP serving, linting, evaluations, and trace replay — runs through this single binary.

## Commands at a glance

| Command        | What it does                                                                        |
| -------------- | ----------------------------------------------------------------------------------- |
| `anvil init`   | Scaffold package.json, tsconfig, and starter routes for a new (or existing) project |
| `anvil dev`    | Start a live-reload development server with TypeScript route loading                |
| `anvil build`  | Scan routes, emit `.gen/routes.ts`, and bundle `dist/server.mjs`                    |
| `anvil start`  | Run the production bundle produced by `anvil build`                                 |
| `anvil mcp`    | Serve MCP-exposed routes and `server/tools/` as an MCP tool server                  |
| `anvil lint`   | Validate route params and schemas; exits non-zero on errors                         |
| `anvil eval`   | Run a deterministic + LLM-judge eval suite against an agent route                   |
| `anvil replay` | Re-run a captured agent trace with mocked model responses                           |

## Explore each command

<CardGroup cols={2}>
  <Card title="anvil init" icon="wand-magic-sparkles" href="/cli/init">
    Scaffold a new project — pick a basic API, MCP server, or agent route template.
  </Card>

  <Card title="anvil dev" icon="code" href="/cli/dev">
    Start the live-reload development server with file watching and instant route hot-reloading.
  </Card>

  <Card title="anvil build" icon="hammer" href="/cli/build">
    Generate the route manifest and bundle a self-contained production server.
  </Card>

  <Card title="anvil start" icon="play" href="/cli/start">
    Run the production bundle created by `anvil build`, with optional port override.
  </Card>

  <Card title="anvil mcp" icon="plug" href="/cli/mcp">
    Expose your routes as an MCP tool server over HTTP or stdio for AI agents and Claude Desktop.
  </Card>

  <Card title="anvil lint" icon="circle-check" href="/cli/lint">
    Catch param mismatches and lossy MCP schemas at compile time, before a broken deploy.
  </Card>

  <Card title="anvil eval" icon="flask" href="/cli/eval">
    Run deterministic and LLM-as-judge assertions against agent routes in a reproducible suite.
  </Card>

  <Card title="anvil replay" icon="rotate-left" href="/cli/replay">
    Replay a captured trace locally with no live model calls to debug production failures.
  </Card>
</CardGroup>

## Installation

The CLI is included in the main `anvil` package — no separate install is needed.

```bash theme={null}
npm install anvil-sdk
```

Run any command via your package manager's script runner:

```bash theme={null}
npx anvil dev
# or add to package.json scripts:
# "dev": "anvil dev"
```

<Note>
  Anvil requires **Node.js ≥ 20**. All CLI commands are ESM-native and use the Node.js `--input-type=module` environment automatically.
</Note>
