flipper-mcp
# flipper-mcp
A local MCP server for controlling a Flipper Zero over USB-CDC. Forked from
[Str1ck9/flipper-mcp](https://github.com/Str1ck9/flipper-mcp), using the official
MCP Python SDK v2, serialized USB transactions, and guarded transmission.
Unofficial; not affiliated with Flipper Devices.
**Resume work:** [PLAN.md](PLAN.md). **Evidence:** [hardware validation](docs/hardware-validation.md).
## Current status
Hardware last checked September 22, 2026, on **Momentum mntm-012**:
- 64 tools, one triage prompt, and 13 bundled protocol definitions.
- Re-invoked 63 tools after the firmware update, including safety refusals,
not 63 successful physical tests.
- Storage, device controls, IR/LF-RFID/iButton/SubGHz reception, and registry
operations respond. Installed apps: 195.
- JVC Power and Volume Up were captured as RAW IR. One Volume Up replay was
accepted by firmware; **the TV's response is unconfirmed**.
- NFC CLI detection times out. App closure may require Back. The clock setter
remains untested on this firmware after an earlier USB disconnect.
- No general Bluetooth scanner or firmware-flashing tool is exposed.
## Setup
Requires [uv](https://docs.astral.sh/uv/) and a USB data cable. The package is
on PyPI as `flipper-mcp-jamiew`, so there's nothing to clone:
```bash
claude mcp add flipper -- uvx flipper-mcp-jamiew
```
Other MCP clients use `{"command": "uvx", "args": ["flipper-mcp-jamiew"]}`.
Set `FLIPPER_PORT` to a serial device path if auto-detection picks the wrong one.
To work on the server, run it from a checkout instead (Python 3.11+):
```bash
git clone https://github.com/jamiew/flipper-mcp.git
cd flipper-mcp
uv sync --locked
```
The project `.mcp.json` runs the editable checkout in Oh My Pi or compatible
MCP clients. Approve it in your client if prompted, and restart the server
when dependencies or code change:
```json
{
"mcpServers": {
"flipper": {
"type": "stdio",
"command": "uv",
"args": ["run", "--no-sync", "flipper-mcp"]
}
}
}
```
Run the client from this checkout. For a desktop client launched elsewhere,
use the absolute path to `.venv/bin/flipper-mcp` as its stdio command.
Only one process should own the Flipper's serial port. Close qFlipper or
Flipper Lab before connecting. For a standalone hardware check, with the MCP
server disconnected:
```bash
uv run --no-sync flipper-smoke
```
## Safety and limits
The transmit, emulate, credential-write, and power tools are **disabled by
default**, along with the matching raw CLI commands. They require
`FLIPPER_ENABLE_TX=1` in the server process. Enable it only for a specific,
authorized operation, then end that process. Do not add it permanently to
`.mcp.json` or enable it merely to run a sweep.
The gate does not cover app launches, button input, or storage writes and
deletes. An on-device app driven through those tools (Sub-GHz, Infrared,
Bad USB, scripts) can still transmit, so watch the device during UI workflows.
SubGHz frequency checks enforce hardware windows, not legal permission.
GPIO changes also need operator care.
Reader modes may energize LF-RFID/NFC tags. A capture is not proof of a working
copy, and rolling codes should not be treated as replayable static commands.
## Tools
Use your MCP client's tool list for exact arguments. The
[coverage table](docs/hardware-validation.md#tool-coverage) names every tool
and distinguishes data, command acceptance, receiver checks, and failures.
| Area | Main operations |
|---|---|
| Device | Firmware, help, tasks, memory, battery, clock, raw CLI |
| Storage | List, read/write text, stat, checksum, rename, remove, inspect captures |
| SubGHz | Decoded/RAW reception, offline RAW decoding, registry identification; gated replay/chat |
| Infrared | Capture/identify, decoded transmission, universal database; gated RAW CLI replay |
| RFID/NFC/iButton | Receive/read where firmware supports it; gated writes/emulation |
| UI | Launch apps, inspect running app, button input, capture workflows |
| GPIO | Pin mode/read/write and I2C scan |
| Registry | Browse, describe, fetch, install, remove, validate |
UI workflows send navigation inputs; they cannot verify the selected screen.
Check `loader_info` and the physical display. Bluetooth `bt hci_info` returns
controller metadata, not nearby devices.
For an external CC1101, pass `device=1` to supported SubGHz receive tools or
set `FLIPPER_DEFAULT_DEVICE=1`. RAW reception uses the internal radio.
## Protocol registry
Definitions in [flipper_mcp/protocols](flipper_mcp/protocols) match decoded
text and classify saved files. They do not add firmware radio decoders.
See [CONTRIBUTING.md](CONTRIBUTING.md) for the schema and capture requirements.
```bash
uv run --no-sync flipper-registry status
uv run --no-sync flipper-registry list --pack garage
uv run --no-sync flipper-registry describe princeton
uv run --no-sync flipper-registry validate path/to/protocol.json
```
Remote indexes contain `schema_version: 1`, a `name`, and a `protocols` list
with each entry's `id`, `name`, `category`, `url`, `version`, and optional
`sha256`/`packs`. A supplied SHA-256 is checked, but is not publisher
authentication. Cached entries override bundled entries with the same ID
under `$XDG_DATA_HOME/flipper-mcp/protocols` or
`~/.local/share/flipper-mcp/protocols`.
## Troubleshooting
- **Port busy:** close the other USB client; do not run two MCP processes.
- **No device:** check the data cable, unlock the device, and run
`uv run --no-sync python -m serial.tools.list_ports`.
- **No decoded signal:** try a nearby known transmitter during the capture
window. RAW pulses alone do not identify a protocol.
- **Plugin load failure:** check firmware/SD asset compatibility. An app
working on-device does not prove its CLI command exists.
- **App stays open:** use Back or long Back, then check `loader_info`.
- **NFC timeout or wrong clock:** see the current limitations in
[PLAN.md](PLAN.md); do not repeatedly retry disruptive operations.
## Development and reference
```bash
uv sync --locked
uv run --no-sync ruff check flipper_mcp tests
uv run --no-sync ruff format --check flipper_mcp tests
uv run --no-sync ty check
uv run --no-sync pytest
```
To release, bump `version` in `pyproject.toml`, add a CHANGELOG entry, push, then
publish a GitHub release tagged `vX.Y.Z`. `.github/workflows/publish.yml` checks
the tag, runs the tests, publishes to PyPI, and lists `server.json` in the MCP
Registry with the tag's version.
- [IR capture and playback](docs/ir-tv-probing.md)
- [Transport and SDK notes](docs/dev-notes.md)
- [Changelog](CHANGELOG.md)
- Historical research: [landscape](docs/landscape.md),
[feature ideas](docs/feature-ideas.md), [opportunities](docs/opportunities.md)
Thanks to the upstream project and the USB/UI/IR work documented in the
[landscape comparison](docs/landscape.md). MIT; see [LICENSE](LICENSE).
<!-- mcp-name: io.github.jamiew/flipper-mcp -->
TDQS
Scored across 64 tools
Most tools are distinguishable by resource and action, but there are several near-neighbors: subghz_rx vs subghz_rx_raw vs subghz_decode_raw vs scan_and_identify, and ir_rx vs ir_scan_and_identify. The workflow_* convenience wrappers (workflow_subghz_read_start, workflow_close_app) also overlap conceptually with loader_open/loader_close and the raw CLI-radio tools, and flipper_press_key vs flipper_hold_key vs flipper_input_sequence require reading descriptions to choose correctly. Descriptions do mitigate this, but boundaries are only clear after careful reading.
There is a dominant resource_action pattern (subghz_rx, rfid_write, storage_mkdir, registry_install), but it is broken by bare noun/verb tools (power, led, vibro, uptime, ps, free, i2c_scan) and by inconsistent prefixes — flipper_ appears on some tools (flipper_info, flipper_press_key) but not on close peers (power_info, datetime_get). The workflow_ and registry_ namespaces are internally consistent, which keeps it readable despite the mix.
At 64 tools the surface is very heavy for a single device, and the agent must pick among many similar radio capture/identify variants. While the Flipper's breadth (SubGHz, NFC, IR, RFID, iButton, GPIO, storage, loader, UI, registry) justifies a large set, many tools are thin one-shot wrappers that could be consolidated (e.g. one capture tool with a mode flag, one key-input tool).
Coverage is strong across all major radios plus storage, GPIO, loader, power, UI input, and a protocol registry lifecycle (list/describe/fetch/install/remove) with clear lifecycle symmetry for RFID/iButton (read/write/emulate). Minor gaps exist: no NFC write/save tool, no BLE tools despite `registry_list` advertising a `ble` category, and captures can only be transmitted from existing .sub files rather than saved from a scan.