Skip to main content
Glama

can-engineering-mcp

A Model Context Protocol server that lets AI agents deterministically inspect, author, convert, validate, and diagnose Controller Area Network (Classical CAN & CAN FD) databases and trace logs.

LLMs are good at systems reasoning and root-cause synthesis, but bad at raw hex parsing, Motorola bit-numbering math, and scanning million-line trace files. This server does the deterministic heavy lifting — bit-packing validation, streaming log aggregation, transport-protocol reassembly, statistical anomaly detection — and hands the agent compact, token-efficient summaries instead of raw bytes.

What it does

19 tools across six stages:

  • DBC discovery — inspect a database, fuzzy-search messages/signals/IDs/units, render an exact Intel/Motorola bit-layout grid, validate for bit overlaps and structural errors.

  • DBC authoring — atomic, backed-up (.bak) mutation of nodes, messages, and signals, with an auto-packer that finds free bit ranges and rejects overlapping writes with a structured conflict map.

  • Templates & conversion — generate clean-room J1939, CANopen (CiA 301), and UDS/ISO-TP skeleton databases from scratch; convert between .dbc/.dbf/.arxml/.kcd/.sym/.xlsx; diff two databases into an engineering changelog (bit shifts, scale changes, cycle-time changes).

  • Trace ingestion — stream .asc/.blf/.trc/.log/.csv/.parquet traces (tested against real files up to 500MB+), summarize per-arbitration-ID statistics, query decoded signal trends, and filter/export with a safe (non-eval) signal-condition expression language.

  • Transport protocol & UDS — a real ISO 15765-2 (ISO-TP) state machine for SF/FF/FC/CF reassembly, UDS (ISO 14229) service and negative-response-code decoding, J1939-21 BAM/CMDT multi-packet reassembly.

  • Bus health & reverse engineering — bus-load/microburst analysis, error-storm and Bus-Off detection, cycle-time jitter and alive-counter fault detection, and a heuristic classifier that reverse-engineers undocumented frames (constant masks, counters, checksums, continuous signals, discrete flags) into a draft candidate DBC.

Related MCP server: canforge-mcp

Install

pip install can-engineering-mcp

Or from source, editable:

git clone https://github.com/kankan-sarkar/canbus-mcp.git
cd canbus-mcp
python -m venv .venv && . .venv/bin/activate
pip install -e ".[dev]"

Register with an MCP client

Add to your client's MCP server config (e.g. Claude Code's .mcp.json for a single project, or its user-scope config to enable it everywhere):

{
  "mcpServers": {
    "can-engineering-mcp": {
      "command": "/path/to/python",
      "args": ["-m", "can_mcp.server"]
    }
  }
}

File access is sandboxed to the current working directory the server is launched in (override with the CAN_MCP_WORKSPACE_ROOT environment variable).

Development

pytest   # full suite runs offline in well under 15s, against synthetic generated fixtures only

Every fixture is generated deterministically in-memory (tests/fixtures/generator.py) — nothing proprietary, nothing downloaded.

Dependency & license guardrails

Only permissively-licensed (MIT/BSD-2-Clause/BSD-3-Clause/LGPLv3-dynamic-link) dependencies are used: mcp, cantools, canmatrix, python-can, polars, duckdb, pydantic, lxml, openpyxl, canopen. No proprietary database content (e.g. the SAE J1939 Digital Annex) is bundled; protocol templates (J1939, CANopen, UDS/ISO-TP) are clean-room structural generators built from public framing specifications.

License

MIT — see LICENSE.

Available Tools

19 tools
add_or_update_signalC

Create or update a signal; auto_pack=True finds the first free bit block. Rejects bit-overlapping writes.

Inputs: length (required), dbc_path (required), signal_name (required), message_id_or_name (required), +14 more.

analyze_bus_health_and_faultsB

Diagnose bus load/microbursts, error storms & Bus-Off transitions, cycle-time jitter/missing-frame/babbling-node faults, and alive-counter skips/freezes, with root-cause advisories.

Inputs: log_path (required), dbc_path, fd_data_baudrate, nominal_baudrate.

convert_database_formatC

Convert between .dbc/.dbf/.arxml/.kcd/.sym/.xlsx (via canmatrix) and report any attribute loss.

Inputs: input_path (required), output_path (required), dry_run, target_format.

delete_dbc_messageC

Remove a frame cleanly from the database.

Inputs: dbc_path (required), frame_id_or_name (required), dry_run.

delete_dbc_signalC

Delete a signal and its associated value table/attribute entries.

Inputs: dbc_path (required), signal_name (required), message_id_or_name (required), dry_run.

diff_databasesB

Structured engineering changelog between two databases of any supported format: added/removed messages and signals, bit shifts, scaling/offset changes, and cycle-time changes.

Inputs: db_path_a (required), db_path_b (required).

extract_uds_diagnostic_transcriptC

Reassemble ISO-TP (SF/FF/FC/CF) diagnostic sessions and decode UDS requests/responses, NRCs, and security-access lockouts.

Inputs: log_path (required), request_id, response_id, export_filtered_log_path.

filter_and_export_traceB

