Remote access from a server
contextcode serve brings up the same remote access as Channels → Web access in the app, but without opening a window. It is what you use on a server, a VPS or a machine that stays on at home.
Which URL the QR carries
Section titled “Which URL the QR carries”There are three ways to publish the server, from most closed to most open:
| How you start it | QR URL | When to use it |
|---|---|---|
contextcode serve --print-qr | http://<local network IP>:8787 | The phone is on the same Wi-Fi as the machine. |
contextcode serve --public --print-qr | The machine’s fixed URL if it has one; otherwise a temporary Cloudflare URL | Server on another network or a VPS. |
contextcode serve --stable --print-qr | The machine’s fixed URL under the Context Code domain | A server you connect to every day. Requires the plan with remote servers. |
With --public, serve looks in this order:
- The fixed URL the machine already has saved (the same one the app’s «Stable URL» button gives).
- If there is none and you are signed in with
contextcode login, it requests one from the tunnel service and saves it. - If that is not possible, it falls back to a temporary
trycloudflare.comtunnel and warns that this URL changes on every start: the QR you scan will stop working when the server restarts.
--stable requests the fixed URL on every start, so it corrects itself if you changed the port.
With --print-qr and a public URL, the main QR is the public one and the local network URL appears below it.
Running it as a service
Section titled “Running it as a service”contextcode serve --install --publicInstalls serve as a service of your user with the same options you pass, and starts it:
- Linux: a systemd user unit (
contextcode-serve); starts at boot, restarts if it crashes and logs to the journal. Nosudoneeded. - macOS: a LaunchAgent.
- Windows: a scheduled task «at log on», no UAC.
The service keeps its token in a file (--token-file, ~/.context/serve-token by default, with 0600 permissions), so it doesn’t depend on the system keychain. When the installation finishes it prints the URL and the QR with that same token: that is the one to scan.
To remove it: contextcode serve --uninstall.
Seeing the QR again
Section titled “Seeing the QR again”With the service already running, don’t start another serve; use
contextcode conexion --qrIt takes the token from the installed service (or from the file you pass with --token-file) and shows the public URL if there is one. If you try to start a second serve on the same port, it stops with a message that explains it instead of a generic error.
Paired phones
Section titled “Paired phones”When it scans the QR, each phone gets its own credential. You can list them and revoke their access without touching the link token:
contextcode dispositivos # name, id, paired, last used, IPcontextcode dispositivos --jsoncontextcode dispositivos revocar "Daniel's Vivo" # by name, id or id prefixcontextcode dispositivos revocar --todos --si # without asking for confirmationThe revocation takes effect immediately, even with the server running: that phone’s next request is rejected. Tokens and hashes are never shown.
The phone stays «connecting»
Section titled “The phone stays «connecting»”Check in this order:
- That the QR belongs to the server that is running. If you ran
serve --print-qrand then installed the service with--install, the service uses another token and that QR is no longer valid. Get the right one withcontextcode conexion --qr. - That the phone can reach that URL. Open it in the phone’s browser: if the web loads, the network is fine. If it keeps loading, the phone is not on the same network or there is a firewall (
sudo ufw allow 8787/tcp). Outside the local network, use--public. - That the service is alive:
systemctl --user status contextcode-serveandjournalctl --user -u contextcode-serve -n 50.
Documentation assistant
Answers only from the Context Code manual
Hi. Ask me how to use Context Code and I'll answer with what this documentation says, linking to the pages.
Listening…
Speak normally. When you pause, I answer out loud.
It can make mistakes: check the details on the linked pages. 0/500