Skip to main content
Glama
README.md
# SO-101 × Claude Code

An MCP server that gives Claude Code (or any MCP client) a real [SO-101](https://github.com/TheRobotStudio/SO-ARM100) robot arm.
Claude reads joint state, moves joints, runs saved poses and gestures, works the gripper and looks at the desk through a camera.
A safety core on top of [LeRobot](https://github.com/huggingface/lerobot) keeps every move inside the arm's calibrated range.

[![SO-101 driven by Claude Code](docs/so101-claude-code.jpg)](https://www.ayuugoyal.tech/robotics/so101-claude-code.mp4)

▶ [Demo video](https://www.ayuugoyal.tech/robotics/so101-claude-code.mp4) · more at [ayuugoyal.tech/robotics](https://www.ayuugoyal.tech/robotics)

```
> wave at me, then look around the desk

⏺ so101 - status()
⏺ so101 - gesture(name="wave", repeats=3)
  ⎿ Did 'wave' and returned to: shoulder_pan=74.0, shoulder_lift=-102.3, ...
⏺ so101 - look(camera=0)
```

## Tools

| Tool | What it does |
|---|---|
| `status` | Connects if needed; joint angles, calibrated limits, motor temperatures, supply voltage |
| `move_joints` | Absolute targets in degrees (gripper 0-100); omitted joints hold still |
| `nudge` | Relative moves from the current position |
| `gripper` | 0 = closed, 100 = fully open |
| `go_to_pose` / `save_pose` / `list_poses` | Named poses stored in `poses.json` |
| `gesture` | `wave`, `nod`, `shake`, `look_around`, `garba`; returns to the starting pose |
| `look` | Camera photo (OpenCV), so Claude can see the scene |
| `release` | Parks at rest, then turns torque off |

Joint angles are degrees with 0 at the middle of each joint's calibrated range.

## Safety model

LeRobot does not clamp targets in degrees mode, so `so101_core.Arm` adds:

- **Range clamp**: every target is clamped to the joint's calibrated range, and the reply says what was clamped.
- **Speed cap**: motion is interpolated (smoothstep) at ≤ 100 deg/s, and LeRobot's `max_relative_target` limits every step.
- **One command at a time**: a lock serializes the serial bus, and `stop()` halts at the next step.
- **Park before limp**: torque is never released mid-air. `release()`, idle timeout and process exit all move to `rest` first.
- **Idle auto-park**: after `SO101_IDLE_RELEASE_S` seconds without a command (default 180).
- **Errors go to the model**: hardware errors (port busy, no power, no calibration) come back as tool results with a fix, not a crash.

## Setup

You need a calibrated SO-101 follower arm. A leader arm is only needed for teleoperation.

```bash
git clone https://github.com/ayuugoyal/so101-claude-code
cd so101-claude-code
python -m venv .venv && source .venv/bin/activate   # Windows: .venv\Scripts\activate
pip install -r requirements.txt

lerobot-find-port                                     # which port is the follower on?
lerobot-calibrate --robot.type=so101_follower --robot.port=COM13 --robot.id=my_follower
```

Then register the server with Claude Code (use the Python from the environment above):

```bash
claude mcp add so101 \
  --env SO101_PORT=COM13 --env SO101_ID=my_follower \
  -- /path/to/.venv/bin/python /path/to/so101-claude-code/server.py
```

Or in `.mcp.json`:

```json
{
  "mcpServers": {
    "so101": {
      "command": "/path/to/.venv/bin/python",
      "args": ["/path/to/so101-claude-code/server.py"],
      "env": { "SO101_PORT": "COM13", "SO101_ID": "my_follower" }
    }
  }
}
```

| Variable | Default | Meaning |
|---|---|---|
| `SO101_PORT` | `COM13` | Follower serial port (`/dev/ttyACM0` on Linux, `/dev/tty.usbmodem…` on macOS) |
| `SO101_ID` | `my_follower` | The `--robot.id` you calibrated with |
| `SO101_IDLE_RELEASE_S` | `180` | Park and release after this many idle seconds (`0` = never) |
| `SO101_APP_URL` | unset | Optional: forward every tool to a local app that owns the port (see `server.py`) |

### Poses

`poses.json` ships with `rest`, `ready`, `hand_up` and `face_me`. **`rest` depends on your calibration**: before the first `release()`, fold your arm by hand into its resting position (with torque off) and save it, e.g. ask Claude to "save this pose as rest".

### Smoke test

```bash
python test_client.py                                    # list tools only, no motion
python test_client.py status "gesture:{\"name\":\"nod\"}" release
```

## Files

| File | |
|---|---|
| `server.py` | MCP server (stdio); thin tool layer |
| `so101_core.py` | `Arm`: connection, clamping, interpolated motion, gestures, poses, leader-arm teleop, idle park |
| `poses.json` | Saved poses |
| `test_client.py` | Starts the server like Claude Code does and calls tools |

## License

[Apache-2.0](LICENSE). Built on [LeRobot](https://github.com/huggingface/lerobot) (Apache-2.0) and the [SO-ARM100/SO-101](https://github.com/TheRobotStudio/SO-ARM100) design by TheRobotStudio.

Made by [Ayush Goyal](https://www.ayuugoyal.tech) · [@ayuugoyal](https://x.com/ayuugoyal)