flipper-mcp-jamiew 0.7.3__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (26) hide show
  1. flipper_mcp_jamiew-0.7.3/LICENSE +21 -0
  2. flipper_mcp_jamiew-0.7.3/PKG-INFO +183 -0
  3. flipper_mcp_jamiew-0.7.3/README.md +168 -0
  4. flipper_mcp_jamiew-0.7.3/flipper_mcp/__init__.py +5 -0
  5. flipper_mcp_jamiew-0.7.3/flipper_mcp/__main__.py +3 -0
  6. flipper_mcp_jamiew-0.7.3/flipper_mcp/bridge.py +396 -0
  7. flipper_mcp_jamiew-0.7.3/flipper_mcp/protocols/came-atomo.json +32 -0
  8. flipper_mcp_jamiew-0.7.3/flipper_mcp/protocols/em4100.json +32 -0
  9. flipper_mcp_jamiew-0.7.3/flipper_mcp/protocols/faac-slh.json +31 -0
  10. flipper_mcp_jamiew-0.7.3/flipper_mcp/protocols/hormann-hsm.json +32 -0
  11. flipper_mcp_jamiew-0.7.3/flipper_mcp/protocols/ht12.json +35 -0
  12. flipper_mcp_jamiew-0.7.3/flipper_mcp/protocols/keeloq.json +36 -0
  13. flipper_mcp_jamiew-0.7.3/flipper_mcp/protocols/nec-ir.json +34 -0
  14. flipper_mcp_jamiew-0.7.3/flipper_mcp/protocols/nice-flo.json +32 -0
  15. flipper_mcp_jamiew-0.7.3/flipper_mcp/protocols/princeton.json +36 -0
  16. flipper_mcp_jamiew-0.7.3/flipper_mcp/protocols/samsung32-ir.json +30 -0
  17. flipper_mcp_jamiew-0.7.3/flipper_mcp/protocols/security-plus-2.json +36 -0
  18. flipper_mcp_jamiew-0.7.3/flipper_mcp/protocols/sony-ir.json +31 -0
  19. flipper_mcp_jamiew-0.7.3/flipper_mcp/protocols/tpms-generic.json +36 -0
  20. flipper_mcp_jamiew-0.7.3/flipper_mcp/registry.py +433 -0
  21. flipper_mcp_jamiew-0.7.3/flipper_mcp/registry_cli.py +210 -0
  22. flipper_mcp_jamiew-0.7.3/flipper_mcp/safety.py +98 -0
  23. flipper_mcp_jamiew-0.7.3/flipper_mcp/server.py +1119 -0
  24. flipper_mcp_jamiew-0.7.3/flipper_mcp/ui.py +271 -0
  25. flipper_mcp_jamiew-0.7.3/pyproject.toml +67 -0
  26. flipper_mcp_jamiew-0.7.3/pyproject.toml.orig +62 -0
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 James Strick
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,183 @@
1
+ Metadata-Version: 2.4
2
+ Name: flipper-mcp-jamiew
3
+ Version: 0.7.3
4
+ Summary: MCP server for driving a Flipper Zero over USB-CDC serial, with a bundled RF/IR protocol registry.
5
+ License-Expression: MIT
6
+ License-File: LICENSE
7
+ Requires-Dist: anyio>=4,<5
8
+ Requires-Dist: mcp>=2.3,<3
9
+ Requires-Dist: pyserial>=3.5,<4
10
+ Requires-Dist: pydantic>=2.14,<3
11
+ Requires-Python: >=3.11
12
+ Project-URL: Homepage, https://github.com/jamiew/flipper-mcp
13
+ Project-URL: Issues, https://github.com/jamiew/flipper-mcp/issues
14
+ Description-Content-Type: text/markdown
15
+
16
+ # flipper-mcp
17
+
18
+ A local MCP server for controlling a Flipper Zero over USB-CDC. Forked from
19
+ [Str1ck9/flipper-mcp](https://github.com/Str1ck9/flipper-mcp), using the official
20
+ MCP Python SDK v2, serialized USB transactions, and guarded transmission.
21
+ Unofficial; not affiliated with Flipper Devices.
22
+
23
+ **Resume work:** [PLAN.md](PLAN.md). **Evidence:** [hardware validation](docs/hardware-validation.md).
24
+
25
+ ## Current status
26
+
27
+ Hardware last checked September 22, 2026, on **Momentum mntm-012**:
28
+
29
+ - 64 tools, one triage prompt, and 13 bundled protocol definitions.
30
+ - Re-invoked 63 tools after the firmware update, including safety refusals,
31
+ not 63 successful physical tests.
32
+ - Storage, device controls, IR/LF-RFID/iButton/SubGHz reception, and registry
33
+ operations respond. Installed apps: 195.
34
+ - JVC Power and Volume Up were captured as RAW IR. One Volume Up replay was
35
+ accepted by firmware; **the TV's response is unconfirmed**.
36
+ - NFC CLI detection times out. App closure may require Back. The clock setter
37
+ remains untested on this firmware after an earlier USB disconnect.
38
+ - No general Bluetooth scanner or firmware-flashing tool is exposed.
39
+
40
+ ## Setup
41
+
42
+ Requires [uv](https://docs.astral.sh/uv/) and a USB data cable. The package is
43
+ on PyPI as `flipper-mcp-jamiew`, so there's nothing to clone:
44
+
45
+ ```bash
46
+ claude mcp add flipper -- uvx flipper-mcp-jamiew
47
+ ```
48
+
49
+ Other MCP clients use `{"command": "uvx", "args": ["flipper-mcp-jamiew"]}`.
50
+ Set `FLIPPER_PORT` to a serial device path if auto-detection picks the wrong one.
51
+
52
+ To work on the server, run it from a checkout instead (Python 3.11+):
53
+
54
+ ```bash
55
+ git clone https://github.com/jamiew/flipper-mcp.git
56
+ cd flipper-mcp
57
+ uv sync --locked
58
+ ```
59
+
60
+ The project `.mcp.json` runs the editable checkout in Oh My Pi or compatible
61
+ MCP clients. Approve it in your client if prompted, and restart the server
62
+ when dependencies or code change:
63
+
64
+ ```json
65
+ {
66
+ "mcpServers": {
67
+ "flipper": {
68
+ "type": "stdio",
69
+ "command": "uv",
70
+ "args": ["run", "--no-sync", "flipper-mcp"]
71
+ }
72
+ }
73
+ }
74
+ ```
75
+
76
+ Run the client from this checkout. For a desktop client launched elsewhere,
77
+ use the absolute path to `.venv/bin/flipper-mcp` as its stdio command.
78
+ Only one process should own the Flipper's serial port. Close qFlipper or
79
+ Flipper Lab before connecting. For a standalone hardware check, with the MCP
80
+ server disconnected:
81
+
82
+ ```bash
83
+ uv run --no-sync flipper-smoke
84
+ ```
85
+
86
+ ## Safety and limits
87
+
88
+ The transmit, emulate, credential-write, and power tools are **disabled by
89
+ default**, along with the matching raw CLI commands. They require
90
+ `FLIPPER_ENABLE_TX=1` in the server process. Enable it only for a specific,
91
+ authorized operation, then end that process. Do not add it permanently to
92
+ `.mcp.json` or enable it merely to run a sweep.
93
+
94
+ The gate does not cover app launches, button input, or storage writes and
95
+ deletes. An on-device app driven through those tools (Sub-GHz, Infrared,
96
+ Bad USB, scripts) can still transmit, so watch the device during UI workflows.
97
+ SubGHz frequency checks enforce hardware windows, not legal permission.
98
+ GPIO changes also need operator care.
99
+ Reader modes may energize LF-RFID/NFC tags. A capture is not proof of a working
100
+ copy, and rolling codes should not be treated as replayable static commands.
101
+
102
+ ## Tools
103
+
104
+ Use your MCP client's tool list for exact arguments. The
105
+ [coverage table](docs/hardware-validation.md#tool-coverage) names every tool
106
+ and distinguishes data, command acceptance, receiver checks, and failures.
107
+
108
+ | Area | Main operations |
109
+ |---|---|
110
+ | Device | Firmware, help, tasks, memory, battery, clock, raw CLI |
111
+ | Storage | List, read/write text, stat, checksum, rename, remove, inspect captures |
112
+ | SubGHz | Decoded/RAW reception, offline RAW decoding, registry identification; gated replay/chat |
113
+ | Infrared | Capture/identify, decoded transmission, universal database; gated RAW CLI replay |
114
+ | RFID/NFC/iButton | Receive/read where firmware supports it; gated writes/emulation |
115
+ | UI | Launch apps, inspect running app, button input, capture workflows |
116
+ | GPIO | Pin mode/read/write and I2C scan |
117
+ | Registry | Browse, describe, fetch, install, remove, validate |
118
+
119
+ UI workflows send navigation inputs; they cannot verify the selected screen.
120
+ Check `loader_info` and the physical display. Bluetooth `bt hci_info` returns
121
+ controller metadata, not nearby devices.
122
+
123
+ For an external CC1101, pass `device=1` to supported SubGHz receive tools or
124
+ set `FLIPPER_DEFAULT_DEVICE=1`. RAW reception uses the internal radio.
125
+
126
+ ## Protocol registry
127
+
128
+ Definitions in [flipper_mcp/protocols](flipper_mcp/protocols) match decoded
129
+ text and classify saved files. They do not add firmware radio decoders.
130
+ See [CONTRIBUTING.md](CONTRIBUTING.md) for the schema and capture requirements.
131
+
132
+ ```bash
133
+ uv run --no-sync flipper-registry status
134
+ uv run --no-sync flipper-registry list --pack garage
135
+ uv run --no-sync flipper-registry describe princeton
136
+ uv run --no-sync flipper-registry validate path/to/protocol.json
137
+ ```
138
+
139
+ Remote indexes contain `schema_version: 1`, a `name`, and a `protocols` list
140
+ with each entry's `id`, `name`, `category`, `url`, `version`, and optional
141
+ `sha256`/`packs`. A supplied SHA-256 is checked, but is not publisher
142
+ authentication. Cached entries override bundled entries with the same ID
143
+ under `$XDG_DATA_HOME/flipper-mcp/protocols` or
144
+ `~/.local/share/flipper-mcp/protocols`.
145
+
146
+ ## Troubleshooting
147
+
148
+ - **Port busy:** close the other USB client; do not run two MCP processes.
149
+ - **No device:** check the data cable, unlock the device, and run
150
+ `uv run --no-sync python -m serial.tools.list_ports`.
151
+ - **No decoded signal:** try a nearby known transmitter during the capture
152
+ window. RAW pulses alone do not identify a protocol.
153
+ - **Plugin load failure:** check firmware/SD asset compatibility. An app
154
+ working on-device does not prove its CLI command exists.
155
+ - **App stays open:** use Back or long Back, then check `loader_info`.
156
+ - **NFC timeout or wrong clock:** see the current limitations in
157
+ [PLAN.md](PLAN.md); do not repeatedly retry disruptive operations.
158
+
159
+ ## Development and reference
160
+
161
+ ```bash
162
+ uv sync --locked
163
+ uv run --no-sync ruff check flipper_mcp tests
164
+ uv run --no-sync ruff format --check flipper_mcp tests
165
+ uv run --no-sync ty check
166
+ uv run --no-sync pytest
167
+ ```
168
+
169
+ To release, bump `version` in `pyproject.toml`, add a CHANGELOG entry, push, then
170
+ publish a GitHub release tagged `vX.Y.Z`. `.github/workflows/publish.yml` checks
171
+ the tag, runs the tests, publishes to PyPI, and lists `server.json` in the MCP
172
+ Registry with the tag's version.
173
+
174
+ - [IR capture and playback](docs/ir-tv-probing.md)
175
+ - [Transport and SDK notes](docs/dev-notes.md)
176
+ - [Changelog](CHANGELOG.md)
177
+ - Historical research: [landscape](docs/landscape.md),
178
+ [feature ideas](docs/feature-ideas.md), [opportunities](docs/opportunities.md)
179
+
180
+ Thanks to the upstream project and the USB/UI/IR work documented in the
181
+ [landscape comparison](docs/landscape.md). MIT; see [LICENSE](LICENSE).
182
+
183
+ <!-- mcp-name: io.github.jamiew/flipper-mcp -->
@@ -0,0 +1,168 @@
1
+ # flipper-mcp
2
+
3
+ A local MCP server for controlling a Flipper Zero over USB-CDC. Forked from
4
+ [Str1ck9/flipper-mcp](https://github.com/Str1ck9/flipper-mcp), using the official
5
+ MCP Python SDK v2, serialized USB transactions, and guarded transmission.
6
+ Unofficial; not affiliated with Flipper Devices.
7
+
8
+ **Resume work:** [PLAN.md](PLAN.md). **Evidence:** [hardware validation](docs/hardware-validation.md).
9
+
10
+ ## Current status
11
+
12
+ Hardware last checked September 22, 2026, on **Momentum mntm-012**:
13
+
14
+ - 64 tools, one triage prompt, and 13 bundled protocol definitions.
15
+ - Re-invoked 63 tools after the firmware update, including safety refusals,
16
+ not 63 successful physical tests.
17
+ - Storage, device controls, IR/LF-RFID/iButton/SubGHz reception, and registry
18
+ operations respond. Installed apps: 195.
19
+ - JVC Power and Volume Up were captured as RAW IR. One Volume Up replay was
20
+ accepted by firmware; **the TV's response is unconfirmed**.
21
+ - NFC CLI detection times out. App closure may require Back. The clock setter
22
+ remains untested on this firmware after an earlier USB disconnect.
23
+ - No general Bluetooth scanner or firmware-flashing tool is exposed.
24
+
25
+ ## Setup
26
+
27
+ Requires [uv](https://docs.astral.sh/uv/) and a USB data cable. The package is
28
+ on PyPI as `flipper-mcp-jamiew`, so there's nothing to clone:
29
+
30
+ ```bash
31
+ claude mcp add flipper -- uvx flipper-mcp-jamiew
32
+ ```
33
+
34
+ Other MCP clients use `{"command": "uvx", "args": ["flipper-mcp-jamiew"]}`.
35
+ Set `FLIPPER_PORT` to a serial device path if auto-detection picks the wrong one.
36
+
37
+ To work on the server, run it from a checkout instead (Python 3.11+):
38
+
39
+ ```bash
40
+ git clone https://github.com/jamiew/flipper-mcp.git
41
+ cd flipper-mcp
42
+ uv sync --locked
43
+ ```
44
+
45
+ The project `.mcp.json` runs the editable checkout in Oh My Pi or compatible
46
+ MCP clients. Approve it in your client if prompted, and restart the server
47
+ when dependencies or code change:
48
+
49
+ ```json
50
+ {
51
+ "mcpServers": {
52
+ "flipper": {
53
+ "type": "stdio",
54
+ "command": "uv",
55
+ "args": ["run", "--no-sync", "flipper-mcp"]
56
+ }
57
+ }
58
+ }
59
+ ```
60
+
61
+ Run the client from this checkout. For a desktop client launched elsewhere,
62
+ use the absolute path to `.venv/bin/flipper-mcp` as its stdio command.
63
+ Only one process should own the Flipper's serial port. Close qFlipper or
64
+ Flipper Lab before connecting. For a standalone hardware check, with the MCP
65
+ server disconnected:
66
+
67
+ ```bash
68
+ uv run --no-sync flipper-smoke
69
+ ```
70
+
71
+ ## Safety and limits
72
+
73
+ The transmit, emulate, credential-write, and power tools are **disabled by
74
+ default**, along with the matching raw CLI commands. They require
75
+ `FLIPPER_ENABLE_TX=1` in the server process. Enable it only for a specific,
76
+ authorized operation, then end that process. Do not add it permanently to
77
+ `.mcp.json` or enable it merely to run a sweep.
78
+
79
+ The gate does not cover app launches, button input, or storage writes and
80
+ deletes. An on-device app driven through those tools (Sub-GHz, Infrared,
81
+ Bad USB, scripts) can still transmit, so watch the device during UI workflows.
82
+ SubGHz frequency checks enforce hardware windows, not legal permission.
83
+ GPIO changes also need operator care.
84
+ Reader modes may energize LF-RFID/NFC tags. A capture is not proof of a working
85
+ copy, and rolling codes should not be treated as replayable static commands.
86
+
87
+ ## Tools
88
+
89
+ Use your MCP client's tool list for exact arguments. The
90
+ [coverage table](docs/hardware-validation.md#tool-coverage) names every tool
91
+ and distinguishes data, command acceptance, receiver checks, and failures.
92
+
93
+ | Area | Main operations |
94
+ |---|---|
95
+ | Device | Firmware, help, tasks, memory, battery, clock, raw CLI |
96
+ | Storage | List, read/write text, stat, checksum, rename, remove, inspect captures |
97
+ | SubGHz | Decoded/RAW reception, offline RAW decoding, registry identification; gated replay/chat |
98
+ | Infrared | Capture/identify, decoded transmission, universal database; gated RAW CLI replay |
99
+ | RFID/NFC/iButton | Receive/read where firmware supports it; gated writes/emulation |
100
+ | UI | Launch apps, inspect running app, button input, capture workflows |
101
+ | GPIO | Pin mode/read/write and I2C scan |
102
+ | Registry | Browse, describe, fetch, install, remove, validate |
103
+
104
+ UI workflows send navigation inputs; they cannot verify the selected screen.
105
+ Check `loader_info` and the physical display. Bluetooth `bt hci_info` returns
106
+ controller metadata, not nearby devices.
107
+
108
+ For an external CC1101, pass `device=1` to supported SubGHz receive tools or
109
+ set `FLIPPER_DEFAULT_DEVICE=1`. RAW reception uses the internal radio.
110
+
111
+ ## Protocol registry
112
+
113
+ Definitions in [flipper_mcp/protocols](flipper_mcp/protocols) match decoded
114
+ text and classify saved files. They do not add firmware radio decoders.
115
+ See [CONTRIBUTING.md](CONTRIBUTING.md) for the schema and capture requirements.
116
+
117
+ ```bash
118
+ uv run --no-sync flipper-registry status
119
+ uv run --no-sync flipper-registry list --pack garage
120
+ uv run --no-sync flipper-registry describe princeton
121
+ uv run --no-sync flipper-registry validate path/to/protocol.json
122
+ ```
123
+
124
+ Remote indexes contain `schema_version: 1`, a `name`, and a `protocols` list
125
+ with each entry's `id`, `name`, `category`, `url`, `version`, and optional
126
+ `sha256`/`packs`. A supplied SHA-256 is checked, but is not publisher
127
+ authentication. Cached entries override bundled entries with the same ID
128
+ under `$XDG_DATA_HOME/flipper-mcp/protocols` or
129
+ `~/.local/share/flipper-mcp/protocols`.
130
+
131
+ ## Troubleshooting
132
+
133
+ - **Port busy:** close the other USB client; do not run two MCP processes.
134
+ - **No device:** check the data cable, unlock the device, and run
135
+ `uv run --no-sync python -m serial.tools.list_ports`.
136
+ - **No decoded signal:** try a nearby known transmitter during the capture
137
+ window. RAW pulses alone do not identify a protocol.
138
+ - **Plugin load failure:** check firmware/SD asset compatibility. An app
139
+ working on-device does not prove its CLI command exists.
140
+ - **App stays open:** use Back or long Back, then check `loader_info`.
141
+ - **NFC timeout or wrong clock:** see the current limitations in
142
+ [PLAN.md](PLAN.md); do not repeatedly retry disruptive operations.
143
+
144
+ ## Development and reference
145
+
146
+ ```bash
147
+ uv sync --locked
148
+ uv run --no-sync ruff check flipper_mcp tests
149
+ uv run --no-sync ruff format --check flipper_mcp tests
150
+ uv run --no-sync ty check
151
+ uv run --no-sync pytest
152
+ ```
153
+
154
+ To release, bump `version` in `pyproject.toml`, add a CHANGELOG entry, push, then
155
+ publish a GitHub release tagged `vX.Y.Z`. `.github/workflows/publish.yml` checks
156
+ the tag, runs the tests, publishes to PyPI, and lists `server.json` in the MCP
157
+ Registry with the tag's version.
158
+
159
+ - [IR capture and playback](docs/ir-tv-probing.md)
160
+ - [Transport and SDK notes](docs/dev-notes.md)
161
+ - [Changelog](CHANGELOG.md)
162
+ - Historical research: [landscape](docs/landscape.md),
163
+ [feature ideas](docs/feature-ideas.md), [opportunities](docs/opportunities.md)
164
+
165
+ Thanks to the upstream project and the USB/UI/IR work documented in the
166
+ [landscape comparison](docs/landscape.md). MIT; see [LICENSE](LICENSE).
167
+
168
+ <!-- mcp-name: io.github.jamiew/flipper-mcp -->
@@ -0,0 +1,5 @@
1
+ """flipper-mcp: MCP server that drives a Flipper Zero over USB-CDC serial."""
2
+
3
+ from importlib.metadata import version
4
+
5
+ __version__ = version("flipper-mcp-jamiew")
@@ -0,0 +1,3 @@
1
+ from .server import run
2
+
3
+ run()