Tethergate
This server does not currently have a deployable release on Glama. Follow the repository's setup instructions to install and configure it for your MCP client, including any required credentials and local dependencies.
Tethergate
Tethergate is an OpenCode MCP server plus a systemd node agent for running allow-listed root commands on enrolled LAN or Tailscale machines over mutual TLS. Nodes connect outbound to the server, so there is no SSH daemon, inbound node port, or shared VPN credential to manage.
The server exposes these MCP tools to OpenCode:
Tool | Purpose |
| List granted nodes, labels, and inventory facts |
| Run a command on a node as root |
| Run one command on up to 20 nodes or a label group (grants resolve labels when created) |
| Read an allowlisted file with a SHA-256 checksum (agent 0.5.0+) |
| Atomically write an allowlisted file (agent 0.5.0+) |
| Check a command against the safety floor without running it |
| Read recent encrypted audit entries |
| Filter the audit log by node, action, outcome, or time |
Every tool carries MCP annotations for read-only, destructive, idempotent, and open-world behavior so clients can choose the right approval UX.
Commands run as root on the node. Tethergate is for machines you own and control, not for untrusted multi-tenant hosts.
Get started right now
Paste this into your OpenCode session on the Linux machine that will host Tethergate:
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 full agent checklist is in STARTUP.md. Prefer to run the setup yourself? Use the manual steps below.
Related MCP server: MCP SSH Server
Security at a glance
No inbound node ports. The agent opens an outbound TLS connection to the server and stays connected.
Mutual TLS. A local EC P-256 CA issues node certificates that rotate automatically. A node is authenticated by its certificate, not a shared password.
One-command enrollment. The server prints a curl one-liner with a short-lived, single-use or fleet token.
Deny by default. A new OpenCode session has access to no nodes until an operator grants it through
/tethergateor the admin web UI.Human approval. Access changes require an OpenCode permission prompt. A model cannot silently grant itself a node.
Hard command floor. The node refuses destructive patterns such as
rm -rf /even if the server or model asks for them.Encrypted state. The CA key and audit payloads are encrypted with
TETHER_MASTER_KEY; enrollment tokens are stored as hashes.Private binds only. Wildcard and public bind addresses are refused.
Audited. Node access, policy decisions, lifecycle changes, and certificate renewals are recorded in a hash-chained audit log.
See SECURITY.md for the full trust model and residual limitations.
Architecture
┌──────────────┐ stdio ┌────────────────────┐
│ OpenCode ├───────────►│ tethergate mcp │
└──────────────┘ └─────────┬──────────┘
│ mcp.sock
┌─────────▼──────────┐
│ Tethergate server │
│ Docker, host net │
├────────────────────┤
│ control.sock admin │
│ HTTPS :8787 │
│ mTLS :8788 agent │
│ HTTP :8789 web UI │
└─────────┬──────────┘
│ outbound TLS
┌──────────────┴──────────────┐
│ │
┌─────▼─────┐ ┌─────▼─────┐
│ node A │ │ node B │
│ systemd │ │ systemd │
└───────────┘ └───────────┘The server stores its CA, node records, and audit log under /data. The OpenCode
plugin only talks to the server's local Unix sockets; it never connects to a node
directly.
Quick start
1. Start the server
You need a Linux host with Docker, a private LAN address or Tailscale address, and outbound access from the nodes to that address.
git clone https://github.com/peva3/tethergate.git
cd tethergate
cp .env.example .env
chmod 600 .envSet these in .env:
TETHER_BIND=<private-lan-or-tailscale-ip>
TETHER_PUBLIC_HOST=<same-address-nodes-use>
TETHER_MASTER_KEY=<base64url 32-byte key>
TETHER_CONTROL_CAPABILITY=<random hex capability>Generate the two secrets without reusing them:
python3 -c 'import base64,secrets; print(base64.urlsafe_b64encode(secrets.token_bytes(32)).decode())'
openssl rand -hex 32Start the server:
docker compose up -d --build
set -a; . ./.env; set +a
curl -k "https://$TETHER_PUBLIC_HOST:8787/healthz"The install and enrollment endpoints use HTTPS with the local CA. Use -k only
while verifying a fresh install, or install the server CA certificate and use normal
verification.
2. Install the OpenCode plugin
opencode plugin add opencode-tethergate@latestOr add it manually to opencode.json:
{
"plugins": ["opencode-tethergate@latest"],
"mcp": {
"servers": {
"tethergate": {
"type": "local",
"command": ["docker", "exec", "-i", "tethergate", "tethergate", "mcp"]
}
}
}
}@latest follows new releases. A bare opencode-tethergate installs the
current release once and does not auto-update. To pin the admin surface, use an
exact version such as opencode-tethergate@0.5.0 and update it deliberately
after reviewing CHANGELOG.md.
3. Enroll a node
In OpenCode:
/tethergate node add worker-1The command prints a complete curl … | sudo bash one-liner. Run it as root on the
target machine. The installer:
Pins the server public-key fingerprint embedded in the installer URL (not a public CA chain).
Installs the agent under
/opt/tethergate-agent/releases/<version>.Writes
/etc/tethergate-agent/agent.jsonwith mode0600.Enrolls the node and starts
tethergate-agent.service.
For a reusable fleet installer:
/tethergate fleet add tailnetRun the printed one-liner on each machine. Fleet tokens have a use limit and an
expiry and can be revoked from /tethergate, the web UI, or the CLI.
4. Grant the session access
/tethergate grant worker-1Or open /tethergate and choose nodes. A grant is scoped to the current OpenCode
session; it is not a global permission.
5. Use it
Ask OpenCode to run a command through the Tethergate MCP tool. For example:
Use remote_node_exec on worker-1 to run `uname -a`.Admin surfaces
TUI menu —
/tethergatein the OpenCode TUI.Slash command —
/tethergate …for TUI, web, and desktop clients.Standalone web UI — optional, disabled by default. Set
TETHER_WEB_PORT=8789,TETHER_WEB_BINDto a private LAN/Tailscale address, and a long randomTETHER_WEB_TOKEN. Openhttp://<address>:8789/and log in with the token. Prefer Tailscale or an SSH tunnel; never expose it publicly.CLI —
docker exec -it tethergate tethergate …for break-glass server work. Normal access changes should go through/tethergateso they are permission-gated and audited.
The web UI supports overview/health, node inventory and lifecycle actions, fleet installers, session grants, and audit verification.
OpenCode slash commands
These work as /tethergate … in the TUI and as a server-side slash command in the
OpenCode web and desktop clients. Access changes and node lifecycle actions trigger
the Tethergate permission prompt.
Command | Action |
| Show the command list |
| Show this session's access and nodes |
| Grant this session every enrolled node |
| Grant this session specific nodes |
| Grant active nodes matching a label |
| Revoke this session's node access |
| New sessions get no node access |
| New sessions get every node |
| List enrolled nodes |
| Set node labels used by groups |
| Create a one-command enrollment token |
| Revoke a node |
| Clear quarantine and re-enable a node |
| Rename a node |
| Retire a node and free its name |
| Update a node agent to this server version |
| Roll back a node agent |
| Remove the agent from a node |
| Show automatic agent update state |
| Stop future automatic agent updates |
| Resume automatic agent updates |
| Skip the delay and start the rollout now |
| Stop all remote execution |
| Reopen remote execution |
| Show the global freeze state |
| Create a reusable fleet installer |
| List fleet installers |
| Revoke a fleet installer |
node add and fleet add print the complete installer one-liner. default all
requires --yes; the default is deny. auto run skips the configured rollout
delay, so use it only after reviewing the target version.
Web and Desktop GUI
The /tethergate slash command works in the OpenCode web and desktop clients today.
We are targeting native Web and Desktop GUI panels as soon as OpenCode exposes a
stable GUI plugin surface in those clients. Until then, the standalone web UI
provides the full operator surface outside OpenCode.
Node lifecycle
Node lifecycle commands are listed in the slash-command table above.
Update/rollback pushes a checksum-verified, versioned agent release over the existing mutual-TLS connection.
Rename changes the node label without re-enrollment.
Retire keeps an audited tombstone and frees the original name for a replacement.
Uninstall removes the unit and agent files remotely.
Revoke disables the certificate immediately.
Agent updates can also roll out automatically. The server waits
TETHER_AUTO_UPDATE_DELAY_SECONDS, updates one canary node, and proceeds only if
that node reconnects with the new version. Set TETHER_AUTO_UPDATE=off for a manual
lockout window.
Certificates
Node certificates are valid for 180 days. The agent checks every six hours and, in the final 30 days, generates a new P-256 key and CSR, sends it over the authenticated mTLS connection, and atomically installs the signed certificate and key. The old certificate remains accepted until the node presents the new one, so a lost renewal response cannot lock out a node.
Existing nodes that predate key rotation continue to renew with the same key until
they receive a node update.
Backups and audit
Create an encrypted backup of the CA, TLS material, state database, and master key:
./scripts/backup.shRestore with ./scripts/restore.sh <archive> while the container is stopped. Keep
backups off the data volume. The archive contains the CA private key and the master
key, so treat it as a secret.
Audit retention defaults to 90 days and keeps the newest 1,000 entries. Pruning is anchored with an HMAC so truncation is detectable. Verify the chain from the web UI or:
docker exec tethergate tethergate audit verify
docker exec tethergate tethergate audit search --node NODE --outcome denied
docker exec tethergate tethergate audit export --format csv > audit.csvPrometheus metrics are available at https://<server>:8787/metrics when
TETHER_METRICS_TOKEN is set; send it as Authorization: Bearer <token>. Set
TETHER_AUDIT_SINK_URL to an HTTPS collector to stream each new audit entry to an
append-only external sink; delivery is asynchronous and never blocks execution.
TETHER_AUDIT_SINK_TOKEN adds a bearer token to sink requests. Audit payloads
include command output, so protect the collector like the local audit database.
Use tethergate freeze on --reason "maintenance" to stop every remote command,
bulk job, and file transfer. The freeze survives restarts and is shown in
/healthz, status, and the web UI.
Common operations
# Health
curl -k "https://<server>:8787/healthz"
# Logs
docker compose logs -f tethergate
# Stop / start
docker compose down
docker compose up -d
# Rebuild after an upgrade
git pull
docker compose up -d --buildThe server keeps state in the tethergate-data volume and sockets in
tethergate-run. docker compose down -v deletes the CA, node records, and audit
history; do not use it unless you intend a full reset.
Development
python3 -m pytest -q
python3 -m ruff check tethergate tests
python3 -m compileall -q tethergate
cd opencode-plugin
node --check *.js
node --testDocumentation
STARTUP.md — copy-paste agent setup checklist
SECURITY.md — trust boundaries and residual risks
docs/ARCHITECTURE.md — components and protocol
docs/FLEET.md — fleet deployment, backup, upgrades, renewal
docs/OPENCODE.md — OpenCode integration details
docs/SESSION-RISK.md — design idea for session risk telemetry (not implemented)
CHANGELOG.md — release history
CONTRIBUTING.md — development and contribution guide
CODE_OF_CONDUCT.md — community standards
SUPPORT.md — where to ask for help
AGENTS.md — guidance for AI-assisted contributions
License
MIT. See LICENSE.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
This server cannot be deployed
Maintenance
Related MCP Connectors
Tailscale device, route, DNS, key, user, and ACL management over MCP and CLI.
Operate Linux, macOS and Windows from your LLM. Every action runs through an auditable allowlist.
- browser-sshDeprecatedcom.browserssh
Scoped, audited SSH exec, sessions, and SFTP on your saved servers without exposing credentials
Securely control computers you explicitly pair through files, terminals, processes, screenshots, desktop UI/input, clipboard, browser automation, diagnostics, and document tools.
Related MCP Servers
- AlicenseBqualityBmaintenanceEnables Claude Code and OpenCode agents to delegate tasks to peer machines over a self-hosted A2A mesh, using mTLS identity and executing via local CLIs or scripts.8Apache 2.0
- AlicenseNot gradedqualityBmaintenanceEnables secure execution of arbitrary commands on remote hosts via SSH with OIDC authentication, allowlisted access, and dynamically injected private keys.MIT
- AlicenseNot gradedqualityBmaintenanceEnables an MCP client to inspect and administer a Tailscale node through the local tailscale CLI and the wider tailnet through the control-plane REST API, exposing 186 read, write, and destructive tools plus resources, prompts, and completions. Tier and preset dials keep dangerous operations unlisted until explicitly enabled, and both surfaces degrade gracefully when the CLI or a credential is absent.21Apache 2.0
- AlicenseNot gradedqualityBmaintenanceEnables agents to spawn, monitor, and control CLI coding agents running in isolated tmux sessions, with verified input injection, redacted pane capture, fleet and per-session state classification, lineage tracking, blocking exec with exit codes, cross-agent messaging, waste analytics, and log/ledger reading. Ownership checks, policy controls, and audit events keep every control action safe by default.Apache 2.0