SAP S/4HANA MCP Server
Provides tools for OData interaction with SAP S/4HANA, allowing discovery of services, retrieval of entity metadata and field values, and execution of CRUD queries on SAP entities.
Click on "Deploy 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., "@SAP S/4HANA MCP Server Discover available SAP OData services"
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.
SAP S4 MCP Server
MCP server for SAP S/4HANA OData access. Discover services, query entities, fetch metadata, and manage data — built on the @modelcontextprotocol/sdk TypeScript SDK.
Tools
Tool | Description |
| Discovers available services from the SAP Gateway Service Catalog |
| Fetches and summarizes OData service metadata optimized for LLM consumption |
| Fetches dropdown/value-list values from SAP OData entities |
| Executes OData CRUD operations (GET returns CSV, writes return JSON) |
Related MCP server: SAP OData MCP Server
Prerequisites
Node.js >= 18.0.0
SAP S/4HANA system with OData services enabled
SAP user with appropriate OData authorizations
Setup
git clone https://github.com/Nidhideep/sap-s4-mcp-server
cd sap-s4-mcp-server
npm install
cp .env.example .env
# Edit .env with your SAP connection details
npm run buildEnvironment Variables
Copy .env.example to .env and fill in the values.
OData Connection (required)
Variable | Description | Example |
| Full SAP S/4HANA URL including scheme and port |
|
| SAP client number |
|
|
|
|
| SAP user (when AUTH_METHOD=basic) |
|
| Password (when AUTH_METHOD=basic) | |
| Bearer token (when AUTH_METHOD=token) |
Operational
Variable | Description | Default |
|
|
|
| When |
|
MCP Client Configuration
Claude Code
claude mcp add sap-s4-mcp-server -- node /absolute/path/to/sap-s4-mcp-server/dist/src/index.jsThen set env vars via .mcp.json (copy from .mcp.example.json).
Claude Desktop / Cline
Copy .mcp.example.json to .mcp.json, fill in real values, and add to your MCP client config:
{
"mcpServers": {
"sap-s4-mcp-server": {
"command": "node",
"args": ["/absolute/path/to/sap-s4-mcp-server/dist/src/index.js"],
"env": {
"S4_ODATA_HOST": "https://your-s4.example.com:44301",
"S4_ODATA_CLIENT": "100",
"AUTH_METHOD": "basic",
"S4_ODATA_USER": "your_user",
"S4_ODATA_PASSWORD": "your_password"
}
}
}
}Recommended Workflow
Discover —
discover_sap_servicesto find the service nameUnderstand —
get_entity_metadatato see entity sets and field namesValidate inputs —
get_field_valuesto look up valid dropdown valuesQuery or write —
execute_odata_querywith the correct service, entity, and fields
Project Structure
src/
index.ts # Server entry point (stdio transport)
server.ts # Tool registration
tools/
s4-discover-services.tool.ts # Gateway catalog discovery
s4-metadata.tool.ts # OData $metadata parser
s4-field-values.tool.ts # Value-list / dropdown fetcher
s4-odata-query.tool.ts # CRUD query executor
config/
env.ts # Zod-validated environment config
auth.ts # Auth headers + CSRF token fetch
policy.ts # DRY_RUN enforcement + audit log
docs/
authentication.md
governance.md
troubleshooting.md
examples/
example-workflow.mdDevelopment
npm run dev # Watch mode with tsx
npm run typecheck # Type-check without building
npm run build # Compile to dist/Governance
DRY_RUN=trueblocks all write operations — safe for read-only environmentsAll write operations are audit-logged to stderr
CSRF tokens are fetched automatically before every write
No credentials are ever committed — use
.env(gitignored) or MCP client env injection
Available Tools
4 toolsdiscover_sap_servicesA
Discovers available OData services from the SAP Gateway Service Catalog. Returns service names, titles, and descriptions. Use this first when you don't know which service name to pass to execute_odata_query or get_entity_metadata.
Inputs: search, top.
execute_odata_queryA
Executes OData CRUD operations against SAP S/4HANA. GET requests return data as CSV for easy reading. POST, PATCH, and DELETE return JSON with the operation result. Use discover_sap_services to find service names, get_entity_metadata for field names, and get_field_values for valid input values before writing.
Inputs: service (required), entity (required), method, entityKey, +6 more.
get_entity_metadataA
Fetches and summarizes OData service metadata from SAP S/4HANA. Returns all entity sets with their key fields, properties, and navigation properties. Use this before calling execute_odata_query to understand the available fields and correct entity names.
Inputs: service (required).
get_field_valuesA
Fetches dropdown and value-list options from a SAP S/4HANA OData entity. Use this to discover valid input values before writing data with execute_odata_query. Provide the entity set that acts as the value-help source and the target field name.
Inputs: service (required), entity (required), valueField (required), labelField, +1 more.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 4 tools
Each tool has a distinct purpose: service discovery, query execution, metadata retrieval, and field values. No overlap, clear differentiation.
All tool names follow a consistent verb_noun pattern in snake_case: discover, execute, get, get. Uniform and predictable.
Four tools cover the essential workflow for interacting with SAP OData services efficiently. Not over- or under-scoped.
The tool set enables a complete cycle: discover services, understand metadata, fetch valid input values, and perform CRUD operations. No critical gaps.
Maintenance
Related MCP Connectors
List datasets, schemas, run APL queries, and use prompts for exploration, anomalies, and monitoring.
Connect AI to Odoo ERP 14-20: search, create, update and manage records in natural language.
Query, explore, and manage your databases through natural conversation.
Connect your Odoo to Claude and ChatGPT: ask about sales, stock, customers and invoices.
Related MCP Servers
- AlicenseNot gradedqualityDmaintenanceTransforms SAP S/4HANA or ECC systems into conversational AI interfaces by exposing OData services as dynamic MCP tools. Enables natural language interactions with ERP data for querying, creating, updating, and deleting business entities.1MIT
- AlicenseAqualityDmaintenanceEnables 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.1113MIT
- AlicenseNot gradedqualityBmaintenanceEnables interaction with SAP S/4HANA systems, providing 38 tools to search and manage business partners, products, pricing, purchase orders, supplier invoices, service entry sheets, journal entries, and cost centers via OData V2/V4 and SOAP.MIT
- AlicenseNot gradedqualityCmaintenanceEnables Claude, ChatGPT, Copilot and Cursor to explore and query SAP S/4HANA's HANA database using SAP's data dictionary, organization structure, CDS views, and read-only SQL, with tools for finding tables, fields, joins, code values, and running SELECT queries. All access is read-only, with encrypted credentials and audited calls.2AGPL 3.0