✨ hex-ssh-mcp — hash-verified remote file editing for AI agents over SSH #31
levnikolaevich
announced in
Announcements
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Your agent can read and edit local files — but what about the server running in production? When something breaks at 2 AM, the agent needs to check configs, search logs, and patch files on remote machines. Raw SSH commands flood context with noisy output — timestamps, UUIDs, and IPs that change on every run. And there's no way to verify that an edit landed on the right line of the right version of a remote file.
hex-ssh-mcp is an MCP server that brings hash-verified editing to remote machines over SSH. Every remote file read returns FNV-1a hash-annotated lines and range checksums — the same format as hex-line-mcp. Edits verify those checksums before applying changes. Command output is normalized and deduplicated automatically.
Tip
Same verification contract as hex-line, but across SSH boundaries. If the remote file changed since you last read it, the edit is rejected — not silently applied to the wrong version.
When it matters
🔍 "Check a config on the remote server"
Your agent needs to read the nginx config on production — 200 lines, but only the upstream block matters. With raw
ssh cat /etc/nginx/nginx.conf, the entire file floods your context. Withssh-read-lines, the agent requests lines 40–80 with hash annotations. Each line carries an FNV-1a tag, ready for immediate editing — no second read needed.The agent read the file 5 minutes ago and wants to fix a typo on line 65. But someone deployed a hotfix since then — lines shifted. With a raw SSH command, the edit silently overwrites the wrong line. hex-ssh's
ssh-edit-blockchecks the range checksum before applying. Stale? Edit rejected, current checksum returned. The agent re-reads just the changed range and retries.📋 "Search remote logs for an error pattern"
The agent greps 10,000 lines of application logs looking for "connection timeout." Raw output: thousands of duplicate stack traces with different timestamps, UUIDs, and request IDs.
ssh-search-codenormalizes all dynamic values — UUIDs become<UUID>, timestamps become<TS>, IPs become<IP>. Identical normalized lines collapse with(xN)counts. 10K lines become ~60 actionable ones.🔒 "Write to a restricted path"
The agent generates a new config and writes it to the staging server. But a typo in the path targets
/etc/instead of/home/deploy/etc/. With raw SSH, the file lands in the system directory — potentially breaking the server. hex-ssh checks againstALLOWED_DIRSbefore every write. Path outside the permitted list? Rejected immediately.Output normalization
Remote command output is noisy. hex-ssh cleans it up automatically:
<UUID>550e8400-e29b-41d4-...→<UUID><TS>2026-03-19 14:30:00→<TS><IP>192.168.1.100:8080→<IP>/<ID>/a1b2c3d4e5→/<ID><N>1234567→<N>Pipeline: Normalize → Deduplicate (collapse identical lines with
(xN)) → Truncate (keep first 40 + last 20).Average: 72% reduction (62,948 → 17,865 chars).
6 tools
ssh-read-linesssh-edit-blockssh-search-codessh-write-chunkssh-verifyremote-sshSecurity — not optional when agents talk to production
known_hostsorALLOWED_HOST_FINGERPRINTSsafeoropenexplicitlysafemode blocksrm -rf /,mkfs, fork bombs,chmod 777, etc.rewriteuses temp file + rename; content is base64-encoded (no injection via content)SSH config support
hex-ssh reads
~/.ssh/configautomatically — use your aliases, not raw IPs:Connections are pooled and reused (idle timeout 60s, max 10). Multi-key auth tries each
IdentityFilein order, like OpenSSH.Get started
Set
ALLOWED_HOSTSto restrict which servers the agent can reach. AddALLOWED_DIRSfor path restrictions. SetREMOTE_SSH_MODE=safeif you want shell command execution.Tip
If you use claude-code-skills, the
/ln-010-dev-environment-setupskill installs all three hex MCP servers, configures hooks, and syncs settings across Claude, Gemini, and Codex in one pass.Hex Family
Full docs: README · npm: @levnikolaevich/hex-ssh-mcp · Site: hex-ssh page
What remote operations eat the most tokens in your workflow? Let us know in the comments.
Beta Was this translation helpful? Give feedback.
All reactions