@linkup-ai/abap-ai 2.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (114) hide show
  1. package/README.md +384 -0
  2. package/dist/adt-client.js +364 -0
  3. package/dist/cli/activate.js +113 -0
  4. package/dist/cli/init.js +333 -0
  5. package/dist/cli/remove.js +80 -0
  6. package/dist/cli/status.js +229 -0
  7. package/dist/cli/systems.js +68 -0
  8. package/dist/cli.js +81 -0
  9. package/dist/index.js +1318 -0
  10. package/dist/knowledge/abap/abap-dictionary.md +199 -0
  11. package/dist/knowledge/abap/abap-sql.md +296 -0
  12. package/dist/knowledge/abap/amdp.md +273 -0
  13. package/dist/knowledge/abap/clean-code.md +293 -0
  14. package/dist/knowledge/abap/cloud-background-processing.md +250 -0
  15. package/dist/knowledge/abap/cloud-communication.md +265 -0
  16. package/dist/knowledge/abap/cloud-development.md +176 -0
  17. package/dist/knowledge/abap/cloud-extensibility.md +252 -0
  18. package/dist/knowledge/abap/cloud-released-apis.md +261 -0
  19. package/dist/knowledge/abap/constructor-expressions.md +289 -0
  20. package/dist/knowledge/abap/enhancements.md +232 -0
  21. package/dist/knowledge/abap/exceptions.md +271 -0
  22. package/dist/knowledge/abap/internal-tables.md +205 -0
  23. package/dist/knowledge/abap/object-orientation.md +298 -0
  24. package/dist/knowledge/abap/performance.md +216 -0
  25. package/dist/knowledge/abap/rap-abstract-entities.md +206 -0
  26. package/dist/knowledge/abap/rap-business-events.md +216 -0
  27. package/dist/knowledge/abap/rap-draft.md +191 -0
  28. package/dist/knowledge/abap/rap-eml.md +453 -0
  29. package/dist/knowledge/abap/rap-end-to-end.md +486 -0
  30. package/dist/knowledge/abap/rap-feature-control.md +185 -0
  31. package/dist/knowledge/abap/rap-numbering.md +280 -0
  32. package/dist/knowledge/abap/rap-service-exposure.md +163 -0
  33. package/dist/knowledge/abap/rap-unmanaged.md +468 -0
  34. package/dist/knowledge/abap/string-processing.md +180 -0
  35. package/dist/knowledge/abap/unit-testing.md +303 -0
  36. package/dist/knowledge/abap-cds/access-control.md +241 -0
  37. package/dist/knowledge/abap-cds/annotations.md +331 -0
  38. package/dist/knowledge/abap-cds/associations.md +254 -0
  39. package/dist/knowledge/abap-cds/expressions.md +230 -0
  40. package/dist/knowledge/abap-cds/functions.md +245 -0
  41. package/dist/knowledge/abap-cds/metadata-extensions.md +294 -0
  42. package/dist/knowledge/cap/authentication.md +278 -0
  43. package/dist/knowledge/cap/cdl-syntax.md +247 -0
  44. package/dist/knowledge/cap/cql-queries.md +266 -0
  45. package/dist/knowledge/cap/deployment.md +343 -0
  46. package/dist/knowledge/cap/event-handlers.md +287 -0
  47. package/dist/knowledge/cap/fiori-integration.md +303 -0
  48. package/dist/knowledge/cap/service-definitions.md +287 -0
  49. package/dist/knowledge/fiori/annotations.md +347 -0
  50. package/dist/knowledge/fiori/deployment.md +340 -0
  51. package/dist/knowledge/fiori/fiori-elements.md +332 -0
  52. package/dist/knowledge/fiori/fiori-side-effects.md +107 -0
  53. package/dist/knowledge/fiori/fiori-valuelist.md +144 -0
  54. package/dist/knowledge/fiori/ui5-controllers.md +358 -0
  55. package/dist/knowledge/fiori/ui5-data-binding.md +311 -0
  56. package/dist/knowledge/fiori/ui5-fragments-dialogs.md +330 -0
  57. package/dist/knowledge/fiori/ui5-manifest.md +411 -0
  58. package/dist/knowledge/fiori/ui5-routing.md +303 -0
  59. package/dist/knowledge/fiori/ui5-xml-views.md +294 -0
  60. package/dist/logger.js +114 -0
  61. package/dist/system-profile.js +207 -0
  62. package/dist/tools/abap-doc.js +72 -0
  63. package/dist/tools/abapgit.js +161 -0
  64. package/dist/tools/activate.js +68 -0
  65. package/dist/tools/atc-check.js +117 -0
  66. package/dist/tools/auth-object.js +56 -0
  67. package/dist/tools/breakpoints.js +76 -0
  68. package/dist/tools/call-hierarchy.js +84 -0
  69. package/dist/tools/cds-annotations.js +98 -0
  70. package/dist/tools/cds-dependencies.js +65 -0
  71. package/dist/tools/check.js +47 -0
  72. package/dist/tools/code-completion.js +70 -0
  73. package/dist/tools/code-coverage.js +111 -0
  74. package/dist/tools/create-amdp.js +111 -0
  75. package/dist/tools/create-dcl.js +81 -0
  76. package/dist/tools/create-transport.js +38 -0
  77. package/dist/tools/create.js +285 -0
  78. package/dist/tools/data-preview.js +37 -0
  79. package/dist/tools/delete.js +45 -0
  80. package/dist/tools/deploy-bsp.js +298 -0
  81. package/dist/tools/discovery.js +59 -0
  82. package/dist/tools/element-info.js +93 -0
  83. package/dist/tools/enhancements.js +186 -0
  84. package/dist/tools/extract-method.js +44 -0
  85. package/dist/tools/function-group.js +59 -0
  86. package/dist/tools/knowledge.js +275 -0
  87. package/dist/tools/lock-object.js +75 -0
  88. package/dist/tools/message-class.js +67 -0
  89. package/dist/tools/navigate.js +80 -0
  90. package/dist/tools/number-range.js +57 -0
  91. package/dist/tools/object-documentation.js +43 -0
  92. package/dist/tools/object-structure.js +78 -0
  93. package/dist/tools/object-versions.js +57 -0
  94. package/dist/tools/package-contents.js +60 -0
  95. package/dist/tools/pretty-printer.js +35 -0
  96. package/dist/tools/publish-binding.js +49 -0
  97. package/dist/tools/quick-fix.js +69 -0
  98. package/dist/tools/read.js +167 -0
  99. package/dist/tools/refactor-rename.js +60 -0
  100. package/dist/tools/release-transport.js +24 -0
  101. package/dist/tools/released-apis.js +51 -0
  102. package/dist/tools/repository-tree.js +90 -0
  103. package/dist/tools/scaffold-rap.js +642 -0
  104. package/dist/tools/search.js +73 -0
  105. package/dist/tools/shared/data-format.js +101 -0
  106. package/dist/tools/sql-console.js +17 -0
  107. package/dist/tools/system-info.js +270 -0
  108. package/dist/tools/traces.js +66 -0
  109. package/dist/tools/transport-contents.js +83 -0
  110. package/dist/tools/transports.js +67 -0
  111. package/dist/tools/unit-test.js +135 -0
  112. package/dist/tools/where-used.js +59 -0
  113. package/dist/tools/write.js +101 -0
  114. package/package.json +49 -0
