Files
UmbraAudio/infra
B.D. Murphy 5832c70369 infra: add MCP shell server (restores command execution)
OpenCode 2.0.27 withholds the built-in Shell tool regardless of config,
client (desktop app vs TUI) or model -- all three were eliminated by test.
MCP is the one channel demonstrably under user control, so add a stdio
server that restores it.

Stdlib-only and deliberately unfiltered so every line is auditable: a
third-party package with unrestricted command execution is an opaque
trust decision.

Two choices taken from AGENTS.md:

- PATH correction. OpenCode spawns MCP servers that can inherit a bare
  PATH exactly as launchd does, which is the documented cause of
  ffmpeg failing for m4b/MP3 export. /opt/homebrew/bin is prepended to
  the child only.
- background=true detaches into its own session (start_new_session) so
  long-running processes -- TTS server, web UI -- survive both the MCP
  server exiting and an OpenCode restart, and log to a file rather than
  a pipe that would eventually block the writer.

Selftest drives a full handshake and exits non-zero on failure, so a
misbehaving server is caught before an OpenCode restart rather than
after. It found two real bugs during development: a double-encoding
blind spot in an exit-code assertion (tool output is JSON nested in
JSON-RPC, so its quotes are escaped), and an f-string escape that is a
syntax error on Python 3.11, the project's stated floor.

Verified: py_compile clean, ruff clean, selftest 8/8, background mode
detached and logged, exit codes and stdout/stderr separation correct.
Full suite unchanged at 8 failed (pre-existing) / 803 passed.
2026-10-17 06:30:58 -07:00
..