Skip to content

Remote development

graphmind serve binds 127.0.0.1 and has no --host option. Nothing can reach it from another machine or another network namespace, which is the point. When your agent runs somewhere other than your browser, the flow that works is:

  1. Run npx graphmind-ai where the agent runs: inside the container, the Codespace, the WSL distribution, or on the SSH host. The agent then reaches it on its own loopback, with no configuration.

  2. Forward port 4747 to the machine your browser is on, keeping the same port number.

  3. Open http://localhost:4747 in your local browser.

The same port number matters. The server accepts a browser only when the page’s origin is on the server’s own port. If the forward lands on a different local port, say localhost:8888, every script the viewer loads is refused with 403 and the page stays blank. If you cannot keep the port, tell the server which origin to expect:

Terminal window
# on the remote side, if your browser will use http://localhost:8888
GRAPHMIND_ALLOWED_ORIGINS=http://localhost:8888 npx graphmind-ai

Run npx graphmind-ai --no-open in the container’s terminal. VS Code offers to forward a port it sees in terminal output. To make it explicit, add to .devcontainer/devcontainer.json:

{
"forwardPorts": [4747]
}

Check the Ports panel: the “Forwarded Address” should be localhost:4747. If VS Code picked another local port because 4747 was busy on your machine, either free it or set GRAPHMIND_ALLOWED_ORIGINS to that origin as above.

Publishing the port with docker run -p 4747:4747 does not work on its own. Docker forwards to the container’s network interface, and the server listens only on the container’s loopback. VS Code’s forwarding connects from inside the container, which is why it works.

When the server and the agent cannot share a machine

Section titled “When the server and the agent cannot share a machine”

GRAPHMIND_URL tells an SDK where the server is, for example when you run the server on your host and the agent in a container:

Terminal window
GRAPHMIND_URL=ws://host.docker.internal:4747/ingest node agent.js

Two things stand in the way, and both are deliberate:

  1. The Host check. The SDK’s connection arrives with Host: host.docker.internal:4747, which is not a loopback name, and the server answers 403. Allow that hostname on the server:

    Terminal window
    GRAPHMIND_ALLOWED_ORIGINS=http://host.docker.internal:4747 npx graphmind-ai
  2. The loopback bind. The server must be reachable at all from inside the container. Docker Desktop’s host.docker.internal routes to the host’s loopback. On Linux, --add-host=host.docker.internal:host-gateway points at the bridge address, where a server bound to 127.0.0.1 is not listening.

Running the server inside the container, as above, avoids both.

Tested on macOS on 2026-09-14 against the built CLI:

  • A browser on the server’s own loopback port: the viewer loads and connects.
  • A TCP port forward to a different local port, the same thing ssh -L and VS Code do at the socket level: the page is blank, and the console shows 403 (Forbidden) for the viewer’s scripts.
  • The same forward with GRAPHMIND_ALLOWED_ORIGINS set to the forwarded origin: the viewer loads and connects.
  • An SDK connection whose Host is host.docker.internal:4747: refused with 403. Accepted once GRAPHMIND_ALLOWED_ORIGINS=http://host.docker.internal:4793 named that hostname. The port in that setting does not have to match for the Host check.
  • A request with Host: <name>-4747.app.github.dev: refused with 403.

Described from how each environment forwards ports, but not run here: a real VS Code devcontainer, a Codespace (in VS Code or in the browser), WSL 2, SSH, and Docker on Linux with host-gateway. If one of these behaves differently for you, open an issue with the Ports panel entry or the 403 body; the server’s message names the header it refused.