Skip to content

PhotoCraft: An open-source, photo editor written by scratch in pure Rust

Docs: install the CLI and register it with MCP clients (#7663)

KnottyDyesc9d7f1d98451
diff --git a/book/src/automation/mcp.md b/book/src/automation/mcp.md
index 4f3d02496..2c36b464c 100644
--- a/book/src/automation/mcp.md
+++ b/book/src/automation/mcp.md
@@ -5,6 +5,9 @@
- **Headless:** an in-process `Headless` session owns the engine and performs file I/O.
- **Bridge:** `BridgeClient` forwards tools to a desktop application started with `photocraft --control <port>`.
+For a source checkout, first [install the CLI on PATH and register the server](../../../docs/mcp.md#install-and-register).
+The installed binary survives `cargo clean`; a symlink into `target/release` does not.
+
Start the headless server with:
```sh
diff --git a/docs/mcp.md b/docs/mcp.md
index 3046a669b..9a8c573ce 100644
--- a/docs/mcp.md
+++ b/docs/mcp.md
@@ -1,5 +1,52 @@
# MCP conventions
+## Install and register
+
+From the repository root, with the [source-build prerequisites](development.md#prerequisites)
+installed, install the CLI independently of the build directory:
+
+```sh
+cargo install --path apps/photocraft-cli --locked
+# POSIX shells, for Cargo's default install location:
+export PATH="${CARGO_HOME:-$HOME/.cargo}/bin:$PATH"
+photocraft-cli --help
+photocraft-cli mcp --help
+```
+
+Cargo installs a binary, not a symlink into `target/`, so it survives `cargo clean`.
+Re-run the install command after updating the checkout.
+By default the executable goes in `$CARGO_HOME/bin` (`~/.cargo/bin` when unset), or
+`%USERPROFILE%\.cargo\bin` on Windows. If you set `--root`, `CARGO_INSTALL_ROOT`, or
+Cargo's `install.root`, use that installation root's `bin` directory instead. Add it
+to the `PATH` inherited by the MCP client, not just an interactive shell, and restart
+the client after changing its environment.
+
+Register the installed command explicitly (replace `/work/project` with an existing folder):
+
+```sh
+claude mcp add photocraft -- photocraft-cli mcp --automation-read-root /work/project --automation-write-root /work/project
+```
+
+Other MCP clients can use this bare-name configuration:
+
+```json
+{"mcpServers":{"photocraft":{"command":"photocraft-cli","args":["mcp","--automation-read-root","/work/project","--automation-write-root","/work/project"]}}}
+```
+
+Linux `.deb` and `.rpm` packages already install `/usr/bin/photocraft-cli`; those users
+can skip the source install. Other release locations are listed in the
+[installed-release guide](../book/src/automation/mcp.md#from-an-installed-release).
+Installing the CLI does not start or register an MCP server automatically.
+
+If a client reports `ENOENT` or "Executable not found in $PATH", verify the install with
+`command -v photocraft-cli` (PowerShell: `Get-Command photocraft-cli`) in the client's
+environment. If that environment cannot be changed, set JSON `command` to the absolute
+installed binary path, not a literal `~` or `$HOME` expression. Avoid symlinks into
+`target/release`: cleaning the build directory breaks them. A source build alone does
+not put the CLI on `PATH`.
+
+## Start a session
+
PhotoCraft follows the same conventions as FilmCraft #28. Start a headless session:
```sh