logo

Are you need IT Support Engineer? Free Consultant

How to create MCP server for SAP Commerce Cloud Dynatrace

  • By Sanjay
  • 14/09/2026
  • 14 Views



Introduction

SAP Commerce Cloud comes with Dynatrace to monitor your environments. And SAP is using managed Dynatrace. Unlike SaaS Dynatrace, this SAP managed version doesn't expose directly MCP (Model Context Protocol ) server to access on this service. 

However, it is still possible to setup an access through API with your personal token

This article describes step by step how to do.

Create API Token

Screenshot 2026-09-14 At 17.02.11.Png

  1. Log in to your environment: https://emea02.cluster.observability.cloud.sap/e/ccv2-…-p1/
  2. Go to Settings → Integration → Dynatrace API (or Access tokens depending on your version)
  3. Click Generate token (or + New token)
  4. Give it a name (e.g. joule-mcp)
  5. Enable at minimum these scopes for a performance report:

Scope Purpose

metrics.readService response times, throughput, infrastructure metrics
entities.readServices, hosts, process groups
problems.readOpen and recent problems/incidents
DataExportDQL / export capabilities
events.readDeployment and change events

Create Proxy

Create a proxy to inject person token in each MCP query

const http = require(‘http');

const PROXY_PORT = 3001;
const TARGET_PORT = 3002;
const DT_ALIAS = ‘sap-cx-prod';
const DT_TOKEN = process.env.DT_TOKEN;

if (!DT_TOKEN) { console.error(‘Set DT_TOKEN env var'); process.exit(1); }

http.createServer((req, res) => {
const opts = {
hostname: ‘127.0.0.1', port: TARGET_PORT,
path: req.url, method: req.method,
headers: { …req.headers,
host: `127.0.0.1:${TARGET_PORT}`,
‘x-dynatrace-tokens': `${DT_ALIAS}=${DT_TOKEN}` }
};
const proxy = http.request(opts, (pr) => {
res.writeHead(pr.statusCode, pr.headers);
pr.pipe(res, { end: true });
});
req.pipe(proxy, { end: true });
proxy.on(‘error', (e) => { console.error(e); res.writeHead(502); res.end(); });
}).listen(PROXY_PORT, ‘127.0.0.1', () =>
console.log(`Proxy :${PROXY_PORT} → :${TARGET_PORT} (token injected)`)
);

Start proxy with following command

DT_TOKEN=YOUR_API_TOKEN_HERE node dt-proxy.js

Run MCP Server

Create YAML dt-config.yaml configuration file

– apiEndpointUrl: “https://emea02.cluster.observability.cloud.sap”
environmentId: “…-p1”
dynatraceUrl: “https://emea02.cluster.observability.cloud.sap/e/…-p1/”
alias: “sap-cx-prod”

Start MCP Server

export DT_CONFIG_FILE=./dt-config.yaml
npx -y @dynatrace-oss/dynatrace-managed-mcp-server@latest –http –port 3002

Expected log trace at startup

2026-09-14 17:12:28.058 [info] Starting Dynatrace Managed MCP
2026-09-14 17:12:28.061 [info] Initializing Dynatrace Managed MCP Server v1.1.1…
2026-09-14 17:12:28.063 [info] Loading configuration from file: ./dt-config.yaml
2026-09-14 17:12:28.066 [info] Successfully loaded 1 environment(s) from ./dt-config.yaml
2026-09-14 17:12:28.067 [info] Connecting Dynatrace Telemetry via https://…bf.dynatrace.com/mbeacon. You can disable this by setting DT_MCP_DISABLE_TELEMETRY=true.
2026-09-14 17:12:28.608 [warn] DT_MCP_ALLOWED_HOSTS is empty or not set. Falling back to default allowed hosts.
2026-09-14 17:12:28.610 [info] Dynatrace Managed MCP Server running on HTTP at http://127.0.0.1:3002
2026-09-14 17:12:28.610 [info] DNS rebinding protection active; allowed Host headers: 127.0.0.1, localhost, [::1]

Test

Now you can test your MCP Server by asking what are the available tools for your AI

curl -s -X POST http://127.0.0.1:3001/mcp \
-H “Content-Type: application/json” \
-H “Accept: application/json, text/event-stream” \
-d ‘{
“jsonrpc”: “2.0”,
“id”: 1,
“method”: “tools/list”,
“params”: {}
}' | jq .

Conclusion

Even if SAP is using managed Dynatrace for SAP Commerce Cloud with limited access, this article demonstrates that is still possible to initiate MCP server. That's first step to create smart AI agent to automate watching and reporting. Next step is to establish SKILL definition to guide your generative AI. 

For more detail and during your AI journey, you should not hesitate to contact direct SAP Expert Service :  sapcx-expertservices@sap.com

 





Source link

Leave a Reply

Your email address will not be published. Required fields are marked *

Chat with us on WhatsApp!