@mseep/bw-modeling-mcp 0.8.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.
package/CHANGELOG.md ADDED
@@ -0,0 +1,140 @@
1
+ # Changelog
2
+
3
+ ## [0.8.0] — 2026-06-09
4
+
5
+ ### Added
6
+
7
+ - `bw_run_dtp` — starts (executes) a DTP load via `POST /sap/bw/modeling/dtpa/executerun`; returns the new run request id from the `Location` header (an RSPM TSN usable directly with `bw_get_request`); runs in a fresh session to avoid stale-buffer and concurrency issues
8
+ - `bw_list_requests` — lists load requests for a target InfoProvider via the BW/4HANA `/sap/bc/http/sap/bw4/v1/manage/requests` API; shows status, last process status/action, record count, timestamp, user, and TSN
9
+ - `bw_get_request` — full status analysis of one load request in a single call: header, DTP information (start/finish/duration), process step chain, and message log; `format="raw"` returns the parsed JSON of all four payloads
10
+ - `bw_activate_request` — activates loaded data (DSO request activation): moves a finished load from the inbound table into the active data table + change log via `POST .../manage/requests/{tsn}/{storage}/activate`; runtime activation distinct from `bw_activate`; asynchronous
11
+ - Cookie-based authentication for SAML- or OAuth-fronted BW systems (e.g. BW Bridge on the SAP BTP ABAP stack): set `BW_COOKIE_FILE` to a browser-exported cookie file (Netscape or `name=value` format); `BW_USER` / `BW_PASSWORD` become optional; login and session handling analogous to vibing-steampunk
12
+ - `bw_create_adso` — new `template_type` (`ADSO` default / `RSDS`) and `source_system` parameters: propose aDSO fields from a DataSource, not only from another aDSO
13
+ - `bw_create_dtp` — new `source_system` parameter: use a DataSource as the DTP source (`source_type="RSDS"`)
14
+ - `bw_update_dtp` — new `extraction_mode` parameter (`full` / `delta`) to switch an existing DTP between Full (`extractionMode="F"`, `deltaSettingStatus="0"`) and Delta (`extractionMode="D"`, `deltaSettingStatus="2"`); switching modes has BW delta-init implications (a later delta load may require re-initialization)
15
+ - `bw_activate` — new object type `rsds` (with `source_system`) to activate a DataSource
16
+
17
+ ### Improved
18
+
19
+ - `bw_get_request` / `bw_list_requests` — surface the last process status and last action alongside the request status, so a finished green load is no longer reported as "in process"
20
+ - Media-type handling is now fully discovery-driven: the discovery parser reads every `<app:accept>` per collection (previously only the first, so workspaces listing a `+json` variant first fell back to hardcoded media types) and selects the highest-versioned `+xml` type; the query read path leads with the discovered media type
21
+
22
+ ### Fixed
23
+
24
+ - Query reads negotiate the backend content-type version correctly instead of failing with HTTP 415 when the backend returns a version outside the previously hardcoded Accept range (#11)
25
+ - DTP activation no longer fails with a false "transformation inactive" error — the pre-activation priming GET and the activation POST now share one fresh session
26
+ - Adding fields to staging / inbound aDSOs (which have no key elements) no longer produces an invalid element position that was rejected on activation
27
+ - Date (DATS) constants in transformation rules are written in the external date format so they survive activation
28
+ - Transformation rule editing selects the field's own rule (not the global start/end routine rule) on transformations that have a start/end routine
29
+
30
+ ### Notes
31
+
32
+ - The runtime tools (`bw_run_dtp`, `bw_list_requests`, `bw_get_request`, `bw_activate_request`) use the BW/4HANA `/sap/bc/http/sap/bw4/v1/manage` API — the same API the BW/4HANA Cockpit uses — rather than the `/sap/bw/modeling` tool API
33
+ - `bw_activate_request` only applies to aDSOs that have an activation step (not inbound-only staging aDSOs)
34
+
35
+ ---
36
+
37
+ ## [0.7.0] — 2026-05-21
38
+
39
+ ### Added
40
+
41
+ - `bw_get_process_chain` — reads a Process Chain (RSPC) definition via the BW/4HANA-specific endpoint (`/sap/bw/modeling/rspc/{name}/m`, Accept: `application/vnd.sap.bw4.modeling.processchain-v1_0_0+json`); returns header metadata (description, InfoArea, status, version), scheduling attributes (job priority, owner, server, streaming mode), monitoring settings (auto-monitored, error notification, keep-alive, auto-reset), all steps (nodes) with process type, variant, description, last execution status, DECISION branch labels with socket resolution, OR join annotations, and sub-chain references; edges with full conditional flow semantics (positive/negative/neutral, DECISION branch names resolved from socket descriptions); inline variant section; by default (`include_variant_details=true`) automatically fetches and embeds variant configuration for each step via internal calls to `/sap/bw4/v1/modeling/processtypes/{type}/variants/{name}/m` — deterministic, not prompt-driven; types with no variant schema (DTP_LOAD, CHAIN, OR, AND, EXOR, DTP_ADSO) are skipped; set `include_variant_details=false` for structural overview without variant detail; `format="raw"` returns full parsed JSON; use `bw_search` with `object_type=PRCH` to find chain names
42
+ - `bw_get_process_variant` — reads the detail configuration of a single Process Chain step variant from `/sap/bw4/v1/modeling/processtypes/{type}/variants/{name}/m`; generic across all 93 BW/4HANA process types; `oDetail` returned as indented JSON regardless of type — covers ABAP (program + selection variant), ADSOACT (aDSO + NOCONDENSE), ADSOREM (cleanup: days/requests), PLSWITCHL/PLSWITCHP (target aDSO), TRIGGER (full scheduling payload), DECISION (branch formula expressions), and any unknown type; `format="raw"` returns full parsed JSON; process_type and variant_name come from `bw_get_process_chain` output
43
+ - `bw_preview_datasource` — fetches a live data preview from a DataSource (RSDS) via the internal `rsdsint/dataprev` endpoint (`POST /sap/bw/modeling/rsdsint/dataprev/{source_system}/{datasource}?records={n}&external=true`); field names resolved automatically from a prior GET on the DataSource structure; renders a padded plain-text table with proper column alignment; `records` parameter configurable (default 20); handles field/column count mismatch with fallback to `COL_N` headers and warning
44
+
45
+ ### Notes
46
+
47
+ - Process chain support uses the BW/4HANA-specific `/sap/bw4/` API namespace — the same API consumed internally by the BW/4HANA Cockpit (Fiori); `Accept: */*` is used to negotiate the correct media type automatically
48
+ - `bw_get_process_chain` with recursive sub-chain expansion: call the tool again on any CHAIN-type step's variant name to drill into the sub-chain
49
+
50
+ ---
51
+
52
+ ## [0.6.0] — 2026-05-10
53
+
54
+ ### Added
55
+
56
+ - `bw_get_roles` _(Read only)_ — reads the complete BW role hierarchy as shown in the Eclipse BWMT "Publish to Role" dialog; returns ROLE and FOLDER nodes with technical names, descriptions, and nodeids; optional `role_filter` parameter limits output to roles whose name starts with the given prefix (e.g. `"BW:"`); endpoint: `GET /sap/bw/modeling/comp/roles?level=10&requestchk=true&readleaves=false`
57
+ - `bw_get_role_queries` _(Read only)_ — lists all BW Queries published in the role hierarchy, grouped by role and folder; only `SAP_BW_QUERY` objects are returned — PFCG menu entries of other types (e.g. AFO workbooks added as transactions) are not included; uses `readleaves=true` on the same endpoint to retrieve `<leaf>` elements
58
+ - `bw_get_query_roles` _(Read only)_ — returns all roles and folders where a specific BW Query is currently published; uses the `ancof` (ancestor-of) parameter: `GET /sap/bw/modeling/comp/roles?type=SAP_BW_QUERY&ancof=<QUERYNAME>`
59
+ - `bw_set_query_roles` — publishes or removes a BW Query from a role or folder; supports `action="add"` and `action="remove"`, `target_type="role"` or `target_type="folder"`; for role-level add operations the full role subtree (folders + nodeids) is fetched from `bw_get_roles` and sent as `state="unchanged"` children in the PUT body; uses `PUT /sap/bw/modeling/comp/roles?type=SAP_BW_QUERY&ancof=<QUERYNAME>`
60
+ - `BwClient.rawPut()` — new HTTP PUT helper on the shared BW client; sends a raw request body with caller-controlled headers using a fresh axios instance and the current session cookie; used by `bw_set_query_roles`
61
+
62
+ ---
63
+
64
+ ## [0.5.0] — 2026-05-03
65
+
66
+ ### Added
67
+
68
+ - `bw_query_data` _(Read only)_ — executes a BEx Query or previews data from an InfoProvider (aDSO, CompositeProvider) via the BICS reporting endpoint (`/sap/bw/modeling/comp/reporting`); parameters: `comp_id`, `is_provider` (adds `!` prefix for direct provider access), `state` (axis layout — ROWS/COLUMNS/FREE — plus per-characteristic filters supporting EQ/BT/GT/LT/GE/LE operators, include/exclude, external key, internal GUID key with `presentationMode="INT"`, and hierarchy-node filters via `nodeId=1`), `variables` (fills query variables; name and id must be copied verbatim from the GET response as they are session-specific and may contain trailing spaces), `from_row`/`to_row` (pagination), `drill_operations` (expand or collapse hierarchy and structure nodes by 1-based tuple index: `drill_state=3` expands, `drill_state=2` collapses), `format` (`text` default — formatted table with hierarchy indentation; `raw` — XML); all reporting calls use `X-sap-adt-sessiontype: stateless`; CSRF retry: on HTTP 403 the cached token is cleared and the request is retried once automatically
69
+ - `bw_get_filter_values` _(Read only)_ — looks up valid characteristic values before setting filters or variables; returns both `CHAVL_EXT` (use for state filters, `presentationMode="EXT"`) and `CHAVL_INT` (use for variable inputs); supports wildcard search (`*` for all, prefix match e.g. `2022*`); parameters: `characteristic_name`, `search_string`, `info_provider` (optional, scopes values to a specific provider), `max_rows` (default 201)
70
+
71
+ ### Improved
72
+
73
+ - `bw_get_query` — added `format` parameter: `text` (new default) renders a compact human-readable summary covering settings, variables, filter, layout (rows/columns/free characteristics), CKFs, RKFs, exceptions, and cell definitions; `raw` returns the full parsed JSON (previous behaviour)
74
+ - `BwClient` — added `rawGet()` helper (shared session GET with caller-controlled headers, used by all reporting calls); CSRF token TTL of 4 minutes so that `ensureCsrf()` proactively re-fetches the token before SAP's ~5-minute session idle timeout expires (prevents "CSRF token has expired" failures in environments with slow tool-call approval); `clearCsrfToken()` public method exposed for use by retry logic
75
+
76
+ ---
77
+
78
+ ## [0.4.0] — 2026-04-26
79
+
80
+ ### Added
81
+
82
+ - `bw_get_dataflow` _(Read only)_ — reads the complete structural data flow of any BW object (ADSO, RSDS, HCPR, TRFN, DTPA, IOBJ, TRCS, LSYS) using the same transient dataflow graph that Eclipse BWMT renders; supports direction (upwards / downwards / both), configurable depth levels, and format "text" | "raw"; text output uses tree rendering for ≤ 30 nodes and flat table for larger graphs
83
+ - `bw_list_source_systems` — lists all logical source systems (LSYS) registered in BW, optionally filtered by type (ODP_BW, ODP_SAP, ODP_CDS, ODP, FILE); returns name, description, type, status, and `children_path`
84
+ - `bw_list_datasources` — recursively traverses the full APCO hierarchy under a source system and lists all DataSources with name, description, status, and APCO path; format: `text` (default table) or `raw` (XML feed bodies)
85
+ - `bw_get_source_system` — reads full metadata of a single LSYS including type, description, connection details (ODP context/destination, HANA remote source/schema/SDI adapter)
86
+ - `bw_get_datasource` — reads complete DataSource structure: all fields with type, length, precision/scale, transfer flag, key flag, position, selection options, conversion exit, unit/currency reference, and active adapter config; format: `text` (default) or `raw` (XML)
87
+
88
+ ### Improved
89
+
90
+ - `bw_xref` — new optional `source_system` parameter; required when `object_type=RSDS`; correct space-padded 40-character objectName (datasource padded to 30 + source system) is built automatically; explicit error thrown if omitted for RSDS
91
+ - `bw_get_transformation` — `raw` boolean replaced by `format: "text" | "raw"` parameter; `format="raw"` returns clean XML without wrapper header lines
92
+ - `bw_get_datasource`, `bw_list_datasources`, `bw_get_transformation` — unified `format: "text" | "raw"` parameter pattern across all three tools
93
+ - `bw_xref` tool description — documents that `object_type=DTPA` returns the process chain(s) a DTP belongs to, preferred over `bw_get_dtp` when only the process chain is needed
94
+ - `bw_get_dtp` tool description — documents that `bw_xref` with `object_type=DTPA` is the faster alternative when only process chain membership is needed
95
+
96
+ ---
97
+
98
+ ## [0.3.0] — 2026-04-24
99
+
100
+ ### Added
101
+
102
+ - `bw_get_composite_provider` _(Read only)_ — reads a CompositeProvider (HCPR) structure: view node type (Union/Join), source providers with input mapping counts, all fields with dimension classification, join conditions, and temporal join details (extended from v0.2.0: field-level detail and join conditions fully parsed)
103
+ - `bw_get_ckf` _(Read only)_ — reads a global Calculated Key Figure with recursively resolved human-readable formula and full dependency graph of all referenced CKF/RKF sub-components
104
+ - `bw_get_rkf` _(Read only)_ — reads a global Restricted Key Figure: base measure resolved by name, all characteristic restriction groups with field and value details, and metadata
105
+ - `bw_get_structure` _(Read only)_ — reads a global Structure: all members with Formula/Selection breakdown, referenced components, characteristic filters, optional child members, and metadata
106
+ - `bw_list_contents` _(Read only)_ — navigates the full BW repository tree (InfoArea → type folder → object → sub-folder), mirroring the Eclipse BWMT Project Explorer; each entry includes `children_path` for seamless drill-down
107
+
108
+ ---
109
+
110
+ ## [0.2.0] — 2026-04-19
111
+
112
+ ### Added
113
+
114
+ - `bw_get_query` — new read-only tool for BW Queries
115
+ - Reads active version (`/A`) with automatic fallback to inactive (`/M`)
116
+ - Parses all subComponents: Variables, Calculated Key Figures (CKFs), Restricted Key Figures (RKFs)
117
+ - CKF formulas recursively resolved to human-readable strings: InfoObject names, cross-references between CKFs/RKFs, variable references, `IF` / `NOERR` / `NODIM` operators
118
+ - RKF selection conditions fully parsed: key figure restrictions, characteristic restrictions, component references
119
+ - Full layout parsing: columns, rows, free characteristics — both simple Dimensions and CustomDimensions (reusable structures)
120
+ - CustomDimension members fully parsed including nested `childMembers` — inline RKFs with selection conditions and inline formulas with local member name resolution
121
+ - Filter area: fixed values, variable references, mixed selections (variable + fixed value on same InfoObject)
122
+ - Exceptions with alert levels, thresholds, cell coordinates, and evaluation flags
123
+ - Grid cells and help cells fully parsed (cross-table layout queries)
124
+ - Query-level settings: zero suppression, planning mode, result position, RFC/OData/easyQuery flags, sign presentation
125
+
126
+ ---
127
+
128
+ ## [0.1.0] — 2026-04-17
129
+
130
+ ### Added
131
+
132
+ - Initial public release as pre-release (v0.1.0)
133
+ - aDSO: create, update (fields, settings, keys, field properties), delete — including write-interface (`pushMode`)
134
+ - InfoObject: create CHA + KYF, update attributes (DIS/NAV), delete
135
+ - InfoArea: create, move objects
136
+ - InfoSource (TRCS): create with/without template, update fields, delete
137
+ - Transformation: create (all source/target types), update (direct mapping, formula, field routines ABAP+AMDP, start/end routines), activate
138
+ - DTP: create, update (description + value filter), set filter routine
139
+ - Push API: `bw_push_data`, `bw_get_push_schema`
140
+ - General: search (`bw_search`), activate (`bw_activate`), where-used/xref (`bw_xref`), release locks (`bw_unlock`), delete (`bw_delete`)
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 dnic-dev
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.