SAP + Model Context Protocol
An MCP Server for SAP: Giving AI Agents Safe, Governed Access to ECC and S/4HANA
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.
- ERP
- SAP S/4HANA, SAP ECC 6.0, SAP S/4HANA Cloud
- Industries
- Manufacturing, Aerospace, Electronics, Industrial Machinery
- Written for
- Enterprise Architect
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.
What usually gets in the way
The problems we hear most from enterprise architect teams running SAP S/4HANA.
Point-to-point AI integrations
Each AI pilot builds its own SAP connection, leading to duplicated effort and inconsistent security.
Overly broad tools
A generic run any query tool gives agents unlimited reach and makes behaviour unpredictable.
Shared technical users
MCP servers often authenticate to SAP with one technical user, losing per-user authorisation and audit.
Unclear write controls
Without explicit rules, agents may create or change SAP documents without the approvals that apply to people.
ECC left out
Many examples assume S/4HANA OData; ECC landscapes need BAPI and RFC-based tools.
Where AI earns its place in SAP S/4HANA
Each use case names the ERP objects it reads or writes, so your ERP team can judge the integration effort before anyone commits budget.
Sales order lookup tool
Return open sales orders for a customer with status, delivery dates and blocks.
Touches: 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
Return stock and availability for a material and plant, including open receipts.
Touches: API_MATERIAL_STOCK_SRV; BAPI_MATERIAL_AVAILABILITY in ECC
Outcome: Reliable availability answers for sales and planning agents.
Purchase order status tool
Return PO lines, confirmations and goods receipts for a PO or supplier.
Touches: API_PURCHASEORDER_PROCESS_SRV; BAPI_PO_GETDETAIL1 in ECC
Outcome: Buyers and agents see supply status without opening ME23N.
Production order status tool
Return production order status, operations and confirmations.
Touches: 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
Create a purchase requisition that then follows release strategy, only after user confirmation.
Touches: Purchase requisition API in S/4HANA; BAPI_PR_CREATE in ECC
Outcome: Agents prepare requests while approvals stay intact.
Document search tool
Search attached documents and long texts related to an SAP object.
Touches: GOS attachments, long texts, DMS documents
Outcome: Agents combine structured data with related documents.
Cross-system composite tools
Combine SAP data with MES or PLM through separate MCP servers used by the same agent.
Touches: SAP MCP tools plus MES and PLM MCP tools
Outcome: Agents answer plant questions across systems.
Reference architecture
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.
- 1
Agent clients
MCP-capable assistants and agent frameworks, using a private model on your infrastructure.
- 2
MCP server
Tool definitions with typed inputs and outputs, input validation and rate limits.
- 3
SAP adapters
OData clients for S/4HANA and RFC clients via the SAP NW RFC SDK for ECC BAPIs.
- 4
Identity
OAuth or SAML with principal propagation so SAP calls run as the user.
- 5
Audit
Logs of tool calls, parameters, results and users forwarded to the SIEM.
Integration notes for your ERP team
- 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.
Deployment options
On-prem MCP server
ECC and on-prem S/4HANA, restricted environments.
Server and model run inside your network with direct access to SAP.
Private cloud MCP server
SAP in a hyperscaler under your account.
Server in your VPC with private connectivity to SAP.
SAP-native agents first
S/4HANA Cloud with SAP agent coverage.
Use SAP's agents and add MCP only for gaps.
Compliance and data control
How the architecture supports your obligations. Certification and accountability stay with your organisation; the design keeps the evidence straightforward.
SOX
Write tools create drafts subject to existing approvals and release strategies; no direct posting.
NIST SP 800-171 / CMMC
Per-user authentication, least privilege tools and logging support the customer's controls.
ITAR / EAR
On-prem server and model keep controlled data inside the boundary.
Internal AI policy
Tool lists are reviewed like role designs and recertified periodically.
How an engagement runs
Phase 1 . 1-2 weeks
Tool design
- -Use case to tool mapping
- -SAP interface selection
- -Security design
Phase 2 . 3-4 weeks
Build
- -MCP server with read tools
- -Identity integration
- -Logging
Phase 3 . 3-4 weeks
Pilot
- -Agent pilot with users
- -Evaluation set
- -Security testing
Phase 4 . Ongoing
Extend
- -Gated write tools
- -Cross-system tools
- -Tool recertification
Questions to ask any vendor, including us
A short list that separates real SAP S/4HANA AI work from a chatbot demo.
- 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?
Frequently asked questions
What is an MCP server for SAP?
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?
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?
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?
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?
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?
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?
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.
Related guides
AI Agents for ERP, Running On-Prem
A practical guide to on-prem AI agents for ERP: what they can safely automate, where human approval belongs, and how to design the guardrails.
SAP S/4HANA + private AIAI for SAP S/4HANA, Running On-Prem or in Your Private Cloud
Run AI on SAP S/4HANA without sending ERP data to a public API. On-prem and private-cloud architecture, CDS views, OData, and honest deployment trade-offs.
SAP security + AISAP AI Security: How to Let an LLM Read SAP Data Without Breaking Your Authorisation Model
SAP AI security: technical users, PFCG roles, S_RFC and OData scope, prompt injection from long texts, audit logging and SoD when AI reads SAP data.
ECC vs S/4HANA AIAI on SAP ECC vs S/4HANA: What Each Platform Can Actually Run
AI on SAP ECC vs S/4HANA: Joule and embedded AI, data model and API differences, and what a private model can run on ECC today before you migrate.
SAP PP/MRP + AI agentsAI Agents for SAP Production Planning, MRP, and Exception Triage
AI agents that triage SAP MD04 exceptions, explain predictive MRP shortages, and draft planned-order actions, grounded on your own SAP data, deployed on-prem.
SAP ECC 6.0 + AIGet AI Value From SAP ECC Now, and Use It to De-Risk the Move to S/4HANA
SAP ECC 6.0 mainstream maintenance ends in 2027. Add AI value on ECC now, using its existing BAPIs and IDocs, and use it to de-risk the S/4HANA migration.
Plan it with numbers
ERP MCP Server Python Tool Skeleton Generator
Get a runnable Python MCP server with one read-only ERP lookup tool, argument validation and errors that the model can understand.
Free ToolMCP Server Security Checklist
Work through authentication, authorization, input handling, prompt injection, secrets, logging and deployment before an MCP server touches ERP data.
Free ToolMCP Integration Effort Estimator
Estimate the engineering hours and cost to build MCP servers connecting AI agents to your enterprise systems, based on system count, integration complexity, and auth model.
GuideAI Agent Architecture for Enterprise ERP Systems
Design AI agent architectures for ERP systems with multi-agent orchestration, tool-use patterns, memory management, and enterprise integration strategies.
GuideSecurity Review for AI Agents in the Enterprise
A security review checklist for enterprise AI agents: data residency, identity and access, prompt injection defense, logging, and vendor risk for manufacturers.
GuideHuman-in-the-Loop Design for ERP AI
Human-in-the-loop design for ERP AI: where to place approvals, confidence thresholds, and audit trails so agents act safely inside SyteLine, LN, and M3.
Talk it through with an engineer who knows SAP S/4HANA
Bring one real question your team cannot answer from the ERP today. We will map the data path, the model, and where it runs, and tell you honestly if AI is the wrong tool for it.
Try it here, free
SAP MM and QM BAPI and API List Reference
A searchable list of the common SAP MM and QM BAPIs and S/4HANA OData APIs, what each does, and whether it needs a commit.
Keep exploring
Free tools
- SAP MM and QM BAPI and API List ReferenceA searchable list of the common SAP MM and QM BAPIs and S/4HANA OData APIs, what each does, and whether it needs a commit.
- SAP ECC BAPI_PO_CHANGE ABAP GeneratorGenerate a working ABAP program that changes an SAP purchase order item with BAPI_PO_CHANGE, with POITEM/POITEMX, schedule line date conversion, test run and commit handling.
- ABAP BAPI Return Handling and Commit GeneratorWrap any BAPI call with BAPIRET2 error checking, message text building and a safe commit or rollback.
AI on your ERP
- AI on SAP ECC vs S/4HANA: What Each Platform Can Actually RunAI on SAP ECC vs S/4HANA: Joule and embedded AI, data model and API differences, and what a private model can run on ECC today before you migrate.
- AI-Driven SAP S/4HANA Implementation: Where AI Speeds the Programme and Where It Does NotWhere AI helps an SAP S/4HANA implementation: custom code, data quality, test scripts, mapping and cutover, what SAP tools cover and what stays human.
Integrations
- How to build an MCP server for SAP S/4HANABuild a Model Context Protocol server for SAP S/4HANA: which read-only tools to expose, OData and BAPI backends, auth, stdio versus HTTP, scoping and audit.
- How to build an MCP server for SAP ECC 6.0How to build a Model Context Protocol server for SAP ECC 6.0: which BAPI-backed tools to expose, RFC auth, stdio vs HTTP, permission scoping and audit logging.