Environment Variables
mcserial reads configuration from environment variables at startup. These variables set server-wide defaults that apply to all connections unless overridden by tool parameters.
Server Configuration
Section titled “Server Configuration”MCSERIAL_DEFAULT_BAUDRATE
Section titled “MCSERIAL_DEFAULT_BAUDRATE”Default baud rate used when open_serial_port is called without a baudrate parameter and auto-detection either fails or is not applicable (e.g., URL-based connections).
| Default | 9600 |
| Type | Integer |
| Example | MCSERIAL_DEFAULT_BAUDRATE=115200 |
# Set a higher default for modern devicesexport MCSERIAL_DEFAULT_BAUDRATE=115200MCSERIAL_DEFAULT_TIMEOUT
Section titled “MCSERIAL_DEFAULT_TIMEOUT”Default read timeout in seconds for new connections. Applied as the timeout parameter when open_serial_port is called without an explicit timeout.
| Default | 1.0 |
| Type | Float (seconds) |
| Example | MCSERIAL_DEFAULT_TIMEOUT=2.0 |
# Longer timeout for slow devicesexport MCSERIAL_DEFAULT_TIMEOUT=5.0MCSERIAL_MAX_CONNECTIONS
Section titled “MCSERIAL_MAX_CONNECTIONS”Maximum number of simultaneously open serial port connections. Attempts to open more ports than this limit return an error.
| Default | 10 |
| Type | Integer |
| Example | MCSERIAL_MAX_CONNECTIONS=20 |
# Allow more concurrent connectionsexport MCSERIAL_MAX_CONNECTIONS=20Setting Environment Variables
Section titled “Setting Environment Variables”For other MCP clients, consult their documentation for how to pass environment variables to server processes.
Installation Extras
Section titled “Installation Extras”mcserial supports optional dependency groups for specialized hardware.
mcserial[cp2110]
Section titled “mcserial[cp2110]”Adds the hidapi package for Silicon Labs CP2110 HID-to-UART bridge support. Required to use the cp2110:// URL scheme with open_serial_port.
# Install with CP2110 supportuv pip install mcserial[cp2110]
# Or with uvxuvx --with hidapi mcserialWithout this extra installed, attempting to open a cp2110:// URL returns an error:
cp2110:// requires the hidapi package. Install with: pip install mcserial[cp2110]