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

# CLI

> Reference for the GolfMCP command-line interface.

The `golf` command-line interface is your primary tool for managing GolfMCP projects.

## Commands

### `golf init`

Initializes a new GolfMCP project directory with Golf branding and modern authentication setup.

<CodeGroup>
  ```bash Basic theme={null}
  golf init my_awesome_server
  ```

  ```bash With options theme={null}
  golf init my-api-project --output-dir ./projects
  ```
</CodeGroup>

<ParamField path="project_name" type="string" required>
  The name of the project and the directory to be created.
</ParamField>

<ParamField path="--output-dir" type="string">
  Specifies a different directory to create the project in. Defaults to a new directory named `project_name` in the current location.

  Alias: `-o`
</ParamField>

### `golf build`

Builds your GolfMCP project into a runnable MCP server. The build process includes enhanced authentication handling and validation.

<CodeGroup>
  ```bash Development theme={null}
  golf build dev
  ```

  ```bash Production theme={null}
  golf build prod
  ```
</CodeGroup>

The build environment parameter is required and must be either `dev` or `prod`:

<table>
  <thead>
    <tr>
      <th>Development (`dev`)</th>
      <th>Production (`prod`)</th>
    </tr>
  </thead>

  <tbody>
    <tr>
      <td>
        • Copies `.env` file to `dist/` directory<br />
        • Environment variables loaded from local file<br />
        • Optimized for local development and testing
      </td>

      <td>
        • No `.env` file copied<br />
        • Environment variables expected at runtime<br />
        • Optimized for production deployment
      </td>
    </tr>
  </tbody>
</table>

### `golf run`

Runs a previously built GolfMCP server with enhanced runtime features.

```bash theme={null}
golf run
```

<Note>
  Make sure to run <code>golf build prod</code> or <code>golf build dev</code> before using <code>golf run</code>.
</Note>
