Skip to content

CLI Reference

farzad edited this page Oct 7, 2026 · 2 revisions

CLI Reference

peykan <command> [options], defined in src/peykan/cli.py. peykan <command> --help shows every option.

Commands that print data print JSON or a table to stdout; logs go to stderr, so peykan uds-dtcs > dtcs.json produces clean JSON.

Running things

Command Does
peykan demo [--host 127.0.0.1] [--port 6278] [--transport sse|streamable-http|stdio] [--log FILE] Simulator + MCP server in one process. With --log, serves a looping recording instead of the simulator
peykan server [--host] [--port] [--transport] MCP server only (real hardware, or a bus fed by something else)
peykan simulate Simulator only. Refuses to run on real hardware unless PEYKAN_SIMULATOR_ON_HARDWARE=true

Inspecting traffic

Command Does
peykan frames [--seconds 1.0] Raw frames as JSON
peykan monitor <signal> [--seconds 2.0] [--json] Watch one signal
peykan snapshot [--seconds 1.0] [--json] Latest value of every signal seen
peykan decode <id> <data> [--json] Decode one 11-bit frame with the DBC
peykan dbc-info [message] The DBC's messages and signals

Payload format for decode and j1939-decode: space-separated bytes are hex, as candump prints them (e8 03 a0 32); comma-separated bytes are decimal (232,3,160,50); 0x prefixes work in both.

Diagnostics

Command Does
peykan obd-request --service <svc> [--pid <pid>] [--timeout 1.0] OBD-II request; decodes known PIDs, or DTCs for Mode 03
peykan vin [--timeout 2.0] VIN via OBD Mode 09 (multi-frame ISO-TP)
peykan uds-read <did>... [--request-id 0x7E0] [--response-id 0x7E8] UDS ReadDataByIdentifier, e.g. peykan uds-read 0xF190 0xF40C
peykan uds-dtcs [--status-mask 0xFF] UDS stored DTCs with status bits
peykan uds-clear UDS ClearDiagnosticInformation (a write service)
peykan diag-request --service-id <id> [--parameter-id] [--data-field] The DBC's UDS-style protocol; prints every ECU's reply
peykan fault <preset|clear|list> Activate or clear a fault scenario, or list them

SAE J1939

Command Does
peykan j1939-decode <id> <data> [--json] Decompose a 29-bit ID and decode known SPNs
peykan j1939-pgns The PGN/SPN catalog
peykan j1939-request <pgn> [--timeout 2.0] Request PGN; pgn can be EEC1, 0xF004 or 61444
peykan j1939-dtcs [--seconds 3.0] Active DTCs from every ECU's DM1

Logs

Command Does
peykan log-info <file|sample> [--json] Analyse a recording: IDs and rates, signal ranges, DTCs, gaps
peykan log-signal <file> <signal> [--max-points 50] [--message J1939:EEC1] One signal over the recording, as JSON
peykan replay <file> [--speed 1.0] [--loop] Replay onto the configured bus (a write: needs permission on real hardware)
peykan record <file> [--seconds 30] [--simulate] [--fault <preset> --fault-at 10] Record the bus to .asc / .blf / .log / .trc / .csv

See Recorded CAN Logs.

Same-process rule

On the virtual bus, commands that send or listen (frames, monitor, snapshot, obd-request, vin, uds-*, diag-request, fault, j1939-request, j1939-dtcs) only see a simulator running in the same process, so running them in a second terminal next to peykan demo finds nothing. Use the MCP tools of the demo process instead, or record --simulate. On real hardware this doesn't apply. See Troubleshooting.

Exit codes

0 success, 1 timeout / error, 2 refused by the transmit policy.

Deprecated alias

mcp-can still runs the same CLI and prints a note to use peykan.

Clone this wiki locally