Skip to content

MCP tools

The MCP server exposes the same pipeline as the CLI, as JSON-RPC tools.

Connect your client

{
  "mcpServers": {
    "return_rp": {
      "command": "node",
      "args": ["/absolute/path/AxureRP-return-rp/bin/mcp.mjs"],
      "env": {
        "PATH": "/absolute/path/AxureRP-return-rp/.venv/bin:/usr/local/bin:/usr/bin:/bin",
        "AXURE_BLANK_TEMPLATE_RP9": "/absolute/path/my-rp9-blank.rp",
        "AXURE_BLANK_TEMPLATE_RP11": "/absolute/path/my-rp11-blank.rp"
      }
    }
  }
}

PATH must include the Python interpreter with the installed dependencies. Use an absolute Node path in command if needed. Reconnect the client after upgrading — tool schemas are read at connection time.

Start a session

Tool Purpose
studio_describe({ "topic": "workflow" }) Read the built-in workflow guide and tool scope
studio_open_project({ "projectDir": "/abs/path/proj" }) Open a project and return a canvas url
generate_prototype Compile RP/1 source into a native .rp
revise_prototype Apply a revision to an existing prototype

generate_prototype

Pass either spec (inline object, JSON text, or file path) or source (absolute .rp1 path).

Parameter Default Meaning
output required Absolute or relative path; relative resolves against AXURE_WRITE_ROOT or the working directory
template from env Explicit blank .rp path, when AXURE_BLANK_TEMPLATE_* is not set
overwrite false Allow in-place update and clean up old .build-* directories
strictAudit false Fail when aesthetic audit warnings fire (font size, spacing tokens)
autoHeal false Recompile and re-run gates on candidate fixes; rolls back the batch if new errors appear
compact true Return source, output, previews, status and report path; false expands structure, event coverage and artifact details
async false Return a job handle immediately instead of blocking

Native generation targets RP 11; pass target: 9 in the spec or set AXURE_TARGET_VERSION=9 for RP 9.

Long jobs

{"source": "/abs/source.rp1", "output": "/abs/prototype.rp", "strictAudit": true, "async": true}

The call returns id, type and status. Poll with jobs_get({ "id": ... }) and expect queued → running → completed/failed/cancelled. jobs_cancel({ "id": ... }) cancels, but files already written stay on disk. If an input file changes while queued, the job fails with E_STALE_JOB_INPUT. Handles live in the server process and disappear when it stops.

Keep source and native edits in sync

Every successful generation writes <output>.baseline.json with the source fingerprint, the .rp fingerprint, and the logicalId ↔ record+id map.

sync_prototype mode What it does
status Reports clean, source_ahead, native_ahead, diverged, or untracked
lift Writes native text, renames, geometry, style, added/removed widgets and simple unconditional OnClick back into the source
merge Three-way merge and recompile; conflicting same-property edits return conflict with conflicts[]

Resolve conflicts with prefer: "source" | "native" or per-property resolutions: { "<logicalId>:<prop>": "source" | "native" | { "value": ... } }. Pass includeSpec: true only when you need the full source inlined in the response.

Screenshot to native

{
  "image": "/abs/screenshot-2x.png",
  "output": "/abs/from-image.rp",
  "scale": 2,
  "page": "Home",
  "replace": ["Old text=New text"],
  "version": 11,
  "preview": "/abs/window.png"
}

generate_from_image runs OCR (Apple Vision on macOS; other platforms fall back to geometry-only layering), extracts cards, dividers, icons and media slices into <output>.assets/, and writes a native .rp offline plus a visualDiff summary. Pass baseRp to detect native drift (E_NATIVE_DRIFT_PROTECTED).

Inspect without generating

verify, locate, inspect and read_interactions accept either an active session or path: "/abs/file.rp" for a read-only check that creates no working copies.

read_interactions pages by interaction owner (20 per page, shrinking as the page approaches 20 KB); continue with nextOffset until items: [], returned: 0, nextOffset: null.

GUI roundtrip

gui_roundtrip saves, closes, reopens and optionally previews the file through the native host (PowerShell on Windows, Swift on macOS). Pass preview: true to trigger Axure's own Publish → Preview and receive outputSha256.

Failures

A failed call returns isError: true, status: "failed" and stage, and never writes a half-built file to the requested output path. diagnostics[] entries keep code, message, pointer and add pageId, widgetId or sourceId when the owner is known.