Serial Web Terminal MCP
Allows interaction with Linux serial devices (e.g., /dev/ttyUSB*, /dev/ttyS*) for device management, command execution, and monitoring via a web terminal.
Provides integration with serial port devices in Python environments, allowing AI agents to connect to serial ports, send commands, and capture output from devices like embedded systems, network equipment, and industrial hardware.
Click on "Install Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@Serial Web Terminal MCPConnect to /dev/ttyUSB0 and list all serial ports"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
Serial Web Terminal MCP
A Model Context Protocol server that gives AI coding assistants (Claude Code, Cursor, Windsurf, etc.) the ability to interact with serial port devices.
AI agents can connect to serial devices, send commands, and capture output โ while users watch the entire process in real-time through a browser-based terminal.
โจ Features
๐ Serial Connection โ Connect to COM ports,
/dev/ttyUSB*,/dev/ttyS*, etc. with automatic login๐ฅ๏ธ Web Terminal โ xterm.js browser terminal showing real-time serial I/O (like Xshell)
๐ค MCP Server โ Native tool integration; AI agents call directly via MCP protocol
๐ Timestamped Logs โ Every line logged with timestamps, daily rotation, matches terminal display exactly
โจ๏ธ Bidirectional โ AI sends commands + user can type manually in the browser terminal
๐ Multi-language Login โ Auto-detects login/password prompts in English, Chinese, and Japanese
โฑ๏ธ Wait-and-Send โ Wait for specific output then immediately send data (e.g., uboot password windows)
๐ก๏ธ Timeout Recovery โ Automatic Ctrl+C on timeout, no hung sessions
๐ฆ Installation
pip install mcp pyserial aiohttpOr from requirements:
pip install -r requirements.txt๐ Quick Start
1. Configure your AI client
Claude Code (.mcp.json in project root or ~/.claude/claude_config.json):
{
"mcpServers": {
"serial-terminal": {
"command": "python",
"args": ["/path/to/serial_mcp_server.py"]
}
}
}Cursor (Settings โ MCP โ Add Server):
{
"mcpServers": {
"serial-terminal": {
"command": "python",
"args": ["/path/to/serial_mcp_server.py"]
}
}
}See
examples/for ready-to-use configuration files.
2. Talk to your AI assistant
> List available serial ports
AI: [calls serial_list_ports] โ Found COM3, COM4...
> Connect to COM3, username admin, password ****
AI: [calls serial_connect(port="COM3", login_user="admin", login_pass="****")]
โ Serial connected, Web terminal: http://localhost:8080
> Run uname -a
AI: [calls serial_send(command="uname -a")]
โ Linux device 4.19.246 aarch64 GNU/LinuxOpen http://localhost:8080 in your browser to watch AI's serial operations in real-time.
๐ง MCP Tools
Tool | Description |
| List all available serial port devices |
| Connect to a serial port and start the web terminal (supports auto-login) |
| Send a shell command and return device output |
| Send raw data (e.g., Ctrl+C = |
| Wait for specific output, then immediately send data (for time-critical operations) |
| Check current connection status |
| Get timestamped operation logs |
| Disconnect and stop the web terminal |
serial_connect
Connect to a serial device with optional auto-login.
Parameter | Type | Default | Description |
| str | (required) | Serial device name (e.g., |
| int |
| Baud rate |
| str |
| Auto-login username (skip if empty) |
| str |
| Auto-login password |
| str |
| Command to run after login (prevent session timeout) |
| int |
| Web terminal port |
serial_send
Send a shell command and capture output.
Parameter | Type | Default | Description |
| str | (required) | Shell command to execute |
| int |
| Response timeout in seconds |
serial_wait_send
Wait for a specific string in serial output, then immediately send data. Ideal for:
Entering uboot during reboot (3-second password window)
Responding to login prompts
Any "wait for X, then send Y" automation
Parameter | Type | Default | Description |
| str | (required) | Target string to wait for |
| str | (required) | Data to send when target is found |
| int |
| Max wait time in seconds |
| str |
| Optional data to send before waiting (e.g., |
๐ฅ๏ธ Standalone Usage (without MCP)
serial_web.py can run independently via HTTP API:
# Start with auto-login
python serial_web.py --port COM3 --baud 115200 \
--login-user admin --login-pass secret \
--init-cmd "unset TMOUT"
# List available ports
python serial_web.py --listHTTP API
# Send a command
curl -s -X POST http://localhost:8080/api/send \
-H "Content-Type: application/json" \
-d '{"command":"ls /","timeout":5}'
# Send raw data (Ctrl+C)
curl -s -X POST http://localhost:8080/api/raw \
-H "Content-Type: application/json" \
-d '{"data":"\x03"}'
# Wait-and-send
curl -s -X POST http://localhost:8080/api/wait-send \
-H "Content-Type: application/json" \
-d '{"wait_for":"login:","send_data":"admin","timeout":30}'
# Check status
curl -s http://localhost:8080/api/status
# Get logs
curl -s "http://localhost:8080/api/log?lines=50"CLI Arguments
Argument | Default | Description |
| (required) | Serial device name (COM3, /dev/ttyUSB0) |
|
| Baud rate |
|
| Web server port |
| (none) | Auto-login username |
| (none) | Auto-login password |
|
| Post-login command (use |
| (auto) | Custom prompt detection regex |
| โ | List available serial ports |
๐ Log Format
Logs are saved to logs/serial_YYYYMMDD.log (daily rotation):
2026-08-06 15:32:22 device # uname -a
2026-08-06 15:32:22 Linux device 4.19.246 aarch64 GNU/Linux
2026-08-06 15:32:23 device # cat /proc/cpuinfo | head -5
2026-08-06 15:32:23 processor : 0
2026-08-06 15:32:23 >>> ่ชๅจ็ปๅฝๆต็จๅฎๆTerminal output:
timestamp content(extracted from xterm.js buffer โ matches browser display exactly)System events:
timestamp >>> message(login, startup, etc.)
Log line fidelity:
No wrap splitting โ lines soft-wrapped by the terminal (80-column wrap) are merged back into a single logical line
Progress-bar aware โ
\roverwrite sequences (10%\r20%\r30%) are collapsed to the final visible state (30%)Backspace-aware โ manual edits with backspace are recorded as the final edited line
Every line always carries a timestamp prefix
๐๏ธ Architecture
AI Agent (Claude Code / Cursor / ...)
โโ MCP Protocol (stdio)
โโ serial_mcp_server.py
โโ HTTP API
โโ serial_web.py (aiohttp)
โโ Serial Port (pyserial)
โโ Web Terminal (xterm.js + WebSocket)
โโ Log Recording
Browser
โโ http://localhost:8080
โโ xterm.js terminal (real-time serial data)
โโ Log panel (timestamped logs)๐ Project Structure
serial-web-terminal/
โโโ serial_web.py # Core: Web terminal + HTTP API
โโโ serial_mcp_server.py # MCP Server (wraps HTTP API)
โโโ tests/
โ โโโ test_regression.py # Regression test suite (68 tests)
โโโ examples/
โ โโโ claude-code.json # Claude Code MCP config
โ โโโ cursor.json # Cursor MCP config
โโโ requirements.txt
โโโ LICENSE
โโโ README.md๐งช Testing
Run the regression test suite (no physical serial device required):
python tests/test_regression.py -vTests cover:
Output cleaning (ANSI stripping, echo removal, prompt removal)
Prompt detection (shell prompts, known prompts)
Log line buffering (backspace handling, partial lines, ANSI cleaning)
Auto-login keyword detection (English, Chinese, Japanese)
Command send/receive (mock serial, timeout, Ctrl+C recovery)
Wait-and-send (immediate match, dynamic match, timeout, trigger)
HTML page structure (no duplicate IDs, required elements)
MCP server tool registration
HTTP API endpoints (status, send, raw, log โ error handling)
Security (no hardcoded credentials, .gitignore coverage)
๐ Auto-Login
The auto-login flow supports multi-language prompts:
Language | Login Prompts | Password Prompts |
English |
|
|
Chinese |
|
|
Japanese | โ |
|
Login flow:
Send Enter to wake the terminal
Detect
login:prompt โ send usernameDetect
Password:prompt โ send passwordWait for shell prompt
Execute
stty cols 200(wide terminal, prevents 80-column wrapping)Execute
--init-cmd(default:unset TMOUT)
If already logged in (no login prompt detected), skips to step 5.
๐ License
This server cannot be installed
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Related MCP Connectors
Connect AI assistants to GitHub - manage repos, issues, PRs, and workflows through natural language.
Live browser debugging for AI assistants โ DOM, console, network via MCP.
Connect AI assistants to your GitHub-hosted Obsidian vault to seamlessly access, search, and analyโฆ
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/WakkeWang/serial-terminal-mcp-tool'
If you have feedback or need assistance with the MCP directory API, please join our Discord server