r/opencodeCLI • u/peva3 • 1h ago
Tethergate for Opencode - Secure MCP access to your remote machines
I'm not sure if anyone else has run into this using Opencode, but I really didn't like the setup of giving Opencode straight up SSH creds/keys to my remote machines I wanted it to have access to, even with best practices it just felt kinda janky.
So I made a MCP server that runs locally plus a small agent that gets installed on your remote machines. This gives Opencode gated, end to end encrypted access that is locked down to specific opencode sessions.
If you want to get setup quickly you can just tell your opencode session:
"Read https://github.com/peva3/tethergate/blob/main/STARTUP.md and follow it to set up Tethergate on this machine. Ask me for the node details it requires."
The default setup would be using something like Tailscale, or being on the same LAN as your nodes, I would not recommend doing this over public IPs, just because I don't think it would be smart to open up a possible attack vector, but there's nothing stopping you from doing that technically.
So that's it, basically it's just a small MCP server with a web ui, you set that up, then create either one time use or fleet keys for your nodes, run the command on your node, and they sync up and download the needed files and config. Then you login to the web ui or use slash commands in your Opencode session, and grant that session access to specific nodes, then you're set, that session should now be able to run gated commands remotely.
Also, just want to be upfront that this is a totally self hosted setup, there's no central server, no phoning home, no goal of making this some sort of SAAS product, you own it, it's your private deployment, I don't want to touch your servers.