Servomotor-MCP is an MCP server for driving the Gearotons M17 open-source servo motor through natural language. The M17 is a NEMA-17 integrated, closed-loop, RS-485 servo motor. This server exposes the M17 to Claude Desktop, Claude Code, or any MCP client, letting users control a real motor through natural-language instructions, for example: "Find my motors and rotate the one on the bench two full turns, slowly."
Main capabilities
- Serial port discovery: list_serial_ports enumerates the ports on the machine (macOS /dev/cu., Windows COM, Linux /dev/ttyUSB*) and flags USB serial adapters.
- Connection: connect opens the port chosen by the user or model at 230400 baud.
- Auto-detection: automatically detects every motor on the bus (unique ID + alias), with no need to write an address map.
- Motor driving: the server automatically converts every command in the firmware command set into an MCP tool (48 commands as of library 0.10.0), including enable_mosfets, go_to_position, move_with_velocity, move_with_acceleration, multimove, homing, zero_position, get_position, get_temperature, set_device_alias, set_pid_constants, system_reset, vibrate, ping, and more; it also provides high-level tools for everyday motion.
- Addressing modes: motors can be addressed by alias number, 16-bit hexadecimal unique ID, or "all" (broadcast).
- Unit conversion: parameters use friendly units (degrees, seconds, degrees/second, volts, degrees Celsius), and the server converts them to firmware units.
Usage
- Quick start without hardware (about 2 minutes): copy the configuration block from examples/claude_desktop_config.json into claude_desktop_config.json, restart Claude Desktop, then ask: "What serial ports do you see? Connect and find my motors." A scripted demo is provided in examples/demo_prompts.md.
- Driving real motors: plug one M17 (or multiple in a daisy chain) into a USB↔RS-485 adapter and install the [serial] extra component; no other configuration is needed. After installing the servomotor library, the server automatically uses the real serial backend; if it is not installed, the server runs a simulator and will explain this: list_serial_ports and connect return a notice field and output a warning to stderr. When using uv, run uvx --from 'servomotor-mcp[serial]' servomotor-mcp.
- Environment variables (all optional): GEAROTONS_MOTOR_BACKEND (auto, serial, or mock; default auto: use serial when the servomotor library is installed, otherwise use mock), GEAROTONS_SERIAL_PORT (the default port for connect when no port is passed by the model), GEAROTONS_DEFAULT_SPEED_DPS (the default speed for move_to / move_relative, 180).
- hardware_tests/ contains scripts for end-to-end testing of the real serial path against a bench motor (port scanning, full command suite, stdio MCP session).
Technical architecture
- The server is a thin layer on top of the Gearotons servomotor Python library. The library is data-driven—motor_commands.json defines each firmware command—and the server converts the same command catalog into MCP tools, so new commands added to the library appear automatically.
- Tool calls are forwarded directly to the hardware, with no software limits; the full multi-turn travel range and arbitrary speeds are supported. The motor's own firmware protections (overcurrent/overvoltage/overtemperature) still apply.
- The same set of tools can run against the mock backend (GEAROTONS_MOTOR_BACKEND=mock) for development and CI.
Validation status
- The complete firmware command surface (48 commands), serial port discovery, bus auto-detTested on physical M17 (firmware 0.15.3.0) via a real stdio MCP session and uvx, covering all four test adapters (motors are only discovered where motors actually exist).
- Simulated backend + 39 unit tests, no hardware required.
- Cross-platform port handling via pyserial enumeration (macOS / Windows / Linux).
Use cases and limitations
- Use cases: controlling M17 servo motors via natural language, hardware-free development and CI testing, cross-platform serial motor control.
- Limitations: requires an MCP client; real hardware control requires an M17 motor and a USB↔RS-485 adapter; the current material does not provide other limitations or pricing information.