Serve markdown files as mobile-friendly web pages over Tailscale.
Built for reading documents generated during CLI sessions (e.g. Claude Code) from a mobile device connected via Tailscale.
- Dark theme optimized for mobile reading
- Directory-based serving with relative link support
- GFM markdown with syntax highlighting (highlight.js)
- Per-heading inline comments (stored as sidecar
.comments.jsonfiles) - Tailscale CGNAT IP filtering (localhost +
100.64.0.0/10only) - Path traversal protection
- Allowlisted file types only (
.md,.json,.txt,.yaml)
npm install -g mdgateOr clone and link:
git clone https://github.com/cmygray/mdgate.git
cd mdgate
npm install
npm linkRegister your Tailscale Magic DNS hostnames (stored in ~/.mdgate/config.json):
mdgate --init myhost.tailnet-name.ts.netmdgate docs/plan.md # serve a markdown file (port 9483)
mdgate -p 8080 notes.md # custom port
mdgate --stop # stop the server
mdgate --status # check if runningThen open http://<your-tailscale-host>:9483 from your mobile browser.
Linked markdown files (e.g. [Unit 01](units/unit-01.md)) are navigable. Comments can be added per heading section via the [+] button.
- Binds to
0.0.0.0but rejects connections outside Tailscale CGNAT range and localhost - No secrets in source code; hostnames stored only in local config (
~/.mdgate/) - Comment writes are restricted to
.md-adjacent sidecar files within the served directory
ISC