Logo vun HANA MCP Server

HANA MCP Server

Communautéit
HatriGt

SAP HANA MCP server — Enterprise Model Context Protocol server for SAP HANA. Use with Claude Code, VS Code. npm: hana-mcp-server

EditeurHatriGt
Repositoryhana-mcp-server
SproochJavaScript
Forks
29
Stären
67
Disponibel Tools
0
Transporttypstdio
Kategorien
LizenzMIT
Linken
  • Tools mat KI-Workflows verbannen

    HANA MCP Server stellt MCP-Funktioune bereit, déi vu kompatibele KI-Clienten a KI-Agente kënne benotzt ginn.

  • 0 disponibel Tools

    Kuckt Iech déi opruffbar Aktiounen hei drënner un, mat Nimm a Beschreiwungen, wa se vum Server geliwwert ginn.

  • Konfiguratioun fir ze kopéieren

    Benotzt d'Installatiounsbeispiller, fir dëse Server an Ärem bevorzugte MCP-Client ze konfiguréieren.

  • Indicateure fir Open Source

    67 Stären an 29 Forks aus dem verlinkte Repository.

SAP HANA MCP Server

npm version npm downloads Node.js License MCP

SAP HANA MCP Server implements the Model Context Protocol for SAP HANA and SAP HANA Cloud. AI clients discover schema, run SQL with guardrails, and optionally merge business/domain metadata so agents interpret codes and tables consistently—without replacing your database as the system of record.


📚 Documentation

DocumentPurpose
This READMEPrerequisites, install, how to wire each client, capability summary, configuration cheat sheet, troubleshooting
CHANGELOG.mdRelease history — features and fixes by version (latest 0.3.1)
docs/README.mdIndex of /docs
docs/ENVIRONMENT.mdAuthoritative env reference: every variable, defaults, hard bounds, HTTP auth, security notes
docs/configuration-samples.mdCopy-paste: connection profiles (single-container, MDC), semantics JSON, paging pointers
docs/local-http-mcp.mdLocal HTTP MCP: npm run start:http, Cursor mcp.json, curl smoke checks

✅ Prerequisites

  • Node.js 18+
  • A SAP HANA or SAP HANA Cloud database reachable on the SQL port from the machine running the server
  • An MCP client (Claude Desktop, Claude Code, VS Code, Cursor, Cline, Windsurf, or custom HTTP client)
  • Credentials supplied via env (see Security)

📦 Installation

MethodUse when
npx + -y hana-mcp-server in MCP configDefault — no global install
npm install -g hana-mcp-serverYou need hana-mcp-server on PATH
Clone + node hana-mcp-server.jsDeveloping or pinning a local build

HTTP entrypoint (from a clone): npm run start:http — default bind 127.0.0.1:3100, path /mcp. See Hosted & HTTP.


🎯 Use cases

AudienceTransportNext step
Chat / lite usersstdioClaude Desktop
Developers (Claude Code, VS Code, Cline, Cursor, Windsurf)stdioIDEs & code agents
Business apps with AI agents (you host MCP over HTTP)HTTPHosted & HTTP

🖥️ Claude Desktop

  1. Config file path:

    • macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
    • Windows: %APPDATA%\claude\claude_desktop_config.json
    • Linux: ~/.config/claude/claude_desktop_config.json
  2. Register the server; put connection settings in env (see Configuration; full profile JSON in configuration-samples.md). The example below includes HANA_INSTANCE_NUMBER / HANA_DATABASE_NAME for MDC—remove them if you use a single-container database.

