HANA Cloud ML Bridge

by hatrigt

408 downloads
Not rated
GitHub

About

Bridges SAP HANA Cloud databases with machine learning operations through a three-layer architecture that enables model management, execution contexts, and standardized communication for both inference and training workflows.

Details

Author
hatrigt
Repository
HatriGt/hana-mcp-server
Downloads
408
License
MIT License
Categories
Productivity, Developer Tools, AI, Database, Infrastructure, Other
Tags
#data-science

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

| Area | Tools | What you get |
|------|-------|--------------|
| Connection & config | hana_show_config hana_test_connection hana_show_env_vars hana_get_session_info | Verify connectivity, inspect configuration, see current user / schema / database / version |
| Schema browsing | hana_list_schemas hana_list_tables hana_describe_table hana_explain_table hana_search_tables hana_search_columns | Paginated schema/table lists, column metadata, cross-schema search, optional business-meaning overlay |
| SQL execution | hana_execute_query hana_query_next_page | Parameterized SQL with optional row/column/cell caps, paging (maxRows/offset/includeTotal), and snapshot continuation |
| Structural analysis | hana_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_ddl | PK/UK/FK/check constraints, indexes, views with SQL definition, synonyms, effective privileges, CREATE statement DDL |
| Code objects | hana_list_procedures hana_describe_procedure hana_list_functions hana_describe_function hana_list_calculation_views hana_list_sequences | Stored procedures, scalar/table functions, SAP BW/S4 calculation views (_SYS_BIC), sequences |
| Data & performance | hana_get_table_stats hana_get_sample_data hana_get_column_stats hana_explain_plan hana_get_dependencies hana_get_partition_info hana_get_expensive_queries | Row 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 |
| Resources | hana:///schemas hana:///schemas/{s}/tables/{t} | MCP resource URIs for schema and table enumeration; truncated flag on large payloads |
| Domain knowledge | via hana_explain_table | Optional JSON semantics overlay (table descriptions, column meanings, code-value maps) — configuration-samples.md |

---

Setting up with Highlight

This MCP is not yet compatible with Highlight’s one-click setup. However, you can still use it with Highlight by following these steps:

  1. Download and install Highlight from highlightai.com/download
  2. Navigate to the plugins tab and select "Add Custom Plugin"
  3. Configure the plugin with the settings below
    Plugin Name HANA Cloud ML Bridge
    Command (node, npx, python, etc.) npx
    Arguments
    • Argument 1 -y
    • Argument 2 hana-mcp-server
    Environment
    • HANA_SSL true
    • HANA_HOST your-hana-host.com
    • HANA_PORT 443
    • HANA_USER your-username
    • LOG_LEVEL info
    • HANA_SCHEMA your-schema
    • HANA_ENCRYPT true
    • HANA_PASSWORD your-password
    • HANA_DATABASE_NAME HQQ
    • HANA_VALIDATE_CERT true
    • ENABLE_FILE_LOGGING true
    • HANA_CONNECTION_TYPE auto
    • HANA_INSTANCE_NUMBER 10
    • ENABLE_CONSOLE_LOGGING false

    Please refer to the README for specific instructions on how to obtain API keys or other required environment variables.

  4. Enable "Start Automatically" if you want the plugin to start when Highlight launches

From the repository

| Method | Use when |
|--------|----------|
| npx + -y hana-mcp-server in MCP config | Default — no global install |
| npm install -g hana-mcp-server | You need hana-mcp-server on PATH |
| Clone + node hana-mcp-server.js | Developing 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.

---

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.

hana_show_config

Verify connectivity and inspect configuration.

hana_test_connection

Test the connection to the SAP HANA database.

hana_show_env_vars

See current user, schema, database, and version.

hana_get_session_info

Retrieve information about the current session.

hana_list_schemas

Get a paginated list of schemas in the database.

hana_list_tables

Get a paginated list of tables in the selected schema.

hana_describe_table

Retrieve metadata for a specific table.

hana_explain_table

Get an explanation of the table structure and semantics.

hana_search_tables

Search for tables based on a query string.

hana_search_columns

Search for columns in the database.

hana_execute_query

