<!-- Canonical HTML: https://docs.didro.ai/sap-ui-automation/agent-setup -->

# Setting up sap-ui-automation (instructions for an AI agent)

You are an AI agent with a terminal (Claude Code, Codex, Cursor, ...). The
user asked you to set up the sap-ui-automation MCP server (npm package
`sap-ui-automation`). Follow these steps in order. Keep the user informed
in one or two lines per step. People: the prompt to paste is in
[Set up with your agent](https://docs.didro.ai/sap-ui-automation/getting-started/setup-prompt).

## Rules

- **Never type an SAP password and never log on to SAP.** The user logs
  on. The server refuses every action on a logon screen.
- Do not edit MCP client config files by hand: `setup` does it and keeps a
  `.bak` of each file it changes.
- Do not change `SAP_WRITE` unless the user asks. The default, `on`, lets
  actions that may write run; `off` refuses them.
- When a step needs the user to click something (SAP GUI options, Chrome,
  SAP Logon), say what to click and wait until they say it is done.

## 1. Check Node.js

Run `node --version`. It must be 22 or later. If Node is missing or older,
tell the user to install the LTS version from https://nodejs.org (or with
their package manager), and wait.

## 2. Run setup

```sh
npx -y sap-ui-automation setup --dry-run
npx -y sap-ui-automation setup
```

Show the user what the dry run would change, then run it for real. Run by
an agent (no terminal to answer in), `setup` asks nothing: it takes every
agent it finds. To limit it, pass `--agent <ids>` (see
[CLI commands](https://docs.didro.ai/sap-ui-automation/reference/cli)). Its "Next" lines say which apps to
restart; pass them on.

If the user works in their everyday Chrome through the SAP UI MCP
extension, run `npx -y sap-ui-automation setup --extension` instead.

## 3. Run doctor

```sh
npx -y sap-ui-automation doctor
```

(Pass `--extension` when checking the Chrome extension route:
`npx -y sap-ui-automation doctor --extension`.)

It prints one block per area, with a line per check (`✓` passed, `✗`
failed, `–` not checked). Then the `Route` block (`Routes` on Windows): how
far each way to SAP got, from `1/4 installed` to `4/4 first screen read`,
with one `→` step under each route before `4/4`. Then the `Writes` block.
Under a `✗`, a `→` line says what to do, except for a check that holds a
route back: its step is that route's `→`, said once. Do the `→` steps,
then run doctor again until its last line starts with `Ready.` That comes
once a route has read an SAP screen, so the user has to be logged on.

| Output | What to do |
| --- | --- |
| `✗ Chrome: Google Chrome was not found on this machine` | Ask the user to install Google Chrome, or set `SAP_CHROME_PATH` to its program file. Nothing has to be switched on in Chrome. |
| `✓ SAP window: not open (...)`, with the route's `→ Run npx -y sap-ui-automation browser` | Run `npx -y sap-ui-automation browser`. A Chrome window opens. Ask the user to open their SAP address there (Web GUI or the Fiori launchpad) and log on, and wait. |
| `✗ Chrome: no Chrome with remote debugging allowed is running` | Only with `SAP_BROWSER=attach`. Ask the user to open `chrome://inspect/#remote-debugging`, tick "Allow remote debugging for this browser instance", then click Allow when Chrome asks. |
| `✗ Chrome extension: no SAP UI MCP extension connected` | Ask the user to install the extension from the [Chrome Web Store](https://chromewebstore.google.com/detail/ui-automation-for-sap/geglpbkaklfpmnbidfcpflegmdkjodkn), then run `npx -y sap-ui-automation setup --extension` and ask them to restart Chrome once. |
| `✗ Chrome extension: the extension is installed but not paired` | Ask the user to click the extension's icon in Chrome's toolbar and Pair (or run `npx -y sap-ui-automation extension pair` and give them the code it prints). |
| `✗ SAP systems: none registered in the extension` | Ask the user to open their SAP system in Chrome, click the extension's icon and "Add This SAP Page". |
| `✗ SAP GUI is running: no` | Ask the user to start SAP Logon and log on to a system. |
| `✗ Scripting is on in SAP GUI: no, it is off` | Ask the user to open SAP Logon > Options > Accessibility & Scripting > Scripting, tick "Enable scripting", and restart SAP Logon. |
| `✗ Scripting is allowed on the SAP system` | The system has profile parameter `sapgui/user_scripting` off. Only the SAP Basis team can set it to `TRUE` (transaction RZ11). Tell the user so, and go on: Web GUI and Fiori, or the network reader, may work without it. |
| `✗ Notice "a script is attaching" is off` (or "opens a connection") | Ask the user to untick "Notify when a script attaches to SAP GUI" and "Notify when a script opens a connection" in the same Scripting options. |
| `✗ PowerShell may run the host` | A Windows policy restricts PowerShell. Only the user's IT team can allow it. Tell the user so, and suggest Web GUI or Fiori in Chrome, which need no PowerShell. |
| `– not checked: it runs only on Windows` | Not an error. SAP GUI for Windows needs Windows; on macOS and Linux use Web GUI or Fiori. |
| A route at `2/4 waiting for sign-in` | Ask the user to log on where its `→` step says (the SAP window, a Chrome tab or SAP Logon), and wait. |
| A route at `3/4 attached` | Do its `→` step: usually the user brings the tab or window to an SAP screen. Then run doctor again. |
| Any other `✗` | Read the `→` line to the user and do what it says. [FAQ and troubleshooting](https://docs.didro.ai/sap-ui-automation/faq) has one entry per check. |

On Windows, doctor checks SAP GUI two ways (scripting and the network
reader). One that works is enough.

## 4. Check in the agent

When doctor says `Ready.`, ask the user to restart the agent apps setup
named and to open an SAP screen. In the new session, call `sap_sessions`
and `sap_look`, and describe the screen in three lines.

## 5. Tell the user how writes work

Report the effective write mode. Under `on`, the default, actions that may
save, post or delete run, and the client's own tool approval of each
`sap_act` call is the only question before them. `SAP_WRITE=off` refuses
them. See [Safety model](https://docs.didro.ai/sap-ui-automation/concepts/safety#approval-in-the-client).
