Skip to main content
Glama
bw-modeling-mcp

bw-modeling-mcp

by dnic-dev

bw-modeling-mcp

A Model Context Protocol (MCP) server that enables AI assistants like Claude to work directly inside SAP BW/4HANA or SAP BW 7.5 on HANA systems — reading, creating and modifying BW modeling objects via the same internal SAP APIs that Eclipse BWMT and the BW/4HANA Cockpit use: the BW Modeling REST API (/sap/bw/modeling/) for objects, queries and live data, the ADT API (/sap/bc/adt/) for the ABAP and AMDP routines BW generates, the BW/4HANA manage API for the request monitor and runtime, and the Push API (/sap/bw4/) for data loads.

This is not a simulation. Every tool call connects to a live BW system — write operations produce real changes.


☁️ Running on SAP BTP Cloud Foundry

Central MCP server for AI-assisted SAP BW modeling: MCP-capable AI clients connect via OAuth to bw-modeling-mcp, whose analyst, reader and developer roles reach on-premise, private cloud and BW Bridge systems via principal propagation

Besides stdio, the server can run as an HTTP service on SAP BTP Cloud Foundry with XSUAA OAuth in front and a BTP destination behind — either a shared technical user (BasicAuthentication) or principal propagation, where each caller reaches BW as themselves and BW applies their own authorizations.

Three role collections decide what a user is offered: BW MCP Reader (everything that only reads), BW MCP Analyst (a small reporting client — run queries and understand what they return) and BW MCP Developer (everything, including changes). stdio is unchanged — npm start behaves exactly as before. Setup: docs/CENTRAL-HOSTING-SETUP.md (step-by-step) and docs/CLOUD-FOUNDRY.md (reference).

What central hosting changes

Scenario

stdio only

Hosted on BTP

One analyst, one BW system

runs on the analyst's machine

server-side, the analyst logs in with their own identity

Several analysts, one server

not possible, no central auth

all log in via BTP, each caller's identity reaches BW

Tool permissions

none — whoever runs it can call every tool

granted per role, independent of BW authorizations: a BW developer can be read-only in the MCP, or the querying tools can be withheld from someone who may otherwise view data

BW authorizations

enforced through the user's own credentials

unchanged, still fully enforced — with principal propagation each caller acts as themselves, never as a shared identity

Audit trail

limited

XSUAA logs every login; with principal propagation the BW session log shows the real user

A new tool stays unavailable to read-only callers until it is explicitly classified as a read, so the surface never widens by accident; write implies read, never the reverse. The three role collections are a starting point and can be split further in xs-security.json. Principal propagation additionally needs a certificate rule and ICM trust on the BW side.


Related MCP server: abap-adt-mcp

System Compatibility

System

Support

SAP BW/4HANA (all versions)

✅ Full support

SAP BW Bridge (SAP BTP ABAP stack)

✅ Via cookie authentication (BW_COOKIE_FILE)

SAP BW on HANA (7.5)

✅ Modelling reads after a small ABAP enhancement, and modelling writes for every object type that has a REST resource there — InfoObjects, aDSOs, InfoAreas, InfoSources, CompositeProviders, Open Hub Destinations, queries and their reusable components, aggregation levels. The tool surface adjusts to what the system publishes, and the objects without a REST resource — including planning, chain runs and the APD — are read from their metadata tables. bw_system_profile states per write tool what was verified there. See BW 7.5 Support


A two-part blog series about this project (both available in German and English):

  1. Agentic AI meets SAP BW — the full story behind this project: why I built it, what's inside, what happens when Claude walks through a complete BW data lineage on its own. https://www.nextlytics.com/blog/agentic-ai-meets-sap-bw

  2. Agentic AI in practice: MCP server for SAP BW/4HANA — how the server is operated company-wide on SAP BTP Cloud Foundry with role-based access and per-user identity, plus two real customer projects. https://www.nextlytics.com/blog/agentic-ai-in-practice-mcp-server-for-sap-bw/4hana