Stream-filter a trace by arbitration ID, time range, and/or a decoded signal_condition expression, writing matches to .blf/.asc/.trc/.log/.csv/.parquet.

Inputs: output_path (required), input_log_path (required), dry_run, dbc_path, +4 more.

generate_database_from_templateB

Generate a clean-room baseline, J1939, CANopen CiA301, or UDS/ISO-TP skeleton .dbc from scratch.

Inputs: output_path (required), template_type (required), dry_run, baudrate, +1 more.

inspect_database_summaryC

Protocol type, baudrate, ECU/message/signal counts, and node matrix.

Inputs: dbc_path (required).

manage_ecu_nodeB

Add, rename, or delete an ECU node (BU_), updating sender/receiver references.

Inputs: action (required), dbc_path (required), node_name (required), comment, +2 more.

query_decoded_signalsB

Decode requested signals across a trace; aggregation='summary' returns min/max/mean/std/anomalies plus a downsampled time series, otherwise up to max_rows raw decoded rows.

Inputs: dbc_path (required), log_path (required), signal_names (required), end_time, +3 more.

reassemble_j1939_multipacketC

Reassemble J1939 BAM/CMDT transport-protocol sessions (PGN 0xEC00/0xEB00) into complete multi-byte PGN payloads.

Inputs: log_path (required).

reverse_engineer_unknown_framesB

Classify undocumented payload bitfields (constant masks, alive counters, checksum candidates, continuous physical signals, discrete flags) and emit a draft candidate DBC.

Inputs: log_path (required), dbc_path, target_frame_id.

search_databaseB

Case-insensitive fuzzy/substring search across messages, signals, IDs, units, comments, and value tables.

Inputs: query (required), dbc_path (required), max_results, search_type.

summarize_trace_logA

Stream a .asc/.blf/.trc/.log/.csv/.parquet trace and return duration, frame/error counts, channels, and a per-arbitration-ID summary table (count, Δt stats, DLC, payload entropy).

Inputs: log_path (required), dbc_path.

upsert_dbc_messageC

Create or update a CAN/CAN FD frame, writing GenMsgCycleTime and VFrameFormat attributes.

Inputs: dlc (required), name (required), sender (required), dbc_path (required), +6 more.

validate_database_integrityC

Detect bit overlaps, DLC violations, invalid DLC sizes, duplicate names, and bad min/max/scale.

Inputs: dbc_path (required).

visualize_frame_layoutC

ASCII bit/byte grid showing exact Intel/Motorola signal occupancy for one frame.

Inputs: dbc_path (required), frame_id_or_name (required).

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    B3.2/5.0

    Scored across 19 tools

    Disambiguation5/5

    The tools target clearly distinct resources and actions: database inspection/search, message/signal/ECU editing, format conversion, trace summarization/query/export, diagnostics, and reverse engineering. Overlaps such as summarize_trace_log vs analyze_bus_health_and_faults and query_decoded_signals vs filter_and_export_trace are separated by clear output and purpose differences.

    Naming Consistency4/5

    All names use consistent snake_case and are generally verb_noun oriented, which makes them predictable. Minor inconsistency exists in operation vocabulary and granularity, e.g. upsert_dbc_message vs add_or_update_signal, and manage_ecu_node bundles add/rename/delete while message and signal lifecycle operations are split.

    Tool Count4/5

    Nineteen tools is slightly heavy for the stated scope, but the domain spans database engineering, trace analysis, diagnostics, and reverse engineering, so each tool has a plausible role. It is not inflated with redundant or vague operations.

    Completeness4/5

    The surface covers database creation, inspection, editing, validation, conversion, diffing, trace analysis/export, UDS/J1939 decoding, health diagnostics, and reverse engineering. Minor gaps remain around direct detailed read/get operations, explicit load/save database lifecycle, and full editing of value tables or arbitrary attributes.

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      Not graded
      quality
      B
      maintenance
      Enables LLMs to interact with vehicle CAN bus and OBD-II data through a simulated ECU environment. Provides tools for reading frames, decoding messages via DBC files, monitoring signals, and querying automotive diagnostics without requiring physical hardware.
      19 PyPI
      26
      MIT
    • A
      license
      A
      quality
      D
      maintenance
      Local, read-only MCP server for inspecting DBC files and decoding CAN capture logs, with bounded and composable tools.
      13
      34 PyPI
      1
      MIT
    • A
      license
      Not graded
      quality
      C
      maintenance
      Enables AI-powered automotive diagnostics by connecting LLMs to vehicle ECUs over UDS/CAN, indexing workshop manuals locally, and augmenting with web search, while enforcing a human-in-the-loop approval gate for any write operations.
      1
      MIT
    • A
      license
      Not graded
      quality
      B
      maintenance
      Exposes 20 vehicle-security tools to AI coding agents such as Claude Code and Cursor, enabling them to send, fuzz, and analyze CAN frames, run UDS diagnostics and seed-key handshakes, simulate DoIP ECUs, and decode ISO-TP, J1939, DBC, and V2X data. Everything runs against a virtual CAN bus, so no vehicle or hardware is required.
      1
      MIT