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

# Commands

> Overview of the main unch CLI commands.

`unch` is centered around these main command families:

* `unch auth` to save provider credentials such as an OpenRouter API key
* [`unch index`](/commands/index) to build or refresh a local index
* [`unch search`](/commands/search) to query the current index
* [`unch remote`](/commands/remote) to sync or download published remote state
* [`unch start mcp`](/commands/mcp) to expose the index to MCP clients

<CardGroup cols={3}>
  <Card title="Auth" icon="key">
    Save provider credentials without keeping tokens in your shell environment.
  </Card>

  <Card title="Index" icon="database" href="/commands/index">
    Build or refresh `.semsearch` for a repository.
  </Card>

  <Card title="Search" icon="magnifying-glass" href="/commands/search">
    Query the active index with semantic, lexical, or auto mode.
  </Card>

  <Card title="Remote" icon="cloud-arrow-down" href="/commands/remote">
    Reuse published CI state or download an index for a specific commit.
  </Card>

  <Card title="MCP" icon="plug" href="/commands/mcp">
    Let agents search the repository through stdio MCP tools.
  </Card>
</CardGroup>

<Tip>
  `--state-dir` is the preferred way to point `unch` at external or shared local state. `--db` is kept only as a legacy alias.
</Tip>

## Typical local flow

```bash theme={null}
unch auth openrouter --token sk-or-...
unch index --root .
unch search "sqlite schema"
unch search --details "get path variables from a request"
```

<Tabs>
  <Tab title="Local first">
    ```bash theme={null}
    unch index --root .
    unch search "create a new router"
    ```
  </Tab>

  <Tab title="Remote state">
    ```bash theme={null}
    unch create ci
    unch bind ci https://github.com/owner/repo
    unch remote sync
    unch search "create a new router"
    ```
  </Tab>
</Tabs>

## Typical remote flow

```bash theme={null}
unch create ci
unch bind ci https://github.com/owner/repo
unch remote sync
```

Use the command pages for the full flag reference and behavior notes.

## Typical MCP flow for Codex

```bash theme={null}
npm install -g @uchebnick/unch
unch codex install
```

Restart Codex after installation. Codex will start `unch start mcp` automatically through the registered MCP server and use the installed `unch` skill when code search helps.
