Skip to main content

carrot-mcp-io

Carrot MCP IO Server - serial, TCP, UDP transport wrapper for hardware and network communication.

Tools

Tool Description
version Get server version info
list_transports List available transport types and serial ports
open Open a connection (serial, tcp, udp)
close Close a 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 I/O operations (write/read/wait/flush)
history Get operation history for a connection

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
  }
}

Examples

# List available transports
uvx carrot-mcp-io@latest

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

Buffer Behavior (Backpressure)

  • RX buffer: when full, the poll thread stops reading from hardware/network. Data stays in the OS 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, a TimeoutError is raised.
  • 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}
]

Download files

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

Source Distribution

carrot_mcp_io-0.3.4.tar.gz (9.7 kB view details)

Uploaded Source

Built Distribution

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

carrot_mcp_io-0.3.4-py3-none-any.whl (12.2 kB view details)

Uploaded Python 3

File details

Details for the file carrot_mcp_io-0.3.4.tar.gz.

File metadata

  • Download URL: carrot_mcp_io-0.3.4.tar.gz
  • Upload date:
  • Size: 9.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for carrot_mcp_io-0.3.4.tar.gz
Algorithm Hash digest
SHA256 ebf01fdbb1dbc6a422edb7ea8fd0cac78888d2cbfa4eae208f3b432022593285
MD5 22fc60d497170b813ff5833a3f6c3a6b
BLAKE2b-256 76ad3cbe8fccc56b4243a5eea7895ed24f8705fb8e09042d5a9dc5ec7cb7d67a

See more details on using hashes here.

File details

Details for the file carrot_mcp_io-0.3.4-py3-none-any.whl.

File metadata

  • Download URL: carrot_mcp_io-0.3.4-py3-none-any.whl
  • Upload date:
  • Size: 12.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for carrot_mcp_io-0.3.4-py3-none-any.whl
Algorithm Hash digest
SHA256 dfbadbaa96712ce0e77166ff77f9162b74d5e7122028ec90e68ddc6139edb099
MD5 45350b613466a9d5ab88c6213ce68ec7
BLAKE2b-256 72f3b2ef4bc1a203c3f8006aa86878d70c1f2e28accca03e7cc01072fb208550

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

0.3.4 This release

2 files

0.3.3

2 files

0.3.2

2 files

0.3.1

2 files

0.3.0

2 files

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