S/4HANA MCP Server
Provides tools for interacting with SAP S/4HANA (Cloud Public Edition and on-premise Private Edition) over OData and SOAP, covering business partners, products, sales pricing, warehouses, purchase orders, supplier invoices, service entry sheets, journal entries, cost centers, and finance org structure. Includes write operations for creating supplier invoices, credit memos, canceling invoices, and posting journal entries.
Click on "Install Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@S/4HANA MCP Serverfind business partners in Germany"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
S/4HANA MCP Server
An MCP server exposing 38 tools for SAP S/4HANA (Cloud Public Edition and on-premise Private Edition) over OData V2, OData V4, and SOAP: business partners, products, sales pricing, warehouses, purchase orders, purchasing info records, supplier invoices (including posting and cancellation), service entry sheets, journal entries, cost centers, and finance org structure.
Write tools (create_*, cancel_supplier_invoice, check_invoice_posting_readiness) and get_finance_structure return their result inline as JSON. Every other (read) tool writes its result — CSV for collections, Markdown for single records — to an E2B sandbox and returns the file path(s), instead of inlining potentially large SAP result sets (hundreds of business partners, full journal-entry item detail, etc.) directly into the calling agent's context. This server only connects to an E2B sandbox your MCP client already owns — it never creates one. Your client needs its own E2B integration (the E2B SDK, or a Claude environment with matching code-execution access) to read the files back; see E2B sandbox setup.
Quick start
git clone https://github.com/ilia-inovaflow/s4hana-mcp-server.git
cd s4hana-mcp-server
npm install
npm run build
cp .env.example .env # fill in your E2B sandbox + SAP connection details
npm start # stdio transport (Claude Desktop, MCP Inspector, etc.)For local development without building first: npm run dev.
Related MCP server: SAP OData MCP Server
E2B sandbox setup
Register for a free API key at e2b.dev, then start (or reuse) a sandbox your MCP client can read files from, and set:
E2B_API_KEY=<your E2B API key>
SANDBOX_ID=<an already-running sandbox ID> # stdio only — HTTP takes this per-sessionOver the HTTP transport, SANDBOX_ID is supplied per session instead, via the sandbox-id request header — useful when one running server instance handles multiple callers, each with their own sandbox.
This is unrelated to SAP's own sandbox.api.sap.com trial host below — "sandbox" means two different things in this README.
Try it with no SAP tenant of your own
SAP publishes a free, public read-only API sandbox at sandbox.api.sap.com that this server talks to out of the box. Register for a free API key at api.sap.com, then set:
SAP_HOST=https://sandbox.api.sap.com
SAP_CLIENT_ID=<your sandbox API key>No username, password, or OAuth setup needed — the sandbox authenticates with a single APIKey header. Business partner, product, and pricing tools work immediately against sandbox demo data (you still need the E2B sandbox above to receive read-tool results).
Connecting a real SAP tenant
Set SAP_HOST to your tenant URL and pick one of three auth modes via SAP_AUTH_MODE:
Mode | Use case | Required variables |
| Quick testing, on-prem systems without OAuth configured |
|
| S/4HANA Cloud Public Edition, service-to-service (OAuth 2.0 Client Credentials) |
|
| User-delegated OAuth Authorization Code — HTTP transport only, caller supplies a fresh token per request via the | none (token comes from the MCP client) |
SAP_CLIENT (the SAP client/mandant number, e.g. 100) defaults to 100 if unset.
Two API families need basic or X.509 authentication by SAP design and reject OAuth: journal entry posting (create_journal_entry, SOAP SAP_COM_0002) and the accounting-document detail views (get_journal_entry, search_journal_entries with document_level=true). Everything else works under any of the three modes.
See .env.example for the full variable list, including the optional SAP_JE_SOAP_PATH override some on-premise SOAMANAGER configurations need.
Transports
stdio (default, npm start / npm run dev) — one SAP connection and one E2B sandbox per process, configured entirely from .env. This is what Claude Desktop and most local MCP clients expect:
{
"mcpServers": {
"s4hana": {
"command": "node",
"args": ["/absolute/path/to/s4hana-mcp-server/dist/index.js"],
"env": {
"E2B_API_KEY": "...", "SANDBOX_ID": "...",
"SAP_HOST": "...", "SAP_AUTH_MODE": "basic", "SAP_USERNAME": "...", "SAP_PASSWORD": "..."
}
}
}
}Streamable HTTP (npm run start:http / npm run dev:http) — for remote or multi-tenant deployment. Each session's SAP connection is configured either from .env defaults or per-request headers (sap-host, sap-auth-mode, sap-username, sap-password, sap-token-url, sap-client-id, sap-client-secret, sap-client, sap-je-soap-path), and its E2B sandbox from the sandbox-id header (or SANDBOX_ID env as a fallback) — letting one running server field requests against different tenants and sandboxes. E2B_API_KEY is always read from the server's own environment. PORT (default 3000) and HOST (default localhost) configure the listener; the MCP endpoint is POST /mcp, with GET /health for liveness checks.
If you deploy the HTTP transport somewhere reachable over the network, put it behind your own authentication/network boundary — this server does not itself gate access to the /mcp endpoint, only to the downstream SAP connection.
Tools
search_business_partners— search customers, vendors, persons, organizationsget_business_partner— full detail for one Business Partnerquery_business_partner_odata— generic query against anyAPI_BUSINESS_PARTNERentity set
search_products— search materials, finished goods, services, raw materialsget_product— full detail for one productquery_product_odata— generic query against anyAPI_PRODUCT_SRVentity set
get_product_pricing— combined price lookup for a material (start here for "what does X cost")search_pricing_conditions— browse condition records by type/rateget_pricing_condition— full detail for one condition recordquery_pricing_odata— generic query against any pricing entity set
list_warehousesget_warehouse
search_purchase_ordersget_purchase_orderquery_purchase_order_odata— generic query, including item/schedule-line levelget_purchase_order_confirmations— supplier order/shipping/GR confirmations, bulk lookup
search_purchasing_info_recordsget_purchasing_info_recordquery_purchasing_info_record_odata
search_supplier_invoicesget_supplier_invoicequery_supplier_invoice_odatacreate_supplier_invoice_po⚠️ write — PO-referenced 3-way-match invoicecreate_supplier_invoice_gl⚠️ write — non-PO expense invoice, direct G/L linescreate_supplier_credit_memo⚠️ write — PO-referenced credit memocancel_supplier_invoice⚠️ write — reverses a posted invoice or credit memocheck_invoice_posting_readiness— read-only pre-flight guard check
search_service_entry_sheetsget_service_entry_sheetquery_service_entry_sheet_odata
create_journal_entry⚠️ write — posts a G/L document (SOAP, basic/X.509 auth only)search_journal_entries— analytical (aggregated) or accounting-document (line-level) viewget_journal_entry— one accounting document by numbersearch_gl_accountssearch_open_po_items— a supplier's still-invoiceable PO lines, in one callsearch_cost_centersget_cost_center_hierarchy— the standard cost center hierarchy treeget_finance_structure— company codes, ledgers, charts of accounts, segments, business areas
Every write tool runs server-side guard checks (existence, blocking flags, duplicate detection, balance validation) before posting and reports a structured reason list — with nothing sent to SAP — if any guard fails. Deterministic SAP rejections (closed posting periods, missing tax jurisdiction, etc.) are translated into actionable messages rather than raw error codes.
Architecture
src/
├── server.ts # McpServer factory — tool registration, schemas, annotations
├── client.ts # SapClient — OData V2/V4 requests, CSRF-protected writes, SOAP posts
├── auth.ts # Auth strategies: Basic, OAuth Client Credentials, OAuth Authorization Code
├── config.ts # Connection config + SAP public sandbox detection
├── index.ts # stdio entry point
├── http.ts # Streamable HTTP entry point (Express, per-session auth)
└── tools/
├── shared.ts # OData/CSV/error-parsing + E2B sandbox file I/O, shared by every tool
└── *.ts # one file per tool (schema + handler)Writes to OData V2 endpoints follow SAP's CSRF token protocol: fetch a token via GET with X-CSRF-Token: Fetch, resend it with the session cookie on the POST, retry once on a 403. Journal entry posting instead builds and sends a raw SOAP envelope, since that API has no OData equivalent.
Development
npm run dev # stdio, hot reload via tsx
npm run dev:http # HTTP, hot reload via tsx
npm run typecheck # tsc --noEmit
npm run build # compile to dist/License
This server cannot be installed
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Related MCP Servers
- FlicenseNot gradedqualityDmaintenanceEnables interaction with SAP ABAP systems through ABAP Development Tools (ADT), providing access to repository objects, source code, where-used analysis, and SQL queries with support for both on-premise and BTP systems.2
- FlicenseAqualityDmaintenanceEnables AI assistants to integrate with SAP systems via OData REST APIs for querying entity sets, performing CRUD operations, and executing function imports. It features automatic service discovery, CSRF token management, and smart connection handling without requiring the SAP RFC SDK.1112
- FlicenseAqualityCmaintenanceEnables interaction with SAP S/4HANA systems via OData, allowing service discovery, metadata exploration, field value retrieval, and CRUD operations through natural language.45
- FlicenseNot gradedqualityDmaintenanceEnables querying ABAP programs, classes, function modules, and other objects from SAP systems with OAuth 2.0 authentication.
Related MCP Connectors
Search, document and execute authenticated API calls across 700+ apps via one MCP server
34 production API tools over one hosted MCP endpoint.
Run SOQL queries to explore and retrieve Salesforce data. Access accounts, contacts, opportunities…
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/ilia-inovaflow/s4hana-mcp-server'
If you have feedback or need assistance with the MCP directory API, please join our Discord server