SAP RCA MCP Server
SAP RCA MCP Server
Python MCP 服务器,使 AI 代理能够通过查询 Azure Log Analytics 数据对 SAP 系统执行根因分析。
架构
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: CloudWatch Log Analyst MCP
4 个工具
工具 | 用途 |
| 返回已注册表的精确列名、类型、时间列、SID 列和 KQL 提示。请先调用此工具。 |
| 验证代理生成的 KQL 查询(只读保护),然后执行该查询。 |
| 应用 SAP 领域知识对原始行进行分类:错误类别、严重级别、建议。 |
| 自动执行全部 8 个 RCA 步骤,并返回合并后的 JSON 报告。 |
先决条件
Python 3.11+
已安装 Azure CLI(
az)可访问 Azure Log Analytics 工作区(需要工作区 ID)
已为您的账户分配
Log Analytics Reader角色(或使用托管标识)
设置
# 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>在 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 系统日志 | ⏳ 等待 schema CSV |
| SM37 批处理作业 | ⏳ 等待 schema CSV |
| 实例可用性 | ⏳ 等待 schema CSV |
| 进程可用性 | ⏳ 等待 schema CSV |
| 操作系统指标 | ⏳ 等待 schema CSV |
| HA 集群 | ⏳ 等待 schema CSV |
添加新表 Schema
提供 schema 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 上,请使用托管标识;不要在 App Service 配置中存储
AZURE_CLIENT_SECRET
⚠ 待解决问题(需要操作)
在服务器能够连接到您的工作区之前,您需要提供以下信息:
# | 内容 | 查找位置 | 需更新的文件 |
1 | Log Analytics 工作区 ID | Azure 门户 → Log Analytics 工作区 → 概览 → 工作区 ID |
|
2 | Azure 租户 ID | Azure 门户 → Microsoft Entra ID → 概览 → 租户 ID |
|
3 |
| 您提供的 CSV 显示为 |
|
4 | SID_s 列是否存在 | 您的 ShortDumps 表中是否存在 |
|
5 | 其余 6 个表的 schema | 为其余表提供 schema CSV(格式与 |
|
This server cannot be installed
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Related MCP Servers
- FlicenseNot gradedqualityDmaintenanceEnables querying and managing Azure Log Analytics workspaces using KQL (Kusto Query Language). Supports executing queries, managing saved queries, and exploring workspace tables and schemas with Service Principal authentication.
- AlicenseNot gradedqualityDmaintenanceEnables LLMs to autonomously query AWS CloudWatch Logs and perform structured root-cause analysis via natural language prompts, using MCP tools for log group listing and Insights queries.MIT
- AlicenseNot gradedqualityCmaintenanceEnables AI agents to investigate backend incidents by executing runbooks that gather evidence from observability and storage systems.59MIT
- FlicenseNot gradedqualityDmaintenanceEnables AI-powered analysis of exceptions using vector similarity search and Azure OpenAI for operations teams.
Related MCP Connectors
AI agent run monitoring with incident replay and SLA receipts.
Find relevant security data from Sentinel data lake for building effective agents. More:aka.ms/s/de
Debug, build, and manage Power Automate cloud flows with AI agents
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/vchinnu/AMS-MCPV2'
If you have feedback or need assistance with the MCP directory API, please join our Discord server