json
{
  "mcpServers": {
    "HANA Database": {
      "command": "npx",
      "args": ["-y", "hana-mcp-server"],
      "env": {
        "HANA_HOST": "your-hana-host.com",
        "HANA_PORT": "443",
        "HANA_USER": "your-username",
        "HANA_PASSWORD": "your-password",
        "HANA_SCHEMA": "your-schema",
        "HANA_SSL": "true",
        "HANA_ENCRYPT": "true",
        "HANA_VALIDATE_CERT": "true",
        "HANA_CONNECTION_TYPE": "auto",
        "HANA_INSTANCE_NUMBER": "10",
        "HANA_DATABASE_NAME": "HQQ",
        "LOG_LEVEL": "info",
        "ENABLE_FILE_LOGGING": "true",
        "ENABLE_CONSOLE_LOGGING": "false"
      }
    }
  }
}

If the CLI is on PATH, you may use "command": "hana-mcp-server" and omit args.

  1. Restart Claude Desktop.

Optional: HANA MCP UI — npx hana-mcp-ui for editing envs and deploying to Claude Desktop.


💻 IDEs & code agents

stdio only; same env keys as above. Canonical example — Claude Code (~/.claude.json or project .mcp.json). The env block below includes HANA_DATABASE_NAME for MDC tenant HANA; omit it for most single-container setups.

json
{
  "mcpServers": {
    "hana": {
      "type": "stdio",
      "timeout": 600,
      "command": "npx",
      "args": ["-y", "hana-mcp-server"],
      "env": {
        "HANA_HOST": "<host>",
        "HANA_PORT": "31013",
        "HANA_USER": "<user>",
        "HANA_PASSWORD": "<password>",
        "HANA_SCHEMA": "SAPABAP1",
        "HANA_DATABASE_NAME": "HQQ",
        "HANA_SSL": "false",
        "HANA_ENCRYPT": "false",
        "HANA_VALIDATE_CERT": "false",
        "LOG_LEVEL": "info",
        "ENABLE_FILE_LOGGING": "true",
        "ENABLE_CONSOLE_LOGGING": "false"
      }
    }
  }
}

Use the same command, args, and env in VS Code, Cline, Cursor, and Windsurf. After any change to env, restart the MCP server connection in the IDE.


🌐 Hosted & HTTP

Run the HTTP transport from a checkout of this repository (after npm install). The published npx hana-mcp-server path is stdio only.

bash
npm run start:http

Cursor / local IDE over HTTP: set HANA_* in the shell (or process manager) that runs start:http, then add an HTTP MCP entry with url http://127.0.0.1:3100/mcp ("type": "fetch" or "type": "http", depending on Cursor version). See docs/local-http-mcp.md and ./scripts/start-http-mcp.sh.