package/README.md ADDED
@@ -0,0 +1,384 @@
1
+ # abap-mcp-server
2
+
3
+ MCP (Model Context Protocol) Server that connects [Claude Code](https://claude.ai/code) to any SAP S/4HANA system via the ABAP Development Tools (ADT) REST API.
4
+
5
+ Once configured, Claude can read, write, create, activate, search, refactor, test and deploy ABAP objects — including RAP/Fiori stacks — directly from your editor without any manual SAP GUI interaction.
6
+
7
+ **55 tools** covering the full ABAP development lifecycle, powered by a **curated knowledge base** with 49 reference guides on ABAP, CDS, RAP, Fiori and CAP.
8
+
9
+ ---
10
+
11
+ ## Tools
12
+
13
+ ### Core ABAP Operations
14
+
15
+ | Tool | Description |
16
+ |------|-------------|
17
+ | `abap_read` | Read source code of any ABAP object (supports class includes). For tables and structures, returns field list with types and descriptions |
18
+ | `abap_write` | Write source code to an existing ABAP object |
19
+ | `abap_create` | Create a new ABAP object (programs, classes, CDS views, BDEFs, SRVDs, SRVBs, etc.) |
20
+ | `abap_activate` | Activate an object — returns syntax errors on failure |
21
+ | `abap_check` | Check syntax without activating |
22
+ | `abap_delete` | Delete an ABAP object (irreversible, requires transport for non-local) |
23
+ | `abap_search` | Search objects by name with wildcard support (`*`) |
24
+ | `abap_where_used` | List all objects that reference a given object |
25
+
26
+ ### Code Intelligence
27
+
28
+ | Tool | Description |
29
+ |------|-------------|
30
+ | `abap_code_completion` | Code completion proposals at a specific position (autocomplete) |
31
+ | `abap_navigate` | Go to Definition — navigate to the definition of a code element |
32
+ | `abap_call_hierarchy` | Call hierarchy — who calls / who is called by a method or function |
33
+ | `abap_element_info` | Get type info, signature and parameters for a code element at a specific position |
34
+ | `abap_quick_fix` | List and apply quick fixes for errors/warnings in ABAP code |
35
+ | `abap_object_structure` | List methods, attributes and interfaces of a class or interface |
36
+ | `abap_doc` | Read ABAP Doc inline documentation for classes/methods |
37
+ | `abap_object_documentation` | Read technical documentation of any SAP object |
38
+
39
+ ### Refactoring
40
+
41
+ | Tool | Description |
42
+ |------|-------------|
43
+ | `abap_refactor_rename` | Rename a symbol (variable, method, attribute) across all references |
44
+ | `abap_extract_method` | Extract a code selection into a new method (Extract Method refactoring) |
45
+ | `abap_pretty_printer` | Format ABAP source code using SAP Pretty Printer |
46
+
47
+ ### Testing & Quality
48
+
49
+ | Tool | Description |
50
+ |------|-------------|
51
+ | `abap_unit_test` | Run ABAP Unit tests and return results (pass/fail with details) |
52
+ | `abap_code_coverage` | Run ABAP Unit tests with code coverage (statement-level) |
53
+ | `abap_atc_check` | Run ATC (ABAP Test Cockpit) checks — returns findings with priority and line |
54
+
55
+ ### Data & SQL
56
+
57
+ | Tool | Description |
58
+ |------|-------------|
59
+ | `abap_data_preview` | Preview data from tables or CDS views with optional WHERE, ORDER BY and column selection |
60
+ | `abap_sql_console` | Execute arbitrary ABAP SQL (Open SQL) queries and return tabular results |
61
+
62
+ ### Transport Management
63
+
64
+ | Tool | Description |
65
+ |------|-------------|
66
+ | `abap_list_transports` | List open transport requests for a user |
67
+ | `abap_assign_transport` | Assign an existing object to a transport request |
68
+ | `abap_create_transport` | Create a new transport request (workbench or customizing) |
69
+ | `abap_transport_contents` | Read detailed contents of a transport request (objects, tasks, owner) |
70
+ | `abap_release_transport` | Release a transport request (irreversible) |
71
+
72
+ ### CDS & Annotations
73
+
74
+ | Tool | Description |
75
+ |------|-------------|
76
+ | `abap_cds_annotations` | List available CDS annotation definitions in the system |
77
+ | `abap_cds_dependencies` | Dependency graph of a CDS view (what it uses and what uses it) |
78
+ | `abap_annotation_propagation` | Check how CDS annotations propagate through the view stack |
79
+
80
+ ### RAP & Fiori
81
+
82
+ | Tool | Description |
83
+ |------|-------------|
84
+ | `abap_scaffold_rap` | Create a full RAP stack with 4 scenarios: `managed` (basic), `managed_draft` (complete with draft, projections, DDLX), `unmanaged` (BAPI wrapping), `query` (custom entity) |
85
+ | `abap_create_dcl` | Create a DCL (Data Control Language) access control object with PFCG auth, user aspect, or literal conditions |
86
+ | `abap_create_amdp` | Create an AMDP class (procedure or table function) with SQLScript boilerplate |
87
+ | `abap_publish_binding` | Publish a Service Binding to SAP Gateway (OData V4/V2) |
88
+ | `abap_deploy_bsp` | Deploy a Fiori/UI5 app folder to BSP in the ABAP Repository |
89
+
90
+ ### DDIC & Object Types
91
+
92
+ | Tool | Description |
93
+ |------|-------------|
94
+ | `abap_enhancement_spot` | Read enhancement spots and implementations (BAdIs, enhancement points) |
95
+ | `abap_lock_object` | Read lock object (enqueue) definition — tables, parameters, lock mode |
96
+ | `abap_auth_object` | Read authorization object definition — fields and check indicators |
97
+ | `abap_number_range` | Read number range configuration — intervals, internal/external |
98
+ | `abap_package_contents` | List all objects inside an ABAP package |
99
+ | `abap_object_versions` | Get version history of an object (version, date, author) |
100
+ | `abap_function_group` | List all function modules in a function group |
101
+ | `abap_message_class` | Read all messages from a message class (T100) |
102
+
103
+ ### System & Repository
104
+
105
+ | Tool | Description |
106
+ |------|-------------|
107
+ | `abap_system_info` | Auto-detect SAP system type, version, capabilities and quirks |
108
+ | `abap_discovery` | List all ADT APIs and object types supported by the SAP system |
109
+ | `abap_released_apis` | List released APIs (C1 contract) — essential for BTP/Cloud ABAP |
110
+ | `abap_repository_tree` | Navigate the SAP repository tree (software components, packages) |
111
+
112
+ ### abapGit Integration
113
+
114
+ | Tool | Description |
115
+ |------|-------------|
116
+ | `abap_git_repos` | List abapGit repositories linked to the SAP system |
117
+ | `abap_git_pull` | Pull from an abapGit repository (import from Git to ABAP) |
118
+ | `abap_git_stage` | Show staging status and push to an abapGit repository |
119
+
120
+ ### Debugging & Traces (Experimental)
121
+
122
+ | Tool | Description |
123
+ |------|-------------|
124
+ | `abap_traces` | List and create ABAP traces (SAT/runtime analysis) for performance analysis |
125
+ | `abap_breakpoints` | Manage external breakpoints (list/set/remove) |
126
+
127
+ ### Knowledge Base
128
+
129
+ | Tool | Description |
130
+ |------|-------------|
131
+ | `abap_knowledge` | Curated reference guides for ABAP, CDS, RAP, Fiori and CAP — search, list and read |
132
+
133
+ The knowledge base is the core differentiator of this MCP server. It provides Claude with **curated, LLM-optimized reference material** (70% code examples, 30% rules and anti-patterns) so that generated code follows best practices out of the box.
134
+
135
+ **49 guides** organized in 4 domains:
136
+
137
+ | Domain | Topics | Examples |
138
+ |--------|--------|----------|
139
+ | **ABAP Core** | 25 | Internal tables, ABAP SQL, RAP (EML, draft, feature control, numbering, unmanaged), OO, clean code, performance, unit testing, cloud development |
140
+ | **ABAP CDS** | 6 | Annotations, associations, access control, expressions, functions, metadata extensions |
141
+ | **Fiori / UI5** | 11 | Fiori Elements, annotations, value lists, side effects, XML views, controllers, routing, data binding, fragments, manifest, deployment |
142
+ | **CAP (Node.js)** | 7 | CDL syntax, CQL queries, service definitions, event handlers, authentication, Fiori integration, deployment |
143
+
144
+ **Three actions:**
145
+
146
+ | Action | What it does | Example |
147
+ |--------|-------------|---------|
148
+ | `list` | Show all available topics grouped by domain | `action:'list', domain:'abap'` |
149
+ | `search` | Keyword search with relevance scoring | `action:'search', query:'draft annotations'` |
150
+ | `get` | Read full content of up to 5 guides | `action:'get', topics:['abap/rap-draft']` |
151
+
152
+ The `abap_create` and `abap_write` tools include guidance in their descriptions nudging Claude to consult the knowledge base before generating code.
153
+
154
+ ---
155
+
156
+ ## Supported Object Types
157
+
158
+ | Type | ADT Path | Description |
159
+ |------|----------|-------------|
160
+ | `PROG/P` | `programs/programs` | Report / Executable Program |
161
+ | `CLAS/OC` | `oo/classes` | Global Class |
162
+ | `FUGR/FF` | `functions/functionmodules` | Function Module |
163
+ | `FUGR/F` | `functions/groups` | Function Group |
164
+ | `DOMA/D` | `ddic/domains` | Domain |
165
+ | `DTEL/D` | `ddic/dataelements` | Data Element |
166
+ | `TABL/DT` | `ddic/tables` | Transparent Table |
167
+ | `TABL/DS` | `ddic/structures` | Structure |
168
+ | `TTYP/TT` | `ddic/tabletypes` | Table Type |
169
+ | `MSAG/N` | `messageclass` | Message Class |
170
+ | `INTF/OI` | `oo/interfaces` | Interface |
171
+ | `DDLS/DF` | `ddic/ddl/sources` | CDS View |
172
+ | `DDLX/MX` | `ddic/ddlx/sources` | Metadata Extension |
173
+ | `SRVD/SRV` | `ddic/srvd/sources` | Service Definition |
174
+ | `BDEF/BDO` | `bo/behaviordefinitions` | Behavior Definition |
175
+ | `SRVB/SVB` | `businessservices/bindings` | Service Binding |
176
+ | `XSLT/XT` | `transformations/xslt` | XSLT Transformation |
177
+ | `XSLT/ST` | `transformations/simple` | Simple Transformation |
178
+ | `ENHS/ES` | `enhancements/spots` | Enhancement Spot |
179
+ | `ENHO/EO` | `enhancements/implementations` | Enhancement Implementation |
180
+ | `ENQU/DL` | `ddic/lockobjects` | Lock Object |
181
+ | `NROB/NR` | `content/numberranges` | Number Range Object |
182
+ | `SUSO/B` | `authorization/authorizationobjects` | Authorization Object |
183
+
184
+ ### Reading Tables and Structures
185
+
186
+ Standard SAP tables and structures (e.g. `J_1BNFDOC`, `J_1BNF_BADI_HEADER`) don't expose source code via the ADT `/source/main` endpoint. The `abap_read` tool handles this automatically:
187
+
188
+ 1. Tries `GET /source/main` (works for custom Z-tables in newer systems)
189
+ 2. If 404, falls back to the ADT XML metadata endpoint and parses the field definitions
190
+ 3. Returns a formatted field list with name, data type, length, and description
191
+
192
+ This means you can read both custom and standard DDIC objects:
193
+
194
+ ```
195
+ abap_read(object_type: "TABL/DT", object_name: "J_1BNFDOC") → fields of a standard table
196
+ abap_read(object_type: "TABL/DS", object_name: "J_1BNF_BADI_HEADER") → fields of a structure
197
+ ```
198
+
199
+ ---
200
+
201
+ ## Configuration
202
+
203
+ The server is configured entirely via environment variables:
204
+
205
+ | Variable | Required | Description |
206
+ |----------|----------|-------------|
207
+ | `SAP_URL` | Yes | Base URL of the SAP system (e.g. `https://my-sap-host:8443`) |
208
+ | `SAP_USER` | Yes | SAP username |
209
+ | `SAP_PASS` | Yes | SAP password |
210
+ | `SAP_CLIENT` | No | SAP client/mandant (default: `100`) |
211
+ | `SAP_LANGUAGE` | No | Logon language (default: `PT`) |
212
+ | `SAP_SYSTEM_TYPE` | No | System preset: `ON_PREMISE_S4` (default), `BTP_ABAP_ENV`, `ON_PREMISE_ECC` |
213
+ | `SAP_TIMEOUT` | No | Request timeout in ms (default: `60000`). Increase for slow systems |
214
+ | `NODE_TLS_REJECT_UNAUTHORIZED` | No | Set to `0` to disable SSL verification for self-signed certificates |
215
+
216
+ ---
217
+
218
+ ## Quick Start
219
+
220
+ ```bash
221
+ # 1. Install
222
+ npm install -g @linkup-ai/abap-ai
223
+
224
+ # 2. Activate license
225
+ abap-ai activate LK-XXXX-XXXX-XXXX
226
+
227
+ # 3. Configure SAP connection (interactive wizard)
228
+ abap-ai init
229
+
230
+ # 4. Verify
231
+ abap-ai status
232
+
233
+ # 5. Open VS Code / Claude Code → ready to use!
234
+ ```
235
+
236
+ The `init` wizard tests the SAP connection, supports multiple systems (DEV, QAS, PRD), and generates `~/.claude/mcp.json` automatically.
237
+
238
+ See [docs/CLI_GUIDE.md](docs/CLI_GUIDE.md) for the full step-by-step guide.
239
+
240
+ ## CLI Commands
241
+
242
+ | Command | Description |
243
+ |---------|-------------|
244
+ | `abap-ai init` | Interactive wizard to configure SAP system connections |
245
+ | `abap-ai activate <KEY>` | Activate product license (BYOK or All-in-One) |
246
+ | `abap-ai status` | Show license, systems (with connection test), usage metrics and knowledge base |
247
+ | `abap-ai systems` | List configured SAP systems |
248
+ | `abap-ai remove <name>` | Remove a SAP system from mcp.json |
249
+
250
+ ### Manual Setup (alternative)
251
+
252
+ If you prefer manual configuration, create `~/.claude/mcp.json`:
253
+
254
+ ```json
255
+ {
256
+ "mcpServers": {
257
+ "abap-dev": {
258
+ "command": "node",
259
+ "args": ["/path/to/abap-mcp-server/dist/index.js"],
260
+ "env": {
261
+ "SAP_URL": "https://your-sap-host:8443",
262
+ "SAP_CLIENT": "100",
263
+ "SAP_USER": "your-username",
264
+ "SAP_PASS": "your-password",
265
+ "SAP_LANGUAGE": "EN",
266
+ "NODE_TLS_REJECT_UNAUTHORIZED": "0"
267
+ }
268
+ }
269
+ }
270
+ }
271
+ ```
272
+
273
+ > Keep `mcp.json` in your `.gitignore` — it contains credentials.
274
+
275
+ ---
276
+
277
+ ## Deploying Fiori/UI5 Apps
278
+
279
+ The `abap_deploy_bsp` tool uploads a local folder (e.g. a `dist/` build output) as a BSP application to the SAP ABAP Repository.
280
+
281
+ **How it works:**
282
+ 1. Reads all files from the specified folder
283
+ 2. Creates a ZIP archive in memory
284
+ 3. Sends the ZIP (base64-encoded) to `/sap/opu/odata/UI5/ABAP_REPOSITORY_SRV/Repositories`
285
+ 4. Automatically detects if the BSP already exists (create vs update)
286
+
287
+ **Example usage (via Claude):**
288
+ > "Deploy the contents of /Users/dev/myapp/dist to BSP ZMYAPP in package $TMP"
289
+
290
+ **Parameters:**
291
+ | Parameter | Required | Description |
292
+ |-----------|----------|-------------|
293
+ | `bsp_name` | Yes | BSP application name (max 15 chars, e.g. `ZVENDASHOJE`) |
294
+ | `folder_path` | Yes | Absolute path to the folder with app files |
295
+ | `package` | No | ABAP package (default: `$TMP`) |
296
+ | `description` | No | BSP description |
297
+ | `transport_request` | No | Transport request (required if package ≠ `$TMP`) |
298
+
299
+ **After deploy, the app is available at:**
300
+ ```
301
+ https://<sap-host>:<port>/sap/bc/ui5_ui5/sap/<bsp_name_lowercase>?sap-client=<client>
302
+ ```
303
+
304
+ ---
305
+
306
+ ## System Profile
307
+
308
+ The server adapts its behavior based on the target SAP system type. A **System Profile** determines URL patterns, CDS syntax, gateway behavior, and known quirks.
309
+
310
+ ### Auto-detection
311
+
312
+ Run `abap_system_info` (no parameters) to auto-detect the system profile. It probes ADT endpoints to determine:
313
+
314
+ - **System type**: S/4HANA on-premise, BTP ABAP Environment, ECC
315
+ - **SAP_BASIS version**: Inferred from available ADT collections
316
+ - **ABAP platform**: Standard vs Cloud
317
+ - **Client role**: Development, Customizing, Production
318
+ - **Capabilities**: Code completion, call hierarchy, quick fix, extract method, code coverage, SQL console, released API catalog, abapGit
319
+ - **Quirks**: ETag behavior, lock support, conversion exit fields
320
+
321
+ ### Presets
322
+
323
+ Set `SAP_SYSTEM_TYPE` env var to use a preset without auto-detection:
324
+
325
+ | Preset | Description |
326
+ |--------|-------------|
327
+ | `ON_PREMISE_S4` | S/4HANA on-premise (default) — full ADT capabilities, embedded gateway |
328
+ | `BTP_ABAP_ENV` | BTP ABAP Environment — auto-registration, released APIs only |
329
+ | `ON_PREMISE_ECC` | SAP ECC — limited capabilities (no CDS view entity, no RAP, no advanced refactoring) |
330
+
331
+ ### Profile-aware behavior
332
+
333
+ | Tool | Adaptation |
334
+ |------|-----------|
335
+ | `abap_write` | ETag mismatch auto-retry on on-premise (extracts correct ETag from error) |
336
+ | `abap_scaffold_rap` | Pre-checks CDS view entity support; warns about conversion exit fields |
337
+ | `abap_publish_binding` | Pre-checks client role; skips publish on BTP (auto-registration) |
338
+ | `abap_deploy_bsp` | Reports correct UI5 bootstrap path and OData URL for the system type |
339
+ | `abap_sql_console` | Only available on systems with BASIS 755+ |
340
+ | `abap_code_completion` | Available on BASIS 750+ |
341
+ | `abap_quick_fix` | Available on BASIS 752+ |
342
+
343
+ ### MCP Resource
344
+
345
+ The current profile is exposed as an MCP Resource at `abap://system-profile` (JSON format), giving Claude contextual awareness of the connected system.
346
+
347
+ ---
348
+
349
+ ## Authentication
350
+
351
+ The server handles authentication automatically:
352
+
353
+ 1. On first call, performs `GET /sap/bc/adt/discovery` with `X-CSRF-Token: Fetch`
354
+ 2. Stores the session cookie and CSRF token in memory
355
+ 3. Reuses the session for all subsequent calls
356
+ 4. Automatically reconnects on HTTP 401
357
+
358
+ Source writes use **ETag-based optimistic locking** (`If-Match` header) — no explicit object lock needed.
359
+
360
+ ---
361
+
362
+ ## Troubleshooting
363
+
364
+ See [docs/TROUBLESHOOTING.md](docs/TROUBLESHOOTING.md) for a complete guide. Quick reference:
365
+
366
+ | Error | Cause | Fix |
367
+ |-------|-------|-----|
368
+ | `401 Unauthorized` | Bad credentials or expired session | Check `SAP_USER`/`SAP_PASS`; auto-retry handles session expiry |
369
+ | `SSL certificate error` | Self-signed cert | Set `NODE_TLS_REJECT_UNAUTHORIZED=0` |
370
+ | `415 Unsupported Media Type` | SAP version too old | DDIC create needs BASIS 752+; RAP needs S/4HANA |
371
+ | `404` on DDIC create | ECC system | DOMA/TABL/TTYP endpoints don't exist on ECC (use SE11) |
372
+ | `409 Conflict` | Object locked | Check SM12; restart MCP server to clear stale locks |
373
+ | `412 Precondition Failed` | ETag mismatch | Auto-handled on S/4; retry usually resolves |
374
+ | Timeout | Slow system | Increase `SAP_TIMEOUT` (e.g. `120000` for 2 min) |
375
+
376
+ ### ECC Compatibility
377
+
378
+ Core ABAP tools (read, write, create PROG/CLAS/INTF/FUGR, activate, check, unit test, ATC, SQL console) work on ECC (BASIS 750+). RAP/CDS/DDIC creation requires S/4HANA. See [docs/RESTRICTIONS.md](docs/RESTRICTIONS.md) for the full compatibility matrix.
379
+
380
+ ---
381
+
382
+ ## License
383
+
384
+ MIT