SAP RCA MCP Server
Enables AI agents to perform root cause analysis on SAP systems by querying Azure Log Analytics data, offering schema discovery, validated KQL execution, result analysis, and automated 8-step RCA workflows.
README
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)
The 4 Tools
| Tool | Purpose |
|---|---|
get_schema |
Returns exact column names, types, time column, SID column, and KQL hints for registered tables. Call this first. |
execute_query |
Validates an agent-generated KQL query (read-only guard) then executes it. |
analyze_results |
Applies SAP domain knowledge to classify raw rows: error categories, severity, recommendations. |
run_full_rca |
Executes all 8 RCA steps automatically and returns a consolidated JSON report. |
Prerequisites
- Python 3.11+
- Azure CLI (
az) installed - Access 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 login
Configuration (.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.py
SSE/HTTP mode (Azure App Service deployment)
pip install uvicorn
uvicorn server:mcp --host 0.0.0.0 --port 8000
The 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 report
Registered Tables
Currently registered (1 of 7):
| Table | SAP Source | Status |
|---|---|---|
SapNetweaver_ShortDumps_CL |
ST22 ABAP Short Dumps | ✅ Registered |
SapNetweaver_SysLogs_CL |
SM21 System Log | ⏳ Awaiting schema CSV |
SapNetweaver_BatchJobs_CL |
SM37 Batch Jobs | ⏳ Awaiting schema CSV |
SapNetweaver_GetSystemInstanceList_CL |
Instance Availability | ⏳ Awaiting schema CSV |
SapNetweaver_GetProcessList_CL |
Process Availability | ⏳ Awaiting schema CSV |
Prometheus_OSExporter_CL |
OS Metrics | ⏳ Awaiting schema CSV |
Prometheus_HaClusterExporter_CL |
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 substitution- All 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 | .env |
| 2 | Azure Tenant ID | Azure Portal → Microsoft Entra ID → Overview → Tenant ID | .env |
| 3 | Time column for SapNetweaver_ShortDumps_CL |
The CSV you provided shows serverTimestamp_t. Agent docs show timestamp_t. Please confirm which column name is correct in your workspace (check Log Analytics → Tables → ShortDumps). |
schema_registry.py line with "time_column" |
| 4 | SID_s column presence | Is SID_s present in your ShortDumps table? (Some workspaces use sapsid_s instead.) |
schema_registry.py "sid_column" field |
| 5 | Remaining 6 table schemas | Provide schema CSVs (same format as SchemaforMCP-Details.csv) for the remaining tables to enable the full 8-step RCA |
schema_registry.py entries |
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。