DEV Community

Cover image for Run an SAP HANA MCP server for Claude in 10 minutes
Matteo Morelli
Matteo Morelli

Posted on Originally published at anythingmcp.com

Run an SAP HANA MCP server for Claude in 10 minutes

This is the short, hands-on version: an MCP server that lets Claude, ChatGPT, Copilot or Cursor read SAP S/4HANA from its HANA database, read-only, with SAP's data dictionary as tools. You need Docker, a host that reaches the HANA SQL port and a database user from your SAP Basis team.

Claude, ChatGPT and Copilot reach the MCP server over MCP; only the server reaches the HANA SQL port, read-only

1. The database user

In the tenant that holds the ABAP schema (usually SAPHANADB):

CREATE USER AMCP_READER PASSWORD "<strong password>" NO FORCE_FIRST_PASSWORD_CHANGE;
ALTER USER AMCP_READER DISABLE PASSWORD LIFETIME;
-- dictionary and organization tables the tools read
GRANT SELECT ON SAPHANADB.DD02L TO AMCP_READER;
GRANT SELECT ON SAPHANADB.DD03L TO AMCP_READER;
GRANT SELECT ON SAPHANADB.DD04T TO AMCP_READER;
-- … the full list is in the guide linked below
GRANT SELECT ON SAPHANADB.ACDOCA TO AMCP_READER;  -- plus the business tables you need
Enter fullscreen mode Exit fullscreen mode

2. Start the server

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
docker compose up -d
Enter fullscreen mode Exit fullscreen mode

Open http://localhost:3000, create the admin user, go to Connectors → Marketplace and install SAP S/4HANA (HANA SQL) with host, port (3<instance>15), tenant, schema, SAP client and the user above. The install runs a test call and tells you if the grants work.

The install dialog of the SAP S/4HANA (HANA SQL) connector, with the SQL for the database user

3. Connect a client

Claude Code:

claude mcp add --transport http sap-hana http://localhost:4000/mcp --header "X-API-Key: <key>"
Enter fullscreen mode Exit fullscreen mode

For claude.ai or ChatGPT, publish only the MCP endpoint over HTTPS, never the HANA port.

4. Ask

"Which company codes are in this system, and in which currency?" is a good first question. Then try "Top 10 customers by net sales in 2025, from the billing documents". Watch the tool calls: the model reads the guide and the dictionary before it writes any SQL.

How the model answers: sap_guide, org structure, dictionary lookups, then one read-only SELECT

What you get

  • 10 tools: a data model guide, dictionary lookups, CDS view search, org structure, and one read-only SELECT
  • SET TRANSACTION READ ONLY on every session, 1,000-row cap, statement timeout, HR tables blocked
  • Roles per MCP server and an audit log of every call

The 10 tools of the connector, each with its SQL visible

Full guide with the complete grant list, screenshots and example questions: https://anythingmcp.com/guides/connect-sap-hana-to-claude. Code: AnythingMCP at https://github.com/HelpCode-ai/anythingmcp, the HANA connector on its own at https://github.com/HelpCode-ai/sap-hana-mcp-server

Top comments (0)