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

# Docker

The Docker image runs the MCP server on stdio, with a headless Chromium for
SAP GUI for HTML (Web GUI) and SAP Fiori. Your MCP client starts it with
`docker run`, as it starts `npx` otherwise: nothing to install but Docker.
The tools, the screen view and the guard are the same as on your machine.

- **Web GUI and Fiori only.** SAP GUI for Windows is a Windows desktop
  program and cannot run in a container. For it, run the server on Windows
  ([SAP GUI for Windows](https://docs.didro.ai/sap-ui-automation/guides/sap-gui-windows)).
- **You log on yourself**, as everywhere: the server never does. The
  container's Chromium has no window, so you log on through
  `chrome://inspect` in your own Chrome, or the server works in your own
  Chrome instead ([Log on](#log-on)).
- **Image:** `ghcr.io/didroai/sap-ui-mcp`, for `linux/amd64` and
  `linux/arm64`, published with each release as `:<version>` and `:latest`.
  You can also [build it yourself](#build-the-image-yourself).

## Quick start

The image name and the address are all you change. Replace
`https://sap.example.com/...` with your Web GUI or Fiori launchpad address:

```sh
docker run -i --rm --init \
  -p 127.0.0.1:9222:9222 -e SAP_CHROME_INSPECT=0.0.0.0:9222 \
  -e SAP_START_URL=https://sap.example.com/sap/bc/gui/sap/its/webgui \
  ghcr.io/didroai/sap-ui-mcp
```

Your MCP client runs this command; you do not. In a client's JSON config it
is:

```json
{
  "mcpServers": {
    "sap-ui-automation": {
      "command": "docker",
      "args": [
        "run", "-i", "--rm", "--init",
        "-p", "127.0.0.1:9222:9222", "-e", "SAP_CHROME_INSPECT=0.0.0.0:9222",
        "-e", "SAP_START_URL=https://sap.example.com/sap/bc/gui/sap/its/webgui",
        "ghcr.io/didroai/sap-ui-mcp"
      ]
    }
  }
}
```

What each part does:

| Part | Why |
| --- | --- |
| `-i` | the client talks to the server over stdin and stdout |
| `--rm` | the container goes when the agent session ends |
| `--init` | a small init process ends Chromium cleanly with the server (the image has one too) |
| `-p 127.0.0.1:9222:9222` | publishes the logon port on your machine's `127.0.0.1` only. Never leave out `127.0.0.1:` |
| `-e SAP_CHROME_INSPECT=0.0.0.0:9222` | the server serves the SAP window's DevTools on port 9222 of the container, for `chrome://inspect` |
| `-e SAP_START_URL=...` | the address the SAP window opens on |

Then ask your agent to look at your SAP screen. It starts the SAP window
in the container and tells you to log on, as below.

## Client configs

Each client below gets the same `docker run` arguments. The snippets use
the [quick start](#quick-start) arguments; add `-e SAP_WRITE=off` before the
image name for [read-only work](#writes-off).

### Claude Code

```sh
claude mcp add sap-ui-automation --scope user -- docker run -i --rm --init \
  -p 127.0.0.1:9222:9222 -e SAP_CHROME_INSPECT=0.0.0.0:9222 \
  -e SAP_START_URL=https://sap.example.com/sap/bc/gui/sap/its/webgui \
  ghcr.io/didroai/sap-ui-mcp
```

### Claude Desktop

In `claude_desktop_config.json` (Settings, Developer, Edit Config), the JSON
block of the [quick start](#quick-start). Restart Claude Desktop.

### Cursor

In `~/.cursor/mcp.json` (all projects) or `.cursor/mcp.json` (one project),
the JSON block of the [quick start](#quick-start).

### Codex

```sh
codex mcp add sap-ui-automation -- docker run -i --rm --init \
  -p 127.0.0.1:9222:9222 -e SAP_CHROME_INSPECT=0.0.0.0:9222 \
  -e SAP_START_URL=https://sap.example.com/sap/bc/gui/sap/its/webgui \
  ghcr.io/didroai/sap-ui-mcp
```

Or in `~/.codex/config.toml`:

```toml
[mcp_servers.sap-ui-automation]
command = "docker"
args = ["run", "-i", "--rm", "--init",
  "-p", "127.0.0.1:9222:9222", "-e", "SAP_CHROME_INSPECT=0.0.0.0:9222",
  "-e", "SAP_START_URL=https://sap.example.com/sap/bc/gui/sap/its/webgui",
  "ghcr.io/didroai/sap-ui-mcp"]
```

### VS Code (GitHub Copilot)

```sh
code --add-mcp '{"name":"sap-ui-automation","type":"stdio","command":"docker","args":["run","-i","--rm","--init","-p","127.0.0.1:9222:9222","-e","SAP_CHROME_INSPECT=0.0.0.0:9222","-e","SAP_START_URL=https://sap.example.com/sap/bc/gui/sap/its/webgui","ghcr.io/didroai/sap-ui-mcp"]}'
```

Or add the same `docker` entry to `~/.copilot/mcp-config.json` under
`"mcpServers"` (recommended for new setups) or `.vscode/mcp.json` under
`"servers"`, with `"type": "stdio"`.

### Two agents at once

Only one container can publish host port 9222. Give the second one another
host port, for example `-p 127.0.0.1:9223:9222`, and add `localhost:9223`
in `chrome://inspect` (Configure...). Or let both use one container that
keeps the SAP window ([below](#keep-the-logon-between-agent-sessions)).

## Log on

The server never logs on and never sees a password. You log on in the
browser the server works in. There are two ways.

| | In the container's window, through `chrome://inspect` | In your own Chrome, over CDP |
| --- | --- | --- |
| What you need | Chrome on your machine | Chrome started with a debugging port; on Linux, `--network host` |
| Where SAP runs | in the container | in your Chrome, which you see |
| Single sign-on of your desktop | no: you type user and password | yes |
| What the server can reach | only the container's window | every tab of that Chrome profile |
| The logon lasts | as long as the container (see below) | as long as your Chrome window |

### In the container's window, through `chrome://inspect`

This is the [quick start](#quick-start) setup: `SAP_CHROME_INSPECT` and
the published port.

1. Ask your agent to look at your SAP screen. The server starts the SAP
   window in the container, on `SAP_START_URL`, and the agent tells you
   that SAP shows its logon page.
2. In your own Chrome, open `chrome://inspect/#devices`. **Discover network
   targets** is ticked and lists `localhost:9222` by default; for another
   port, add it with **Configure...**.
3. Under **Remote Target**, the SAP page of the container appears. Click
   **inspect**. DevTools opens with the page beside it: click into the page
   and log on as usual. If the DevTools window stays empty, use **inspect
   fallback**.
4. Close DevTools and tell the agent to go on. The logon stays in the
   container's window.

The window opens on `SAP_START_URL`, later on the last SAP address it
showed. To go to another address, type `location.href =
"https://sap.example.com/sap/bc/ui2/flp"` in the **Console** of that
DevTools window.

`SAP_CHROME_INSPECT` relays the window's DevTools only while the server
runs. Chrome itself listens on the container's `127.0.0.1`; the relay is
what makes the port reachable through `-p`. Anything that can reach your
machine's `127.0.0.1:9222` controls the SAP window, your logon included, as
with any DevTools port on your machine. On Docker Desktop that includes
other containers, through `host.docker.internal`. So:

- publish it on `127.0.0.1` only, as above, and only while you need it;
- another container on the same Docker network cannot connect to the
  container's port directly, but that is no boundary: see the line above;
- on Linux, use Docker Engine 28 or later. Older versions let other
  machines reach container addresses directly, over a route to the bridge;
- **never combine a non-loopback `SAP_CHROME_INSPECT` with `--network
  host`** (or another network that puts the container on your machine's or
  your LAN's network). There the port would be open on every interface and
  `-p` does nothing. The server refuses it, and says so in `doctor` and in
  the agent's answers. With `--network host`, `SAP_CHROME_INSPECT=9222`
  listens on your machine's own `127.0.0.1`, which is what you want there;
- outside a container, the server listens on `127.0.0.1` only, whatever
  `SAP_CHROME_INSPECT` says.

### In your own Chrome, over CDP

The server works in a Chrome on your machine, in which you log on as usual.
Chrome must listen for DevTools, and since Chrome 136 only with a profile
folder of its own:

```sh
# macOS
"/Applications/Google Chrome.app/Contents/MacOS/Google Chrome" \
  --remote-debugging-port=9333 --user-data-dir="$HOME/chrome-sap"
# Linux
google-chrome --remote-debugging-port=9333 --user-data-dir="$HOME/chrome-sap"
```

Windows: `"C:\Program Files\Google\Chrome\Application\chrome.exe"
--remote-debugging-port=9333 --user-data-dir=%USERPROFILE%\chrome-sap`.

Log on to SAP in that window. Then give the container its address. Chrome
listens on `127.0.0.1` only, so how the container reaches it depends on
Docker:

| Docker | Arguments |
| --- | --- |
| Docker Desktop (macOS, Windows) | `-e SAP_CHROME_CDP=http://host.docker.internal:9333` |
| Linux (Docker Engine) | `--network host -e SAP_CHROME_CDP=http://127.0.0.1:9333` |

```json
{
  "mcpServers": {
    "sap-ui-automation": {
      "command": "docker",
      "args": ["run", "-i", "--rm", "--init", "-e", "SAP_CHROME_CDP=http://host.docker.internal:9333", "ghcr.io/didroai/sap-ui-mcp"]
    }
  }
}
```

- Chrome answers its DevTools port only when asked by IP address or as
  `localhost`. The server looks up a name such as `host.docker.internal`
  and asks Chrome at the address, so this works as written.
- On Linux, `--add-host=host.docker.internal:host-gateway` does not help:
  that address is the Docker bridge, and Chrome does not listen there.
  `--network host` puts the container on your machine's `127.0.0.1`. Do not
  bind Chrome to another address to work around it.
- With `--network host`, never set `SAP_CHROME_INSPECT` to `0.0.0.0` or
  another non-loopback address: the container shares your machine's
  network, so the port would be open to it. The server refuses it.
- The server sees every tab of that Chrome profile and reads the ones it
  recognises as SAP: keep the profile for SAP, and consider
  `SAP_ALLOW_ORIGINS` ([What remote debugging gives away](https://docs.didro.ai/sap-ui-automation/guides/chrome#what-remote-debugging-gives-away)).
- `SAP_CHROME_INSPECT` and the published port are not needed here.

### Keep the logon between agent sessions

With `docker run --rm` per agent session, each session starts a new
container and a new SAP window: you log on again. To log on once, keep one
container with the SAP window running, and let each agent session start
the server in it with `docker exec`:

```sh
docker run -d --name sap-ui --init \
  -p 127.0.0.1:9222:9222 -e SAP_CHROME_INSPECT=0.0.0.0:9222 \
  -e SAP_START_URL=https://sap.example.com/sap/bc/gui/sap/its/webgui \
  ghcr.io/didroai/sap-ui-mcp browser --wait
```

Log on through `chrome://inspect` as above, at any time. The client's
config then runs:

```json
{
  "mcpServers": {
    "sap-ui-automation": { "command": "docker", "args": ["exec", "-i", "sap-ui", "sap-ui-automation"] }
  }
}
```

The logon lasts until SAP ends the session (its own timeout) or the
container stops (`docker stop sap-ui`). Several agents can use the
container at once, in separate SAP sessions. Settings for one client go on
`docker exec`, before the container name: `"exec", "-i", "-e",
"SAP_WRITE=off", "sap-ui", "sap-ui-automation"`.

### A profile that outlives the container

A named volume keeps the SAP window's profile from one container to the
next:

```sh
-v sap-ui-profile:/home/node/.local/share/sap-ui-automation
```

It keeps the last SAP address the window showed (the next window opens on
it) and the cookies the sites set as lasting. It does not keep a standard
SAP logon: SAP's logon cookies (`SAP_SESSIONID_<SID>_<client>`,
`MYSAPSSO2`) are session cookies, which end with the browser, so the next
container shows the logon page again. A single sign-on that remembers you
(an identity provider's cookie) may log you on by itself. One container
at a time per volume. The volume holds those cookies: see
[Security](https://docs.didro.ai/sap-ui-automation/security#what-is-stored-on-disk).

### Why no noVNC

A noVNC view (a virtual screen in the container, shown in a browser tab)
would show the whole window, address bar included. It needs a virtual X
server, a VNC server and noVNC in the image (more than 100 MB), a headed
Chromium, and a second port with a password of its own. `chrome://inspect`
needs nothing but the Chrome you have, and the port it uses is the one the
server needs anyway. It is not offered for now.

## Writes off

`SAP_WRITE` works as on your machine: writes run (`on`, the default) or are
refused (`off`). The image does not set it. For read-only work:

```sh
docker run -i --rm --init -e SAP_WRITE=off ... ghcr.io/didroai/sap-ui-mcp
```

Every other setting of [Configuration](https://docs.didro.ai/sap-ui-automation/reference/configuration) is
passed the same way, with `-e`: `SAP_ALLOW_SYSTEMS`, `SAP_ALLOW_TCODES`,
`SAP_BLOCK_TCODES`, `SAP_ALLOW_ORIGINS` and the rest. The image sets
`SAP_SURFACES=webgui,fiori` and `SAP_CHROME_HEADLESS=on`.

## Files and volumes

The server runs as user `node` (uid 1000) in `/home/node`. What it writes
there goes with the container unless you mount a folder:

| What | In the container | Mount, for example |
| --- | --- | --- |
| Recordings and saved tests (`SAP_RECORD_DIR`) | `/home/node/sap-tests` | `-v "$PWD/sap-tests:/home/node/sap-tests"` |
| Web GUI downloads (`SAP_DOWNLOAD_DIR`) | `/home/node/sap-downloads` | `-v "$PWD/sap-downloads:/home/node/sap-downloads"` |
| The SAP window's profile | `/home/node/.local/share/sap-ui-automation` | `-v sap-ui-profile:/home/node/.local/share/sap-ui-automation` |

A folder you mount must be writable by uid 1000.

`doctor` and the other commands run in the image too:

```sh
docker run --rm -e SAP_CHROME_INSPECT=0.0.0.0:9222 ghcr.io/didroai/sap-ui-mcp doctor
```

## Security

- The server and Chromium run as the non-root user `node`, which has no
  effective capabilities. Docker's default capability set still bounds the
  container, and the Debian base image has setuid programs (`su`, `mount`,
  `passwd`). Unless no-new-privileges is set, a process that takes over the
  container could try them.
- Chromium runs without its own sandbox (`--no-sandbox`): the sandbox
  needs user namespaces, which Docker's default seccomp profile does not
  allow, and Chromium does not start with it on. A page that took over
  Chromium's renderer runs as the same user as the server: it could read
  the window's profile (your SAP session) and the server's settings. The
  container is the boundary. `--security-opt seccomp=unconfined` would let
  the sandbox work, but drops Docker's system call filter for the whole
  container.
- For a tighter container, add `--cap-drop=ALL
  --security-opt=no-new-privileges` before the image name. The image works
  with both (the CI smoke test runs it so):

  ```sh
  docker run -i --rm --init --cap-drop=ALL --security-opt=no-new-privileges \
    -p 127.0.0.1:9222:9222 -e SAP_CHROME_INSPECT=0.0.0.0:9222 \
    ghcr.io/didroai/sap-ui-mcp
  ```

- The DevTools port is published on `127.0.0.1` only in these examples.
  Anything that reaches your machine's `127.0.0.1` reaches it, other
  containers on Docker Desktop included
  ([above](#in-the-container-s-window-through-chrome-inspect)).
- Pin a version (`ghcr.io/didroai/sap-ui-mcp:<version>`, or its digest) for
  production systems, so that the code that runs is the code you reviewed.

More in [Security and data handling](https://docs.didro.ai/sap-ui-automation/security).

## Build the image yourself

From a clone of the repository:

```sh
git clone https://github.com/DidroAI/sap-ui-mcp.git
cd sap-ui-mcp
docker build -t sap-ui-mcp .
```

Then use `sap-ui-mcp` instead of `ghcr.io/didroai/sap-ui-mcp` in the
commands above. The build compiles the package from the source, takes
Chromium from the `playwright-core` version in `bun.lock`, and uses base
images pinned by digest.

## Limits

- **stdio only.** The client starts the container. A server that clients
  reach over HTTP (Playwright MCP's `--port`) is not available yet.
- **Not in the image:** SAP GUI for Windows, and the Chrome extension
  (`SAP_BROWSER=extension`), which pairs with a Chrome on your machine.
- **Headless Chromium.** Screenshots and downloads work; a SAP page that
  opens a file in another program does not.
- **A network of its own.** `SAP_CHROME_INSPECT` on a non-loopback address
  needs the container's own network namespace, with a veth link (Docker's
  bridge networks). It is refused with `--network host`, and also in
  rootless Podman, whose pasta or slirp4netns network is a tap device. There,
  use the [CDP way](#in-your-own-chrome-over-cdp) instead.
