# An MCP Server for SAP: Giving AI Agents Safe, Governed Access to ECC and S/4HANA

> Source: https://netray.co/erp-ai/sap-mcp-server-ai-agents
> Publisher: Netray (netray.co), AI and integration engineering for ERP and manufacturing systems.
> Section: AI for ERP

## Short answer

An MCP server for SAP exposes a small set of well-defined tools, such as get open sales orders, check stock or look up a PO, that AI agents can call through the Model Context Protocol. Each tool maps to a released OData API or CDS view in S/4HANA or a BAPI in ECC, runs with the user's SAP authorisations, and stays read-only unless a write tool is explicitly approved.

## Kind

use-case

## Erp Family

sap

## Erp Products

- SAP S/4HANA
- SAP ECC 6.0
- SAP S/4HANA Cloud

## Industries

- Manufacturing
- Aerospace
- Electronics
- Industrial Machinery

## Region

Global

## Persona

Enterprise Architect

## Eyebrow

SAP + Model Context Protocol

## Intro

The Model Context Protocol has become a common way to connect AI agents to business systems. Instead of each assistant integrating with SAP in its own way, an MCP server publishes tools with clear names, inputs and outputs, and any MCP-capable client or agent framework can use them.

For SAP, this is attractive and risky in equal measure. Attractive, because agents need structured, reliable access to orders, stock, purchasing and production data. Risky, because a poorly designed MCP server with broad technical user access turns every agent into a powerful, unaudited SAP user.

SAP is building its own agent capabilities into Joule and BTP and has signalled support for agent interoperability. If you are on S/4HANA Cloud and SAP's agents cover your scenarios, use them. A self-built or partner MCP server makes sense when you need agents over ECC or on-prem S/4HANA, when agents must combine SAP with other systems, or when everything must run inside your network.

This page describes how to design an SAP MCP server: tool selection, mapping to SAP interfaces, authentication, logging and the rules for write operations.

## Pain Points

### Point-to-point AI integrations

**Detail:** Each AI pilot builds its own SAP connection, leading to duplicated effort and inconsistent security.

### Overly broad tools

**Detail:** A generic run any query tool gives agents unlimited reach and makes behaviour unpredictable.

### Shared technical users

**Detail:** MCP servers often authenticate to SAP with one technical user, losing per-user authorisation and audit.

### Unclear write controls

**Detail:** Without explicit rules, agents may create or change SAP documents without the approvals that apply to people.

### ECC left out

**Detail:** Many examples assume S/4HANA OData; ECC landscapes need BAPI and RFC-based tools.

## Use Cases

### Sales order lookup tool

**Description:** Return open sales orders for a customer with status, delivery dates and blocks.

**Erp Objects:** API_SALES_ORDER_SRV in S/4HANA; BAPI_SALESORDER_GETLIST and VBAK/VBAP in ECC

**Outcome:** Agents answer customer service questions with live SAP data.

### Stock availability tool

**Description:** Return stock and availability for a material and plant, including open receipts.

**Erp Objects:** API_MATERIAL_STOCK_SRV; BAPI_MATERIAL_AVAILABILITY in ECC

**Outcome:** Reliable availability answers for sales and planning agents.

### Purchase order status tool

**Description:** Return PO lines, confirmations and goods receipts for a PO or supplier.

**Erp Objects:** API_PURCHASEORDER_PROCESS_SRV; BAPI_PO_GETDETAIL1 in ECC

**Outcome:** Buyers and agents see supply status without opening ME23N.

### Production order status tool

**Description:** Return production order status, operations and confirmations.

**Erp Objects:** Production order APIs in S/4HANA; BAPI_PRODORD_GET_DETAIL in ECC

**Outcome:** Supervisors and agents track order progress in plain language.

### Draft purchase requisition tool

**Description:** Create a purchase requisition that then follows release strategy, only after user confirmation.

**Erp Objects:** Purchase requisition API in S/4HANA; BAPI_PR_CREATE in ECC

**Outcome:** Agents prepare requests while approvals stay intact.

### Document search tool

**Description:** Search attached documents and long texts related to an SAP object.

**Erp Objects:** GOS attachments, long texts, DMS documents

**Outcome:** Agents combine structured data with related documents.

### Cross-system composite tools

**Description:** Combine SAP data with MES or PLM through separate MCP servers used by the same agent.

**Erp Objects:** SAP MCP tools plus MES and PLM MCP tools

**Outcome:** Agents answer plant questions across systems.

## Architecture

**Overview:** The MCP server sits between agents and SAP, exposing curated tools that map to released interfaces, authenticating per user and logging every call. Write tools are separate, explicit and gated by confirmation.

**Layers:**

#### Agent clients

**Detail:** MCP-capable assistants and agent frameworks, using a private model on your infrastructure.

#### MCP server

**Detail:** Tool definitions with typed inputs and outputs, input validation and rate limits.

#### SAP adapters

**Detail:** OData clients for S/4HANA and RFC clients via the SAP NW RFC SDK for ECC BAPIs.