Execute a parameterized SQL query with optional limits.

hana_query_next_page

Retrieve the next page of results from a previously executed query.

hana_list_constraints

List the constraints defined in the database.

hana_list_foreign_keys

List foreign keys defined in the database.

hana_list_indexes

Get a list of indexes defined on the tables.

hana_describe_index

Get detailed information about a specific index.

hana_list_views

List views available in the database.

hana_describe_view

Get metadata for a specific view.

hana_list_synonyms

List synonyms defined in the database.

hana_list_privileges

List privileges for the current user.

hana_get_ddl

Retrieve the DDL statement for a specified object.

hana_list_procedures

List stored procedures in the database.

hana_describe_procedure

Get metadata for a specific stored procedure.

hana_list_functions

List functions available in the database.

hana_describe_function

Get metadata for a specific function.

hana_list_calculation_views

List calculation views in the database.

hana_list_sequences

List sequences defined in the database.

hana_get_table_stats

Retrieve statistics for a specific table.

hana_get_sample_data

Get a sample of data from a specific table.

hana_get_column_stats

Retrieve statistics for specific columns.

hana_explain_plan

Get the query execution plan for a specific query.

hana_get_dependencies

Retrieve dependencies for a specific object.

hana_get_partition_info

Get information about the partitioning of a table.

hana_get_expensive_queries

Retrieve a list of the top expensive queries in the database.

Claude Desktop / Cursor

Paste into your MCP client config file to install this server.

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

Linux

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

Macos

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

Windows

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

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

| Document | Purpose |
|----------|---------|
| This README | Prerequisites, install, how to wire each client, capability summary, configuration cheat sheet, troubleshooting |
| CHANGELOG.md | Release history — features and fixes by version (latest 0.3.1) |
| docs/README.md | Index of /docs |
| docs/ENVIRONMENT.md | Authoritative env reference: every variable, defaults, hard bounds, HTTP auth, security notes |
| docs/configuration-samples.md | Copy-paste: connection profiles (single-container, MDC), semantics JSON, paging pointers |
| docs/local-http-mcp.md | Local 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

| Method | Use when |
|--------|----------|
| npx + -y hana-mcp-server in MCP config | Default — no global install |
| npm install -g hana-mcp-server | You need hana-mcp-server on PATH |
| Clone + node hana-mcp-server.js | Developing 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

| Audience | Transport | Next step |
|----------|-----------|-----------|
| Chat / lite users | stdio | Claude Desktop |
| Developers (Claude Code, VS Code, Cline, Cursor, Windsurf) | stdio | IDEs & code agents |
| Business apps with AI agents (you host MCP over HTTP) | HTTP | Hosted & 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.

