Metadata-Version: 2.4
Name: liauto
Version: 0.1.0b0
Summary: Unofficial CLI for LiAuto/LiXiang vehicles
Author: licli contributors
License: Proprietary (see LICENSE)
Keywords: lixiang,liauto,car,vehicle
Classifier: Development Status :: 4 - Beta
Classifier: Environment :: Console
Classifier: Intended Audience :: End Users/Desktop
Classifier: Operating System :: Microsoft :: Windows
Classifier: Operating System :: POSIX :: Linux
Classifier: Operating System :: MacOS
Classifier: Programming Language :: Go
Classifier: Topic :: Utilities
Requires-Python: >=3.0
Description-Content-Type: text/markdown
License-File: LICENSE
Dynamic: license-file

# liauto

liauto is a CLI for Li Auto vehicle APIs. It covers device activation/login, real-time status, monthly travel history, control commands, an HTTP API server, and an MCP server.

## Build

```bash
go build ./...
go vet ./...
go test ./...
```

## Commands

```bash
liauto activate          # activate the current device (first activation or re-activation)
liauto login             # device login, prints an OAuth URL, then persists the pasted token JSON
liauto vehicles          # list cached vehicles
liauto status <VIN>      # query vehicle state (--json/--raw)
liauto travel <VIN> [YYYY-MM]   # monthly travel history; with YYYY-MM, that month's detail
liauto control <VIN> <action>   # lock/unlock/find/wake + ac <on|off|auto|temp|fast-cool|fast-heat> + seat-vent/seat-heat [pos] <1-3|off> + wheel-heat <on|off> + window [pos] <0-99> + trunk <open|close> (action: result <id>)
liauto version           # print version
liauto serve             # HTTP API server (default 127.0.0.1:18001; --addr/--token/--allow-control)
liauto mcp               # MCP server, stdio (default) or --transport http (default 127.0.0.1:18002)
```

Run `liauto` with no arguments (or `liauto <unknown>`) to print the command list.

Global flags: `--json` (JSON output), `-v` / `--verbose` (verbose logging to stderr).

Exit codes: `0` success, `1` user input error, `2` network failure, `3` HTTP non-200, `4` activation failure, `5` config permission/corrupt, `6` missing/invalid/expired activation code.

## Activation code

Running any liauto command except `version` requires a valid activation code, set as an
environment variable:

```bash
export LICLI_CODE=<activation code>
liauto login       # one-time: prints an authorization URL, then paste the token JSON from the browser's F12 developer tools
liauto vehicles    # list vehicles
```

A code is issued by the tool's publisher (offline `license-keygen`). It is an
Ed25519-signed token: the binary only verifies it with the built-in public key and
cannot forge codes. Missing/invalid/expired codes exit with code 6.

## HTTP API server (`serve`)

`liauto serve` runs a foreground HTTP server (default `127.0.0.1:18001`, override with `--addr`) exposing JSON endpoints for the vehicles/status/travel/control surface. Bind to a loopback address, set `--token`, or pass `--allow-control` to enable the control endpoints.

## MCP server (`mcp`)

`liauto mcp` serves the [Model Context Protocol](https://modelcontextprotocol.io) over stdio (default) or Streamable HTTP (`--transport http`, default `127.0.0.1:18002`). It exposes six tools: `vehicles`, `status`, `travel_months`, `travel_month`, `control`, `control_result`. The two `control*` tools are enabled by default under stdio; under `--transport http` they require `--allow-control` or `--token`.

## Configuration

Credentials are stored under the XDG config directory (`~/.config/licli` by default, or `$XDG_CONFIG_HOME/licli`) with `0700` directory and `0600` file permissions:

- `device.json` — activated device + key suite
- `auth.json` — API token, ID token, refresh token, expiry
