PhotoCraftfans
Use onlineSearch
English
Documentation-based guide

Connect an agent through MCP

Understand the official local server before allowing automated edits.

5 min readv0.22.0Reviewed 2026-11-09
Documentation-based guide

Based on upstream documentation. These steps have not been independently tested in the desktop app; menu labels and behavior may differ by release.

Step by step

  1. Observe background job progress and cancellation

    v0.22.0 waiting command_run and command_batch steps can report background job progress through _meta.progressToken. Cancellation stops an unfinished job; an already completed edit remains. Bridge mode sends the start once and polls jobs.list, allowing jobs beyond the 55-second reply limit; lost start replies, UI commands and non-job commands still have limits. Headless --gpu is optional; explicit GPU flags are rejected in bridge mode because rendering belongs to the desktop.

  2. Confirm the CLI and client

    Check that your installed photocraft-cli has an mcp subcommand, and use an MCP-capable client with a documented local-server configuration. Client configuration formats can differ.

  3. Inspect the server help

    Run photocraft-cli mcp --help. Upstream documents photocraft-cli mcp as the server entry point. Use the actual installed executable path in your client instead of a path copied from another computer.

  4. Register the installed executable

    The v0.22.0 MCP guide documents explicit registration. Configure the command as photocraft-cli and arguments as mcp plus your read/write roots. Restart the client after PATH changes. For ENOENT, check command -v photocraft-cli or PowerShell Get-Command photocraft-cli in the client environment; do not use a symlink into target/release or a literal ~/$HOME in a JSON command path.

  5. Use a disposable workspace

    Give the agent a copy of a small sample and explicit output paths. Avoid exposing your entire photo library. Inspect each tool request and the available file-access boundaries in the client.

  6. Set explicit file-access roots

    The v0.22.0 MCP server requires explicit read/write roots for file access; without roots it has no filesystem authority. Use --automation-read-root and --automation-write-root with your actual disposable project directory. The /work/project example is a placeholder, not a path to copy blindly.

  7. Make bridge mode explicit

    Use absolute automation roots. Headless mcp needs root flags; bridge roots belong on the desktop app, and root flags on mcp --bridge are rejected. PHOTOCRAFT_CONTROL_PORT can select a bridge when --bridge is absent, or TCP for serve when --port is absent. Check the launch environment; credentials and modes must not be inferred from a copied command.

  8. Separate History state from saved files

    The History panel exposes step navigation and History Brush source selection. Clear History retains the current image and removes earlier states from the list; the clear itself is undoable, but it does not restore an overwritten file. Save a separate source copy before destructive work or automation.

  9. Inspect a failed batch before retrying

    command_batch is not atomic: earlier successful steps remain applied when a later step fails. Inspect the document before retrying. Undo cannot roll back files already saved to disk.

  10. Discover selection-edit parameters before automation

    Inspect command_list for select.refineEdge. Its edits and refineStrokes parameters describe the operations used by the released Select and Mask workspace. The workspace applies them on OK as one undoable operation; direct automation must still provide supported parameters and inspect its result. Refine Hair and Object Aware remain unavailable in the workspace.

  11. Inspect command replies and save nested contents

    command_list returns an array of command definitions, including enabled state and parameter documentation. To edit embedded Smart Objects in memory, use editContents and saveContents, save nested contents from inside outward, then save the parent to an allowed path. Saving a contents document directly exports it rather than updating its parent.

  12. Inspect layers before editing

    v0.22.0 provides the read-only layer.list command for a tree or flat listing. layer.select can target a name and occurrence; ui.set layerFilter controls kind/name/mode filtering. Discover exact parameters through command_list. image.detectFaces is a local detection command, not a cloud generative-image service.

  13. Inspect skipped layers and replacement scope

    doc_export_layers returns skipped entries with reasons; workspace count includes only written files. Groups export merged, standalone adjustments have no pixels, and write errors remain errors. doc_replace_smart_object reads within the granted root in headless/workspace mode, keeps transforms and filters, and is refused in desktop bridge mode. Inspect the response before assuming every layer was exported or replaced.

  14. Keep export and document targeting explicit

    doc_save/doc_export accept ddsCompression and ddsMipmaps for DDS output. In the JSON control protocol, a per-call index targets that document without changing the active one; doc.select changes the active document. Keep checking warnings and outputs inside the granted roots instead of assuming a successful call validates the resulting image.

  15. Keep workspace restrictions intact

    v0.22.0 retains workspace checks for exports, linked Smart Object files and dialogs. Use the granted read/write roots; do not broaden them merely to silence a rejected operation. Invalid UTF-8 requests produce a parse error without ending the MCP session, so inspect the request and previous effects before retrying.

  16. Finish modal workspaces before another menu action

    The v0.22.0 control dispatcher gates both ui.menu.invoke and engine.execute while a modal dialog blocks the command. Commit or cancel the active workspace and resolve prompts or crops before unrelated edits; supported workspace continuation requests are a separate path. ui.menu.list reflects unavailable menu commands. This does not expand filesystem access.

  17. Request bounded memory and export options

    Headless doc.open/doc.place accept approveHighMemory; MCP doc_open/doc_place use approve_high_memory. Consent is per call and cannot bypass the hard budget or granted filesystem roots. doc.save accepts tiffTransparency, tiffPyramid and pcraftFullComposite; MCP doc_save/doc_export use snake_case option names. The full-size native composite is optional, capped at 2^26 pixels and may be omitted on allocation, encoding or archive limits. Verify the saved manifest and warnings.

  18. Treat control channels separately

    The desktop JSON control channel has its own authentication and local-host requirements. Read the official protocol before using it; do not publish a local control port to the internet.

  19. Keep writes in a dedicated output folder

    doc_save and doc_export can replace existing supported image/document files inside the write root, but refuse to overwrite unrelated files such as .env or source code. Multi-file exports never replace files. A client still receives the full rights of its roots, and document text can contain misleading instructions. Use a dedicated output directory instead of granting an entire project.

  20. Handle docking and screenshot state explicitly

    Shared panel commands expose grouping and workspace locking. window.panel.window is refused on web because panels stay inside the page. ui.screenshot keeps the accepted document target, retries geometry changes within its deadline, and refuses minimized or over-budget captures. Inspect errors rather than assuming a screenshot shows the intended document; these are desktop control commands, not a web export API.

  21. Check desktop control preferences before restart

    Allow Agent Control and Control Port are read when the desktop starts. Turning Allow Agent Control off refuses a listener even when a port was requested; a valid explicit port overrides the preference. A preference change is not a live permission grant. Keep loopback authentication and existing root limits, and never expose the control port publicly.

  22. Inspect selected color components

    channel.target accepts colors:[0,2] and inspection exposes selectedColors. Invalid or empty sets fail without editing; masks and saved channels cannot join a color set. Discover command parameters first and retain your existing filesystem roots.

  23. Distinguish recorded document references

    Recorded actions support layer-stack indexes and selected ordinal forms. For document.activate, numeric document values are zero-based tab indexes; typed {index:...} values use one-based opening order, and offsets wrap in opening order. These differ from layer IDs and visible row numbers. Test multi-document actions on copies.

  24. Close without losing unsaved work

    file.close defaults to discarding changes. In headless playback, save:"ask" refuses to close a changed document; it does not open a save dialog. Save explicitly first or deliberately choose discard. Imported Close steps without a recorded save choice retain this refusal.

  25. Review new size and profile options

    Inspect command_list after upgrading. Image Size supports scaleStyles, defaulting to true for native commands but false when absent in imported ATN. Convert to Profile adds opt-in dither, flatten and rasterizePlaced. Flatten and rasterize change document structure; test a layered copy within your existing roots.

  26. Keep fill and paste choices explicit

    Content-Aware Fill retains color, quarter-turn rotation, scale and mirror adaptation options. Explicit path/shape paste needs retained, bounded SVG source; unsupported geometry fails instead of silently becoming pixels. The native SVG clipboard service is not a promise of browser clipboard support.

photocraft-cli mcp --help
# Replace /work/project with your disposable project directory
photocraft-cli mcp --automation-read-root /work/project --automation-write-root /work/project

Sources and further reading

PhotoCraft is in early alpha. Keep original files and test a copy before relying on it for important work.

Suggest a correction