SAP RCA MCP Server
Provides Root Cause Analysis for SAP systems by querying Azure Log Analytics data, with tools to retrieve table schemas, execute validated KQL queries, classify SAP errors, and run an automated 8-step RCA workflow.
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@SAP RCA MCP ServerInvestigate short dumps for SID CHA in the last 4 hours"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
SAP RCA MCP Server
Python MCP server that enables AI agents to perform Root Cause Analysis on SAP systems by querying Azure Log Analytics data.
Architecture
AI Agent (Azure AI Foundry / Claude / Copilot Studio)
│ MCP Tool Calls
▼
FastMCP Server (server.py)
├── get_schema → schema_registry.py (table/column metadata)
├── execute_query → la_client.py (validated KQL execution)
├── analyze_results → domain_knowledge.py (SAP error classification)
└── run_full_rca → rca_orchestrator.py (8-step automated workflow)
│
▼
Azure Log Analytics (read-only KQL queries via Managed Identity)Related MCP server: exception-mcp-server
The 4 Tools
Tool | Purpose |
| Returns exact column names, types, time column, SID column, and KQL hints for registered tables. Call this first. |
| Validates an agent-generated KQL query (read-only guard) then executes it. |
| Applies SAP domain knowledge to classify raw rows: error categories, severity, recommendations. |
| Executes all 8 RCA steps automatically and returns a consolidated JSON report. |
Prerequisites
Python 3.11+
Azure CLI (
az) installedAccess to the Azure Log Analytics workspace (Workspace ID needed)
Role
Log Analytics Readerassigned to your account (or Managed Identity)
Setup
# 1. Clone / navigate to this folder
cd C:\Users\padmajat\Documents\AMS-Agentic-RCA\MCP
# 2. Create virtual environment
python -m venv .venv
.venv\Scripts\activate # Windows
# source .venv/bin/activate # Linux/macOS
# 3. Install dependencies
pip install -r requirements.txt
# 4. Configure
copy .env.example .env
# Edit .env and fill in AZURE_LOG_ANALYTICS_WORKSPACE_ID and AZURE_TENANT_ID
# 5. Authenticate (local development)
az loginConfiguration (.env)
AZURE_LOG_ANALYTICS_WORKSPACE_ID=<your-workspace-guid>
AZURE_TENANT_ID=<your-tenant-id>On Azure with Managed Identity, only the workspace ID is needed — leave all
AZURE_CLIENT_* fields blank.
Running
stdio mode (Claude Desktop, MCP Inspector, Azure AI Foundry local)
python server.py
# or:
mcp dev server.pySSE/HTTP mode (Azure App Service deployment)
pip install uvicorn
uvicorn server:mcp --host 0.0.0.0 --port 8000The SSE endpoint will be: http://localhost:8000/sse
Connect to Claude Desktop
Add to claude_desktop_config.json:
{
"mcpServers": {
"sap-rca": {
"command": "python",
"args": ["C:/Users/padmajat/Documents/AMS-Agentic-RCA/MCP/server.py"],
"env": {
"AZURE_LOG_ANALYTICS_WORKSPACE_ID": "<your-workspace-id>",
"AZURE_TENANT_ID": "<your-tenant-id>"
}
}
}
}Connect to Azure AI Foundry
In Azure AI Foundry, add an MCP connection pointing to:
https://<your-app-service>.azurewebsites.net/sse
Example Agent Conversation
Focused query workflow:
Agent → get_schema(["SapNetweaver_ShortDumps_CL"])
Agent → execute_query("SapNetweaver_ShortDumps_CL | where serverTimestamp_t > ago(4h) | where SID_s == 'CHA' | take 100")
Agent → analyze_results(results, "short_dumps", context="SID=CHA, last 4h")Full automated RCA:
Agent → run_full_rca(sid="CHA", time_range_hours=4, issue_description="Multiple batch job failures")
← Returns complete 8-step RCA reportRegistered Tables
Currently registered (1 of 7):
Table | SAP Source | Status |
| ST22 ABAP Short Dumps | ✅ Registered |
| SM21 System Log | ⏳ Awaiting schema CSV |
| SM37 Batch Jobs | ⏳ Awaiting schema CSV |
| Instance Availability | ⏳ Awaiting schema CSV |
| Process Availability | ⏳ Awaiting schema CSV |
| OS Metrics | ⏳ Awaiting schema CSV |
| HA Cluster | ⏳ Awaiting schema CSV |
Adding a New Table Schema
Provide the schema CSV (columns + description) — same format as
SchemaforMCP-Details.csv.Add a new entry to
schema_registry.pyfollowing the existingSapNetweaver_ShortDumps_CLentry as a template.If the table needs domain-specific analysis logic, add a
_analyze_<type>()function totools/analyze_results.py.Add a KQL template to
_KQL_TEMPLATESintools/rca_orchestrator.py.Restart the server — no other changes needed.
Security Notes
execute_queryblocks all KQL management commands (.ingest,.drop,.set, etc.)run_full_rcauses parameterised KQL templates — SID values are validated before substitutionAll credentials are loaded from environment variables — no secrets in code
On Azure, use Managed Identity; do not store
AZURE_CLIENT_SECRETin App Service config
⚠ Outstanding Questions (Action Required)
Before the server can connect to your workspace, you need to provide:
# | What | Where to find it | File to update |
1 | Log Analytics Workspace ID | Azure Portal → Log Analytics workspace → Overview → Workspace ID |
|
2 | Azure Tenant ID | Azure Portal → Microsoft Entra ID → Overview → Tenant ID |
|
3 | Time column for | The CSV you provided shows |
|
4 | SID_s column presence | Is |
|
5 | Remaining 6 table schemas | Provide schema CSVs (same format as |
|
This server cannot be deployed
Maintenance
Related MCP Connectors
AI agent run monitoring with incident replay and SLA receipts.
Read-only finance and operations controls for AI agents with evidence and safe next actions.
List datasets, schemas, run APL queries, and use prompts for exploration, anomalies, and monitoring.
AI agent observability for production traces, natural-language insights, and improvement loops.
Related MCP Servers
- AlicenseNot gradedqualityDmaintenanceEnables AI agents to investigate backend incidents by executing runbooks that gather evidence from observability and storage systems.3 npm9MIT
- FlicenseNot gradedqualityDmaintenanceEnables AI-powered analysis of exceptions using vector similarity search and Azure OpenAI for operations teams.-
- AlicenseNot gradedqualityDmaintenanceEnables AI assistants to query and analyze data in Azure Data Explorer, Log Analytics, and Microsoft Sentinel using Kusto Query Language (KQL) through tools, resources, and prompts.5MIT
- AlicenseNot gradedqualityAmaintenanceEnables AI agents to discover, inspect, and call SAP RFC-enabled function modules (BAPIs/RFCs) with configurable read/write policies, transaction support, audit logging, and ABAP source retrieval.MIT