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

# toolshed login

> Authenticate with the Toolshed server.

## Usage

```bash theme={null}
toolshed login [--server <url>]
```

| Option               | Default                 | Description         |
| -------------------- | ----------------------- | ------------------- |
| `-s, --server <url>` | `http://localhost:3000` | Toolshed server URL |

## How it works

1. The CLI starts a temporary HTTP server on a random local port
2. Opens your browser to the Toolshed server's `/api/auth/cli-login` endpoint, passing the local callback URL
3. The server generates a user ID and session token, then redirects back to the CLI's callback
4. The CLI saves the credentials to `~/.toolshed/config.json` and exits

## Example

```bash theme={null}
$ toolshed login --server http://localhost:3001
Logging in to http://localhost:3001...
Opening browser to authenticate...
Logged in as user_f7c469e8
```

## Config file

After login, credentials are stored in `~/.toolshed/config.json`:

```json theme={null}
{
  "serverUrl": "http://localhost:3001",
  "userId": "user_f7c469e8",
  "sessionToken": "..."
}
```

This file is used by [`toolshed serve`](/cli/serve), [`toolshed connect`](/cli/connect), and [`toolshed status`](/cli/status).

## If already logged in

Running `login` again will print the current session and exit. To log in to a different server, delete `~/.toolshed/config.json` first.
