---
title: "Overview"
description: "Install the CLI and authenticate it."
---

import { Callout } from "fumadocs-ui/components/callout";

# CodeSpar CLI

<VersionBadge pkg="@codespar/cli" />

The `codespar` CLI lets you interact with the CodeSpar platform directly from your terminal. Use it to authenticate, inspect servers and tools, execute one-off tool calls, manage per-user connections, and scaffold new agents.

<Callout type="info">
The CLI is the fastest way to explore the server catalog, run smoke tests, and debug production sessions — no frontend or SDK integration required.
</Callout>

## Install

```bash
npm install -g @codespar/cli
```

Verify the install:

```bash
codespar --version
```

<Callout>
If `codespar: command not found` after install, make sure your global `npm bin` directory is on your `$PATH`. Run `npm config get prefix` to check.
</Callout>

## Authenticate

Log in with your CodeSpar API key — you only do this once per machine:

```bash
codespar login
```

The CLI opens a browser window for you to authorize, then stores a session token at `~/.codespar/config.json`. All subsequent commands use that token.

Alternatively, authenticate non-interactively with an API key (useful in CI):

```bash
export CODESPAR_API_KEY=csk_live_...
codespar whoami
```
