Guide · Grok Build
Run Grok Build on your VPS and use it from your browser
Grok Build is great in a terminal. But a terminal on your laptop stops when the lid closes, and it is hard to use from a phone. This guide puts Grok Build on a server you own and gives you a clean chat for it in any browser.
Why run Grok Build on a server?
- It keeps working. A long task keeps running on the server while you close your laptop or switch devices.
- Pick up from anywhere. Start a task at your desk, check on it from your phone, approve the next step from a tablet.
- Your code stays yours. The project, the agent and your Grok login all live on your server, not in someone else's sandbox.
- Real tools. The agent uses the packages, git and CLIs on that machine, the same way it would in your own terminal.
AgentPort is the piece in the middle: a small Docker container on your server that runs Grok Build, plus a web app where you chat with it. Your browser talks directly to your server. AgentPort's cloud only handles sign-in and remembers which computers are yours. It never streams your chats or code.
What you need
- A Linux VPS (or any always-on computer) with Docker installed and running.
- A free AgentPort account.
- A Grok account. You sign in to Grok yourself; AgentPort never asks for an API key, and you pay xAI directly for Grok.
127.0.0.1 on the server. You do not need a domain, a reverse proxy or firewall changes.Step 1: Add your server in AgentPort
- Sign in at agentport.johnstech.in/login.
- Click Add machine and give it a name, for example VPS.
- Choose Your computer. AgentPort shows a one-line install command. Secrets are starred on screen; use the Copy button to copy the real command.
The command looks like this (your token and link details are filled in for you):
curl -fsSL "https://control.agentport.johnstech.in/install.sh" | bash -s -- \
--control-url "https://control.agentport.johnstech.in" \
--token "apj_…" --tunnel-token "…" --wss-url "wss://…/ws"
The apj_ token is one-time and expires, so if you wait too long just click to get a new command.
Step 2: Paste it on the server
SSH into your VPS and paste the command. In about a minute it:
- Downloads the AgentPort image (
ghcr.io/johnversus/agentport-node, built for both amd64 and arm64 servers). - Starts the container, bound to
127.0.0.1:8787only. - Opens the secure link for this computer.
- Links the computer to your AgentPort account and prints All set.
Leave the browser tab open while it runs. You do not need to refresh; the setup screen says when the computer is ready. Then click Connect.
Step 3: Sign in to Grok
Open the computer's settings and go to AI Model. If Grok is not on the server yet, click Install Grok CLI. Then log in: AgentPort shows a short code and a link to xAI's verify page. Open the link, enter the code, and approve. The login is saved in ~/.grok on your server, so it survives updates.
Step 4: Start a chat
Click New chat, pick Grok, and type what you want: "Make a clean todo app with dark mode", "Fix the failing test", "Add a pricing section". You see the agent's thinking, tool calls and file edits as compact rows in the chat. Projects live in ~/agentport-workspaces on the server.
Pick how much freedom the agent gets with the Mode menu:
- Ask first: Grok asks before changing files or running commands.
- Auto: safe reads run freely; you still approve edits and commands.
- Always approve: Grok edits and runs tools without asking. Powerful; use it on projects you trust.
You can also choose the model and effort when Grok offers them. Run several chats at once; they are grouped by project folder, and you can rename, archive or delete them. Reload the page or switch devices and the chat is still there.
Step 5: Look at the changes
The file panel shows your project tree. Click a file to preview it, including images and video. The Changed tab lists what git sees as modified, with a Diff view per file, so you can review what the agent did before you ship it.
Optional: let Grok push to GitHub and deploy to Vercel
In the computer's settings, open Connectors. AgentPort runs the official gh and vercel CLIs on your server and walks you through their normal browser login. The sessions stay on your server, and Grok is told what is connected, so you can say "commit this and open a PR" or "deploy a preview".
Updating and uninstalling
When a new version is out, the computer's Software tab shows Update. You can also run bash ~/.agentport/update-node.sh on the server. Updates keep your Grok login, projects and chats.
To remove AgentPort, use the uninstall command in the computer's settings (it removes only AgentPort's container, volume and network), then delete the computer in the app. Your project folder and Grok login stay on the server.
FAQ
Does AgentPort see my code?
No. The browser connects straight to the agent on your server over a secure WebSocket. The cloud side handles sign-in and the list of your computers, and issues short-lived session tokens.
Can I use it on a Mac instead of a VPS?
Yes, if Docker is running on it. The same command works. A VPS is just handy because it is always on.
How much does it cost?
AgentPort Free covers 1 computer. Pro is $27/month for up to 3 computers. Grok usage is between you and xAI.
Try it on your own computer
The Free plan covers 1 computer. Pro is $27/month for up to 3. You bring the AI login and pay that provider directly.