TopicDetail
EndpointPOST JSON-RPC to /mcp (default base http://127.0.0.1:3100)
TuningMCP_HTTP_HOST, MCP_HTTP_PORT
HealthGET /health → 200
CORSMCP_HTTP_ALLOWED_ORIGINS — ENVIRONMENT.md §7

Optional Bearer JWT (OAuth2 / OIDC)

VariableRole
MCP_HTTP_AUTH_ENABLEDtrue → require Authorization: Bearer <token> on POST /mcp
MCP_HTTP_JWT_ISSUERIssuer / JWKS (omit on SAP BTP with bound XSUAA)
MCP_HTTP_JWT_AUDIENCEOptional expected aud
MCP_HTTP_JWT_SCOPES_REQUIREDOptional scope list

SAP BTP: bind XSUAA, MCP_HTTP_AUTH_ENABLED=true, assign role collections. Details: ENVIRONMENT.md §7.


🔒 Security

  • Secrets: HANA_PASSWORD, JWT material, and URLs with embedded credentials belong in env or a secret manager — not in git.
  • Supply chain: Prefer npx -y from the published package in CI and shared desktops instead of a mutable global install.
  • HTTP: Enable JWT validation for anything beyond localhost; put the service behind a reverse proxy for TLS termination and network policy.

Further notes: ENVIRONMENT.md §9.


🎯 Capabilities

34 tools across six areas, all verified on HANA Cloud.

AreaToolsWhat you get
Connection & confighana_show_config hana_test_connection hana_show_env_vars hana_get_session_infoVerify connectivity, inspect configuration, see current user / schema / database / version
Schema browsinghana_list_schemas hana_list_tables hana_describe_table hana_explain_table hana_search_tables hana_search_columnsPaginated schema/table lists, column metadata, cross-schema search, optional business-meaning overlay
SQL executionhana_execute_query hana_query_next_pageParameterized SQL with optional row/column/cell caps, paging (maxRows/offset/includeTotal), and snapshot continuation
Structural analysishana_list_constraints hana_list_foreign_keys hana_list_indexes hana_describe_index hana_list_views hana_describe_view hana_list_synonyms hana_list_privileges hana_get_ddlPK/UK/FK/check constraints, indexes, views with SQL definition, synonyms, effective privileges, CREATE statement DDL
Code objectshana_list_procedures hana_describe_procedure hana_list_functions hana_describe_function hana_list_calculation_views hana_list_sequencesStored procedures, scalar/table functions, SAP BW/S4 calculation views (_SYS_BIC), sequences
Data & performancehana_get_table_stats hana_get_sample_data hana_get_column_stats hana_explain_plan hana_get_dependencies hana_get_partition_info hana_get_expensive_queriesRow counts, sample rows, distinct/null stats, query execution plan, object dependency graph, partition info, top expensive statements
DML guard—INSERT / UPDATE / DELETE / TRUNCATE blocked by default; opt-in individually via HANA_ALLOW_INSERT / HANA_ALLOW_UPDATE / HANA_ALLOW_DELETE
Resourceshana:///schemas hana:///schemas/{s}/tables/{t}MCP resource URIs for schema and table enumeration; truncated flag on large payloads
Domain knowledgevia hana_explain_tableOptional JSON semantics overlay (table descriptions, column meanings, code-value maps) — configuration-samples.md

🛠️ Configuration

Variables apply to stdio (env in the client config) and HTTP (process environment). Restart after changes.

Source of truth for names, defaults, and clamp ranges: docs/ENVIRONMENT.md.
Copy-paste connection JSON (single-container / MDC): docs/configuration-samples.md#connection-profiles-env-json.

Required

ParameterDescriptionExample
HANA_HOSTHostname or IPhana.company.com
HANA_USERDatabase userDBADMIN
HANA_PASSWORDDatabase password(secret)

Connection & TLS

ParameterDefaultNotes
HANA_PORT443MDC SQL ports often 3NN13 (e.g. 31013)
HANA_SCHEMA—Default when a tool omits schema_name
HANA_CONNECTION_TYPEautoauto, single_container, mdc_system, mdc_tenant
HANA_INSTANCE_NUMBER—MDC instance id (e.g. 10)
HANA_DATABASE_NAME—Tenant name for MDC (e.g. HQQ, HQP) — session database only
HANA_SSL / HANA_ENCRYPT / HANA_VALIDATE_CERTtrueTLS and cert validation flags for the driver

Logging

ParameterDefaultNotes
LOG_LEVELinfoerror … debug
ENABLE_FILE_LOGGINGfalse*true enables file logs
ENABLE_CONSOLE_LOGGINGtrueOften false for stdio to reduce stderr noise

*Code default; examples frequently set file logging to true.

Limits (queries, lists, resources)

ParameterDefaultPurpose
HANA_QUERY_LIMITS_ENABLEDfalseSet to true to enable automatic row/column/cell caps. When false, user-provided maxRows, offset, and includeTotal still work.
HANA_QUERY_TIMEOUT_MS0Statement timeout (ms); 0 = disabled. Per-call timeout_ms overrides.
HANA_MAX_RESULT_ROWS50Max rows per hana_execute_query page (active when limits enabled)
HANA_MAX_RESULT_COLS50Max columns per row returned (active when limits enabled)
HANA_MAX_CELL_CHARS200Truncate long cell text (active when limits enabled)
HANA_QUERY_DEFAULT_OFFSET0Default offset (active when limits enabled)
HANA_LIST_DEFAULT_LIMIT200List tools: default and max page size
HANA_RESOURCE_LIST_MAX_ITEMS500Cap embedded names in hana:/// payloads
HANA_QUERY_SNAPSHOT_TTL_MS300000Snapshot id lifetime for query paging
HANA_CONNECTION_POOL_SIZE3HANA connection pool size (1–20)

DML permissions

INSERT, UPDATE, and DELETE are blocked by default. Set each to true to permit:

ParameterDefaultPurpose
HANA_ALLOW_INSERTfalsePermit INSERT via hana_execute_query
HANA_ALLOW_UPDATEfalsePermit UPDATE via hana_execute_query
HANA_ALLOW_DELETEfalsePermit DELETE and TRUNCATE via hana_execute_query

Business / domain JSON (HANA_SEMANTICS_*)

ParameterDefaultPurpose
HANA_SEMANTICS_PATH—File path to dictionary JSON (wins over URL)
HANA_SEMANTICS_URL—HTTPS URL to same format
HANA_SEMANTICS_TTL_MS60000Cache / reload behavior

Samples: configuration-samples.md.


🔧 Troubleshooting

SymptomCheck
spawn npx ENOENT / spawn hana-mcp-server ENOENT in client logsClient cannot find npx / hana-mcp-server on PATH — see Client cannot find npx below
Connection refusedHANA_HOST, HANA_PORT, network path
Auth failed / no clientPassword, user, HANA_DATABASE_NAME on tenants; use connection test tool for driver message
TLS errorsHANA_VALIDATE_CERT, trust store
Wrong or empty objectsMDC: tenant drives visibility; identical schema names can differ by tenant
SQL needs another database prefixhana_execute_query does not rewrite SQL; use the three-part names your HANA expects (e.g. HSP.SAPABAP1.TABLE) while HANA_DATABASE_NAME stays the tenant you connect to (e.g. HQP)

Debug: LOG_LEVEL=debug, ENABLE_CONSOLE_LOGGING=true, restart.

Client cannot find npx (spawn ENOENT)

GUI clients launched from the Dock or Start Menu (Claude Desktop, Cursor, VS Code, …) inherit a minimal PATH and may not see Node tooling installed under /opt/homebrew/bin, ~/.nvm/..., mise, or volta. This affects every npx-based MCP, not just this server. The error appears in MCP client logs as:

text
Connection failed: spawn npx ENOENT

Pick one fix:

  1. Symlink npx / node into a GUI-visible path (macOS, Homebrew):

    bash
    ln -s "$(which npx)"  /usr/local/bin/npx
    ln -s "$(which node)" /usr/local/bin/node
  2. Use absolute paths in the MCP config — most portable, no PATH dependency. Resolve paths with which node and npm root -g:

    json
    {
      "mcpServers": {
        "hana": {
          "type": "stdio",
          "command": "/opt/homebrew/bin/node",
          "args": ["/opt/homebrew/lib/node_modules/hana-mcp-server/hana-mcp-server.js"],
          "env": { "HANA_HOST": "...", "HANA_USER": "...", "HANA_PASSWORD": "..." }
        }
      }
    }

    Requires a one-time npm install -g hana-mcp-server.

  3. Inject PATH into the MCP env block — keeps the npx form:

    json
    "env": {
      "PATH": "/opt/homebrew/bin:/usr/local/bin:/usr/bin:/bin",
      "HANA_HOST": "...",
      "HANA_USER": "...",
      "HANA_PASSWORD": "..."
    }

Restart the MCP client after the change. If npx then fails with EPERM on ~/.npm/_cacache, the npm cache has root-owned files from a previous sudo npm — fix with sudo chown -R "$(whoami)" ~/.npm or set "NPM_CONFIG_CACHE": "/tmp/hana-mcp-npm-cache" in the same env block.


🖥️ HANA MCP UI

bash
npx hana-mcp-ui

HANA MCP UI


🏗️ Architecture

HANA MCP Server Architecture

text
hana-mcp-server/
├── src/
│   ├── server/           # MCP lifecycle, resources, HTTP transport
│   ├── tools/            # 34 tools: schema, SQL, discovery, config
│   ├── database/         # HANA client, connection pool, executor, query runner
│   ├── semantics/        # Optional semantics / domain JSON loader
│   ├── utils/            # Logger, config, validators, formatters
│   ├── query-snapshot-store.js
│   └── constants/        # MCP constants, tool definitions
├── tests/
├── docs/                 # README index, ENVIRONMENT.md, configuration-samples.md, diagrams
└── hana-mcp-server.js    # stdio entry point

📦 Package

RuntimeNode.js 18+
PlatformsmacOS, Linux, Windows
Dependencies@sap/hana-client, axios, jose

🤝 Support

📄 License

MIT — see LICENSE.

Installatioun

TypingMind
Viraussetzungen:

Node.js 18+

{
  "mcpServers": {
    "hatrigt-hana-mcp-server": {
      "command": "",
      "args": []
    }
  }
}

HANA MCP Server MCP mat verschiddene KI-Modeller benotzen

TypingMind verbënnt MCP-Tools um Niveau vum Aarbechtsberäich. Soubal HANA MCP Server verbonnen ass, kënnt Dir et mat verschiddene KI-Modeller an TypingMind benotzen, amplaz et fir all Modell separat anzeriichten. Dës MCP-Integratioun leeft lokal iwwer den TypingMind-MCP-Connector op Ärem Apparat.

Ariichtungsuleedung fir de lokale Connector ze benotzen

Benotzt dës Optioun, wann den MCP-Server Zougrëff op lokal Fichieren, Appen oder privat Ressourcen op Ärem Computer brauch.

1

D'MCP-Astellungen opmaachen

Gitt an TypingMind op „Astellungen“, „Erweidert Astellungen“, dann op „Model Context Protocol“ a wielt „Connector ariichten“.

  1. Maacht TypingMind an Ärem Browser op.
  2. Klickt op d'Astellungssymbol.
  3. Gitt op „Erweidert Astellungen“.
  4. Maacht d'Sektioun „Model Context Protocol“ op.
  5. Klickt op „Connector ariichten“ a wielt „Dësen Apparat“.
Ariichtungsbildschierm vum TypingMind-MCP-Connector mat „Dësen Apparat“ ausgewielt
2

De Connector-Befeel ausféieren

Wielt „Dësen Apparat“, kopéiert de Befeel aus TypingMind a féiert en am Terminal aus. Loosst de Prozess lafen, wärend Dir MCP benotzt.

  1. Kopéiert den Ariichtungsbefeel, deen TypingMind uweist.
  2. Maacht Terminal op macOS oder Windows Terminal op Windows op.
  3. Pescht de Befeel an a féiert en aus.
  4. Bestätegt d'Installatioun vum Package, wann den Terminal Iech freet, ob Dir weiderfuere wëllt.
  5. Loosst den Terminal an de Prozess doranner lafen, wärend Dir MCP-Tools benotzt.
3

HANA MCP Server als Server derbäisetzen

Wann de Connector-Status „Prett“ ass, klickt op „Serveren änneren“ a pescht d'MCP-Serverkonfiguratioun an.

  1. Waart, bis de Connector-Status „Prett“ weist.
  2. Klickt op „Serveren änneren“.
  3. Pescht d'MCP-Serverkonfiguratioun vu HANA MCP Server an.
  4. Späichert d'Serverlëscht.
  5. Aktualiséiert, wann Dir kontrolléiere wëllt, ob de Connector nach ëmmer prett ass.
MCP-Astellunge vun TypingMind mat aktivem Server an dem Knäppchen „Serveren änneren“
{
  "mcpServers": {
    "hatrigt-hana-mcp-server": {
      "command": "npx",
      "args": [
        "-y",
        "hana-mcp-server"
      ]
    }
  }
}
4

D'Verbindung mat verschiddene Modeller benotzen

Späichert d'Serverlëscht, maacht „Plugins“ op an aktivéiert d'MCP-Tools vu HANA MCP Server. Wielt dann e belibegen ënnerstëtzte KI-Modell an TypingMind a benotzt d'Tools am Chat oder weist se engem KI-Agent zou.

  1. Maacht d'Säit „Plugins“ an TypingMind op.
  2. Aktivéiert d'MCP-Tools vu HANA MCP Server.
  3. Start e Chat a wielt de KI-Modell, deen Dir benotze wëllt.
  4. Benotzt d'MCP-Tools am Chat oder weist se engem KI-Agent zou.
  5. Wiesselt bei Bedarf op en anere KI-Modell, ouni MCP nei ze verbannen.
TypingMind-Chat mat aktivéierte MCP-Tools an engem ausgewielte KI-Modell
Hëlleft Dir mir bei dëser Aufgab mat HANA MCP Server?
HANA MCP Server
Jo. Ech hunn et gelies.
Dat hunn ech mat HANA MCP Server fonnt.

Heefeg gestallte Froen

Fir wat gëtt de MCP-Server HANA MCP Server benotzt?

HANA MCP Server ass e MCP-Server, deen et kompatibele KI-Clienten erlaabt, sech mat externen Tools a Kontext ze verbannen. An TypingMind kënnt Dir dëse MCP-Server eemol derbäisetzen a seng Tools an Ärem KI-Aarbechtsberäich zur Verfügung stellen.

Kann ech HANA MCP Server MCP mat méi KI-Modeller an TypingMind benotzen?

Jo. TypingMind verbënnt MCP-Tools um Niveau vum Aarbechtsberäich. Sou kënnt Dir HANA MCP Server mat verschiddene KI-Modeller wéi Claude, ChatGPT, Gemini oder anere Modeller benotzen, déi Dir an TypingMind konfiguréiert hutt, ouni de MCP-Server fir all Modell separat anzeriichten.

Firwat HANA MCP Server MCP mat TypingMind benotzen?

TypingMind ass eng vun de beschte Benotzeruewerfläche fir LLM-Chat, well et méi KI-Modeller, Prompts, Plugins, KI-Agenten, API-Schlësselen a MCP-Tools an engem Aarbechtsberäich zesummebréngt. Wann HANA MCP Server verbonnen ass, kënnt Dir seng MCP-Tools mat Äre bevorzugte Modeller benotzen a gläichzäiteg Är Chataarbecht an TypingMind organiséieren.

Wéi verbannen ech HANA MCP Server MCP mat TypingMind?

HANA MCP Server leeft iwwer de lokale MCP-Connector vun TypingMind. Dat eegent sech am beschten, wann de MCP-Server Zougrëff op lokal Fichieren, Desktop-Apps, Kommandozeilen-Tools oder privat Ressourcen op Ärem Computer brauch.

Wéi eng Tools stellt HANA MCP Server MCP an TypingMind zur Verfügung?

HANA MCP Server stellt MCP-Funktiounen zur Verfügung, déi Dir op der Plugins-Säit vun TypingMind aktivéiere kënnt, fir se am Chat ze benotzen oder KI-Agenten zouzeweisen.

Muss ech meng API-Schlëssele mat TypingMind deelen, fir HANA MCP Server MCP ze benotzen?

Nee. TypingMind setzt op lokal Veraarbechtung a léisst Iech d'Kontroll iwwer Är Modellubidder, API-Schlësselen, Prompts a MCP-Konfiguratioun. Wann HANA MCP Server eng Authentifizéierung verlaangt, setzt déi néideg Headeren, OAuth-Astellungen oder lokal Konfiguratioun fir dee MCP-Server derbäi, wann Dir d'Verbindung erstallt.

Änlech MCP-Serveren

All weisen

Elo Ären eegene KI-Workspace ariichten

Abonnéiert Iech op eisen Newsletter, fir iwwer nei Funktiounen an zukünfteg Gewënnspiller informéiert ze ginn 👇