mcp-canbus

March 28, 2026 ยท View on GitHub

MCP server exposing CAN bus connectivity for reading and writing CAN frames.

PyPI Python Ruff

Install

pip install mcp-canbus

Usage

from mcp_canbus import mcp

mcp.run()

MCP Tools

list_interfaces

Lists all available CAN interfaces on the system.

get_interface_info

Gets detailed information about a specific CAN interface.

read_frame

Reads a single CAN frame from an interface.

write_frame

Writes a CAN frame to an interface.

configure_interface

Configures CAN interface parameters (bitrate, etc.).

get_bus_statistics

Gets bus statistics for an interface.

CLI

mcp-canbus --help

API

MCP Server

The server exposes the following tools via the MCP protocol:

  • list_interfaces() -> List[str]: Returns available CAN interface names
  • get_interface_info(interface: str) -> Dict: Returns interface details
  • read_frame(interface: str, timeout: float) -> Dict: Reads a CAN frame
  • write_frame(interface: str, arbitration_id: int, data: List[int], ...) -> bool: Writes a CAN frame
  • configure_interface(interface: str, bitrate: int, ...) -> bool: Configures an interface
  • get_bus_statistics(interface: str) -> Dict: Returns bus statistics

Development

git clone https://github.com/dclavijo/mcp-canbus.git
cd mcp-canbus
pip install -e ".[test]"

# run tests
pytest

# format
ruff format src/ tests/

# lint
ruff check src/ tests/

# type check
mypy src/

mcp-name: io.github.dclavijo/mcp-canbus