coserial
Enables humans and AI agents to collaboratively control serial ports via MCP tools or Web UI, with real-time data sharing across all participants.
README
coserial
简体中文 | English
Collaborative Serial Debug Bridge. Humans and AI Agents co-control serial ports via MCP tools or Web UI, sharing all IO data in real time. Humans, Agents, and hardware — all on the same page.
Architecture
Agent A ── MCP stdio ── coserial-client ──┐
Agent B ── MCP stdio ── coserial-client ──┤
Agent C ── MCP stdio ── coserial-client ──┤
... │ HTTP (localhost)
Human A ── Web UI ────────────────────────┤
Human B ── Web UI ────────────────────────┤
... ▼
coserial-server
├── HTTP API (/mcp/…) ← MCP tool calls
├── WebSocket /ws ← Web UI real-time data
├── GET / ← Web UI (HTML/CSS/JS)
├── SessionManager
│ ├── COM1
│ ├── COM2
│ └── ...
└── Web UI Monitor
Features
- 🤝 Human-Agent Collaboration — Humans and AI Agents share the same serial session, debugging in real time
- 🔌 MCP Tool Control — Agents read/write serial ports, wait for pattern matches, send commands, etc. via standard MCP protocol
- 🖥️ Web UI Monitor — Dark theme, real-time RX/TX data stream, HEX display, search highlighting, log export
- 🔄 Three-Party Data Sync — Agent I/O and Web UI I/O write to the same buffer — nobody misses anything
- 📡 Multi-Session Management — Connect to multiple serial ports simultaneously, switch via Web UI dropdown
- 🔧 Signal Line Control — DTR/RTS hardware reset support
- 📝 Log Persistence — Serial I/O automatically recorded to file
- 🎯 Zero-Build Frontend — Vanilla HTML/CSS/JS, no frontend toolchain required
Quick Start
Install
# Clone the repo
git clone https://github.com/FlipFlopszzz/coserial.git
cd coserial
# Install dependencies (requires uv)
uv sync
Launch
# Start server + open Web UI (manual debug mode)
uv run coserial
# Start and auto-connect to COM20
uv run coserial COM20
# List all active sessions
uv run coserial list
# Start server only (headless)
uv run coserial-server
MCP Tools
| Tool | Description |
|---|---|
server() |
Discover/start server process, returns port |
open_session(port, baud) |
Create a serial session, returns session_id |
close_session(session_id) |
Close a specific session |
write(session_id, data) |
Send data to serial port |
read(session_id, timeout, size) |
Read buffer data |
wait_for(session_id, pattern, timeout) |
Wait for output matching a regex |
command(session_id, data, expect, timeout) |
Send command and wait for response |
set_params(session_id, baud, ...) |
Dynamically adjust serial parameters |
get_params(session_id) |
Get full session parameters |
set_signals(session_id, dtr, rts) |
Control DTR/RTS signal lines |
list_ports() |
List available serial ports |
list_sessions() |
List all active sessions |
web(port) |
Open Web UI in system browser |
preview(port) |
Return URL for Agent's embedded browser |
shutdown_server() |
Shut down server process |
Web UI
Open http://127.0.0.1:37210/ directly in your system browser, or via any Agent tool's embedded browser.
Project Structure
coserial/
├── pyproject.toml
├── src/coserial/
│ ├── __main__.py # Entry: uv run coserial
│ ├── client.py # MCP stdio client → HTTP proxy to server
│ ├── server.py # Server: HTTP API + WebSocket + Web UI
│ ├── session.py # SessionBuffer + SerialSession + SessionManager
│ └── web_ui/
│ └── index.html # Single-page HTML, inline CSS/JS
Dependencies
- Python >= 3.11
- pyserial — Serial communication
- mcp — MCP SDK (FastMCP)
- websockets — WebSocket server
- aiohttp — HTTP server
- pywin32 — Windows process management
- Icons from IconPark
License
Recommended Servers
playwright-mcp
A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.
Magic Component Platform (MCP)
An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.
Audiense Insights MCP Server
Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.
VeyraX MCP
Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.
graphlit-mcp-server
The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.
Kagi MCP Server
An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.
Neon Database
MCP server for interacting with Neon Management API and databases
E2B
Using MCP to run code via e2b.
Exa Search
A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.
Qdrant Server
This repository is an example of how to create a MCP server for Qdrant, a vector search engine.