agentleFS
fr0sterfr0ster/mcp-abap-adt/CLAUDE.md

mcp-abap-adt

CLAUDE.md111 starsChanged 13 months agoApache-2.0View on GitHub

Integration tests run against a real SAP system. Two modes: Strategy: Run soft mode for mass regression testing. Use hard mode only for targeted verification of recent changes. Shared objects: Before the first test run, create shared SAP objects (tables, CDS views, service definitions, classes) that some tests depend on: Important: Shared object setup and SAP environment verification require collaboration with the user. Don't try to automate everything — run shared:setup once, show the result, and ask the user to…

  • Reads credentials
  • Installs packages

The file

We split this CLAUDE.md into the rules it gives an agent

6 rules. About 0 are common, 3 are distinctive, and 3 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈3

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 3

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Strategy: Run soft mode for mass regression testing.

    line 12
  2. Distinctive:

    Shared objects: Before the first test run, create shared SAP objects (tables, CDS views, service definitions, classes) that some tests …

    line 14
  3. Very specific:

    All test parameters live in tests/test-config.yaml (gitignored).

    line 34
  4. Distinctive:

    If the question comes back, SAP moving is the deciding condition.

    line 140
  5. Very specific:

    Never npx: scripts call the package's own bin (biome, tsc), a test spawns process.execPath with the resolved CLI.

    line 160
  6. Very specific:

    What it is: Not our bug list, and not a to-do.

    line 170

≈ “Common” is an estimate: at least 1 in 5 of the 29,248 CLAUDE.md files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
CLAUDE.md

MCP ABAP ADT - Development Guide

Testing

Integration Tests

Integration tests run against a real SAP system. Two modes:

  • Soft mode (default, integration_hard_mode.enabled: false): calls handlers directly, no MCP subprocess.
  • Hard mode (integration_hard_mode.enabled: true): spawns full MCP server via stdio, calls tools through MCP protocol.

Strategy: Run soft mode for mass regression testing. Use hard mode only for targeted verification of recent changes.

Shared objects: Before the first test run, create shared SAP objects (tables, CDS views, service definitions, classes) that some tests depend on:

npm run shared:setup     # first run only, persists across test runs
npm run shared:check     # verify they exist

Important: Shared object setup and SAP environment verification require collaboration with the user. Don't try to automate everything — run shared:setup once, show the result, and ask the user to verify activation in ADT. If activation fails, ask the user what they see rather than retrying blindly.

Running integration tests: Save the full output to a log file; never truncate it with tail. Live files run one at a time on node:test; a first Ctrl-C lets the running files finish their cleanup, a second ends them. One file, one case and why one at a time: src/__tests__/integration/README.md, "Running".

# Soft mode (mass run) — save the full log
npm run test:integration 2>&1 | tee <log>

# One file (hard mode: integration_hard_mode.enabled: true in test-config.yaml), by its source path
npm run test:integration -- src/__tests__/integration/<path>.test.ts

Test Configuration

All test parameters live in tests/test-config.yaml (gitignored). The template (tests/test-config.yaml.template) works out of the box with sensible defaults.

Setup:

cp tests/test-config.yaml.template tests/test-config.yaml
# Edit ONLY the lines marked "# ← CHANGE"

