Skip to main content
Glama
Otii MCP Server
by qoitech
README.md
# Otii MCP server

An [MCP](https://modelcontextprotocol.io) server that lets AI assistants measure the energy consumption of your device with a
Qoitech [Otii Arc](https://www.qoitech.com/otii-arc-pro) or [Otii Ace](https://www.qoitech.com/otii-ace).

You can ask your assistant things like:

> Power my board at 3.3 V for 20 seconds and tell me how much energy one cycle uses.

> I changed the firmware to sleep between transmissions, measure again and compare with the previous recording.

The server powers your device under test from the Otii, records current and (optionally) the device's UART log, and computes energy, charge and current statistics. These can cover a whole recording, a time range, or the interval between two log messages.

> **Early preview.** Tool names and parameters may change. Feedback is welcome through GitHub issues.

## Requirements

- An [Otii Arc](https://www.qoitech.com/otii-arc) or [Otii Ace](https://www.qoitech.com/otii-ace) connected to your computer.
- The [Otii 3](https://home.qoitech.com/download) desktop application or the [otii_server](https://docs.qoitech.com/en/user-manual/automation-toolbox#otii-server) running.
- An Otii account with an [Automation Toolbox](https://www.qoitech.com/automation-toolbox) license available. The server reserves one license for each tool call and returns it afterwards.
- [uv](https://docs.astral.sh/uv/getting-started/installation/), used to run the server without a manual install.

## Configuration

The server is configured through environment variables, set in your MCP client's configuration:

| Variable                         | Default     | Description                                                                  |
|:---------------------------------|:------------|:-----------------------------------------------------------------------------|
| `OTII_CREDENTIALS`               |             | Path to a JSON file with your Otii login (see `credentials.example.json`).   |
| `OTII_USERNAME`, `OTII_PASSWORD` |             | Otii login, used when `OTII_CREDENTIALS` is not set or the file is missing.  |
| `OTII_HOST`                      | `127.0.0.1` | Host running the Otii application.                                           |
| `OTII_PORT`                      | `1905`      | Otii TCP server port.                                                        |
| `OTII_DEVICE`                    |             | Name of the Otii device to use. Only needed when more than one is connected. |

If the Otii application is already logged in, no credentials are needed.

A credentials file keeps your password out of the MCP client's configuration:

```json
{
  "username": "your-otii-username",
  "password": "your-otii-password"
}
```

## Adding the server to your MCP client

### Claude Code

```sh
claude mcp add otii --env OTII_CREDENTIALS=$HOME/.config/otii/credentials.json \
  -- uvx --from git+https://github.com/qoitech/otii-mcp otii-mcp
```

Add `--scope project` to write it to the repository's `.mcp.json`, so that everyone working on the firmware gets it.

### Codex CLI

Register the server with Codex CLI:

```sh
codex mcp add otii --env "OTII_CREDENTIALS=$HOME/.config/otii/credentials.json" \
  -- uvx --from git+https://github.com/qoitech/otii-mcp otii-mcp
```

Create the credentials file using the format above, or omit `--env` if the Otii application is already logged in. Codex saves the server configuration in `~/.codex/config.toml`.

Run `codex mcp list` to verify registration, then start a new Codex session and use `/mcp` to check that the server is connected. See the [Codex MCP documentation](https://developers.openai.com/codex/mcp) for more configuration options.

### Claude Desktop, Cursor, VS Code and other clients

Most clients use the same JSON format: `claude_desktop_config.json` for Claude Desktop, `.cursor/mcp.json` for Cursor, and `.vscode/mcp.json` (under `"servers"`) for VS Code.

```json
{
  "mcpServers": {
    "otii": {
      "command": "uvx",
      "args": ["--from", "git+https://github.com/qoitech/otii-mcp", "otii-mcp"],
      "env": {
        "OTII_CREDENTIALS": "/path/to/credentials.json"
      }
    }
  }
}
```

### From a local clone

```sh
git clone https://github.com/qoitech/otii-mcp
```

Then use `"command": "uv"` with `"args": ["run", "--directory", "/path/to/otii-mcp", "otii-mcp"]`.

## Tools

| Tool                      | Description |
|:--------------------------|:---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `list_devices`            | List connected Otii devices.                                                                                                                                                           |
| `measure`                 | Power the device under test at a given voltage for a set time and record it. Returns a recording id and whole-recording statistics. Optionally records UART output and extra channels. |
| `list_recordings`         | List recordings in the active Otii project.                                                                                                                                            |
| `get_log`                 | Read the recorded UART log, with timestamps, optionally filtered.                                                                                                                      |
| `get_statistics`          | Energy, charge and min/max/average current between two timestamps.                                                                                                                     |
| `energy_between_messages` | Energy between two UART log lines, e.g. one firmware cycle.                                                                                                                            |
| `energy_between_gpi_edges`| Energy while digital input GPI 1 or 2 is high (or low), from one edge to the next, e.g. one active period.                                                                             |
| `set_gpo`                 | Switch Otii digital output GPO 1 or 2.                                                                                                                                                 |
| `set_ace_0_15_voltage`    | Set the voltage of the Ace 0–15 V pin.                                                                                                                                                 |

Recordings are stored in the project that is open in the Otii application, so you can have them there for a closer look.

## Measuring per-cycle energy with UART log markers

The most useful measurements come from combining the current with your firmware's log output:

1. Connect the device's UART TX to the Otii RX, and set `exp_voltage` to the device's IO voltage.
2. Make your firmware print a fixed line once per cycle, e.g. `Connecting...`.
3. Ask the assistant to measure with `uart_baudrate` set. It then calls `energy_between_messages` with that line to get the energy of one cycle. `occurrence: 1` skips the first cycle, which includes boot.

## Measuring per-phase energy with GPI markers

For more precise timing than log lines, drive a spare GPIO high during the phase you want to measure (e.g. while active, or during a sleep) and wire it to Otii GPI1 or GPI2. Ask the assistant to measure with `channels: ["i1"]` (or `"i2"`) and `exp_voltage` set to the device's IO voltage. It then calls `energy_between_gpi_edges` to get the energy from the rising to the falling edge. Only complete intervals count, so a pin that is already high when the recording starts does not give an interval.

## USB Flashing

**Tip:** if your device is also connected over USB for flashing or debugging, it may be partly powered from USB, which makes the measurements wrong. Use `set_gpo` to switch a USB power switch off while measuring.

[AI-assisted power measurements with Otii MCP](https://docs.qoitech.com/en/use-cases/ai-assisted-power-measurements)

## Safety

`measure` turns on the Otii main output at the voltage you, or the assistant, choose. Tell the assistant your device's supply voltage, and set `max_current_A` to a sensible limit. Consider allowing `measure`, `set_gpo` and `set_ace_0_15_voltage` only after confirmation in your MCP client.

## License

MIT

TDQS

A3.5/5.0

Scored across 9 tools

Disambiguation4/5

Each tool targets a distinct action: device listing, recording control, pin control, log retrieval, and two clearly separated energy analyses (UART-message-based vs GPI-edge-based). The only mild overlap is between `measure` (which returns statistics for the whole recording) and `get_statistics` (which computes statistics for a time window), which an agent could occasionally confuse, but descriptions make the distinction workable.

Naming Consistency4/5

Most tools follow a predictable verb_noun or verb_object pattern: list_devices, list_recordings, get_log, get_statistics, set_gpo, set_ace_0_15_voltage. Deviations are `measure` (bare verb) and the two `energy_between_*` noun-phrase tools, which are readable but break the dominant convention.

Tool Count5/5

Nine tools is well-scoped for a power-measurement instrument: one per device/recording listing, one measurement driver, two pin/voltage setters, and three analysis tools. Every tool earns its place and none appears redundant.

Completeness4/5

The surface covers the core lifecycle: discover devices, run a measurement, list recordings, inspect logs/statistics, and compute energy over UART or GPI markers, plus output pin control. Minor gaps exist around recording management (rename/delete/export) and stopping an in-flight recording or streaming live current, but agents can work around these.

Maintenance

ActivityMaintained
ResponsivenessNo recent community issues