CLI or MCP?
The agent in your app serves one set of tools. A coding agent reaches them in one of two ways:
- the command line: the agent jar, one shell call per tool;
- MCP: streamable HTTP at
http://127.0.0.1:8765/mcp.
The tools, their arguments and their answers are the same either way.
Use the CLI when your agent has a shell
Section titled “Use the CLI when your agent has a shell”This is the main path for coding agents.
UI="java -jar swing-ui-agent-0.1.0-SNAPSHOT-agent.jar --port 8765"$UI session$UI snapshot '{"window":"main","depth":3,"compact":true}'$UI menu '{"path":["File","New order"]}'- Nothing to set up. No client configuration: the agent runs the jar like any other command.
- Nothing to reconnect. Each call connects, runs one tool and exits. Restart or rebuild the app, and the next call just works.
- Plain answers. One JSON answer on stdout, an error on stderr, and an exit code the agent can branch on:
3means no app with the agent is running. - Files instead of images.
--out orders.png screenshotwrites the PNG to a file, so the agent opens it only when it needs to. - The skills assume it. The three skills show every step as a CLI call.
Recording and recorded tests are tools like the rest: recording (start, stop, list, edit, replay, export, load) and run_recorded_test. From a shell, run_recorded_test exits 4 when the recorded test fails (see Run and edit a recorded test).
Each call starts a small JVM. Driving a whole task is many calls, so use batch when the next steps are already known: several steps, one call.
Use MCP when your agent speaks it
Section titled “Use MCP when your agent speaks it”Point any MCP client that supports streamable HTTP at http://127.0.0.1:8765/mcp. The client lists the tools itself and calls them as tool calls. Setup for a few clients is in MCP clients.
- No shell needed. For agents and chat clients without one.
- Recording and running.
recordingandrun_recorded_testare listed like every other tool; a failed run is a normal answer withpassed: false, not a transport error. - Images inline.
screenshotreturns the PNG as image content. - Instructions on connect. The client receives a short description of how to read and act on the app.
The endpoint is stateless: each request is one JSON-RPC message, answered in the response. There is no MCP session to keep alive.
Both at once
Section titled “Both at once”The CLI, MCP clients and running tests all talk to the same agent, so they can be mixed. One owner acts at a time: while a test run or a script holds the lease, others can still read, but not act.
What's next
Section titled “What's next”- Let your agent drive the app: a worked session on Order Desk.
- Skills: teach your coding agent the workflow.
- Tools: every tool and its arguments.
Apache-2.0 · A Kormcrete project · For coding agents:llms.txt, llms-full.txt