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

# Installation

> Install the 9p CLI from npm and sign in.

## Requirements

* **Node.js 20 or newer** (`node --version`)
* **macOS or Linux** — Windows is best-effort until after launch
* A [9th Protocol account](https://9thprotocol.com), or an OpenRouter key for BYOK

## Install

<CodeGroup>
  ```bash npm theme={null}
  npm install -g @9thprotocol/cli
  ```

  ```bash pnpm theme={null}
  pnpm add -g @9thprotocol/cli
  ```

  ```bash bun theme={null}
  bun add -g @9thprotocol/cli
  ```
</CodeGroup>

This puts the `9p` binary on your `PATH`:

```bash theme={null}
9p --help
```

<Note>
  During private beta the package is not yet on the public npm registry. Beta
  users get an install line with their invite.
</Note>

## Sign in

```bash theme={null}
9p login
```

This prints a short code and opens your browser. Approve the code and the CLI
saves credentials to `~/.9p/auth.json` with `0600` permissions.

```
Sign in to 9th Protocol

  code:  B4HR-R7S6
  open:  https://app.9thprotocol.com/device

Approve the code in your browser. Waiting…

✓ signed in as you@example.com (plan: core)
```

On a headless machine with no browser, use `9p login --paste` and supply an
access token from the dashboard instead.

See [Authentication](/authentication) for BYOK, environment variables, and how
tokens refresh.

## Run it

```bash theme={null}
cd ~/code/your-project
9p
```

In a TTY this starts the full terminal UI. Add `--plain` for a bare REPL, which
is what you want in CI or over a pipe.

## Optional setup

<AccordionGroup>
  <Accordion title="Project memory">
    `9p init` writes a `9P.md` for standing instructions, or scaffolds an
    Obsidian-style vault. See [Memory](/memory).
  </Accordion>

  <Accordion title="Codebase map">
    `9p map` writes wiki-style notes about your codebase into the vault so later
    sessions navigate a map instead of re-reading files. See [Vault](/vault).
  </Accordion>

  <Accordion title="MCP servers">
    Drop a `.9p/mcp.json` in the project to add any MCP server's tools. See [MCP](/mcp).
  </Accordion>
</AccordionGroup>

## Upgrading

```bash theme={null}
npm install -g @9thprotocol/cli@latest
```

## Uninstall

```bash theme={null}
9p logout            # revokes the token server-side
npm uninstall -g @9thprotocol/cli
rm -rf ~/.9p         # removes memory, skills, MCP config and credentials
```
