How adancurusul/serial-mcp-server works
Serial MCP Server exposes serial-device operations through both an MCP stdio server and a scriptable CLI. Users discover ports, open connections, exchange data or control lines, and close connections; bounded capture reads extend ordinary reads. Its macro workflow validates and loads or accepts a JSON pack, plans macros or assemblies, then runs the plan against a connection or simulated input. The graph includes session management and configuration as supporting layers. README documents CLI capabilities beyond the sampled CLI implementation, so those links are limited to documented dispatch and behavior.
Main entry points: serial_handler.rs MCP tools · main.rs Command dispatch · cli.rs CLI commands · mod.rs Connection manager
Components 20
Entry points
- Command dispatch
src/main.rs - CLI commands
src/cli.rs - MCP tools
src/tools/serial_handler.rs - Tool inputs
src/tools/types.rs
Serial access
- Port discovery
src/serial/port.rs - Connection manager
src/serial/mod.rs - Serial connection
src/serial/connection.rs - Capture reads
src/serial/capture.rs
Macro automation
- Macro DSL
src/automation/dsl.rs - Pack validation
src/automation/validation.rs - Pack registry
src/automation/registry.rs - Plan expansion
src/automation/planner.rs - Macro execution
src/automation/executor.rs - Macro transports
src/automation/transport.rs
Runtime support
- Configuration
src/config.rs - Session lifecycle
src/session/manager.rs - Session state
src/session/serial_session.rs
Other components
- CLI user
- MCP client
- Serial device
Connections 25
- CLI user → Command dispatch: invokes
- Command dispatch → Configuration: loads config
- Command dispatch → CLI commands: dispatches CLI
- Command dispatch → MCP tools: serves MCP
- MCP client → MCP tools: calls tools
- MCP tools → Tool inputs: uses inputs
- CLI commands → Port discovery: lists ports
- CLI commands → Connection manager: serial commands
- MCP tools → Port discovery: lists ports
- MCP tools → Connection manager: manages connections
- Connection manager → Serial connection: opens and retrieves
- Serial connection → Serial device: reads and writes
- MCP tools → Capture reads: captures reads
- CLI commands → Capture reads: capture options
- Session lifecycle → Session state: tracks sessions
- Session lifecycle → Connection manager: creates connections
- MCP tools → Pack validation: validates packs
- Pack validation → Macro DSL: checks definitions
- MCP tools → Pack registry: loads and lists
- MCP tools → Plan expansion: requests plans
- Plan expansion → Macro DSL: expands targets
- MCP tools → Macro execution: runs plans
- Macro execution → Macro transports: dispatches steps
- Macro transports → Serial connection: uses connection
- Macro transports → Serial device: simulates reads