🆕 What's New — v2.0.0 · 21 Tools Instead of 134

The largest release so far, in two directions at once: the model now works with a tool surface a third the size, and the write paths have been checked operation by operation against what BW actually accepts — so a change the server reports as saved also activates.

🎯 Focused tool surface, now the default

  • 21 tools instead of 134. Each focused tool stands for a group of operations and selects one through its type or operation parameter: bw_read reads any object type, bw_write_adso creates and changes aDSOs, bw_activate checks, activates and unlocks. Nothing was removed — every operation is still there, with the same parameters and behaviour

  • A third of the context. The tool definitions take about a third of the space they took before, which leaves the model more room for the actual work. In our tool-selection benchmark it picked the right operation as often on the focused surface as on the full one

  • bw_describe on demand. The focused tools carry short parameter notes; bw_describe(tool, operation) returns the complete definition of one operation when the model needs it, and a wrong or missing operation is refused with the allowed values before anything reaches BW

  • Roles and platform still apply per operation: a Reader sees only the reading operations, and a BW 7.5 system only what it can answer

Upgrading to 2.0

The one breaking change: clients now see the focused tool names.

  • Allowlists and permission settings that name full tools (bw_get_adso, bw_update_transformation, …) need the focused names (bw_read, bw_write_transformation, …) — or set BW_TOOL_MODE=full to keep the full surface exactly as it was

  • Scripts and automations that call the server directly with full tool names keep working without a change: a full tool name sent to the server is answered in either mode

  • Skills and prompts that name full tools in their text are best moved to the focused names — an agent can only pick from the tools it is shown — or run with BW_TOOL_MODE=full

  • Hosted on SAP BTP: role collections and scopes are unchanged

  • The mapping from every full tool to its focused tool and operation is in Tool modes

On every release (BW/4HANA and BW 7.5)

✅ Check before you activate

  • New bw_check (operation check of bw_activate) — runs the activation checks on the saved version of an object, as "Check" in the modeling tools does, without activating anything and without a lock. The answer says whether the object would activate and why not. It is a read operation, so read-only users can use it too

🧱 Writes that activate the first time

  • aDSO — a type change now writes the type as a whole and drops what the new type cannot carry; removing a field removes its key, partition and index entries with it; an InfoObject brings its compounding parents along; key fields are checked before they are saved, and every one of these is reported in the answer

  • CompositeProvider — update_join gives both sides of a join key the common target field BW requires, a compounded field brings its compounding parent, and mapping an input again no longer leaves duplicate fields behind

  • InfoObject — attributes can be key figures, units and time characteristics, display attributes can be time-dependent, and a navigation attribute BW would refuse is refused before anything is written

🆕 New capabilities

  • Open Hub Destinations can be created from an aDSO or CompositeProvider and changed — table and file destinations, write mode, key, fields and file properties (bw_create_open_hub, bw_update_open_hub)

  • Partitions and data tiering of an aDSO — static range partitions or dynamic partitioning (manage_partitions), hot and warm storage per object or per partition

  • Master data, text and hierarchy properties of a characteristic — text lengths, language- and time-dependent texts, hierarchies with version and time dependency

BW/4HANA

🔀 Transformations and DTPs

  • The rule of a field can be changed from any type to any other — direct, time conversion, constant, formula, routine with several source fields, lookup — and a lookup binds every key field of the object it reads from

  • bw_update_dtp takes the execution settings: package size and parallel extraction, request selection, error handling, SAP HANA execution and the batch manager. Each value is checked against what the server admits for that DTP, so an inadmissible setting is refused with the admissible ones instead of an HTTP 500 without a message

📤 Open Hub from a query

  • A query can be released as an InfoProvider and used as the template and source of an Open Hub Destination, so the result of a query lands in a table or file through a DTP

