Skip to main content
Archived

This project has been archived by its maintainers, and is no longer receiving any updates.

carrot-mcp-serial

Carrot MCP Serial Server - pyserial wrapper for serial port communication.

Tools

Tool Description
version Get server version info
list_ports List available serial ports
open Open a serial port connection (baudrate, parity, timeouts, buffer_size)
close Close a serial port connection
read Blocking read with timeout
recv Non-blocking read from buffer
write Buffered write (hex or ascii with escape support)
script Execute a sequence of serial operations (write/read/wait/flush)
history Get operation history for a port

Examples

# List ports
uvx carrot-mcp-serial@latest

# MCP config
{
  "carrot-serial": {
    "command": "uvx",
    "args": ["carrot-mcp-serial@latest"]
  }
}

Buffer Behavior (Backpressure)

  • RX buffer: when full, the poll thread stops reading from hardware. Data stays in the OS serial buffer until the consumer frees space. No data is silently dropped.
  • TX buffer: when full, write() blocks until the poll thread drains enough space. If write_timeout expires (or drain cannot complete due to device issues), a TimeoutError is raised. Hardware write failures also raise the original exception (e.g. SerialException).
  • Buffer size is configurable via the buffer_size parameter on open (default 1MB).

Return Format

All tools return dict with {"status": "ok"|"error", ...}.

  • read/recv returns data in the specified format (default "hex", uppercase e.g. "48656C6C6F")
  • read/recv with fmt="ascii" returns escaped string (e.g. "Hello\nWorld")
  • write supports hex or ascii input, ascii supports escape sequences (\n, \x00)
  • script executes a sequence of operations, each step returns its result

Script Example

All read params are optional with defaults: size=256, timeout=1.0, expect=None, on_mismatch="stop".

[
  {"op": "write", "data": "AA"},
  {"op": "wait", "ms": 10},
  {"op": "write", "data": "BB"},
  {"op": "read", "size": 1, "timeout": 1.0, "expect": "CC"}
]

Minimal read (use defaults):

[
  {"op": "write", "data": "AA"},
  {"op": "read"}
]

Use fmt="ascii" for ASCII mode:

[
  {"op": "write", "data": "Hello"},
  {"op": "read", "size": 10}
]

Note: expect with default on_mismatch="stop" will stop script on mismatch. Use on_mismatch="continue" to only check without stopping.

Script Return Format

Each step result contains:

  • op: Operation type ("write"|"read"|"wait"|"flush")
  • step: Step index (0-based)
  • status: "ok" or "error"

Additional fields by op:

  • write: {bytes_written}
  • read: {data, length} + {matched, expected} if expect provided
  • wait: {ms}
  • On error: {message}

Example:

[
  {"op": "write", "step": 0, "status": "ok", "bytes_written": 2},
  {"op": "read", "step": 1, "status": "ok", "data": "AABB", "length": 2, "matched": true}
]

Metadata

Release files for carrot-mcp-serial 0.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for carrot-mcp-serial 0.2.0
File Size Uploaded Provenance Actions
carrot_mcp_serial-0.2.0.tar.gz 8.7 kB Without provenance Details for carrot_mcp_serial-0.2.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for carrot-mcp-serial 0.2.0
File Interpreter ABI Platform Actions
carrot_mcp_serial-0.2.0-py3-none-any.whl Python 3 none any Details for carrot_mcp_serial-0.2.0-py3-none-any.whl

Total release size: 19.9 kB

Release files / carrot_mcp_serial-0.2.0.tar.gz

Download URL carrot_mcp_serial-0.2.0.tar.gz
Size 8.7 kB
Tags Source
SHA-256 checksum
How to use checksums
ec9eba0b92321ae3bc53f4a57f507fd1d4f6b045debe087edf0111aef35983ed
BLAKE2b-256 checksum
How to use checksums
cf84d29419f6b2e721dbbff0b1ff6d6875f60b6c0062b5fd3227962fbe20edb2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.12

Release files / carrot_mcp_serial-0.2.0-py3-none-any.whl

Download URL carrot_mcp_serial-0.2.0-py3-none-any.whl
Size 11.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
c9508787c5cf161b997e5c3be81c74e3631c298637b953e0a545dd99d88a5439
BLAKE2b-256 checksum
How to use checksums
16d9c50e2a33db77f29ccb523361b1beb9f5dc775cd968923db1c7ebb748ab30
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.12

Security for carrot-mcp-serial 0.2.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page