Skip to content

CLI Reference

farzad edited this page Aug 19, 2026 · 1 revision

CLI Reference

mcp-can <command> [options], defined in src/mcp_can/cli.py. server/demo/simulate print colorized logs via rich instead of raw text.

Process commands

Command Description
mcp-can simulate Start the ECU simulator using vehicle.dbc.
mcp-can server [--port 6278] [--transport sse|streamable-http|stdio] Run the MCP server.
mcp-can demo [--port] [--transport] Simulator + server in one process — see Architecture for why this matters on Windows.

Inspection commands

Command Description
mcp-can frames --seconds 1.0 Capture raw CAN frames for a period, print as JSON.
mcp-can decode <id> <data> [--json] Decode a single frame. id is hex (0x100) or decimal; data is space- or comma-separated bytes. Table output by default.
mcp-can snapshot --seconds 1.0 [--json] Latest value of every signal seen while listening — CLI counterpart to get_vehicle_snapshot, built from its own short listen window rather than the server's buffer.
mcp-can dbc-info [message] Table of every message/signal in the DBC, or just one message's.
mcp-can monitor <signal> --seconds 2.0 [--json] Watch one signal; live output by default.

Protocol commands

Command Description
mcp-can obd-request --service <hex|int> [--pid <hex|int>] [--timeout 1.0] OBD-II (SAE J1979) request; response includes a decoded value for known PIDs (or DTCs for Mode 03).
mcp-can diag-request --service-id <hex|int> [--parameter-id] [--data-field] [--timeout 2.0] UDS-style diagnostic request; prints every responding ECU's reply.
mcp-can fault <preset|clear|list> [--timeout 1.0] Activate/clear a fault-injection scenario in a running simulator, or list available presets.

Global note

Every command above except listing/decoding-a-literal-frame needs a simulator to actually be listening on the same bus — and on this platform, that means the same OS process (mcp-can demo), because python-can's virtual backend doesn't share state across processes. See Troubleshooting if a command times out or returns nothing.

--json flag

decode, monitor, and snapshot default to a rich table for human reading; pass --json for machine-readable output (scripting, piping to jq, etc.).

Clone this wiki locally