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.0.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.0-py3-none-any.whl (13.5 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: agent_can-0.1.0.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.0.tar.gz
Algorithm Hash digest
SHA256 711875d3f6561434faa8a3391ff43ce905ce5bb251cbd401c62ef7aa860c1209
MD5 c4b1d5631c721be08cf6af83962a8a52
BLAKE2b-256 426718a5ceffba165500cfaf18fabd82d4595f159058c13f2244248557d07f02

See more details on using hashes here.

File details

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

File metadata

  • Download URL: agent_can-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 13.5 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.0-py3-none-any.whl
Algorithm Hash digest
SHA256 4f015494565a1bccbc77e0f6e0b75427fe45e4dc56ae3ba2c64cfc5e788bab87
MD5 0440c474ba7d744b51ed54668f571c56
BLAKE2b-256 030457fd3dc1f69b1f7aa72297d8a0295be3cd0ea02124bfff6fc1ec12a1dfcb

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