Summary
An open-source SAP HANA MCP server for Claude, ChatGPT and Copilot: SAP's data dictionary and CDS views as tools, read-only SQL, self-hosted with Docker.
Try asking
Example prompts for SAP S/4HANA (HANA SQL)
Click any prompt to copy it. Paste into Claude, ChatGPT, Cursor, Gemini, Copilot or OpenClaw to run it against this connector.
Claude is AI and can make mistakes. Please double-check responses.
TL;DR: AnythingMCP is an open-source MCP server that reads SAP HANA. Any HANA database works as a plain database connector; for SAP S/4HANA there is a dedicated connector that turns SAP's own data dictionary and CDS views into tools, so the model knows what BUKRS, HSL or VBRK mean before it writes SQL. Every session is read-only in HANA itself, capped at 1,000 rows and timed out. It runs with Docker Compose inside the network that reaches HANA, and Claude, ChatGPT, Copilot, Cursor and Claude Code connect to it over MCP.
- 10 sap_* tools
- Roles and tool access
- Read-only by default
- Audit log
Two ways to use HANA
Database connector (hana://) | SAP S/4HANA (HANA SQL) connector | |
|---|---|---|
| For | Any SAP HANA database | The HANA database under S/4HANA |
| Tools | Schema, example and query tools generated from the database, or your own parameterized queries | 10 ready tools: sap_guide, SAP's dictionary, CDS views, org structure, sap_query |
| What the model sees | Table and column names | SAP's business labels, currency fields, code values, joins, released views |
| Setup | Connection string and a user | Connection details, a read-only user and the grants in the setup guide |
Quick start
On a host that reaches the HANA SQL port:
mkdir anythingmcp && cd anythingmcp
curl -fsSLo docker-compose.yml \
https://raw.githubusercontent.com/HelpCode-ai/anythingmcp/main/docker-compose.quickstart.yml
printf 'JWT_SECRET=%s\nENCRYPTION_KEY=%s\n' "$(openssl rand -hex 32)" "$(openssl rand -hex 32)" > .env
echo 'SSRF_ALLOWED_HOSTS=hana.internal' >> .env # private hosts are refused otherwise
docker compose up -d # → http://localhost:3000
Then Connectors → Marketplace → SAP S/4HANA (HANA SQL), or Add Connector → Database with a hana:// connection string for any other HANA database. The sap-hana-mcp-server repository packages the same connector with an install script and a smoke test.
Connection string
hana://host:port/?databaseName=TENANT¤tSchema=SCHEMA&sapClient=100&tls=verify
| Option | Meaning |
|---|---|
| host, port | The tenant database's SQL port: 3<instance>15 for the first tenant, 3<instance>41 and up for further tenants. The system database port 3<instance>13 works with databaseName, but may redirect to an internal host name. |
databaseName | Tenant name in a multi-container system. Also accepted as the path: hana://host:30013/S4P. |
currentSchema | Schema for unqualified names, e.g. SAPHANADB or SAPABAP1. |
sapClient | The three-digit SAP client. Sets the CDS_CLIENT session variable, without which SAP's CDS views return no rows. |
tls | verify (default), no-verify for a self-signed certificate, or off. |
statementTimeout | Seconds before a statement is cancelled. Default 60, maximum 600. |
driver | hdb (default, bundled) or hana-client. |
User and password go into the connector's credentials, stored encrypted, never into the URL.
How Claude finds the data
sap_guideexplains SAP's data model for SQL by topic: basics, finance, sales, inventory, procurement, operations, pitfalls and query recipes.sap_org_structurescopes the question: company codes with currency and fiscal year variant, plants, sales and purchasing organizations.sap_search_cds_viewsandsap_search_tablesfind where the data lives, flagging compatibility views that plain SQL would read wrongly.sap_describe_table,sap_find_fields,sap_field_valuesandsap_table_relationsgive labels, currency fields, code meanings and joins.sap_queryruns one read-onlySELECT.
The dictionary tools are fixed, read-only queries on SAP's own tables (DD02L, DD03L, DD04T, DD07T, DD08L, DDHEADANNO, DDFIELDANNO). Every tool and its SQL is visible on the connector page.
Guarantees
The database grants remain the real boundary: SQL does not apply SAP's application authorizations, so create a user that can read only what the model may see. Direct SQL on the ABAP schema by a third-party application is governed by your HANA licence: a runtime licence bundled with S/4HANA usually does not cover it, a full-use licence does.
Drivers
AnythingMCP ships hdb, SAP's pure-JavaScript HANA driver (Apache-2.0): user and password, TLS, multi-tenant systems. SAP's native @sap/hana-client adds Kerberos, hdbuserstore and connection pooling, but its licence does not allow redistribution, so you install it into your own deployment and select it with driver=hana-client or HANA_DRIVER=hana-client. Details: SAP HANA in the AnythingMCP docs.
Compared with a generic HANA MCP server
A generic HANA MCP server lists schemas and runs SQL. On an S/4HANA system that is not enough: the model sees tens of thousands of tables with abbreviated names, amounts without their currency field, and compatibility views that return wrong totals. The S/4HANA connector adds SAP's data dictionary, CDS views and a guide to the data model, so the model picks the right table and states its assumptions. It also works from any MCP client, with roles, an audit log and the read-only guarantees above.
FAQ
Is there an SAP MCP server? Yes. AnythingMCP includes MCP connectors for SAP S/4HANA (HANA SQL and OData), S/4HANA Cloud, SAP Business One and SAP Concur, open source and self-hosted. This page covers the HANA one; Connect SAP to Claude lists them all.
How do I get started with the HANA MCP server?
Run AnythingMCP with Docker Compose on a host that reaches the HANA SQL port, add the host to SSRF_ALLOWED_HOSTS, install the SAP S/4HANA (HANA SQL) connector with a read-only database user and add the MCP server to your client. The setup guide has the SQL for the user and its grants.
Can the model write to HANA?
No. The session is read-only in HANA, only a single SELECT runs, and writes and locking reads are refused.
Does it work with SAP ECC or Business One? Not through this connector: it reads S/4HANA's tables and CDS views. ECC connects through its SAP Gateway OData services, Business One through its Service Layer.
Which MCP clients work? Claude (claude.ai, Desktop and Code), ChatGPT (paid plans), GitHub Copilot, Cursor and any other client that speaks MCP over HTTP.
Next steps
- Connect SAP S/4HANA to Claude via SAP HANA: the step-by-step setup with example questions
- Connect SAP to Claude: every SAP route at a glance
- OData to MCP: S/4HANA and ECC through SAP Gateway
- Database to MCP: HANA next to SQL Server, PostgreSQL and Oracle
Was this guide helpful?