Project is based on btp-sap-odata-to-mcp-server by Wouter Lemaire
MCP Server for SAP Cloud ALM APIs, deployed on SAP BTP Cloud Foundry.
src/
├── index.ts # Express HTTP server, OAuth flow, session management
├── mcp-server.ts # MCP server wrapper, wires services and tools
├── services/
│ ├── auth-service.ts # XSUAA authentication and token validation
│ ├── destination-service.ts # BTP Destination Service connectivity
│ └── sap-client.ts # CALM API calls (landscape, properties, events)
├── tools/
│ └── tool-registry.ts # MCP tool definitions
├── types/
│ ├── mcp-types.ts # MCP type definitions
│ ├── sap-types.ts # CALM API query parameter types and enums
│ ├── sap-xsenv.d.ts # @sap/xsenv type declarations
│ └── sap-xssec.d.ts # @sap/xssec type declarations
└── utils/
├── config.ts # Configuration from env vars and VCAP_SERVICES
├── error-handler.ts # Centralized error handling
└── logger.ts # Winston-based logger
mta.yaml # MTA deployment descriptor
xs-security.json # XSUAA security configuration
| Tool | API Endpoint | Description |
|---|---|---|
get-landscape-info |
/calm-landscape/v1/landscapeObjects |
Query landscape objects with optional filters (name, objectType, role, serviceType, etc.) |
get-landscape-property-info |
/calm-landscape/v1/properties |
Get properties for a single landscape object by ID |
get-status-events |
/bsm-service/v1/events |
Query status events with optional filters (type, eventType, serviceName, period, etc.) |
All tools require the read scope via the CALMViewer role.
Create a destination in your BTP subaccount pointing to the SAP Cloud ALM API:
| Property | Value |
|---|---|
| Name | Value of CALM_DESTINATION_NAME env var |
| Type | HTTP |
| URL | https://<your-calm-tenant>.<your-region>.alm.cloud.sap/api |
| Proxy Type | Internet |
| Authentication | OAuth2ClientCredentials |
| Token Service URL | https://<your-calm-tenant>.authentication.<region>.hana.ondemand.com/oauth/token |
The destination name used by the application is configured via the CALM_DESTINATION_NAME environment variable.
npm run build:btp
npm run deploy:btpThis builds the MTA archive and deploys it to your current CF target. The mta.yaml creates the required service instances (XSUAA, Connectivity) and binds them to the application. The Destination service instance must already exist.
Assign the CALMViewer role to users that need access.
Hybrid mode runs the server locally while binding to real BTP service instances via cds bind.
- Cloud Foundry CLI
cf loginto your BTP subaccount/space- The application already deployed once (so service bindings exist)
Bind each required BTP service instance to the local project:
cds bind -2 "xsuaa service name as per mta.yml"
cds bind -2 "destination service name as per mta.yml"
cds bind -2 "connectivity service name as per mta.yml"Replace <space> with your CF space name. This creates a .cdsrc-private.json with the service keys.
npm run start:hybridThis executes cds bind --exec -- npm run start:http, which:
- Fetches service keys for bound XSUAA, Destination, and Connectivity instances
- Sets
VCAP_SERVICESin the local environment - Builds and starts the HTTP server on
http://localhost:3000