diff --git a/.agents/skills/formweb-harness/sub-skills/agent-connect-and-terminal/SUB-SKILL.md b/.agents/skills/formweb-harness/sub-skills/agent-connect-and-terminal/SUB-SKILL.md index 23347768..96303a88 100644 --- a/.agents/skills/formweb-harness/sub-skills/agent-connect-and-terminal/SUB-SKILL.md +++ b/.agents/skills/formweb-harness/sub-skills/agent-connect-and-terminal/SUB-SKILL.md @@ -34,7 +34,7 @@ Agents is on; every MCP call fails with a 403 otherwise. An outside agent cannot 2. The approval settings are readable only in the window, so plan for a wait. With "Ask me before an agent deletes, replaces the open project or changes retention" on (`agentDestructive`), destructive tools and any `apply_commands` batch that removes something wait for a person's decision; only the person can change that choice. 3. If a call waits, it holds up to 100 seconds. Tell the person to watch Agent Connect and wait for the result. If it ends with "No one approved", the approval expired: ask them to be ready and retry once. If it ends with "The person denied", stop, do not rephrase the request to slip past the denial, and offer a non-destructive alternative. 4. Never approve your own request. Decisions are the person's, or a reviewer's for releases (see sibling `branch-and-review`). -5. For a client card, `GET /api/agents/clients` reports each file as missing, ready or changed. Writing that client's project file (`.mcp.json`, `.codex/config.toml` or `.cursor/mcp.json`) is done by the person from the card in Agent Connect; a request from outside the window is refused with "Only the FormWeb window can do this." Ask for the one card the person wants. +5. For a client card, `GET /api/agents/clients` reports each file as missing, ready or changed. Writing that client's project file (`.mcp.json`, `.codex/config.toml` or `.cursor/mcp.json`) is done by the person from the card in Agent Connect; a request from outside the window is refused with "Only the FormWeb window can do this." Ask for the one card the person wants. In the installed desktop app the written entries name the running app's `http://127.0.0.1:PORT/mcp` instead of the `formweb` launcher; after the app changes port the card reads changed and the person writes it again. 6. The terminal is a shell in the FormWeb folder that only the FormWeb window can open; an outside agent cannot, and should not look for another way in. It is for the person's own work; do not run commands that print tokens or provider secrets. 7. `./formweb run --list` lists engine commands. `./formweb run node.update id=headline 'patch={"text":"Hello"}'` applies one; values are parsed as JSON when possible. Add `--json` for machine output and `--revision N` to require a revision. The command line is an outside agent too: it calls the MCP endpoint, so Agents must be on and the approval settings apply. The change is one undo step, appears live and is attributed to the agent channel. 8. After changes, read `formweb://activity` to confirm who did what and under which channel. diff --git a/.claude/skills/formweb-harness/sub-skills/agent-connect-and-terminal/SUB-SKILL.md b/.claude/skills/formweb-harness/sub-skills/agent-connect-and-terminal/SUB-SKILL.md index 23347768..96303a88 100644 --- a/.claude/skills/formweb-harness/sub-skills/agent-connect-and-terminal/SUB-SKILL.md +++ b/.claude/skills/formweb-harness/sub-skills/agent-connect-and-terminal/SUB-SKILL.md @@ -34,7 +34,7 @@ Agents is on; every MCP call fails with a 403 otherwise. An outside agent cannot 2. The approval settings are readable only in the window, so plan for a wait. With "Ask me before an agent deletes, replaces the open project or changes retention" on (`agentDestructive`), destructive tools and any `apply_commands` batch that removes something wait for a person's decision; only the person can change that choice. 3. If a call waits, it holds up to 100 seconds. Tell the person to watch Agent Connect and wait for the result. If it ends with "No one approved", the approval expired: ask them to be ready and retry once. If it ends with "The person denied", stop, do not rephrase the request to slip past the denial, and offer a non-destructive alternative. 4. Never approve your own request. Decisions are the person's, or a reviewer's for releases (see sibling `branch-and-review`). -5. For a client card, `GET /api/agents/clients` reports each file as missing, ready or changed. Writing that client's project file (`.mcp.json`, `.codex/config.toml` or `.cursor/mcp.json`) is done by the person from the card in Agent Connect; a request from outside the window is refused with "Only the FormWeb window can do this." Ask for the one card the person wants. +5. For a client card, `GET /api/agents/clients` reports each file as missing, ready or changed. Writing that client's project file (`.mcp.json`, `.codex/config.toml` or `.cursor/mcp.json`) is done by the person from the card in Agent Connect; a request from outside the window is refused with "Only the FormWeb window can do this." Ask for the one card the person wants. In the installed desktop app the written entries name the running app's `http://127.0.0.1:PORT/mcp` instead of the `formweb` launcher; after the app changes port the card reads changed and the person writes it again. 6. The terminal is a shell in the FormWeb folder that only the FormWeb window can open; an outside agent cannot, and should not look for another way in. It is for the person's own work; do not run commands that print tokens or provider secrets. 7. `./formweb run --list` lists engine commands. `./formweb run node.update id=headline 'patch={"text":"Hello"}'` applies one; values are parsed as JSON when possible. Add `--json` for machine output and `--revision N` to require a revision. The command line is an outside agent too: it calls the MCP endpoint, so Agents must be on and the approval settings apply. The change is one undo step, appears live and is attributed to the agent channel. 8. After changes, read `formweb://activity` to confirm who did what and under which channel. diff --git a/.docs/wiki/Agents-and-MCP.md b/.docs/wiki/Agents-and-MCP.md index 2d0fef5a..4d1a9cc4 100644 --- a/.docs/wiki/Agents-and-MCP.md +++ b/.docs/wiki/Agents-and-MCP.md @@ -18,6 +18,8 @@ FormWeb works with four agent programs: Claude Code, Codex, Cursor and Antigravi Run `./formweb boot` or `./formweb serve`, enable Agents in the editor, and trust this project in the client. `./formweb agents install` prints the included project configuration paths and launch commands; it does not change user-level configuration. Windows clients should use an absolute `formweb.bat` path and `mcp` argument. +In the installed desktop app there is no `formweb` launcher to start, so Write config in Agent Connect writes files that reach the running app over HTTP instead: `.mcp.json`, `.codex/config.toml` and `.cursor/mcp.json` in the FormWeb folder (`~/FormWeb`, or `FORMWEB_HOME`) each name `http://127.0.0.1:PORT/mcp`, with the port the app is using now, and the Antigravity card adds a `formweb` entry with that address to `~/.gemini/config/mcp_config.json`. Agents must be on in the window for these to connect, as before. If the app starts on another port later, the card says the file has changed; press Write config again. The Antigravity entry FormWeb wrote for an earlier port is updated; an entry you wrote yourself is left alone. With `FORMWEB_AUTH_TOKEN` set, the three project files name that variable, and the agent program reads the token from its own environment; the token is never written into a file. Antigravity's entry has no way to name a variable, so in that case its card writes nothing, and an entry FormWeb wrote there before shows as changed, because without the token it cannot connect; Open in terminal still starts Antigravity with FormWeb's tools. The address and the variable are built in `backend/app/clients.py`. + The server exposes 104 tools, 17 resources and 5 prompts (the site import tool `library_import_site`, which reviews or imports a static site zip sent as base64, made it 104; v0.19.5 added `copy_element` and `paste_element`, which move an element with its motion, code, variables and assets between pages and sites through `POST /api/fragment` and `POST /api/paste`; v0.19.6 added design tokens, text presets and CMS collections to the fragment, and `embed_assets` on `copy_element` so a fragment pastes in another FormWeb, with `paste_element` passing `embedded` through; v0.19.8 added `clip` on both, which carries assets beyond 4 MiB by the loopback clip link (15 minutes by default, `FORMWEB_CLIP_SECONDS` changes it) and needs `embed_assets` (v0.20.1 streams clip assets to disk on paste); v0.19.3 added the 14 authoring tools for motion, variables, components, the section library, new sites and Send to FormPublisher; v0.7.0 added `list_ui_commands`, `describe_ui_command` and `run_ui_command`, which list and run the open editor window's own commands through the window bridge, with an in-window Allow for risky ones; v0.5.6 added `write_copy` and `generate_site`, both using the language model set in formvis; v0.5.7 gave `generate_site` a `reference` action and outline revision; v0.5.5 added `generate_image` and `edit_in_formvis`, v0.5.4 added `search_stock` and `insert_stock`, v0.5.3 `remove_background`, v0.5.2 the team library tools). `generate_image` waits up to 90 seconds, below the stdio proxy's 130, and otherwise returns a job to pass back. Eight domain tools (`edit_nodes`, `edit_pages`, `edit_styles`, `edit_components`, `edit_cms`, `edit_locales`, `edit_site`, and since v0.7 `edit_creative` for tables, sliders, layout defaults, superscript and subscript and multi-step forms) are generated from the engine catalogue in `backend/app/mcp_domains.py` and list each command's parameters; edits return a compact summary unless `detail: "site"` is passed. Every tool has a title; `get_site`, `apply_commands` and `edit_nodes` carry `_meta["anthropic/alwaysLoad"]` so Claude Code loads them without a tool search. Errors carry a `next` sentence the agent can act on. Resources include `formweb://site/tree` (outline with IDs), `formweb://selection` (the editor's selection, reported while Agents is on), `formweb://tokens` and `formweb://audit`. Prompts: build_page, edit_copy, responsive_review, publish_site, recover_session. The stdio proxy forwards the server's instructions and prompts and waits up to 130 seconds per call so approval waits finish. The original authoring tools now share the catalog with content portability, library review, form delivery, releases, branches, comments/access, code compilation and provider workflows. `backend/app/advanced_catalog.py` and `backend/app/providers/catalog.py` define the additions. The live `tools/list` and `resources/list` are authoritative; use the [agent quick start](../../docs/AGENT_QUICKSTART.md) and [advanced Studio guide](../../docs/ADVANCED_GUIDE.md) for the actual operation loop. ## Authoring tools for motion, variables, components and the library (0.19.3) diff --git a/backend/app/clients.py b/backend/app/clients.py index 1abd2aad..19ab7946 100644 --- a/backend/app/clients.py +++ b/backend/app/clients.py @@ -5,15 +5,20 @@ reads one file for the whole account, ~/.gemini/config/mcp_config.json: its card adds the one entry named formweb there when the person asks, keeps every other entry and key, and leaves alone an entry of that name it did not write. The Claude Code card's Open button does not depend on its file: it starts Claude through POST /api/terminal/open with -FormWeb's own MCP config. On Windows the Codex file names formweb.bat in this folder. The installed app ships no -launcher, so there it writes none of these files. +FormWeb's own MCP config. On Windows the Codex file names formweb.bat in this folder. + +The installed app ships no launcher, so there each file and the Antigravity entry name the running app's HTTP endpoint, +http://127.0.0.1:PORT/mcp, instead. With FORMWEB_AUTH_TOKEN set, the three project files name that variable for the +client to read from its own environment; the token itself is never written to disk. Antigravity's entry cannot name a +variable, so in that case its card writes nothing. An entry FormWeb wrote for an earlier port is pointed at this one. """ import json import os +import re from pathlib import Path from . import claude_code -from .config import FROZEN, ROOT +from .config import AUTH_TOKEN, FROZEN, ROOT from .engine import EngineError CLIENTS = { @@ -41,10 +46,24 @@ } -INSTALLED = 'The installed app does not include the formweb launcher these files start, so nothing was written. Open in Agent Connect starts each program with FormWeb\'s tools.' +TOKEN_VAR = 'FORMWEB_AUTH_TOKEN' +OWN_URL = re.compile(r'http://127\.0\.0\.1:[0-9]{1,5}/mcp') + + +def http_content(client_id): + url = claude_code.mcp_url() + if client_id == 'codex': + token = f'bearer_token_env_var = "{TOKEN_VAR}"\n' if AUTH_TOKEN else '' + return f'[mcp_servers.formweb]\nurl = {json.dumps(url)}\n{token}startup_timeout_sec = 30\ntool_timeout_sec = 120\n' + named = '${' + TOKEN_VAR + '}' if client_id == 'claude-code' else '${env:' + TOKEN_VAR + '}' + headers = {'headers': {'Authorization': 'Bearer ' + named}} if AUTH_TOKEN else {} + entry = {**({'type': 'http'} if client_id == 'claude-code' else {}), 'url': url, **headers} + return json.dumps({'mcpServers': {'formweb': entry}}, indent=2) + '\n' def content(client_id, system=None): + if FROZEN: + return http_content(client_id) if client_id == 'codex' and (system or os.name) == 'nt': return f'[mcp_servers.formweb]\ncommand = {json.dumps(str(ROOT / "formweb.bat"), ensure_ascii=False)}\nargs = ["mcp"]\nstartup_timeout_sec = 30\ntool_timeout_sec = 120\n' return CLIENTS[client_id]['content'] @@ -59,10 +78,20 @@ def antigravity_file(): return Path.home() / '.gemini' / 'config' / 'mcp_config.json' +PROTECTED = f'FORMWEB_AUTH_TOKEN is set, and FormWeb does not write that token into {ANTIGRAVITY["path"]}, so nothing was written. Open in Agent Connect starts Antigravity with FormWeb\'s tools.' + + def antigravity_entry(): + if FROZEN: + return {'serverUrl': claude_code.mcp_url()} return {'command': str(ROOT / ('formweb.bat' if os.name == 'nt' else 'formweb')), 'args': ['mcp']} +def antigravity_ours(entry): + """An installed app's entry for another port: only a serverUrl on this computer's /mcp, nothing a person added.""" + return FROZEN and isinstance(entry, dict) and set(entry) == {'serverUrl'} and isinstance(entry['serverUrl'], str) and OWN_URL.fullmatch(entry['serverUrl']) is not None + + def antigravity_read(): path = antigravity_file() try: @@ -75,12 +104,19 @@ def antigravity_read(): def antigravity_card(): data = antigravity_read() entry = None if data is None else data.get('mcpServers', {}).get(ANTIGRAVITY_ENTRY) - status = 'changed' if data is None else 'missing' if entry is None else 'ready' if entry == antigravity_entry() else 'changed' + guarded = FROZEN and bool(AUTH_TOKEN) # the entry cannot carry the token, so no entry of FormWeb's can connect + status = 'changed' if data is None else 'missing' if entry is None else 'ready' if entry == antigravity_entry() and not guarded else 'changed' notes = [] if data is None: notes.append(f'{ANTIGRAVITY["path"]} is not an MCP servers file FormWeb can read, so it was left alone.') + elif guarded and antigravity_ours(entry): + notes.append(f'FORMWEB_AUTH_TOKEN is set, and the {ANTIGRAVITY_ENTRY} entry in {ANTIGRAVITY["path"]} carries no token, so it cannot connect.') + elif status == 'changed' and antigravity_ours(entry): + notes.append(f'The {ANTIGRAVITY_ENTRY} entry in {ANTIGRAVITY["path"]} names another port. Write points it at this one.') elif status == 'changed': notes.append(f'{ANTIGRAVITY["path"]} has an entry named {ANTIGRAVITY_ENTRY} that FormWeb did not write, so it was left alone.') + if guarded: + notes.append(f'FORMWEB_AUTH_TOKEN is set, so Write adds no entry to {ANTIGRAVITY["path"]}.') if (Path.home() / '.gemini' / 'antigravity-cli' / 'mcp_config.json').is_file(): notes.append(f'An older file, {OLDER_FILE}, was seen and left alone.') found = claude_code.located('antigravity').path is not None @@ -88,8 +124,11 @@ def antigravity_card(): def antigravity_write(): + if FROZEN and AUTH_TOKEN: + raise EngineError(PROTECTED, 409) data = antigravity_read() - if data is not None and data.get('mcpServers', {}).get(ANTIGRAVITY_ENTRY) is None: + entry = None if data is None else data.get('mcpServers', {}).get(ANTIGRAVITY_ENTRY) + if data is not None and (entry is None or antigravity_ours(entry)): path = antigravity_file() data.setdefault('mcpServers', {})[ANTIGRAVITY_ENTRY] = antigravity_entry() path.parent.mkdir(parents=True, exist_ok=True) @@ -114,8 +153,6 @@ def cards(): def write(client_id): - if FROZEN: - raise EngineError(INSTALLED, 409) if client_id == 'antigravity': return antigravity_write() if client_id not in CLIENTS: diff --git a/backend/tests/test_agent_client_files.py b/backend/tests/test_agent_client_files.py index 804ed289..cbdb909a 100644 --- a/backend/tests/test_agent_client_files.py +++ b/backend/tests/test_agent_client_files.py @@ -1,15 +1,100 @@ +import json +import tomllib + import pytest +APP_URL = "http://127.0.0.1:8240/mcp" +MCP_HEADERS = {"accept": "application/json, text/event-stream", "content-type": "application/json"} +FILES = {"claude-code": ".mcp.json", "codex": ".codex/config.toml", "cursor": ".cursor/mcp.json"} + + +def entry_in(path): + text = path.read_text(encoding="utf-8") + servers = tomllib.loads(text)["mcp_servers"] if path.suffix == ".toml" else json.loads(text)["mcpServers"] + return text, servers["formweb"] -@pytest.mark.parametrize("client_id", ["claude-code", "codex", "cursor", "antigravity"]) -def test_the_installed_app_writes_no_client_file_that_starts_a_launcher_it_does_not_ship(client, monkeypatch, tmp_path, client_id): + +@pytest.fixture() +def installed(monkeypatch, tmp_path): from app import clients monkeypatch.setattr(clients, "FROZEN", True) - monkeypatch.setattr(clients, "ROOT", tmp_path) + monkeypatch.setattr(clients, "AUTH_TOKEN", "", raising=False) + monkeypatch.setattr(clients, "ROOT", tmp_path / "FormWeb") + monkeypatch.setenv("HOME", str(tmp_path / "home")) + monkeypatch.setenv("USERPROFILE", str(tmp_path / "home")) + return clients + + +@pytest.mark.parametrize("client_id", ["claude-code", "codex", "cursor"]) +def test_the_installed_app_writes_a_project_file_that_reaches_the_running_app_over_http(client, installed, tmp_path, client_id): answer = client.post(f"/api/agents/clients/{client_id}", json={}) - assert answer.status_code == 409 and "installed app" in answer.json()["detail"] - assert list(tmp_path.iterdir()) == [] and not clients.antigravity_file().exists() + assert answer.status_code == 200 and answer.json()["status"] == "ready" + _, entry = entry_in(tmp_path / "FormWeb" / FILES[client_id]) + assert entry["url"] == APP_URL and "command" not in entry and "headers" not in entry and "bearer_token_env_var" not in entry + assert entry.get("type", "http") == "http" + + +@pytest.mark.parametrize("client_id", ["claude-code", "codex", "cursor"]) +def test_with_a_bearer_token_set_the_installed_app_file_names_the_variable_and_never_the_token(client, installed, monkeypatch, tmp_path, client_id): + monkeypatch.setattr(installed, "AUTH_TOKEN", "kept-out-of-files-7Qx", raising=False) + assert client.post(f"/api/agents/clients/{client_id}", json={}).status_code == 200 + text, entry = entry_in(tmp_path / "FormWeb" / FILES[client_id]) + assert "kept-out-of-files-7Qx" not in text and entry["url"] == APP_URL + named = {"claude-code": "Bearer ${FORMWEB_AUTH_TOKEN}", "cursor": "Bearer ${env:FORMWEB_AUTH_TOKEN}"} + if client_id == "codex": + assert entry["bearer_token_env_var"] == "FORMWEB_AUTH_TOKEN" + else: + assert entry["headers"] == {"Authorization": named[client_id]} + + +def test_the_installed_app_claude_file_starts_an_mcp_session_with_the_running_app(client, installed, tmp_path): + assert client.post("/api/agents/clients/claude-code", json={}).status_code == 200 + _, entry = entry_in(tmp_path / "FormWeb" / ".mcp.json") + body = {"jsonrpc": "2.0", "id": 1, "method": "initialize", "params": {"protocolVersion": "2025-06-18", "capabilities": {}, "clientInfo": {"name": "outside", "version": "1"}}} + assert client.post("/api/agents", json={"enabled": True}).status_code == 200 + try: + assert entry["url"] == str(client.base_url).rstrip("/") + "/mcp" + answer = client.post(entry["url"], json=body, headers=MCP_HEADERS) + finally: + client.post("/api/agents", json={"enabled": False}) + assert answer.status_code == 200, answer.text + assert answer.json()["result"]["serverInfo"]["name"] == "FormWeb" + + +def test_the_installed_app_adds_an_http_entry_to_the_antigravity_file_and_keeps_the_others(client, installed): + path = installed.antigravity_file() + path.parent.mkdir(parents=True) + path.write_text(json.dumps({"mcpServers": {"other": {"command": "x"}}, "theme": "dark"}), encoding="utf-8") + answer = client.post("/api/agents/clients/antigravity", json={}) + assert answer.status_code == 200 and answer.json()["status"] == "ready" + assert json.loads(path.read_text(encoding="utf-8")) == {"mcpServers": {"other": {"command": "x"}, "formweb": {"serverUrl": APP_URL}}, "theme": "dark"} + + +def test_the_installed_app_points_its_own_antigravity_entry_from_an_earlier_port_at_this_one(client, installed): + path = installed.antigravity_file() + path.parent.mkdir(parents=True) + path.write_text(json.dumps({"mcpServers": {"formweb": {"serverUrl": "http://127.0.0.1:8241/mcp"}}}), encoding="utf-8") + card = next(item for item in client.get("/api/agents/clients").json()["clients"] if item["id"] == "antigravity") + assert card["status"] == "changed" and "another port" in card["note"] + assert client.post("/api/agents/clients/antigravity", json={}).json()["status"] == "ready" + assert json.loads(path.read_text(encoding="utf-8"))["mcpServers"]["formweb"] == {"serverUrl": APP_URL} + + +def test_the_installed_app_leaves_alone_an_antigravity_entry_a_person_wrote(client, installed): + path = installed.antigravity_file() + path.parent.mkdir(parents=True) + mine = {"serverUrl": "http://127.0.0.1:8241/mcp", "headers": {"X-Mine": "1"}} + path.write_text(json.dumps({"mcpServers": {"formweb": mine}}), encoding="utf-8") + assert client.post("/api/agents/clients/antigravity", json={}).json()["status"] == "changed" + assert json.loads(path.read_text(encoding="utf-8"))["mcpServers"]["formweb"] == mine + + +def test_with_a_bearer_token_set_the_installed_app_writes_no_antigravity_entry(client, installed, monkeypatch): + monkeypatch.setattr(installed, "AUTH_TOKEN", "kept-out-of-files-7Qx", raising=False) + answer = client.post("/api/agents/clients/antigravity", json={}) + assert answer.status_code == 409 and "FORMWEB_AUTH_TOKEN" in answer.json()["detail"] + assert not installed.antigravity_file().exists() def test_the_codex_file_on_windows_starts_the_windows_launcher_without_a_unix_shell(monkeypatch, tmp_path): @@ -38,3 +123,14 @@ def test_the_codex_file_on_windows_keeps_any_folder_name_readable(monkeypatch, t folder = tmp_path / "Sites \U0001f3a8 \"draft\" \\ café" monkeypatch.setattr(clients, "ROOT", folder) assert tomllib.loads(clients.content("codex", "nt"))["mcp_servers"]["formweb"]["command"] == str(folder / "formweb.bat") + + +@pytest.mark.parametrize("port", [8240, 8241]) +def test_with_a_bearer_token_set_the_installed_app_never_calls_a_tokenless_antigravity_entry_ready(client, installed, monkeypatch, port): + monkeypatch.setattr(installed, "AUTH_TOKEN", "kept-out-of-files-7Qx", raising=False) + path = installed.antigravity_file() + path.parent.mkdir(parents=True) + path.write_text(json.dumps({"mcpServers": {"formweb": {"serverUrl": f"http://127.0.0.1:{port}/mcp"}}}), encoding="utf-8") + card = next(item for item in client.get("/api/agents/clients").json()["clients"] if item["id"] == "antigravity") + assert card["status"] == "changed" + assert "carries no token" in card["note"] and "Write points it" not in card["note"] diff --git a/docs/MANUAL.md b/docs/MANUAL.md index 10336763..66e4312b 100644 --- a/docs/MANUAL.md +++ b/docs/MANUAL.md @@ -234,6 +234,8 @@ Connected providers reports available adapters and missing server environment na Start the editor/service and enable Agents. FormWeb works with four agent programs: Claude Code, Codex, Cursor and Antigravity (Google's `agy` program). The repository includes project MCP configurations for Claude, Codex and Cursor. Antigravity reads one file for the whole account, `~/.gemini/config/mcp_config.json`; the Antigravity card in Agent Connect adds FormWeb's entry there when you ask. Use `./formweb agents install` to see paths and commands without changing global configuration. On Windows configure an absolute `formweb.bat` path with the `mcp` argument. +In the installed desktop app there is no `formweb` launcher to start, so Write config in Agent Connect writes files that reach the running app over HTTP instead: `.mcp.json`, `.codex/config.toml` and `.cursor/mcp.json` in the FormWeb folder (`~/FormWeb`, or `FORMWEB_HOME`) each name `http://127.0.0.1:PORT/mcp`, with the port the app is using now, and the Antigravity card adds a `formweb` entry with that address to `~/.gemini/config/mcp_config.json`. Agents must be on in the window for these to connect, as before. If the app starts on another port later, the card says the file has changed; press Write config again. The Antigravity entry FormWeb wrote for an earlier port is updated; an entry you wrote yourself is left alone. With `FORMWEB_AUTH_TOKEN` set, the three project files name that variable, and the agent program reads the token from its own environment; the token is never written into a file. Antigravity's entry has no way to name a variable, so in that case its card writes nothing, and an entry FormWeb wrote there before shows as changed, because without the token it cannot connect; Open in terminal still starts Antigravity with FormWeb's tools. + The `formweb-harness` skill guides an agent through reading, planning, atomic commands, responsive inspection, audit, save and export. MCP exposes the same active document as the editor. An agent should obtain live ids and command schemas before changes and refresh state after a revision conflict. Agent access defaults off. `FORMWEB_AGENTS=1` is available for a deliberately configured local session; once the engine is running, only the FormWeb window can switch it or change the approval choices, and an outside agent asks the person to. `FORMWEB_AUTH_TOKEN` can restrict control requests further. `./formweb mcp` requires the running HTTP service and does not start an isolated engine.