Required changes (marked # ← CHANGE):

  • environment.env — session .env file name ("your-system.env", "another-system.env") from standard sessions folder
  • environment.system_type — "onprem", "cloud", or "legacy"
  • environment.connection_type — "http" or "rfc", required (no default); "rfc" also needs environment.realm_check_url, the HTTP URL the realm check runs against before anything is sent (it is never part of the destination).
  • environment.ashost / sysnr (or mshost, msserv, sysid, group), client, language — RFC only: the destination's address, client and logon language, over the session .env's; an RFC destination states one address, SAP_CLIENT and SAP_LANGUAGE, and no SAP_URL.
  • environment.default_package — dev package (ZMCP_TEST, $TMP)
  • environment.default_transport — transport request or "" for local packages
  • shared_dependencies.package — package for shared test objects
  • shared_dependencies.software_component — "LOCAL", "HOME", etc.

Everything else (object names, timeouts, CDS sources, unit test code) has working defaults. See docs/development/tests/TESTING_GUIDE.md for full details.

available_in

available_in in TOOL_DEFINITION restricts tool to specific SAP environments. If omitted, the tool is available everywhere. Only set it when a tool genuinely doesn't work on some platform (e.g., Programs are onprem-only):

available_in: ['onprem', 'legacy'] as const,  // not available on cloud

Values: 'onprem' | 'cloud' | 'legacy'. If omitted, tool is available everywhere. Test-level available_in is controlled separately in test-config.yaml.template.

Data tools (24.0.0). GetSqlQuery, GetTableContents and compact HandlerGetData are served only with --enable-data-tools (MCP_ENABLE_DATA_TOOLS, YAML enable-data-tools; off by default, SAP API Policy FAQ v1.3 Q33; the customer decides). They live in DataHandlersGroup / compactDataEntries / CompactDataHandlersGroup, added by a set's groups(context, transport, { dataTools }); a new tool that reads business data goes there.

Cloud vs On-Prem

  • Programs on ABAP Cloud: read, source, versions, check and the unit run are served (SAP programs; ADT_TYPES_CLOUD); create, update, delete, activate, lock and validate are on premise only
  • Runtime profiling (class-based) and dumps work on both cloud and onprem
  • RuntimeRunProgram* tools are on premise only (a program cannot be run on cloud)
  • Program includes (PROG/I) on ABAP Cloud: read, source, metadata, deletion check and where-used are served; create, update, delete, activate, lock and validate are on premise only. Table types (TTYP/DA) are served whole on both; their version list is served, their version source is not (SAP answers 403 on both).
  • An include's main programs (GetMainPrograms, compact HandlerGet part main_programs) are read on premise only: the ABAP cloud table lists no mainPrograms.

npm Package Verification

When checking whether an installed npm package contains specific code, always search inside node_modules/ directly (e.g., grep -r "pattern" node_modules/@scope/package/). VS Code search and ripgrep skip node_modules by default due to .gitignore, which leads to false "not found" conclusions. The code may be there — you're just not looking in the right place.

Dependencies

The rule over this whole section: on runtime and toolchain versions we follow SAP. Not the newest release, not what the developer's machine happens to run — what SAP builds and runs against. Two cases are settled below; a third that looks like them is decided the same way.

Node follows what SAP BTP actually runs

engines.node is >=22, the CI and release matrices are 22 and 24, and @types/node is ^22.

SAP BTP Cloud Foundry supports Node 22 and 24; 20 reached end of life on 2026-04-30 and was removed, so restaging a Node 20 app fails. Odd-numbered releases (21, 23, 25) are not on the platform at all, and @sap/cds 10.1.0, @sap/cds-compiler 7.1.0 and @cap-js/cds-typer 0.41.1 all declare engines.node >=22.

@types/node tracks the oldest runtime we claim to support, not the newest available: types a major or two ahead describe API that is not there on 22, and the compiler would wave it through. ^22 was measured clean across tsconfig.json, tsconfig.test.json, server/tsconfig.json and the full suite.

A newer Node on a development machine is fine; nothing here may require it — this one runs 26.7.0, and that changes nothing here.

Node 26 is not a third supported version. Checked 2026-09-27:

  • SAP's own docs for the Cloud Foundry environment list exactly three for nodejs_buildpack — 20 (end of life 2026-04-30), 22, 24 — and say nothing about 26. A nodejs 26 app has nothing to be staged on.
  • Node 26 is in Current, not LTS: released 2026-05-05, LTS in October 2026, and Node's own guidance is Active or Maintenance LTS for production.
  • @sap/cds 10.1.1, @sap/cds-compiler 7.1.1 and @cap-js/cds-typer 0.41.1 declare engines.node >=22. A floor, not a statement that 26 was tested — the same open range admitted 25, which the platform never had.

One thing 26 does change, and it is about installing rather than running. @mcp-abap-adt/auth-broker 3.0.2 and auth-providers 4.2.1 widened engines to "^22 || ^24 || ^26" because under Node 26 npm skips a release whose engines does not admit it and installs the newest one that does — silently an older major (measured: npm i -g @mcp-abap-adt/proxy on 26.7.0 took 4.2.0 while 5.0.1 was latest). This project declares engines.node: ">=22.0.0", an open range, so it was never subject to that; keep it open for the same reason.

So the matrices stay 22 and 24, and the question reopens when the buildpack lists 26, not when Node releases it.

The TypeScript major follows SAP

Stay on typescript@^6.x. Take 6.x patches and minors; leave 7 alone until the CAP toolchain moves, and treat it as a decision already made rather than an upgrade waiting to happen. Measured 2026-09-24:

  • @sap/cds 10.1.0, @sap/cds-dk 10.1.0, @sap/cds-compiler 7.1.0, @cap-js/cds-typer 0.41.1 and @cap-js/cds-types 0.19.0 declare no typescript peer at all, and CAP's docs name no version — cds watch runs cds-tsx, which transpiles without type checking. But cds-typer and cds-types both devDepend on typescript ^6.0.3, so 6 is what SAP tests.
  • cloud-llm-hub type-checks against this project's .d.ts on TypeScript 6 with moduleResolution: node.

If the question comes back, SAP moving is the deciding condition.

No dependency runs an install script

Supply-chain worms (Shai-Hulud and its kind) spread through dependencies' install scripts and steal npm and GitHub tokens. So:

  • allowScripts in package.json lists every package in the tree that has an install script, each denied (false); .npmrc sets strict-allow-scripts=true, so a new dependency with an unreviewed install script fails the install instead of running it. A new entry needs the reason it is needed; the default answer is deny.
  • No min-release-age: it blocked installing a security fix while the gating audit failed CI.
  • npm reads these in full only from 11.19.0, so CI, the release workflow, the Docker images, the portable build and any install outside this checkout use npm ci --ignore-scripts / npm install --ignore-scripts. Our own prepare (husky) is run explicitly where it is wanted.
  • npm audit --audit-level=moderate gates CI and the release: the whole tree, dev dependencies included. An advisory in a dependency with no fixed release is answered with an overrides entry whose reason is in the CHANGELOG (today: argparse 2 under js-yaml 3), or by dropping the package — never by making the audit non-gating.
  • Never npx: scripts call the package's own bin (biome, tsc), a test spawns process.execPath with the resolved CLI.

The SAP errata: ambiguity we account for, not defects we fix

node_modules/@mcp-abap-adt/adt-clients/docs/usage/ERRATA.md — 25 entries of measured SAP behaviour, each with Symptom, Cause, Rule, Workaround, Evidence and "where it bites", and an object tree saying which types answer something the others do not. Read it before measuring a surprising ADT answer again.

What it is. Not our bug list, and not a to-do. It records where the platform is ambiguous, and the ambiguity is ours to account for. The canonical case: 403 on the LOCK before a service binding's publication. It is neither an error nor a success — it means an editing session holds the binding — and Eclipse ADT ignores it and posts the job, because the job needs no lock of the caller's. The errata even hands the choice over: "If the 403 should stop you, pass analyseException instead."

Where the choice lives: the analyse at the call site. Three shapes of it:

  • treat as no failure what looks like one — analysePublicationLock on that 403; activationExecuted="false" with no messages ("nothing to do"); an untyped S::000 beside isDeleted="true";
  • treat as a failure what looks like success — 200 with isDeleted="false", activationExecuted="false" with <msg type="E">, 200 with an empty body where a 404 was meant;
  • leave to a second read what no single answer settles — acceptance is not completion: /activation/runs answers a run id, and GetInactiveObjects is the only answer to "is it active now".

How to apply. New call → look for an entry on that endpoint and pass the strategy it names. Choosing differently from Eclipse is allowed, and then the reason belongs in a comment at the call site, because it is our decision about an ambiguous answer, not the system's behaviour.

Two entries are the connector's, not a reading's: PAK/058 ("a package can be saved only once per ABAP session" — the message says locked, but it is CL_PACKAGE's in-memory instance buffer) and the session-type header. @mcp-abap-adt/connection handles both — HTTP from 9.3.1, RFC from 9.3.2, and from 9.3.4 on a reused conversation whose server context is reset after each call, which needs @mcp-abap-adt/sap-rfc-lite 0.2.1 — 0.2.0 was published from a stale lib/ with no resetServerContext in it, so the connector silently fell back to a new RFC connection per stateless call (correct, and half again as slow: ~1010 s against ~684 s for a full RFC run). PR #230's on-premise RFC run measured the same thing from our side: a stateless read after a create on one RFC connection answered 400 SADT_RESOURCE 007, and a fresh connection answered 200.

Seeing the wire

DEBUG_HTTP_WIRE=true prints every HTTP exchange on stderr — method, URL, params, headers with their values redacted by name, and bodies clipped at DEBUG_HTTP_BODY_CHARS (default 2000, 0 for the size alone, Infinity for all of it). DEBUG_RFC_WIRE is its RFC twin.

Reach for it before writing a probe. DEBUG_CONNECTORS and DEBUG_ADT_LIBS do NOT answer "what did we send and what came back": @mcp-abap-adt/connection logs the session, the CSRF token and the critical section and nothing about a request, and logWire is an RFC transport option the HTTP transports do not take. That gap cost a diagnostic cycle on 2026-09-28 — CheckPackage answered isError: true with no message and no request, and the cause (a guard refusing before the wire) was only visible after wrapping makeAdtRequest by hand.

And when a suite reports Expected: false / Received: true, the payload is what is missing, not the wire: a handler's envelope carries message, origin and request. A test that asserts isError should raise that payload — see CheckHighHandlers.test.ts's expectAccepted.

A release is not verified until an installed copy runs

release:dry reporting Published: 18 Skipped: 0 says the tarballs build. It says nothing about whether anything inside them runs: paths that resolve in a checkout resolve differently under node_modules.

13.0.0 shipped with mcp-abap-adt --version dead on every installed copy — the launcher read __dirname/../../package.json, which is the repo root in a checkout and the scope directory node_modules/@mcp-abap-adt/ from npm. The sibling packages had fixed exactly this one release earlier (auth-broker 3.0.4: mcp-sso importing a dev-only dependency), and their changelog even said how they found it — installing the tarball into an empty directory and running each bin. We took the fix and skipped the check.

src/__tests__/unit/binSmoke.test.ts performs it now, and src/__tests__/unit/installMatrix.test.ts installs the binaries by name, as a user does, in every layout and proves one @mcp-abap-adt/lib per process (19.1.0 loaded two when a wrapper and its base were installed in one command: a binary depended on another binary; none may now). Before a release, make sure npm run test:install ran (it runs both; CI runs it as its own step), and after publishing run npm run release:verify (every package of the release visible on the registry, a clean install from it with a registry-only lockfile, each bin's --version answering the release version; exit 2 means "not visible yet", rerun it) and docs/deployment/RELEASE.md step 9 (the global wrapper-and-base install); when adding a bin, add it to both tests. And treat any __dirname-relative path in server-runtime/ and in the binary packages' version modules as suspect: count the levels for both layouts.

What we write names nothing concrete

The rule: a description is read by a model and indexed by a vector search, so it names nothing concrete. We say class; we do not say which class. It holds for tool descriptions, parameter descriptions, code comments, test data and captured fixtures alike, and the reason is retrieval, not taste: ask for a report in $TMP and a search over the descriptions returns everything whose text mentions $TMP, whatever the rest of the sentence says. Issue #241 measured it in cloud-llm-hub's tool-RAG — Delete* went from 12 of the top 15 to 1 once the literal left their text. In a PARAMETER description it is worse in a second way: the model fills the argument from what it reads there, and an example transport request addressed a real one.

A consumer who wants names is not stuck. They import @mcp-abap-adt/lib, inherit, and override the descriptions to suit their own retrieval. What we ship stays agnostic because we do not know who indexes it, where, or how.

  • What a description says: the operation, then the parameters and the answer, most important first, plus the constraints that change THIS call ("must already exist", "required for validation", "not a task", "up to 26 characters"). Never an example object, package, transport, software component or search prefix. A bare mask (Z*, Y*, any-namespace) and a format placeholder (YYYYMMDDHHMMSS) name nothing and stay.
  • A description is not an ABAP tutorial. A tool works with any object the caller is authorised for, whatever it is called, so naming conventions are not ours to state: "must follow SAP naming conventions", "start with Z or Y", "for the customer namespace", how a behaviour pool is conventionally named and a worked ABAP snippet are all out (stated by the user 2026-09-28). The CONSUMER's skill carries the naming rules and its own requirements, and the consumer is responsible for the validity of the parameters it sends. The same cut removed the CTS lesson from 104 transport_request descriptions: request is a word a description may use, a number like ER121235 never is, so the text keeps not a task — the one fact that decides whether THIS call succeeds — and drops how CTS works, which tool to call next and the SAP message it answers. The transport tools themselves keep their full text: there, request against task is the subject of the tool, not a general lesson.
  • A measurement note records the platform and the date, not the landscape. on premise (2026-09-26) and BASIS 816, never a system id: the release is what made the behaviour, and the SID means nothing to anyone else reading it.
  • Captured fixtures are sanitised — SAPUSER01, SID, a placeholder transport prefix — and the note says so. Test data keeps its numbers under a placeholder prefix so assertions still pair with their inputs.
  • src/__tests__/unit/toolDescriptionsCarryNoLiterals.test.ts keeps the rule over both tool and parameter descriptions, in three classes: a package ($TMP), a customer object (ZCL_…, and L…/SAPL… for a function group's generated includes), a transport number. Add a class rather than an exception when a new kind of literal appears; the generated prefixes are there because the first version of the pattern missed LZOK_FG_…F01 and the test found it.

The state handle

state_handle identifies an LLM session's state — not a user, not an MCP session. Whoever continues the LLM session presents it; protecting it (HTTPS, isolation, logs) is the deployer's, and SECURITY.md says so. There is no owner: no caller proof, no per-user listing, no per-user registry of ours.

What bounds parallel debug sessions is SAP's listener conflict, measured on premise (2026-10-10, both conflict modes, all four combinations of the ids):

  • the same ideId never conflicts, whatever the terminalId: both listeners stay, and the newer one catches;
  • another ideId of the same SAP user conflicts: under refuse (checkConflict=true&isNotifiedOnConflict=true) the newcomer gets 409 conflictDetected and the first one keeps listening; under take-over the newcomer is accepted and the first one's poll returns 409 conflictNotification;
  • the terminalId changed nothing in either mode;
  • a breakpoint caught for whichever listener of that user was active — under take-over the newcomer caught a breakpoint only the first one had set.

Measured again on premise (2026-10-12, BASIS 816: same SAP user, two ideIds, user mode, refuse, the first IDE armed and listening):

  • the user-mode breakpoint set is the user's (with the request user); the ideId does not separate it: the newcomer's arming replaced the first IDE's set, and although its listen was refused 409 and the first listener kept listening, the run stopped at the newcomer's line, not the first one's;
  • a stopListener under another ideId of the same user ends the other IDE's listener: after it the first IDE's poll returned at once with an empty answer, and listening again caught nothing — its set was gone too;
  • deleting only the newcomer's own breakpoint by id instead left the first IDE's listener running, but it caught nothing: the arming had already replaced its set;
  • a checkListener before anything else answered 409 and left the first IDE untouched;
  • a checkListener under the identity of a listener of our own that is running answered 200 and left it listening, in user and terminal mode alike — so the check does not refuse a session's own later arming.

So under listener mode refuse a start checks the listener on the control connection before it reconciles or arms, whatever the breakpoint conflict says, and a 409 there is a refusal before any change. The check is not atomic: a listener another IDE starts between it and our listen has its set replaced by our arming and its listener ended by our rollback's stopListener. That race is accepted and documented, not handled (stated by the user 2026-10-12).

Both ids are random per instance by default, so a second instance of the same SAP user meets the conflict and its answer reaches the model as it is; a shared id is the consumer's explicit choice. The idle bound on waiting for the user (not under 30 minutes, the user's exception to "no timeouts") ends a forgotten session.

The idle bound applies to HTTP and SSE only; stdio has none: its state ends by an explicit tool, the client closing stdin, the backend, or process shutdown.

In user mode the debugger catches the requests of the connected user or of another named by request_user (measured end to end on premise, 2026-10-11, BASIS 816; it needs the debug authorization on that user). ADT cannot attach to a request or a process that is already running: a request is enabled for catching when it starts.

Terminal mode works for the runs this server starts, measured on premise (2026-10-12, BASIS 816):

  • a terminal-mode listener catches a request by the terminal id and IDE id it carries in SAP-PASSPORT; a run URL has no parameter for them. A run started with debuggee: { terminalId, ideId } (adt-clients 29.1.0) carries them and is caught by the terminal-mode listener under those ids and by no other; without them no terminal-mode listener catches it. Random ids work, so terminal mode needs no configured terminal id: a stated one only replaces the random one;
  • two listeners of one SAP user in terminal mode under other ids both listen, and each run is caught only by its own listener;
  • the breakpoint set is still the SAP user's: setBreakpoints under other ids replaced the other's set, in terminal mode as in user mode;
  • a stopListener under other ids left the other terminal-mode listener running (in user mode it ended it).

So under terminal mode our own run carries the session's ids, and in user mode none. Any other request is caught in terminal mode only if it carries the same ids, so a terminal start without a run catches only such requests.

A stop right after a run ended races the listener's next poll (measured on premise, 2026-10-12): the loop polls again at once when a run ends, and a stopListener the system processes before that poll registers leaves the poll holding its full hold (60 s), which the stop awaits. 17.2 deleted breakpoints by id first, which happened to delay the stopListener enough. So while the open poll has not answered, the stop sends stopListener once more; in the clean integration run the second one woke the poll and the stop took 0.4 s, but in an earlier run it took 60 s anyway, and in a terminal-mode run (2026-10-12) the second one, sent 0.44 s after the first, did not wake the poll either. A stopListener does wake our own registered poll in both modes (probe, same day: answered 0.1–0.3 s after the stop, user and terminal mode alike), so the poll was not registered yet. One retry narrows the race, it does not close it; that is accepted and documented, not handled further (stated by the user 2026-10-12).

This holds for this repository (stated by the user 2026-10-10); a handle in another project may mean something else, and the global MCP rules still apply there.

MCP prompts

  • src/lib/prompts/: the nine MCP prompts, built from the listed tools (PromptSource), the steps as data and the text rendered from them; the typed rows (FULL_ROWS, COMPACT_ROWS, READ_AS, LOCKED_AS, RUN_TARGET, WHERE_USED_AS, OBJECT_DIRECTORY_TYPE, ENTRY_ARGUMENT, TRANSPORT_ACTIONS).
  • BaseMcpServer registers the prompts after the tools (prompts: false turns them off); a plain registration only through registerAbapPrompts.
  • listed-prompts.json and prompt-texts.json, with their writers, and test 14 (promptCallsParse.test.ts), which pins every generated call against its listed schema.

Plans and Specs

Plans under docs/superpowers/plans/ and specs under docs/superpowers/specs/ are kept in the tree only while active — i.e. not yet implemented and not cancelled. Once a plan/spec has been fully implemented OR cancelled, delete the file. History lives in git; these directories hold only work in progress.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.