Skip to main content
Glama
README.md
# abap-rap-mcp — End-to-End ABAP Cloud & RAP MCP Server

**`abap-rap-mcp`** is a Model Context Protocol (MCP) server for **SAP S/4HANA Cloud Public Edition**, **SAP BTP ABAP Environment**, and **On-Premise ABAP** systems via the ABAP Development Tools (ADT) REST API.

Built upon the enterprise-grade foundation of [arc-mcp/arc-1](https://github.com/arc-mcp/arc-1), **`abap-rap-mcp`** extends the standard 12 intent-based ADT tools with **end-to-end ABAP Cloud & RAP lifecycle capabilities** — covering Fiori/UI5 BSP deployment, S/4HANA Public Cloud IAM (`SIA1`/`SIA6`/`SIA7`) authoring and local publishing, Cloud Communication Management (`SCO1`/`SCO2`/`SCO3`), Inbound HTTP Services (`HTTP` / `UCON`), ABAP Cloud Form Objects (`SFPF` / `SFPF/5F`) with RAP Service Definition binding and `.xdp`/`.xsd` actions, Number Ranges (`NROB`), `smbc` business configuration generation, and automatic foreground Browser SSO.

---

## Key ABAP Cloud & RAP Highlights

- **End-to-End RAP & DDIC Authoring** — Create, read, update, and activate Tables (`TABL`), Data Elements (`DTEL`), Domains (`DOMA`), CDS View Entities (`DDLS`), Access Controls (`DCLS`), Metadata Extensions (`DDLX`), Behavior Definitions (`BDEF`), Behavior Pools (`CLAS` with method-level surgery), Service Definitions (`SRVD`), and Service Bindings (`SRVB` + OData V2/V4 publish/unpublish).
- **Zero-Dependency UI5 / Fiori Deployment (`BSP_DEPLOY`)** — Packages a local `dist/` or `webapp/` directory into an in-memory PKZIP archive and deploys directly to `/sap/opu/odata/UI5/ABAP_REPOSITORY_SRV` (`create`, `update`, `delete`, and `testMode`).
- **S/4HANA Public Cloud IAM (`SIA1`, `SIA6`, `SIA7` + Publish Locally)** — Create and update IAM Apps (`SIA6` `EXT`/`MBC`, bind OData Service Bindings or `ui5AppId`), Business Catalogs (`SIA1`), and Catalog App Assignments (`SIA7`) in transportable customer packages (`Z*`, `/NS/*`), with one-step local publishing.
- **Cloud Communication & HTTP Integration (`SCO1`, `SCO2`, `SCO3`, `HTTP`)** — Full CRUD for Communication Scenarios (`SCO1` + local `$publish`), Inbound Services (`SCO2`), Outbound Services (`SCO3`), and `IF_HTTP_SERVICE_EXTENSION` Inbound HTTP Services (`HTTP` + `/publish`).
- **ABAP Cloud Form Objects (`SFPF` / `SFPF/5F`)** — Create and update cloud Adobe Form Objects, bind RAP Service Definitions (`SRVD`) via `generalInformation.dataprovider`, upload/download `.xdp` layouts, and download `.xsd` data schemas for Adobe LiveCycle Designer.
- **Number Ranges (`NROB`) & Table Maintenance Generator (`smbc`)** — Read/write AFF Number Range Objects (`NROB/NRO`) and generate Custom Business Configuration (`SMBC`) stacks alongside `ui-service` and `webapi-service` RAP generators.
- **Automatic Foreground Browser SSO (`SAP_AUTO_SSO=true`)** — Automatically opens a foreground Chrome/Edge SSO window when cookies expire (`401` or SAML HTML challenge), captures fresh `MYSAPSSO2` / `SAP_SESSIONID*` cookies via CDP into a persistent per-host profile, closes the window, and transparently retries the in-flight ADT request.

---

## Security & Safe Defaults

- **Safe by default** — Read-only out of the box; mutations, transport writes, Git writes, table previews, and freestyle SQL are disabled until explicitly enabled via `SAP_ALLOW_*` flags.
- **Fail-closed package allowlists** — `SAP_ALLOWED_PACKAGES` (defaults to `$TMP`) restricts every write, delete, publish, and activation against the object's verified SAP package.
- **Action deny list** — Block specific tool actions globally with `SAP_DENY_ACTIONS` (e.g., `SAPWrite.delete`).
- **Token-efficient 12-tool design** — Exposes 12 intent-driven tools (`SAPRead`, `SAPSearch`, `SAPWrite`, `SAPActivate`, `SAPNavigate`, `SAPQuery`, `SAPTransport`, `SAPGit`, `SAPContext`, `SAPLint`, `SAPDiagnose`, `SAPManage`) instead of 200+ endpoint wrappers, plus a 1-tool `hyperfocused` mode.

---

## Quick Start

### 1. Build Locally

```bash
npm ci --ignore-scripts
npm run build
```

### 2. Configure Your MCP Client (`mcp_config.json`)

Example local configuration for an SAP S/4HANA Cloud Public Edition system with automatic Browser SSO:

```json
{
  "mcpServers": {
    "abap-rap-mcp": {
      "command": "node",
      "args": ["/absolute/path/to/abap-rap-mcp/dist/index.js"],
      "env": {
        "SAP_URL": "https://my123456.s4hana.cloud.sap",
        "SAP_CLIENT": "080",
        "SAP_COOKIE_FILE": "/path/to/.arc-1/cookies-dev.txt",
        "SAP_AUTO_SSO": "true",
        "SAP_ALLOW_WRITES": "true",
        "SAP_ALLOW_TRANSPORT_WRITES": "true",
        "SAP_ALLOWED_PACKAGES": "Z*,/YOURNS/*",
        "SAP_ALLOW_DATA_PREVIEW": "true",
        "SAP_ALLOW_FREE_SQL": "false"
      }
    }
  }
}
```

---

## Usage Examples for Cloud Extensions

### Deploy a Fiori / SAPUI5 Application (`BSP_DEPLOY`)
```json
{
  "action": "create",
  "type": "BSP_DEPLOY",
  "name": "ZMY_FIORI_APP",
  "package": "ZMY_PKG",
  "transport": "DEVK900123",
  "source": "{\"sourceDir\":\"C:/projects/my-fiori-app/dist\"}"
}
```

### Create IAM App + Business Catalog + Assignment & Publish (`SIA6`, `SIA1`, `SIA7`)
```json
{
  "action": "create",
  "type": "SIA6",
  "name": "ZMY_APP_EXT",
  "package": "ZMY_PKG",
  "transport": "DEVK900123",
  "source": "{\"appType\":\"EXT\",\"serviceBinding\":\"ZUI_MY_APP_O4\",\"ui5AppId\":\"ZMY_FIORI_APP\",\"publish\":true}"
}
```

### Create ABAP Cloud Form Object + Bind `SRVD` + Upload `.xdp` Layout (`SFPF`)
```json
{
  "action": "create",
  "type": "SFPF",
  "name": "ZMY_INVOICE_FORM",
  "package": "ZMY_PKG",
  "transport": "DEVK900123",
  "serviceDefinition": "ZUI_INVOICE_FORM_SRVD",
  "source": "{\"layoutPath\":\"C:/forms/invoice.xdp\",\"fontEmbed\":true,\"reduceDataVolume\":true}",
  "activate": true
}
```
- Download `.xdp` layout: `SAPRead(type="SFPF", name="ZMY_INVOICE_FORM", include="layout")`
- Download `.xsd` schema: `SAPRead(type="SFPF", name="ZMY_INVOICE_FORM", include="xsd")`

### Create Outbound Service & Communication Scenario (`SCO3`, `SCO1`)
```json
{
  "action": "create",
  "type": "SCO3",
  "name": "ZOB_EXTERNAL_REST",
  "package": "ZMY_PKG",
  "transport": "DEVK900123",
  "source": "{\"type\":\"REST\",\"urlPath\":\"/api/v1/orders\"}"
}
```
```json
{
  "action": "create",
  "type": "SCO1",
  "name": "ZCS_EXTERNAL_INTEGRATION",
  "package": "ZMY_PKG",
  "transport": "DEVK900123",
  "source": "{\"outboundServices\":[{\"obsID\":\"ZOB_EXTERNAL_REST\",\"obsType\":\"REST\"}],\"publish\":true}"
}
```

---

## Development

```bash
npm ci --ignore-scripts
npm run build
npm test
```

See [docs/dev-guide.md](docs/dev-guide.md), [skills/README.md](skills/README.md), and `.env.example` for detailed developer, skill, and configuration references.

---

## Credits & Attribution

`abap-rap-mcp` is built upon and extends **[arc-mcp/arc-1](https://github.com/arc-mcp/arc-1)** under the MIT License:

| Project | Author | Contribution |
|---------|--------|--------------|
| [arc-mcp/arc-1](https://github.com/arc-mcp/arc-1) | Marian Zeis | Core 12-tool ADT MCP architecture, safety ceiling, caching, and BTP support |
| [vibing-steampunk](https://github.com/oisee/vibing-steampunk) | Alice Vinogradova (oisee) & contributors | Original MCP server inspiration |
| [abap-adt-api](https://github.com/marcellourbani/abap-adt-api) | Marcello Urbani | TypeScript ADT API reference |
| [mcp-abap-adt](https://github.com/mario-andreschak/mcp-abap-adt) | Mario Andreschak | Early MCP server for ABAP ADT |
| [abaplint](https://github.com/abaplint/abaplint) | Lars Hvam | ABAP parser and linter (`@abaplint/core`) |

---

## Trademark Disclaimer & License

SAP, SAP S/4HANA, ABAP, SAP BTP, and SAP Fiori are trademarks or registered trademarks of SAP SE or an SAP affiliate company in Germany and other countries. This project is an independent open-source project and is not affiliated with, sponsored by, or endorsed by SAP SE.

Licensed under the [MIT License](LICENSE).