I’ve made something very similar that is almost backend-agnostic: https://github.com/ayourtch-llm/tttt - and it does auto inject the MCP in case of Claude, but it is trivial to adapt to other backends.

This is really cool.

I did something similar with gemini cli by just wrapping it in tmux and building some extensions.[0]

Eventually that wasnt enough so I ended up forking it and adding REST endpoints to inject commands and read the screen.[1]

Your solution is much cleaner! I'll probably replace mine with it. Thanks for sharing!

[0] https://github.com/stevenAthompson/self-command

[1] https://github.com/stevenAthompson/gemini-cli-remote-control