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)
Recommended Servers
playwright-mcp
A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.
Magic Component Platform (MCP)
An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.
Audiense Insights MCP Server
Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.
VeyraX MCP
Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.
graphlit-mcp-server
The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.
Kagi MCP Server
An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.
E2B
Using MCP to run code via e2b.
Neon Database
MCP server for interacting with Neon Management API and databases
Exa Search
A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.
Qdrant Server
This repository is an example of how to create a MCP server for Qdrant, a vector search engine.