{
  "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.

3. Restart Claude Desktop.

Optional: HANA MCP UInpx 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.

{
  "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.

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.

| Topic | Detail |
|--------|--------|
| Endpoint | POST JSON-RPC to /mcp (default base http://127.0.0.1:3100) |
| Tuning | MCP_HTTP_HOST, MCP_HTTP_PORT |
| Health | GET /health200 |
| CORS | MCP_HTTP_ALLOWED_ORIGINSENVIRONMENT.md §7 |

Optional Bearer JWT (OAuth2 / OIDC)

| Variable | Role |
|----------|------|
| MCP_HTTP_AUTH_ENABLED | true → require Authorization: Bearer <token> on POST /mcp |
| MCP_HTTP_JWT_ISSUER | Issuer / JWKS (omit on SAP BTP with bound XSUAA) |
| MCP_HTTP_JWT_AUDIENCE | Optional expected aud |
| MCP_HTTP_JWT_SCOPES_REQUIRED | Optional 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.

| Area | Tools | What you get |
|------|-------|--------------|
| Connection & config | hana_show_config hana_test_connection hana_show_env_vars hana_get_session_info | Verify connectivity, inspect configuration, see current user / schema / database / version |
| Schema browsing | hana_list_schemas hana_list_tables hana_describe_table hana_explain_table hana_search_tables hana_search_columns | Paginated schema/table lists, column metadata, cross-schema search, optional business-meaning overlay |
| SQL execution | hana_execute_query hana_query_next_page | Parameterized SQL with optional row/column/cell caps, paging (maxRows/offset/includeTotal), and snapshot continuation |
| Structural analysis | hana_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_ddl | PK/UK/FK/check constraints, indexes, views with SQL definition, synonyms, effective privileges, CREATE statement DDL |
| Code objects | hana_list_procedures hana_describe_procedure hana_list_functions hana_describe_function hana_list_calculation_views hana_list_sequences | Stored procedures, scalar/table functions, SAP BW/S4 calculation views (_SYS_BIC), sequences |
| Data & performance | hana_get_table_stats hana_get_sample_data hana_get_column_stats hana_explain_plan hana_get_dependencies hana_get_partition_info hana_get_expensive_queries | Row 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 |
| Resources | hana:///schemas hana:///schemas/{s}/tables/{t} | MCP resource URIs for schema and table enumeration; truncated flag on large payloads |
| Domain knowledge | via hana_explain_table | Optional 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

| Parameter | Description | Example |
|-----------|-------------|---------|
| HANA_HOST | Hostname or IP | hana.company.com |
| HANA_USER | Database user | DBADMIN |
| HANA_PASSWORD | Database password |
(secret) |

Connection & TLS

| Parameter | Default | Notes |
|-----------|---------|--------|
| HANA_PORT | 443 | MDC SQL ports often 3NN13 (e.g. 31013) |
| HANA_SCHEMA | — | Default when a tool omits schema_name |
| HANA_CONNECTION_TYPE | auto | auto, 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_CERT | true | TLS and cert validation flags for the driver |

Logging

| Parameter | Default | Notes |
|-----------|---------|--------|
| LOG_LEVEL | info | errordebug |
| ENABLE_FILE_LOGGING | false
| true enables file logs |
| ENABLE_CONSOLE_LOGGING | true | Often false for stdio to reduce stderr noise |

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

Limits (queries, lists, resources)

| Parameter | Default | Purpose |
|-----------|---------|---------|
| HANA_QUERY_LIMITS_ENABLED | false | Set to true to enable automatic row/column/cell caps. When false, user-provided maxRows, offset, and includeTotal still work. |
| HANA_QUERY_TIMEOUT_MS | 0 | Statement timeout (ms); 0 = disabled. Per-call timeout_ms overrides. |
| HANA_MAX_RESULT_ROWS | 50 | Max rows per hana_execute_query page (active when limits enabled) |
| HANA_MAX_RESULT_COLS | 50 | Max columns per row returned (active when limits enabled) |
| HANA_MAX_CELL_CHARS | 200 | Truncate long cell text (active when limits enabled) |
| HANA_QUERY_DEFAULT_OFFSET | 0 | Default offset (active when limits enabled) |
| HANA_LIST_DEFAULT_LIMIT | 200 | List tools: default and max page size |
| HANA_RESOURCE_LIST_MAX_ITEMS | 500 | Cap embedded names in hana:/// payloads |
| HANA_QUERY_SNAPSHOT_TTL_MS | 300000 | Snapshot id lifetime for query paging |
| HANA_CONNECTION_POOL_SIZE | 3 | HANA connection pool size (1–20) |

DML permissions

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

| Parameter | Default | Purpose |
|-----------|---------|---------|
| HANA_ALLOW_INSERT | false | Permit INSERT via hana_execute_query |
| HANA_ALLOW_UPDATE | false | Permit UPDATE via hana_execute_query |
| HANA_ALLOW_DELETE | false | Permit DELETE and TRUNCATE via hana_execute_query |

Business / domain JSON (HANA_SEMANTICS_)

| Parameter | Default | Purpose |
|-----------|---------|---------|
| HANA_SEMANTICS_PATH | — | File path to dictionary JSON (wins over URL) |
| HANA_SEMANTICS_URL | — | HTTPS URL to same format |
| HANA_SEMANTICS_TTL_MS | 60000 | Cache / reload behavior |

No reviews yet — be the first

Sign in to leave a review

Use Google, GitHub, or an email account so ratings stay tied to real people.

Email sign in

No reviews posted yet.