Skip to content

GUI & Storage modules + protocol fixes + singleton lock to prevent multi-session transport corruption#7

Open
thevan4 wants to merge 1 commit into
busse:mainfrom
thevan4:feature/gui-storage-modules
Open

GUI & Storage modules + protocol fixes + singleton lock to prevent multi-session transport corruption#7
thevan4 wants to merge 1 commit into
busse:mainfrom
thevan4:feature/gui-storage-modules

Conversation

@thevan4

@thevan4 thevan4 commented Mar 16, 2026

Copy link
Copy Markdown

What

⚠️ Second MCP server instance will exit immediately at startup — new Claude session will get a dead MCP server; singleton lock enforced (see Other for details) - this is a bit of a holy war change, open to debate)

New MCP tools

  • modules/gui/ — screen capture (ASCII/PNG) and button input injection
  • modules/storage/ — upload local files to SD card, list, mkdir, delete

Protocol fixes

  • storage_write — rewrote with 512-byte chunking + has_next; sending the whole file as a single protobuf message doesn't work on Flipper firmware
  • GUI screen capture — added drain loop after StopScreenStream; without it the next RPC call reads a stale response from the buffer and desyncs
  • All operation timeouts 3s → 15s — 3 seconds wasn't enough for real workloads and slower connections

Other

  • Singleton lock in CLI (/tmp/flipper-mcp.lock) — lock is OS-global, works across all projects and Claude sessions on the same machine; multiple MCP sessions pointing at the same Flipper will interleave RPC frames on the shared transport and corrupt the session; the lock ensures only one server process runs at a time
  • Removed dead FlipperApp.stop() stub (always returned False), replaced with FlipperGUI
  • MCP scope note — configuring MCP servers at user/global scope is generally NOT recommended; prefer project-scope to avoid polluting all sessions. Exception: flipperzero must be in user-scope — if configured per-project, the singleton lock still works OS-globally, but a second Claude window opening a different project will spin up its own instance and bypass the lock's intent. User-scope ensures exactly one server regardless of which project is active.

@thevan4

thevan4 commented Mar 16, 2026

Copy link
Copy Markdown
Author

@claude please review this PR

@thevan4

thevan4 commented Mar 16, 2026

Copy link
Copy Markdown
Author

4 MCP user-scope setup: claude mcp add --scope user --transport stdio flipperzero -- /path/to/.venv/bin/flipper-mcp - mb should this also go into the README?..

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant