SAP-samples/cap-agentic-engineered
A Financial Risk Analyzer built to show what changes when a coding agent is grounded by SAP's MCP servers rather than left to its training data — and it ships the AGENTS.md and skills that did the grounding.
The claim that agents write better SAP code when pointed at live documentation is usually asserted. This is the argument made as an application: a CAP service classifying general-ledger transactions as normal or anomalous over twenty-four engineered features, with an OData V4 service, a Fiori Elements UI and SAP AI Core behind it. What travels beyond the demo is the grounding itself — a reusable AGENTS.md carrying MCP routing rules, and a skills/ folder that triggers on file patterns, routing the agent to the CAP server for models and services, the Fiori server for annotations and the UI5 server for controllers.
Facts
Where it sits
Who is behind it
In the atlas: maintains 222@SAP-samplesmaintainerGuilherme SegantiniContributes to this
In the atlas: contributes to 2, wrote 1@guilherme-segantini1 contributor
What it declares
Every artifact
- Type
- Sample
- Origin
- By SAP
As a sample
- Form
- A reference application
Connections
Packaged knowledge that teaches a coding agent a framework
Calling a language model with tenant and credential handling solved
Whole applications to read rather than snippets to copy
Download
README
quoted from SAP-samples/cap-agentic-engineered under Apache-2.0, readMCP-Grounded SAP Development -- CAP + Fiori Elements Reference Application
A reference application showing how AI coding agents produce higher-quality SAP applications when grounded by SAP MCP servers. The app was built entirely by Claude Code following specs generated by GSD, a spec-driven development tool. The AGENTS.md and skills/ provided the SAP-specific guardrails, routing the agent to the right MCP server (CAP, Fiori, UI5) for each task.
What you get:
- A working Financial Risk Analyzer as concrete evidence of the methodology
- A reusable
AGENTS.mdand skills that tell AI coding agents which MCP server to query for each SAP artifact — portable across Claude Code, Cursor, Copilot, and other MCP-capable tools - The
spec/folder with the specs that drove the build — project roadmap, phased requirements, success criteria, and execution logs - Test suite covering service behavior, annotations, i18n, and manifest correctness
The Application
The Financial Risk Analyzer classifies General Ledger transactions as normal or anomalous using 24 engineered financial features. It exposes an OData V4 service with a Fiori Elements List Report and an unbound action that triggers batch ML inference via SAP AI Core.
Key capabilities:
- CDS data model with 24 feature columns for ML risk scoring
- Unbound OData action (
analyzeRisks) for batch inference across all transactions - Fiori Elements List Report with custom toolbar action and criticality-based highlighting
- SAP AI Core integration for XGBoost model predictions, with a built-in mock predictor for local development
- Role-based access control (RiskAnalyst role for analysis actions)
Prerequisites
- Node.js >= 18
- SAP CAP (
@sap/cds-dk) installed globally:npm i -g @sap/cds-dk - (Optional) SAP AI Core instance for live ML predictions -- the app runs fully locally with the mock predictor
Setup and Run
npm ci
cds watch
Open http://localhost:4004/risk/webapp/index.html in your browser.
Log in with user test-analyst / password pass (mocked authentication in development profile).
Environment Variables (Optional)
To connect to SAP AI Core for live predictions instead of the mock predictor, copy .env.example to .env and fill in your BTP service key credentials:
cp .env.example .env
# Edit .env with your SAP AI Core credentials
Set AI_CORE_MOCK=true (the default) to use the built-in mock predictor without any external services.
Running Tests
npm test
The test suite includes:
| Test | What it verifies |
|---|---|
test/integration/risk-service.test.js | OData service behavior, CRUD, action execution |
test/integration/annotations.test.js | CDS annotation correctness |
test/unit/feature-extractor.test.js | Feature engineering logic |
test/unit/ai-core-client.test.js | AI Core client with mocked responses |
test/unit/i18n.test.js | All i18n keys used in code exist in properties file |
test/unit/manifest.test.js | Manifest.json structure and route configuration |
test/unit/risk-labels.test.js | Risk classification label mappings |
test/feature-columns.test.js | Feature column definitions and ML contract |
Repository Structure
cap-agentic-engineered/
+-- AGENTS.md # MCP routing rules and SAP development patterns (reusable)
+-- db/
| +-- schema.cds # GLTransactions entity with 24 ML feature columns
| +-- data/ # Sample GL transaction data (CSV)
+-- srv/
| +-- risk-service.cds # OData V4 service definition with unbound action
| +-- risk-service.js # Service handler with AI Core integration
| +-- lib/
| +-- ai-core-client.js # SAP AI Core inference client
| +-- mock-predictor.js # Local mock predictor (no AI Core needed)
| +-- feature-extractor.js # 24-feature engineering pipeline
| +-- feature-columns.js # ML contract: CDS field <-> model feature mapping
| +-- risk-labels.js # Risk classification labels and criticality
+-- app/
| +-- services.cds # Service binding for Fiori app
| +-- risks/
| +-- annotations.cds # UI annotations (LineItem, SelectionFields, etc.)
| +-- webapp/
| +-- manifest.json # Fiori Elements List Report configuration
| +-- ext/controller/ListReportExt.controller.js # Custom action handler
+-- test/ # Unit and integration tests
+-- spec/ # GSD specs: roadmap, phased requirements, execution logs
+-- skills/ # SAP MCP skills (auto-trigger on file patterns)
Reusing the AGENTS.md and Skills
The AGENTS.md defines which MCP server to query for each type of SAP artifact — CDS models, Fiori annotations, UI5 controllers — so the generated code is grounded in live API documentation rather than stale training data. The skills in skills/ enforce those rules automatically: when the agent touches a file matching a skill's path pattern (e.g., srv/**/*.cds), the skill fires and instructs it to query the correct MCP server before writing code.
Copy AGENTS.md and skills/ into your own CAP + Fiori Elements project, configure the MCP servers in .claude/settings.json (instructions inside the file), and your AI coding agent will automatically query the right server for each task.
Scope
This application is designed for local development only. It demonstrates the MCP-grounded methodology and the resulting application quality — not a production ready app. For a comprehensive CAP reference covering BTP deployment, HANA, XSUAA, draft editing, compositions, and multi-app frontends, see SAP-samples/cap-sflight.
How to Obtain Support
This repository is provided as-is. For questions about SAP CAP, Fiori Elements, or AI Core, use the SAP Community.
For questions about Claude Code or MCP, see the Claude Code documentation.
Contributing
If you wish to contribute code, offer fixes or improvements, please send a pull request. Due to legal reasons, contributors will be asked to accept a DCO when they create the first pull request to this project. This happens in an automated fashion during the submission process. SAP uses the standard DCO text of the Linux Foundation.
License
Copyright (c) 2026 SAP SE or an SAP affiliate company and cap-agentic-engineered contributors. This project is licensed under the Apache Software License, version 2.0 except as noted otherwise in the LICENSE file.
Details
Sources
Sources are graph entities: the same page may back several entries, and an unreachable source flags every row that rests on it.
Compatibility and provenance
Flavors
“- [Node.js](https://nodejs.org/) >= 18” — SAP-samples/cap-agentic-engineered — README
Contributors
History in the atlas
- Entered from the sap-ai-mcp-servers catalogue, which is credited as the source; written from the repository's own README rather than from the catalogue's line about it. Hard rule 7: skills are indexed, never authored here. The catalogue files it under skills; its own README calls it a reference application showing what grounding does, so it is typed sample and demonstrates rather than provides. VISION §5: evidence is never an option you depend on.
- First seen.
For your agent
- Ref
artifact:sap-samples-cap-agentic-engineered- JSON
- /artifacts/sap-samples-cap-agentic-engineered.json
- MCP
- Connecting an agent