sap-cloud-erp

sap-cloud-erp

An MCP server that provides tools to list, get, create, and update SAP S/4HANA Cloud Public Edition business objects like purchase orders, sales orders, and production orders through the Model Context Protocol.

Category
访问服务器

README

SAP Cloud ERP MCP Server

License: GPL v3

An MCP (Model Context Protocol) server for SAP S/4HANA Cloud Public Edition, built on the SDK's released business OData APIs. It exposes list / get / create (/update) tools for 14 business objects, plus a small number of object-specific actions (e.g. releasing a production order), for a total of 57 tools.

Object Tools
Material (Product) s4_material_list, s4_material_get, s4_material_create, s4_material_update
Material BOM s4_material_bom_list, s4_material_bom_get, s4_material_bom_create, s4_material_bom_update
Purchase Requisition s4_purchase_requisition_list, s4_purchase_requisition_get, s4_purchase_requisition_create, s4_purchase_requisition_update
Purchase Order s4_purchase_order_list, s4_purchase_order_get, s4_purchase_order_create, s4_purchase_order_update
Purchase Contract s4_purchase_contract_list, s4_purchase_contract_get, s4_purchase_contract_create, s4_purchase_contract_update
Sales Quotation s4_sales_quotation_list, s4_sales_quotation_get, s4_sales_quotation_create, s4_sales_quotation_update
Sales Order s4_sales_order_list, s4_sales_order_get, s4_sales_order_create, s4_sales_order_update
Sales Contract s4_sales_contract_list, s4_sales_contract_get, s4_sales_contract_create, s4_sales_contract_update
Production Order s4_production_order_list, s4_production_order_get, s4_production_order_create, s4_production_order_update, s4_production_order_release
Planned Order s4_planned_order_list, s4_planned_order_get, s4_planned_order_create, s4_planned_order_update
Production Order Confirmation s4_production_order_confirmation_list, s4_production_order_confirmation_get, s4_production_order_confirmation_create
Production Operation Confirmation s4_production_operation_confirmation_list, s4_production_operation_confirmation_get, s4_production_operation_confirmation_create
Material Document (goods movement) s4_material_document_list, s4_material_document_get, s4_material_document_create
Outbound Delivery s4_outbound_delivery_list, s4_outbound_delivery_get, s4_outbound_delivery_create, s4_outbound_delivery_update
Inbound Delivery s4_inbound_delivery_list, s4_inbound_delivery_get, s4_inbound_delivery_create, s4_inbound_delivery_update

s4_production_order_release releases a production order via the OData V2 function import ReleaseOrder — order status fields are read-only via PATCH, so this is the only way to release an order through the API.

Setup

npm install
npm run build
cp .env.example .env   # fill in your SAP connection details

Required env vars (see .env.example):

  • S4_BASE_URL — your SAP S/4HANA Cloud API base URL
  • S4_AUTH_TYPE — oauth2_client_credentials or basic
  • OAuth2: S4_OAUTH_TOKEN_URL, S4_CLIENT_ID, S4_CLIENT_SECRET
  • Basic: S4_USERNAME, S4_PASSWORD
  • MCP_TRANSPORT — stdio (default) or http; PORT when using http

The services must be exposed via a Communication Arrangement in your SAP tenant (Communication User + the matching Communication Scenario for each API — see the table below, and the comments at the top of each src/tools/*.ts file for the exact service path).

Running

npm run start                       # stdio transport, for MCP clients like Claude Desktop
MCP_TRANSPORT=http npm run start    # Streamable HTTP on $PORT
npm run inspector                   # MCP Inspector UI against the stdio server

Registering with an MCP client

{
  "mcpServers": {
    "sap-cloud-erp": {
      "command": "node",
      "args": ["/absolute/path/to/sap-cloud-erp/dist/index.js"],
      "env": {
        "S4_BASE_URL": "https://your-tenant-api.s4hana.cloud.sap",
        "S4_AUTH_TYPE": "basic",
        "S4_USERNAME": "...",
        "S4_PASSWORD": "...",
        "MCP_TRANSPORT": "stdio"
      }
    }
  }
}

Verified against a live tenant

list (and CSRF-token acquisition) for the following was confirmed working against a real S/4HANA Cloud Public Edition tenant: Purchase Order, Purchase Requisition, Sales Quotation, Sales Contract, Sales Order, Production Order, Planned Order, Material Document, Outbound Delivery, Inbound Delivery, Production Order Confirmation (both levels). create (including deep-insert with nested account assignment), update, and the release action were verified end-to-end for Purchase Order, Production Order, Sales Order, and Material Document (goods receipt against a PO) against a live tenant. create was also verified for Sales Order against a mock server — see evaluation/.

Not yet independently verified — these returned SAP-side authorization errors on the original test tenant, not code errors (the error was "no start authorization" / "no authorization to access service group", which happens even when the matching Communication Arrangement exists — it means either the arrangement's Inbound Communication tab doesn't have that specific API checked, or the Communication User's backend role/authorization profile is missing the corresponding authorization object):

  • s4_material_* (Product, CE_PRODUCT_0002, comm. scenario SAP_COM_0009)

If you hit this, open the relevant Communication Arrangement in your tenant, check the Inbound Communication → services list, and confirm the Communication User's authorization profile includes that scenario.

Communication Scenarios (confirmed on a live SAP_COM catalog)

Object Comm. Scenario
Material SAP_COM_0009
Material BOM SAP_COM_0105
Purchase Requisition SAP_COM_0102
Purchase Order SAP_COM_0053
Purchase Contract SAP_COM_0101
Sales Quotation SAP_COM_0118
Sales Order SAP_COM_0109
Sales Contract SAP_COM_0119
Planned Order SAP_COM_0104 (Production Planning Integration)
Production Order / Confirmation SAP_COM_0522 (Manufacturing Execution — Order and Confirmation Integration)
Material Document SAP_COM_0108
Outbound / Inbound Delivery SAP_COM_0106 (shared)

Known limitations

  • All additionalFields (create) / fields (update) parameters accept arbitrary extra OData fields as a passthrough, since exact optional-field lists vary by tenant configuration (e.g. account assignment, batch management, variant configuration).
  • No delete/cancel tools are implemented by design — SAP has no hard-delete for these objects, and cancellation flows were explicitly out of scope.
  • s4_material_document_*, s4_production_order_confirmation_*, s4_production_operation_confirmation_* have no update tool — these SAP objects are immutable once posted (only cancellation exists, which is out of scope).
  • Production order component fields (e.g. batch number) are read-only on the classic OData entity set exposed by this server's s4_production_order_get; updating them requires the RAP-BO-based component entity, which is not yet wrapped in a dedicated tool (see CLAUDE.md §3 for the pattern if you need to add one).

Architecture

  • src/sapClient.ts — shared OAuth2/basic auth, token caching, CSRF token handling, V2/V4 response normalization, OData error-message extraction, and sapCallFunctionImport() for calling OData V2 function imports (actions like release).
  • src/tools/*.ts — one file per business object, each registering its own list/get/create(/update) tools with explicit Zod schemas. No shared "generic SAP object" abstraction by design — each object's fields and quirks are handled explicitly.
  • src/index.ts — server bootstrap; registers all tools and starts either the stdio or stateless Streamable HTTP transport based on MCP_TRANSPORT.

See CLAUDE.md for implementation gotchas discovered while building and hardening this server (OData V2 vs V4 decimal encoding, deep-insert requirements, ETag handling for function imports, composite-key pitfalls, and more) — read it before modifying sapClient.ts or adding a new create/update tool.

License

GNU General Public License v3.0.

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选