ABAP Lens
by syeldan
README.md
# ABAP Lens
**Give any AI assistant a clear, safe view into your SAP ABAP system.**
ABAP Lens is an [MCP](https://modelcontextprotocol.io) server that lets Claude, Cursor, GitHub Copilot,
Gemini CLI, Codex, opencode and any other MCP client read and check ABAP code: source, DDIC, CDS,
where-used, transports, versions, short dumps, syntax, ATC and ABAP Unit.
It talks to a small REST service inside SAP (ZDEVAPI, included in [`abap/`](abap/)) instead of ADT.
So it does not depend on ADT, does not need ADT authorizations, and is fast:
| Measured on one S/4HANA 1909 production system | ABAP Lens | ADT REST |
|---|---|---|
| Short dumps, last 7 days (924 dumps) | **0.04 s**, 238 KB | 24 s, 15 MB |
| Where-used of a Z table | **0.02 s** | 0.2 s |
| Transport request with 2 objects | 0.01 s, **0.7 KB** | 0.02 s, 27 KB |
| Source of a 4,330-line include | 0.03 s | 0.04 s |
Smaller answers mean fewer tokens and more room in the model's context.
## Why it is safe
- **Read and check only.** There is no operation that writes, activates, locks or transports.
- **SAP authorizations stay in charge.** Every call needs the `ZDEVAPI` authorization object, and then
the standard check for the object (`S_DEVELOP`, `S_TRANSPRT`, ST22). The user never sees more than in SE80/ST22.
- **Opt-in per system.** Each operation must be switched on in `ZDEVAPI_CFG`; one row turns everything off.
- **Logged.** Each call writes one row to `ZDEVAPI_LOG` (user, operation, object, status, duration, never the payload).
- **Read-only mode for production.** `"readOnly": true` hides syntax/ATC/ABAP Unit from the AI completely.
- **HTTPS only, no environment variables.** Credentials live in one config file or come from your password manager.
## Tools
| Tool | What it does |
|---|---|
| `sap_health` | System ID, service version, operations you may use |
| `sap_search_objects` | Find repository objects by name pattern / type / package |
| `sap_read_source` | Active source of programs, includes, classes (by part), interfaces, function modules, CDS |
| `sap_object_structure` | Class includes and methods, function group includes and FMs, program includes |
| `sap_table_definition` | Table / structure fields with includes expanded, keys, technical settings |
| `sap_cds_source` | CDS DDL source, SQL view name, activation state |
| `sap_where_used` | Where-used list from the index |
| `sap_transport_info` | Transport request header, tasks, objects; or open requests for an object |
| `sap_object_versions` | Version history |
| `sap_list_dumps`, `sap_dump_detail` | ST22 short dumps and their details (no variable values) |
| `sap_syntax_check` ¹ | Syntax check, optionally of proposed source without saving it |
| `sap_run_atc` ¹ | ATC check of one object |
| `sap_run_unit_tests` ¹ | ABAP Unit run of one object |
| `sap_object_brief` | One-call overview: package, size, open transports, last changes |
| `sap_impact_check` | Before a change: where-used, open transports, versions, syntax and ATC baseline |
| `sap_foreign_transport_guard` | Stops when another developer has the object in an open request |
| `sap_join_key_check` | Tells whether join fields cover the full key of a table |
| `sap_cds_compat_check` | Flags CDS syntax that your release does not support (rules in a JSON file) |
| `sap_transport_text` ² | Builds / validates a transport description by your team's format |
| `sap_naming_check` ² | Checks a new object name against your package naming rules |
¹ not available when the system is `readOnly`. ² only when you configure team conventions.
Prompts: `analyze-z-report`, `prepare-change`, `review-cds`, `dump-triage`.
## Quick start
**1. SAP side** (once per system): pull [`abap/`](abap/) with abapGit — classes, tables, authorization object
and ICF node come with it — then follow [`abap/INSTALL.md`](abap/INSTALL.md): activate the ICF node, assign the role,
switch operations on.
**2. Config file** `~/.config/abap-lens/config.json` (Windows: `%USERPROFILE%\AppData\Roaming\abap-lens\config.json`):
```json
{
"systems": {
"dev": {
"url": "https://sap-dev.example.com:44300",
"client": "100",
"user": "MY_SAP_USER",
"passwordCommand": ["pass", "show", "sap/dev"],
"caFile": "certs/dev.pem"
},
"prd": {
"url": "https://sap-prd.example.com:44300",
"client": "100",
"user": "MY_SAP_USER",
"passwordCommand": ["pass", "show", "sap/prd"],
"readOnly": true
}
}
}
```
Then `chmod 600 ~/.config/abap-lens/config.json`.
**3. Your AI client** — one entry per system:
```bash
claude mcp add -s user abap-lens-dev -- npx -y abap-lens --system dev
```
Cursor, VS Code, Claude Desktop, Windsurf, Gemini CLI, Codex, opencode: see [docs/clients.md](docs/clients.md).
**4. Check:** ask *"Call sap_health"*.
## Config reference
`systems.<name>`:
| Key | Required | Meaning |
|---|---|---|
| `url` | yes | `https://host:port`, nothing else |
| `client` | yes | SAP client, 3 digits |
| `user` | yes | SAP user |
| `password` / `passwordCommand` | one of them | Plain password, or a command whose first output line is the password, e.g. `["pass","show","sap/dev"]`, `["security","find-generic-password","-s","sap-dev","-w"]` |
| `caFile` | no | PEM of the server certificate / CA (STRUST export). Relative paths are resolved from the config folder |
| `readOnly` | no | `true`: syntax / ATC / ABAP Unit tools are not registered |
| `servicePath` | no | ICF path, default `/sap/bc/zdevapi` |
| `tlsSkipHostnameCheck` | no | Only for SAP default certificates without a SAN; the certificate chain is still verified |
`team` (all optional):
| Key | Meaning |
|---|---|
| `conventions` | Your conventions JSON. Turns on `sap_transport_text` and `sap_naming_check`. Start from [`examples/conventions.example.json`](examples/conventions.example.json) |
| `cdsRules` | Your own CDS rule set. Default: [`rules/cds-753-limits.json`](rules/cds-753-limits.json) (NetWeaver 7.53) |
| `resources` | Extra documents for the AI, e.g. `{"lessons": "docs/abap-lessons.md"}` → resource `abap-lens://team/lessons` |
Command line: `abap-lens --system <name> [--config <file>]`. With only one system configured, `--system` may be left out.
## Development
```bash
npm ci
npm run build
npm test
```
Node.js 20.18 or later. The MCP side is TypeScript (`src/`), the SAP side ABAP (`abap/src`, abapGit format).
## License
MIT, see [LICENSE](LICENSE).
This server cannot be deployed
Maintenance
ActivityMaintained
ResponsivenessNo recent community issues