Skip to main content

carrot-mcp-io

Carrot MCP IO Server - High-performance async serial, TCP, and UDP transport server for hardware and network communication, powered by the carrot-io engine.

Tools

Tool Description
version Get server version and carrot-io engine info
list_transports List available transport types and system serial ports
open Open a physical serial or network connection (serial, tcp, udp)
close Close an open connection
read Read data with physical framing options (default available, until delimiter, exact fixed-length)
recv Non-blocking read directly from buffer
write Send raw bytes (hex or ascii with escape support)
query Atomic Request-Response (write command, optional delay, read response until delimiter or timeout)
script Execute a sequence of I/O operations (write/read/query/wait/flush)
history Get structured TX/RX communication and timing history

Transports

Serial

{
  "open": {
    "port": "COM3",
    "transport": "serial",
    "baudrate": 115200
  }
}

TCP

{
  "open": {
    "port": "mydevice",
    "transport": "tcp",
    "host": "192.168.1.100",
    "net_port": 5000
  }
}

UDP

{
  "open": {
    "port": "sensor",
    "transport": "udp",
    "host": "192.168.1.200",
    "net_port": 8888
  }
}

Physical Stream Framing (Delimiter & Fixed Length)

In real-world embedded/hardware communication, raw stream bytes require clear framing boundaries:

  1. Delimiter Truncation (until): Reads until a line break or delimiter string arrives (e.g. \n, \r\n for SCPI instruments or AT commands).
    {
      "read": {
        "port": "COM3",
        "until": "\n",
        "fmt": "ascii"
      }
    }
    
  2. Fixed Length (exact=True): Waits until exactly size bytes arrive from the hardware before returning (for fixed sensor telemetry blocks).
    {
      "read": {
        "port": "COM3",
        "size": 32,
        "exact": true,
        "fmt": "hex"
      }
    }
    
  3. Atomic Request-Response (query): Writes command, waits optional physical delay seconds, and reads response:
    {
      "query": {
        "port": "COM3",
        "ascii": "*IDN?\n",
        "until": "\n",
        "fmt": "ascii"
      }
    }
    

Buffer & Concurrency Behavior

  • Powered by carrot-io's pure async FifoBuffer ring buffer, zero-copy reads, and hot-path memory logging.
  • Concurrency-safe: non-blocking coroutines with read/write locks, no background thread polling or GIL lock contention.
  • Full process lifecycle safety: automatic cleanup on server termination and atexit fallback to prevent OS COM port deadlocks.

Return Format

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

  • read/recv/query return data in the specified format (default "hex", uppercase e.g. "48656C6C6F")
  • read/recv/query with fmt="ascii" return decoded string (e.g. "Hello\nWorld")
  • write/query support hex or ascii input, ascii supports escape sequences (\n, \x00, etc.)
  • script executes a sequence of operations and returns a list of step results

Script Example

[
  {"op": "write", "ascii": "AT+RST\r\n"},
  {"op": "wait", "ms": 50},
  {"op": "read", "until": "\n", "expect": "ready\r\n", "fmt": "ascii"},
  {"op": "query", "ascii": "AT+CSQ\r\n", "until": "\n", "fmt": "ascii"}
]

Script Return Format

Each step result contains:

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

Additional fields by op:

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

Metadata

Release files for carrot-mcp-io 1.0.1

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-io 1.0.1
File Size Uploaded Provenance Actions
carrot_mcp_io-1.0.1.tar.gz 7.5 kB Without provenance Details for carrot_mcp_io-1.0.1.tar.gz

Built distribution (wheel)

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

Total release size: 16.2 kB

Release files / carrot_mcp_io-1.0.1.tar.gz

Download URL carrot_mcp_io-1.0.1.tar.gz
Size 7.5 kB
Tags Source
SHA-256 checksum
How to use checksums
e92f764c2430c32148f9a9af472bb18211a76b19f8a889ea1f75489738be5637
BLAKE2b-256 checksum
How to use checksums
29edaf4a7940e668546e116c9616b3b4a9d9a25e5a445d778e04a7dbb98defc1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.14

Release files / carrot_mcp_io-1.0.1-py3-none-any.whl

Download URL carrot_mcp_io-1.0.1-py3-none-any.whl
Size 8.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
14434153bdbfb08eb8cc26c1af568ebafc3673ccc323f49527726be35e5d0fc4
BLAKE2b-256 checksum
How to use checksums
fe7c02eb9072b7edb038248eee12f27b30b59b8db90ab69f2bed8d4d841e84d0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.14

Security for carrot-mcp-io 1.0.1

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