#### Identity

**Detail:** OAuth or SAML with principal propagation so SAP calls run as the user.

#### Audit

**Detail:** Logs of tool calls, parameters, results and users forwarded to the SIEM.

## Deployment Options

### On-prem MCP server

**Fit:** ECC and on-prem S/4HANA, restricted environments.

**Detail:** Server and model run inside your network with direct access to SAP.

### Private cloud MCP server

**Fit:** SAP in a hyperscaler under your account.

**Detail:** Server in your VPC with private connectivity to SAP.

### SAP-native agents first

**Fit:** S/4HANA Cloud with SAP agent coverage.

**Detail:** Use SAP's agents and add MCP only for gaps.

## Compliance

### Write tools create drafts subject to existing approvals and release strategies; no direct posting.

**Framework:** SOX

### Per-user authentication, least privilege tools and logging support the customer's controls.

**Framework:** NIST SP 800-171 / CMMC

### On-prem server and model keep controlled data inside the boundary.

**Framework:** ITAR / EAR

### Tool lists are reviewed like role designs and recertified periodically.

**Framework:** Internal AI policy

## Integration Notes

- Design narrow, task-specific tools rather than a generic query tool.
- Map S/4HANA tools to released OData APIs from the SAP Business Accelerator Hub.
- Use PyRFC or node-rfc with the SAP NW RFC SDK for ECC BAPI-based tools.
- Propagate user identity to SAP; avoid shared technical users for interactive tools.
- Mark write tools clearly and require explicit user confirmation before execution.
- Log every tool call with user, parameters and result size, and alert on unusual patterns.
- Version tool definitions and test them against a fixed evaluation set after SAP upgrades.

## Product Fit

### ERPray

**Why:** Provides governed, read-only SAP access for agents and Q&A with visible queries, deployable on-prem.

### Custom build

**Why:** For SAP MCP servers with tools specific to your processes and identity setup.

## Engagement

### Tool design

**Duration:** 1-2 weeks

**Deliverables:**

- Use case to tool mapping
- SAP interface selection
- Security design

### Build

**Duration:** 3-4 weeks

**Deliverables:**

- MCP server with read tools
- Identity integration
- Logging

### Pilot

**Duration:** 3-4 weeks

**Deliverables:**

- Agent pilot with users
- Evaluation set
- Security testing

### Extend

**Duration:** Ongoing

**Deliverables:**

- Gated write tools
- Cross-system tools
- Tool recertification

## Buyer Questions

- Which SAP interfaces does each tool use, and are they released APIs?
- Does the server authenticate per user or with a shared account?
- How are write tools gated?
- How do you test tools after SAP upgrades?
- Where do the model and server run?
- How do tool calls appear in our audit logs?

## Faq

### What is an MCP server for SAP?

**Answer:** It is a service that implements the Model Context Protocol and exposes SAP operations as tools that AI agents can call. Each tool has defined inputs and outputs and maps to an SAP interface such as an OData API or a BAPI. Agents use these tools to read SAP data, and in controlled cases to prepare documents, without custom integration per assistant.

### Does SAP provide an official MCP server?

**Answer:** SAP is building agent capabilities into Joule and BTP and has signalled support for agent interoperability standards. Check SAP's current announcements for the state of official MCP support for your products. ECC and on-prem S/4HANA customers often build or buy an MCP server that uses standard SAP interfaces.

### Can an MCP server work with SAP ECC?

**Answer:** Yes. Tools map to BAPIs and RFC-enabled function modules called through the SAP NW RFC SDK, using libraries such as PyRFC or node-rfc. The design principles are the same as for S/4HANA: narrow tools, per-user authorisation and logging.

### Should agents be able to write to SAP?

**Answer:** Only through specific write tools that create drafts, such as purchase requisitions subject to release strategy or parked documents, after explicit user confirmation. Direct posting by agents bypasses controls and should be avoided except for low-risk, approved scenarios.

### How many tools should an SAP MCP server have?

**Answer:** Start small, with five to fifteen read tools covering the most common questions in your pilot use case. Narrow tools make agent behaviour more predictable and easier to secure. Add tools based on observed needs rather than exposing everything at once.

### How is security handled?

**Answer:** Through per-user authentication with principal propagation, least-privilege tool design, input validation, rate limiting and logging forwarded to your SIEM. Tool lists are reviewed like role designs. The model and server should run on infrastructure you control when data is sensitive.

### Can one agent use SAP and other systems together?

**Answer:** Yes. An agent can connect to several MCP servers, for example SAP, MES and PLM, and combine their results. This is one of MCP's main benefits for manufacturing, where many questions cross system boundaries.

## Search terms

sap mcp server, mcp server sap s4hana, sap ecc mcp, sap ai agents mcp, sap s/4hana cloud agent, sap ecc agent integration, model context protocol sap, sap agent tools, sap odata mcp, sap bapi mcp, sap ai agent integration

---
Talk to an engineer: https://netray.co/contact?intent=erp_ai | Machine catalog: https://netray.co/agent/catalog.json
