SAP RCA MCP Server
SAP RCA MCP Server
Azure Log Analytics 데이터를 쿼리하여 AI 에이전트가 SAP 시스템에서 근본 원인 분석(Root Cause Analysis)을 수행할 수 있게 해주는 Python MCP 서버입니다.
아키텍처
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
4가지 도구
도구 | 목적 |
| 등록된 테이블의 정확한 열 이름, 유형, 시간 열, SID 열 및 KQL 힌트를 반환합니다. 먼저 호출하세요. |
| 에이전트가 생성한 KQL 쿼리를 검증한 후(읽기 전용 가드) 실행합니다. |
| SAP 도메인 지식을 적용하여 원시 행을 분류합니다: 오류 범주, 심각도, 권장 사항. |
| 8가지 RCA 단계를 모두 자동으로 실행하고 통합 JSON 보고서를 반환합니다. |
사전 요구 사항
Python 3.11+
Azure CLI(
az) 설치Azure Log Analytics 작업 영역에 대한 액세스(작업 영역 ID 필요)
계정에 할당된
Log Analytics Reader역할(또는 관리 ID)
설정
# 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구성(.env)
AZURE_LOG_ANALYTICS_WORKSPACE_ID=<your-workspace-guid>
AZURE_TENANT_ID=<your-tenant-id>관리 ID를 사용하는 Azure에서는 작업 영역 ID만 필요합니다. 모든
AZURE_CLIENT_* 필드는 비워 두세요.
실행
stdio 모드(Claude Desktop, MCP Inspector, Azure AI Foundry 로컬)
python server.py
# or:
mcp dev server.pySSE/HTTP 모드(Azure App Service 배포)
pip install uvicorn
uvicorn server:mcp --host 0.0.0.0 --port 8000SSE 엔드포인트는 다음과 같습니다: http://localhost:8000/sse
Claude Desktop에 연결
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>"
}
}
}
}Azure AI Foundry에 연결
Azure AI Foundry에서 다음을 가리키는 MCP 연결을 추가하세요:
https://<your-app-service>.azurewebsites.net/sse
에이전트 대화 예시
집중 쿼리 워크플로:
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")전체 자동 RCA:
Agent → run_full_rca(sid="CHA", time_range_hours=4, issue_description="Multiple batch job failures")
← Returns complete 8-step RCA report등록된 테이블
현재 등록됨(7개 중 1개):
테이블 | SAP 소스 | 상태 |
| ST22 ABAP 단축 덤프 | ✅ 등록됨 |
| SM21 시스템 로그 | ⏳ 스키마 CSV 대기 중 |
| SM37 배치 작업 | ⏳ 스키마 CSV 대기 중 |
| 인스턴스 가용성 | ⏳ 스키마 CSV 대기 중 |
| 프로세스 가용성 | ⏳ 스키마 CSV 대기 중 |
| OS 메트릭 | ⏳ 스키마 CSV 대기 중 |
| HA 클러스터 | ⏳ 스키마 CSV 대기 중 |
새 테이블 스키마 추가
스키마 CSV(열 + 설명)를 제공하세요.
SchemaforMCP-Details.csv와 동일한 형식입니다.기존
SapNetweaver_ShortDumps_CL항목을 템플릿으로 삼아schema_registry.py에 새 항목을 추가하세요.테이블에 도메인별 분석 논리가 필요한 경우
tools/analyze_results.py에_analyze_<type>()함수를 추가하세요.tools/rca_orchestrator.py의_KQL_TEMPLATES에 KQL 템플릿을 추가하세요.서버를 다시 시작하세요. 다른 변경은 필요 없습니다.
보안 참고 사항
execute_query는 모든 KQL 관리 명령(.ingest,.drop,.set등)을 차단합니다.run_full_rca는 매개변수화된 KQL 템플릿을 사용합니다. SID 값은 치환 전에 검증됩니다.모든 자격 증명은 환경 변수에서 로드됩니다. 코드에 비밀이 없습니다.
Azure에서는 관리 ID를 사용하세요. App Service 구성에
AZURE_CLIENT_SECRET을 저장하지 마세요.
⚠ 미해결 질문(조치 필요)
서버가 작업 영역에 연결하려면 다음을 제공해야 합니다:
# | 항목 | 찾는 위치 | 업데이트할 파일 |
1 | Log Analytics 작업 영역 ID | Azure Portal → Log Analytics 작업 영역 → 개요 → 작업 영역 ID |
|
2 | Azure 테넌트 ID | Azure Portal → Microsoft Entra ID → 개요 → 테넌트 ID |
|
3 |
| 제공하신 CSV에는 |
|
4 | SID_s 열 존재 여부 | ShortDumps 테이블에 |
|
5 | 나머지 6개 테이블 스키마 | 전체 8단계 RCA를 활성화하려면 나머지 테이블에 대한 스키마 CSV( |
|
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
Related MCP Connectors
Query your AI agent traces, root-cause verdicts and issues, and run investigations, from your agent.
Lets AI agents analyze API metrics, request logs, and traces, and manage apps and alerts.
Finds what's broken in your product, explains why, and fixes it from your agent.
AI agent run monitoring with incident replay and SLA receipts.
Related MCP Servers
- AlicenseNot gradedqualityDmaintenanceEnables AI agents to investigate backend incidents by executing runbooks that gather evidence from observability and storage systems.9MIT
- 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.6MIT
- AlicenseAqualityBmaintenanceEnables 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.61MIT