Skip to main content
Glama
zhang-firmware

UART MCP Server

README.md
# UART MCP Server

Windows-only Python MVP for reading UART logs from Codex through MCP while also showing the same serial stream in a small Tkinter UI.

## Features

- Enumerate available Windows COM ports.
- Open and close one serial port.
- Select common baud rates or enter a custom baud rate.
- Show recent UART logs in a Tkinter window.
- Let Codex read recent logs through MCP.
- Clear logs.
- Send text to the UART, optionally appending CRLF.

## Setup

```powershell
python -m venv .venv
.\.venv\Scripts\Activate.ps1
pip install -r requirements-dev.txt
pip install -e .
```

## Run UI

```powershell
python -m uart_mcp_server.app --ui
```

UI supports:

- Resizable receive and send panes.
- Receive display as ASCII or HEX.
- Multi-line one-shot send as ASCII or space-separated HEX.
- Independent loop send area with format, interval, and repeat count.
- Loop count `0` means send forever until `Stop` is clicked.

HEX send format uses space-separated bytes:

```text
01 03 00 00 00 02
```

## Run MCP Server

```powershell
python -m uart_mcp_server.app --mcp
```

## Codex MCP Example

Add this to your Codex `config.toml`, adjusting the path to this repository:

```toml
[mcp_servers.uart]
command = "python"
args = ["-m", "uart_mcp_server.app", "--mcp"]
cwd = "D:\\UART MCP"
startup_timeout_sec = 10
tool_timeout_sec = 30
```

## Notes

The MVP opens one serial port at a time. Windows usually does not allow two processes to open the same COM port simultaneously.