Skip to main content

Agent-first CAN control MCP server

Project description

agent-can

Agent-first CAN bus session frontend for MCP clients. Runtime access goes through python-can; DBC decode/encode goes through cantools.

The server runs over stdio MCP and exposes tools for adapter discovery, connect/disconnect, status, DBC schema discovery, message list/read/send/stop, periodic sends, and python-can trace export.

MCP configuration

Use uvx agent-can as a stdio MCP server:

{
  "mcpServers": {
    "agent-can": {
      "command": "uvx",
      "args": ["agent-can"]
    }
  }
}

For development from this repository:

uv run agent-can

Hardware mode

Real hardware uses the installed python-can backend and host drivers. PEAK PCAN on Windows and SocketCAN on Linux are the intended hardware paths:

{ "interface": "pcan", "channel": "PCAN_USBBUS1", "bitrate": 500000 }

Message operations

Raw sends use target: "0x123" and a hex string payload. Standard 11-bit classic CAN is the default.

{ "target": "0x123", "data": "01020304" }

Use extended: true for extended 29-bit IDs and fd: true for CAN FD payloads.

{ "target": "0x18DAF110", "data": "0102030405060708090A0B0C", "extended": true, "fd": true }

Semantic sends use target: "alias.MessageName" and a signal map:

{
  "target": "vehicle.PowertrainStatus",
  "data": {
    "vehicle_speed": 12.3,
    "engine_rpm": 1200,
    "throttle": 20,
    "coolant_temp": 82
  }
}

Send and read targets accept raw arbitration IDs such as 0x123 or exact semantic names such as alias.MessageName. Schema and message-list filters also accept partial or glob-style semantic names. DBC paths and trace paths must be absolute.

Periodic sends require periodicity_ms of at least 1.

Trace export

Trace export uses python-can logger suffix dispatch. The trace path must be absolute and the parent directory must exist. Use .asc for ASCII logs; other python-can-supported suffixes select their corresponding writer.

Development

uv run ruff check .
uv run pytest
uv build --no-sources

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

agent_can-0.1.1.tar.gz (10.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

agent_can-0.1.1-py3-none-any.whl (13.6 kB view details)

Uploaded Python 3

File details

Details for the file agent_can-0.1.1.tar.gz.

File metadata

  • Download URL: agent_can-0.1.1.tar.gz
  • Upload date:
  • Size: 10.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.11.12 {"installer":{"name":"uv","version":"0.11.12","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for agent_can-0.1.1.tar.gz
Algorithm Hash digest
SHA256 4f20d82dddb8b0f4d85d3ffcf5c8d093df793beba029f5b9bb70bb1af525035d
MD5 3d236d614acd331fdcae66173b280e75
BLAKE2b-256 71e5459eb37926b83d97cbfbc1ea9025e0577e573d08fe5783e3c26e79c4652e

See more details on using hashes here.

File details

Details for the file agent_can-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: agent_can-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 13.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.11.12 {"installer":{"name":"uv","version":"0.11.12","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for agent_can-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 842d3c65b6d258997f540f0b93b3ce891ace051437ad50371cd62fbcd0e04137
MD5 05ae5b4af79a3fa9788aba16015ee9fa
BLAKE2b-256 d29e50a1bb1702c35e970b0d0d925ea5dc72bf57d26d02e0c9e5d61df1c5d448

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page