# MCP server WordCraft speaks the [Model Context Protocol](https://modelcontextprotocol.io) over stdio, so Claude and other agents can write and edit documents. ```sh wordcraft-cli mcp # headless session (no window) wordcraft --control 7981 & # or: drive the running app… wordcraft-cli mcp --connect 127.0.0.1:7981 # …including clicks, keys and screenshots ``` Claude Code: `claude mcp add wordcraft -- wordcraft-cli mcp`. With `--connect`, the bridge sends the app's control key, which it reads from `WORDCRAFT_CONTROL_KEY` or from the key file the app writes at start. It sends the key only to loopback addresses; see [Keys](control-protocol.md#keys). ## Tracked changes by an agent Tracked changes and comments are recorded under the session's user name ("WordCraft User" by default). Name the agent so reviewers can tell its edits from people's: start the headless server with `wordcraft-cli mcp --author "Claude (copyedit)"`, or run `file.setAuthor {"name": "Claude (copyedit)"}`. Turn tracking on explicitly with `review.trackChanges {"value": true}`; without `value` it toggles, which turns tracking *off* in a document that was saved with it on. `wordcraft-cli run` takes `--author` too. ## Confining file access ```sh wordcraft-cli mcp --automation-read-root /work/project --automation-write-root /work/project/out ``` ```json {"mcpServers": {"wordcraft": {"command": "/abs/path/target/release/wordcraft-cli", "args": ["mcp", "--automation-read-root", "/work/project", "--automation-write-root", "/work/project/out"]}}} ``` The two flags (VectorCraft, PhotoCraft and the other Craft apps take the same ones, so one client config works across the suite) keep the agent to the folders you give it: - Every file a command reads must lie inside the **read root**: `open_document` and `file.open`, `file.newFromTemplate`, `insert.textFromFile` and `insert.object`, `insert.picture` and `picture.change` with a `path`, `mailings.recipients` with a `path` (csv, tsv, txt, xlsx, xlsm, ods), `review.compare` (`path` and `original`), the templates and documents `tools.updateStyles`, `styles.organizer` and `styles.copyFrom` read. The pictures an opened HTML file names are read from beside that file, so they are inside the read root too (a link that leads out is not followed). - Every file a command writes must lie inside the **write root**: `save_document`, `file.save`, `file.saveAs`, `file.exportPdf`, `file.exportPng`, `file.printPdf`, `file.saveTemplate`, and `mailings.finish` with a `path`. - Read and write access are separate. Give the same folder twice for both; a root left out grants none of its access (with only `--automation-read-root`, nothing can be written to disk). Without either flag nothing changes. - A path is made absolute against the server's working directory, then its links are followed: a file (or folder) link that leads out of a root is outside it. For a file that doesn't exist yet, its nearest existing folder's links are followed and the rest must be plain names, so `..` below a folder that doesn't exist is refused, as is a link that leads nowhere (writing through it would create its target). The result is compared with the root by whole folder names: `/work2/x` is not inside `/work`. On Windows case is ignored, UNC paths (`\\server\share\...`) are resolved like drive-letter ones, and device names (`CON`, `NUL`, `COM1`...) are refused. - A refused path is an ordinary tool error the agent can read and correct, for example `automation path rejected: outside the write root /work/project/out: /etc/x.docx` or `automation filesystem access is not granted: write authority is absent: /work/project/out/x.docx`. - The roots must be existing folders; a missing one stops the server with an error. Each flag is given once (`--flag