sap-sd-mcp-validation
Validates SAP SD sales orders (material, pricing, credit) before creation using the MCP protocol, enabling clean-core order-to-cash automation.
README
🤖 SAP SD Order Validation Agent — MCP Protocol
Autor: Fabian Andrés Acevedo R. | Bogotá, Colombia Certificaciones: C_S4CPB_2602 · C_LCNC_2601 LinkedIn: fabian-acevedo-sap-cloud-data
🎯 ¿Qué hace este proyecto?
Un agente de inteligencia artificial que valida órdenes de venta SAP SD (Order-to-Cash) antes de impactar el ERP, utilizando el Model Context Protocol (MCP) de Anthropic como capa de comunicación entre Claude/Joule y SAP S/4HANA Cloud Public Edition.
El problema que resuelve
En SAP SD, los errores de pricing, crédito y disponibilidad de material generan correcciones manuales costosas:
| Métrica | Sin agente | Con agente MCP |
|---|---|---|
| Error rate en órdenes | ~3-5% | < 0.5% |
| Tiempo de corrección/error | 30-45 min | 0 min |
| Costo estimado/error | ~$400 USD | $0 |
| Ahorro mensual (500 órdenes) | — | ~$5,400 USD |
🏗️ Arquitectura Clean Core
Usuario / Comprador
↓
MCP Client
(Our Server / App)
↓
SAP SD MCP Server ← Este repositorio
(sap_sd_server.py)
↓ ↓
Claude / Joule S/4HANA Cloud API
Agent (API_SALES_ORDER_SRV)
Principio Clean Core: Toda la lógica de validación corre en la periferia del ERP a través de MCP. El core de SAP S/4HANA no es modificado — extensibilidad 100% vía BTP.
🛠️ Tools expuestas al agente
| Tool | Descripción | Equivalente SAP |
|---|---|---|
validate_material_number |
Verifica existencia y stock | Verificación ATP |
check_pricing_conditions |
Calcula precio total de la orden | Esquema de cálculo |
verify_customer_credit_limit |
Valida cupo financiero del cliente | Control de crédito FI |
create_sales_order |
Crea la orden si todo es válido | VA01 / API_SALES_ORDER_SRV |
Resources disponibles
sap://materials— Catálogo de materialessap://customers— Maestro de clientessap://orders— Órdenes creadas en sesión
Prompt pre-configurado
validate_full_order— Orquesta el flujo completo O2C con auditoría
🚀 Cómo probarlo
Opción A — Google Colab (recomendado, sin instalación)
- Haz clic en el badge Open In Colab al inicio de este README
- Ve al panel izquierdo → ícono 🔑 Secrets → agrega
ANTHROPIC_API_KEY - Menú → Ejecutar todo
Opción B — Local
# Clonar repositorio
git clone https://github.com/TU_USUARIO/sap-sd-mcp-validation.git
cd sap-sd-mcp-validation
# Crear entorno virtual
python -m venv .venv
source .venv/bin/activate # Windows: .venv\Scripts\activate
# Instalar dependencias
pip install -r requirements.txt
# Configurar API key
echo "ANTHROPIC_API_KEY=sk-ant-tu-key" > .env
# Correr el servidor MCP directamente
python sap_sd_server.py
🧪 Casos de prueba incluidos
| Escenario | Cliente | Material | Cantidad | Resultado |
|---|---|---|---|---|
| ✅ Happy path | CUST-500 | MAT-1001 | 5 | Orden SO-1001 creada |
| ❌ Sin stock | CUST-500 | MAT-1003 | 1 | Falla: stock = 0 |
| ❌ Crédito insuficiente | CUST-501 | MAT-1001 | 10 | Escala a Build Process Automation |
| ❌ Material inválido | CUST-500 | MAT-9999 | 1 | Falla: material no existe |
📋 Audit Log integrado
Cada llamada del agente queda registrada con trazabilidad completa:
[1] 2026-06-18T10:30:01
Evento : TOOL_CALL
Tool : validate_material_number
Input : {"material_id": "MAT-1001"}
Output : {"stock_disponible": 42, "disponible": true}
[2] 2026-06-18T10:30:02
Evento : TOOL_CALL
Tool : check_pricing_conditions
Input : {"material_id": "MAT-1001", "quantity": 5}
Output : {"total_price_usd": 6250.0}
🗺️ Roadmap
| Versión | Feature | Stack adicional |
|---|---|---|
| V1 ✅ | Material · Pricing · Crédito · Creación | FastMCP + Mock data |
| V2 | check_atp() — Available-to-Promise con fechas de entrega |
Scheduling logic |
| V3 | propose_delivery_split() — Propuesta de entrega parcial |
Supply Chain logic |
| V4 | trigger_credit_approval() — Escalación vía workflow |
SAP Build Process Automation |
| V5 | APIs reales S/4HANA Cloud via Communication Arrangement | httpx + OAuth2 + BTP Destination |
🔗 Alineación con SAP Roadmap oficial
Este proyecto anticipa funcionalidades del SAP S/4HANA Cloud release 2608 (Q3 2026):
- AI-assisted sales order creation from unstructured data — SAP Road Map Explorer
- Autonomous Enterprise agents for O2C processes — SAP Sapphire 2026
📁 Estructura del repositorio
sap-sd-mcp-validation/
│
├── .gitignore # Excluye .env, __pycache__, .venv
├── requirements.txt # Dependencias Python
├── sap_sd_server.py # Servidor MCP SAP SD (FastMCP)
├── SAP_SD_MCP_Agent_Fabian_Acevedo.ipynb # Notebook Colab interactivo
└── README.md # Este archivo
🤝 Sobre el autor
SAP Certified Implementation Consultant (C_S4CPB_2602) y SAP Certified Build Developer (C_LCNC_2601). Especializado en SAP BTP, Clean Core extensibility, y automatización de procesos O2C con IA.
Open to remote SAP consulting roles — LATAM / Global (EST/CST)
推荐服务器
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 模型以安全和受控的方式获取实时的网络信息。