--- name: live-edit-with-studio-pro description: "Change the model through mxcli while Studio Pro has the project open, with edits appearing live over MCP. Use when Claude Code and Studio Pro run on the same machine and a save-and-reopen cycle is unwanted." --- # Live-Editing an Open Studio Pro Project with mxcli (MCP) Use mxcli to change the model **while Studio Pro has the project open**, with edits appearing live in Studio Pro — no save-and-reopen cycle. This is the workflow when Claude Code runs on the same machine as Studio Pro (e.g. an in-IDE terminal). ## When to use this skill - Studio Pro is open on the project and you want mxcli changes to show up live. - mxcli and Studio Pro run on the **same machine** (same `localhost`). If Studio Pro is **not** open, use the normal file-based flow instead (`mxcli -p app.mpr -c "..."` with no `--mcp`), which edits the `.mpr` on disk. ## How it works (hybrid: local reads, live writes) - **Reads** come from the local `.mpr` you pass with `-p`. - **Writes** go to Studio Pro's live, in-memory model via its built-in MCP server. - Therefore **`-p` MUST be the exact project Studio Pro currently has open**, or reads and writes will describe different projects. ## Connect Studio Pro's MCP server listens on `localhost:7782` and requires the HTTP `Host` header to be `localhost` (a DNS-rebinding guard). Same-machine, **no port-forwarding/socat is needed**: ```bash mxcli --mcp http://localhost/mcp --mcp-dial localhost:7782 \ -p /path/to/app.mpr \ -c "create entity MyModule.Customer" ``` `--mcp-dial localhost:7782` keeps the `Host` header `localhost` while dialing the port. (Plain `--mcp http://localhost:7782/mcp` may also work if your Studio Pro accepts a port-suffixed `Host` — try it; fall back to the `--mcp-dial` form if it is rejected.) Run a script the same way: `mxcli --mcp http://localhost/mcp --mcp-dial localhost:7782 -p app.mpr exec changes.mdl`. ## What you can change via MCP — check first **What's authorable over MCP depends on the Studio Pro version *and on this session*.** The capability surface changes per release, but it also depends on your Studio Pro preferences (some tools are togglable) and on which MCP servers you have connected to Studio Pro. So the answer is not derivable from a version number — ask the connected server, every session, before generating MDL: ```bash mxcli mcp capabilities -p /path/to/app.mpr --mcp http://localhost/mcp --mcp-dial localhost:7782 ``` It prints, for *this session*: what's authorable (modules, entities + ALTER, associations, enumerations, constants, microflows, pages + ALTER PAGE, workflows, navigation, entity access rules, documents into folders), what's **not** (e.g. nanoflows, Java actions, business-event services, view entities, security roles, MOVE/re-parent, attribute type change), and the live tool list. Treat anything reported as not authorable as off-limits over MCP — do it in Studio Pro or against the on-disk `.mpr` instead. A feature can also be reported unavailable because **this session** lacks a tool it needs, or because the tool probe did not answer; the report says which, and mxcli fails closed rather than assuming a tool is there. Quote the whole report in a bug report — a Studio Pro version number alone does not identify the surface you had. New modules and their dependents resolve within the same run, so `create module X; create enumeration X.Status (...)` works in one script. Place a document in a folder at create time (`create microflow X.MF folder 'A/B'`), since MOVE can't re-parent over MCP. ## Two MCP servers — use the built-in one by default The machine may run two MCP servers: - **Studio Pro built-in (port 7782 by default)** — model authoring. **Use this by default.** From **11.13** Studio Pro **auto-selects a free port** when 7782 is taken, so multiple instances can run side by side. The active port is shown in Studio Pro's **status bar** (and set under Preferences > AI > MCP Server) — read it there rather than assuming 7782, and pass it to `--mcp-dial`. - **Concord (port 7783)** — a temporary gap-filler with operational/refactor tools (`delete_document`, `save_all`, `run_app`, `check_model`). **Only** reach for Concord when the built-in server lacks the capability you need. ## Caveats - **Writes are unsaved.** They land in Studio Pro's in-memory model (shown as unsaved). Save in Studio Pro to persist to disk. - **No DROP of standalone documents** (enumeration / microflow / page) through the built-in server — it has no delete tool. Remove them in Studio Pro (or via Concord's `delete_document`). - **`-p` must match the open project.** A mismatched `-p` silently reads the wrong model. ## Verify your change Read it back through the same connection (in-session edits are visible), or look in Studio Pro: ```bash mxcli --mcp http://localhost/mcp --mcp-dial localhost:7782 -p app.mpr -c "list entities in MyModule" ```