Also in this release

  • Query structures: where a hierarchy holds a text node and a characteristic value of the same name, node_type says which one a restriction means, and switch_hierarchy keeps the kind of each node (#52)

  • Fixed: bw_update_infoobject reported a refused activation as success — the answer now carries the server's messages and says that the change is saved but not active; a characteristic with a compounded attribute can be changed again; bw_run_dtp says when a delta found nothing to load instead of reporting a started request; bw_get_request refuses a malformed request id instead of returning the whole process history; texts with & or quotes no longer break a save


Earlier releases — the "What's New" notes for v1.10.0 and older are archived in WHATS_NEW.md; the full structured history is in CHANGELOG.md.


What it can do

An overview by area. Every tool in detail — parameters, behaviour, and the sequences it belongs in — is in the Tools Reference (134 operations behind 21 focused tools).


Combining with an ADT MCP Server

bw-modeling-mcp works best alongside an ADT MCP server such as vibing-steampunk or ARC-1. The two do not overlap as much as it may look.

This server owns the BW object and, with it, the body of the ABAP that BW generated for that object: the class behind a transformation routine, the program behind a DTP filter routine. Write those through bw_set_transformation_routine, bw_set_transformation_expert_routine and bw_set_dtp_filter_routine rather than through ADT — they do not only replace the source, they save the transformation master back afterwards, which is what re-registers the code in the transportable metadata. A class-only edit survives until the next regeneration or transport and is then gone.

The ADT MCP server covers ABAP as a subject in its own right: your own reports, classes, function modules and DDIC tables, repository search and navigation, arbitrary table reads, debugging, ATC, unit tests, dumps and transports. Together they cover the full cycle from BW object to ABAP logic.


Requirements

  • SAP BW/4HANA system with the internal SAP APIs enabled (SAP BW 7.5 works for modeling reads and most modelling writes once the enhancement in bw75/BW75-SUPPORT.md is in place)

  • Node.js 22 or later

  • An MCP-compatible AI client (Claude Desktop, Claude Code, etc.)


Installation

Two ways to run. Locally as a stdio server (one user, one machine — the steps below), or centrally hosted on SAP BTP Cloud Foundry behind XSUAA OAuth for a whole team → see docs/CENTRAL-HOSTING-SETUP.md. The installation and configuration below cover local stdio use. Upgrading from 1.x: see Upgrading to 2.0.

# Option 1: Install via npm (recommended)
npm install -g bw-modeling-mcp

# Option 2: Clone and build
git clone https://github.com/dnic-dev/bw-modeling-mcp.git
cd bw-modeling-mcp
npm install
npm run build

Configuration

For local (stdio) use, the server is configured via environment variables. For central BTP hosting, connection and credentials come from the BTP destination and service bindings instead — see docs/CENTRAL-HOSTING-SETUP.md.

Variable

Description

Required

BW_URL

BW system URL (e.g. https://myhost:50001)

yes

BW_USER

SAP user name

yes (or BW_COOKIE_FILE)

BW_PASSWORD

SAP password

yes (or BW_COOKIE_FILE)

BW_CLIENT

SAP client (e.g. 001)

yes

BW_LANGUAGE

Language for object texts (e.g. EN, DE). Default: DE

no

BW_COOKIE_FILE

Path to a browser-exported cookie file for SAML-/OAuth-fronted systems (e.g. BW Bridge). Netscape or name=value format. When set, BW_USER / BW_PASSWORD are optional.

no

BW_MCP_SERVER_NAME

Server name advertised in the MCP initialize handshake. Default: bw-modeling-mcp. Give each instance a unique name when running several against different BW systems.

no

BW_MCP_SYSTEM_LABEL

Free-text label of the connected BW system (e.g. AP4 (BW production, read-only)), put at the top of the MCP server instructions. Lets a model tell look-alike instances apart even in clients that show an opaque connector id instead of the server name.

no

BW_TOOL_MODE

focused (default) or full. The default offers 21 tools: each stands for a group of operations and selects one through its type or operation parameter, and bw_describe gives the complete parameter definition of any operation. full offers every operation as a tool of its own (134 on BW/4HANA, three times the tool payload in the model's context) for clients that hold allowlists or scripts on the full tool names. See Tool modes.

no

BW_PLATFORM

auto (default), classic or bw4. The server detects whether it is talking to BW/4HANA or a classic release and offers only the tools that release can answer. classic forces that verdict when detection cannot run, bw4 switches the filter off. See bw75/BW75-SUPPORT.md.

no

BW_SESSION_CLOSE

on (default) or off. The server ends the SAP sessions of a tool call once it is answered, and all remaining ones when it stops. Set off only behind a proxy that holds the SAP session itself.

no

Cookie authentication (BW Bridge / SAP BTP): For BW systems that sit behind a SAML or OAuth login (such as BW Bridge on the SAP BTP ABAP stack), Basic Auth is not available. Export the authenticated session cookies from your browser into a file and point BW_COOKIE_FILE at it. The login/session approach is analogous to vibing-steampunk and ARC-1. When the session expires, refresh the cookie file and restart the server.

Claude Desktop

Add to claude_desktop_config.json:

{
  "mcpServers": {
    "bw-modeling-mcp": {
      "command": "node",
      "args": ["/path/to/bw-modeling-mcp/dist/stdio.js"],
      "env": {
        "BW_URL": "https://your-bw-host:50001",
        "BW_USER": "YOUR_USER",
        "BW_PASSWORD": "YOUR_PASSWORD",
        "BW_CLIENT": "001",
        "BW_LANGUAGE": "EN"
      }
    }
  }
}

Claude Code (VS Code extension)

Add .mcp.json to your project root:

{
  "mcpServers": {
    "bw-modeling-mcp": {
      "command": "node",
      "args": ["/path/to/bw-modeling-mcp/dist/stdio.js"],
      "env": {
        "BW_URL": "https://your-bw-host:50001",
        "BW_USER": "YOUR_USER",
        "BW_PASSWORD": "YOUR_PASSWORD",
        "BW_CLIENT": "001",
        "BW_LANGUAGE": "EN"
      }
    }
  }
}

How it works

The server talks to four SAP APIs, and only one of them needs a protocol worth describing.

The BW Modeling REST API (/sap/bw/modeling/) is a full-document API: there is no way to change one attribute of an object. Every write therefore runs the same six steps.

  1. Lock — acquires an exclusive lock and returns a lockHandle

  2. Read — fetches the current complete XML of the object

  3. Modify — applies the change to that XML

  4. PUT — sends the whole document back, never a fragment

  5. Activate — promotes the inactive version to the active one

  6. Unlock — releases the lock

Two consequences are worth knowing. Saving and activating are separate: a document the server accepts can still fail to activate, so a successful write proves less than it appears to. And because the whole document travels, a read that came from a stale session buffer will silently write old values back — the tools read fresh for exactly this reason.

The other three need none of it. The ADT API (/sap/bc/adt/) is used narrowly and always for an object BW generated itself: the body of a transformation routine (its generated class), the body of a DTP filter routine (its generated program), the DataPreview service behind bw_read_metadata_tables, plus transport checks and activation runs. Everything else ABAP — writing your own reports, classes or DDIC tables, searching the repository, reading arbitrary tables, debugging — is the job of an ABAP ADT MCP server alongside this one, see Combining with an ADT MCP Server. The BW/4HANA manage API (/sap/bc/http/sap/bw4/) answers the request monitor, the remodeling monitor and runtime operations. The Push API (/sap/bw4/v1/push/) takes a JSON record array straight into a write-interface aDSO.

Session cookies and CSRF tokens are handled for all four.

See ARCHITECTURE.md for the full technical architecture and the complete endpoint reference.


Contributing

Issues and feature requests are welcome — please use the Issue templates.

If you have access to a BW/4HANA system and want to help expand coverage, I am happy to hear from you. The best way to contribute is to try it out and report what works, what doesn't, and what's missing.


License

MIT

Available Tools

21 tools
bw_activateA

Activate an object with the lock handle a write returned, check it without activating, release a lock, or activate a process chain. The operation enum lists every operation with what it requires; bw_describe(tool: "bw_activate", operation: "…") gives the complete parameter definition of one.

Inputs: operation (required), name, transport, lock_handle, +3 more.

bw_dataA

Work with data rather than definitions: filter values, DataSource preview, push into a write-interface aDSO, selective deletion, save an Analysis for Office workbook. The operation enum lists every operation with what it requires; bw_describe(tool: "bw_data", operation: "…") gives the complete parameter definition of one.

Inputs: operation (required), mode, name, role, +18 more.

bw_deleteB

Delete a BW object permanently. The operation enum lists every operation with what it requires; bw_describe(tool: "bw_delete", operation: "…") gives the complete parameter definition of one.

Inputs: operation (required), object_name, object_type.

bw_describeA

Describe the focused tools: without arguments the catalogue of every tool and its operations; with tool and the operation value (type for bw_read, operation otherwise) the complete parameter definition of that operation.

Inputs: tool, type, operation.

bw_findA

Find BW objects and their relations: search by name, cross references, folder contents, data flows, source systems and DataSources, roles and their queries, metadata tables, system profile. The operation enum lists every operation with what it requires; bw_describe(tool: "bw_find", operation: "…") gives the complete parameter definition of one.

Inputs: operation (required), name, path, role, +18 more.

bw_manageB

Repository management: InfoAreas, moving objects, package and transport assignment, transport tasks. The operation enum lists every operation with what it requires; bw_describe(tool: "bw_manage", operation: "…") gives the complete parameter definition of one.

Inputs: operation (required), name, user, package, +12 more.

bw_monitorA

Monitor loads and runs: requests, process chain runs and their steps, remodeling requests, query statistics. The operation enum lists every operation with what it requires; bw_describe(tool: "bw_monitor", operation: "…") gives the complete parameter definition of one.

Inputs: operation (required), to, top, from, +25 more.

bw_query_dataC

Run a query or read a provider and return its data. The operation enum lists every operation with what it requires; bw_describe(tool: "bw_query_data", operation: "…") gives the complete parameter definition of one.

Inputs: operation (required), state, format, to_row, +6 more.

bw_readA

Read the definition of one BW object. type selects the object type, name is its technical name. The type enum lists every operation with what it requires; bw_describe(tool: "bw_read", type: "…") gives the complete parameter definition of one.

Inputs: name (required), type (required), kind, format, +8 more.

bw_runB

Execute: run a DTP, start a process chain or repeat a failed step, activate or delete a request, run a remodeling request. The operation enum lists every operation with what it requires; bw_describe(tool: "bw_run", operation: "…") gives the complete parameter definition of one.

Inputs: operation (required), name, start, action, +13 more.

bw_write_adsoC

Create or change an aDSO: structure, keys, settings, planning mode. The operation enum lists every operation with what it requires; bw_describe(tool: "bw_write_adso", operation: "…") gives the complete parameter definition of one.

Inputs: operation (required), mode, label, action, +17 more.

bw_write_composite_providerB

Create or change a CompositeProvider. The operation enum lists every operation with what it requires; bw_describe(tool: "bw_write_composite_provider", operation: "…") gives the complete parameter definition of one.

Inputs: operation (required), label, action, inputs, +25 more.

bw_write_datasourceB

Create a DataSource, set its fields, change its delta process. The operation enum lists every operation with what it requires; bw_describe(tool: "bw_write_datasource", operation: "…") gives the complete parameter definition of one.

Inputs: operation (required), fields, transport, description, +6 more.

bw_write_dtpB

Create or change a DTP, including its filters and a filter routine. The operation enum lists every operation with what it requires; bw_describe(tool: "bw_write_dtp", operation: "…") gives the complete parameter definition of one.

Inputs: operation (required), package, dtp_name, transport, +40 more.

bw_write_infoobjectA

Create or change an InfoObject and its hierarchies. The operation enum lists every operation with what it requires; bw_describe(tool: "bw_write_infoobject", operation: "…") gives the complete parameter definition of one.

Inputs: operation (required), name, nodes, length, +33 more.

bw_write_infosourceB

Create or change an InfoSource. The operation enum lists every operation with what it requires; bw_describe(tool: "bw_write_infosource", operation: "…") gives the complete parameter definition of one.

Inputs: operation (required), name, fields, package, +8 more.

bw_write_open_hubB

Create or change an Open Hub Destination. The operation enum lists every operation with what it requires; bw_describe(tool: "bw_write_open_hub", operation: "…") gives the complete parameter definition of one.

Inputs: operation (required), fields, package, directory, +25 more.

bw_write_planningA

Create or change planning objects: aggregation levels, planning functions, sequences, filters, conversion types. The operation enum lists every operation with what it requires; bw_describe(tool: "bw_write_planning", operation: "…") gives the complete parameter definition of one.

Inputs: operation (required), kind, name, rule, +33 more.

bw_write_process_chainA

Create or change a process chain: steps, edges, DTP and program steps, error links, decision variants. The operation enum lists every operation with what it requires; bw_describe(tool: "bw_write_process_chain", operation: "…") gives the complete parameter definition of one.

Inputs: operation (required), to, dtp, dtps, +37 more.

bw_write_queryA

Create or change a query and its reusable components: layout, filter, key figures, characteristics, cells, exceptions, settings, restricted and calculated key figures, structures, variables, role assignments. The operation enum lists every operation with what it requires; bw_describe(tool: "bw_write_query", operation: "…") gives the complete parameter definition of one.

Inputs: operation (required), unit, action, formula, +55 more.

bw_write_transformationB

Create a transformation, change the rule of a field, and set or remove its routines and runtime. The operation enum lists every operation with what it requires; bw_describe(tool: "bw_write_transformation", operation: "…") gives the complete parameter definition of one.

Inputs: operation (required), fields, source, formula, +28 more.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    B3.4/5.0

    Scored across 21 tools

    Disambiguation3/5

    The write_* tools are mostly distinct by BW object type, but several broad tools overlap: bw_run, bw_activate, bw_monitor, bw_data, and bw_query_data have fuzzy boundaries around execution, activation, monitoring, and data access. The operation enums and bw_describe help, but an agent can still struggle to pick the right tool without inspecting operations.

    Naming Consistency4/5

    All tools use a consistent bw_ prefix and snake_case, with most following a predictable verb_noun pattern such as bw_write_adso or bw_query_data. Minor deviations exist, notably bw_data as a noun and broad verbs like bw_manage, but the convention is still readable and predictable.

    Tool Count4/5

    At 21 tools, the surface is on the heavy side, but SAP BW is a broad modeling domain and the write_* tools map to distinct object types rather than duplicating functionality. Each tool has a plausible role, though the count sits at the upper end of practical.

    Completeness4/5

    The surface covers major BW modeling objects and lifecycle actions: read/find, write for key object types, activate, delete, run, monitor, query data, and repository management. Minor gaps may exist for less common object types or administrative operations, but core modeling workflows appear well covered.

    Maintenance

    ActivityActive
    ResponsivenessUsually handled

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      A
      quality
      D
      maintenance
      Enables AI agents to read, write, activate, and transport ABAP code in SAP systems via ABAP ADT REST API, without needing SAP GUI.
      24
      323 npm
      MIT
    • A
      license
      Not graded
      quality
      D
      maintenance
      A Model Context Protocol (MCP) server that enables AI assistants like Claude to work directly inside SAP BW/4HANA systems — reading, creating and modifying BW modeling objects via the internal REST API used by Eclipse BWMT.
      545 npm
      MIT