Document the control token for live MCP sessions

(cherry picked from commit 946ffdf7f5)
This commit is contained in:
yoriswind authored and Codex committed 2026-12-01 16:45:36 +01:00
1 parent ce07b37630
commit 819df31426
2 files changed
+55 -25

No files matched your search

+8 -5
View File
@@ -4,7 +4,9 @@
`vectorcraft --control <port>` listens on `127.0.0.1:<port>` (loopback only). The port must be a number
from 1 to 65535 (`--control=<port>` works too), given once; otherwise the app prints an error and exits
before it starts. One JSON request per line:
before it starts. Each connection must authenticate with the app's control token before it can send
commands. The [MCP setup guide](mcp.md#connect-to-the-desktop-app) shows how to give the app and the CLI
the same token file. After authentication, send one JSON request per line:
`{"id": 1, "method": "ui.inspect", "params": {}}` → `{"id": 1, "ok": true, "result": {...}}` or `{"id":1,"ok":false,"error":"..."}`.
Set `VECTORCRAFT_CONFIG_DIR` to a dedicated directory for an isolated native test profile. Preferences,
@@ -23,10 +25,11 @@ nothing sent after it on that connection runs. That covers text that isn't JSON,
an object without `method`, invalid UTF-8, and a line longer than 4 MiB. An HTTP request (for example a
web page's cross-origin `fetch` to `127.0.0.1:<port>`) therefore can't smuggle a command in its body:
its request line is rejected first. At most 16 connections are served at once; further ones get an error
line and are closed. Clients that get an error reply should reconnect. The port has no authentication,
so only enable it while you use it. Idle clients have 5 minutes to start their next line; once the
first byte arrives, the complete line must arrive within an absolute 30 seconds (trickled bytes do not
renew it). A reply has 60 seconds to be written. Expiration closes the connection and returns its slot
line and are closed. Clients that get an error reply should reconnect and authenticate again. Keep
the control token private and enable the port only while you use it. Idle clients have 5 minutes to start
their next line. Once the first byte arrives, the complete line must arrive within an absolute 30 seconds
(trickled bytes do not renew it). A reply has 60 seconds to be written. Expiration closes the connection
and returns its slot
(an idle connection is closed without a line, so nothing waits where the next reply would be; a line
that stalls gets the usual error line first);
persistent clients can send further requests within these bounds, or reconnect after idle expiration.