Skip to main content
Glama

HANA MCP Server

npm version npm downloads Node.js License MCP

Model Context Protocol (MCP) server for seamless SAP HANA database integration with AI agents and development tools.

๐Ÿš€ Quick Start

1. Install

npm install -g hana-mcp-server

2. Configure Claude Desktop

Update your Claude Desktop config file:

macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
Windows: %APPDATA%\claude\claude_desktop_config.json
Linux: ~/.config/claude/claude_desktop_config.json

{ "mcpServers": { "HANA Database": { "command": "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" } } } }

3. Restart Claude Desktop

Close and reopen Claude Desktop to load the configuration.

4. Test It!

Ask Claude: "Show me the available schemas in my HANA database"

Related MCP server: Cursor DB MCP Server

๐ŸŽฏ What You Get

Database Operations

  • Schema Exploration: List schemas, tables, and table structures

  • Query Execution: Run SQL queries with natural language

  • Data Sampling: Get sample data from tables

  • System Information: Monitor database status and performance

AI Integration

  • Natural Language Queries: "Show me all tables in the SYSTEM schema"

  • Query Building: "Create a query to find customers with orders > $1000"

  • Data Analysis: "Get sample data from the ORDERS table"

  • Schema Navigation: "Describe the structure of table CUSTOMERS"

For easier setup and management, use the HANA MCP UI:

npx hana-mcp-ui

This opens a web interface where you can:

  • Configure multiple database environments

  • Deploy configurations to Claude Desktop with one click

  • Manage active connections

  • Test database connectivity

HANA MCP UI

๐Ÿ› ๏ธ Configuration Options

Required Parameters

Parameter

Description

Example

HANA_HOST

Database hostname or IP address

hana.company.com

HANA_USER

Database username

DBADMIN

HANA_PASSWORD

Database password

your-secure-password

Optional Parameters

Parameter

Description

Default

Options

HANA_PORT

Database port

443

Any valid port number

HANA_SCHEMA

Default schema name

-

Schema name

HANA_CONNECTION_TYPE

Connection type

auto

auto

,

single_container

,

mdc_system

,

mdc_tenant

HANA_INSTANCE_NUMBER

Instance number (MDC)

-

Instance number (e.g.,

10

)

HANA_DATABASE_NAME

Database name (MDC tenant)

-

Database name (e.g.,

HQQ

)

HANA_SSL

Enable SSL connection

true

true

,

false

HANA_ENCRYPT

Enable encryption

true

true

,

false

HANA_VALIDATE_CERT

Validate SSL certificates

true

true

,

false

LOG_LEVEL

Logging level

info

error

,

warn

,

info

,

debug

ENABLE_FILE_LOGGING

Enable file logging

true

true

,

false

ENABLE_CONSOLE_LOGGING

Enable console logging

false

true

,

false

Database Connection Types

1. Single-Container Database

Standard HANA database with single tenant.

Required: HANA_HOST, HANA_USER, HANA_PASSWORD
Optional: HANA_PORT, HANA_SCHEMA

{ "HANA_HOST": "hana.company.com", "HANA_PORT": "443", "HANA_USER": "DBADMIN", "HANA_PASSWORD": "password", "HANA_SCHEMA": "SYSTEM", "HANA_CONNECTION_TYPE": "single_container" }

2. MDC System Database

Multi-tenant system database (manages tenants).

Required: HANA_HOST, HANA_PORT, HANA_INSTANCE_NUMBER, HANA_USER, HANA_PASSWORD
Optional: HANA_SCHEMA

{ "HANA_HOST": "192.168.1.100", "HANA_PORT": "31013", "HANA_INSTANCE_NUMBER": "10", "HANA_USER": "SYSTEM", "HANA_PASSWORD": "password", "HANA_SCHEMA": "SYSTEM", "HANA_CONNECTION_TYPE": "mdc_system" }

3. MDC Tenant Database

Multi-tenant tenant database (specific tenant).

Required: HANA_HOST, HANA_PORT, HANA_INSTANCE_NUMBER, HANA_DATABASE_NAME, HANA_USER, HANA_PASSWORD
Optional: HANA_SCHEMA

{ "HANA_HOST": "192.168.1.100", "HANA_PORT": "31013", "HANA_INSTANCE_NUMBER": "10", "HANA_DATABASE_NAME": "HQQ", "HANA_USER": "DBADMIN", "HANA_PASSWORD": "password", "HANA_SCHEMA": "SYSTEM", "HANA_CONNECTION_TYPE": "mdc_tenant" }

Auto-Detection

When HANA_CONNECTION_TYPE is set to auto (default), the server automatically detects the type:

  • If HANA_INSTANCE_NUMBER + HANA_DATABASE_NAME โ†’ MDC Tenant

  • If only HANA_INSTANCE_NUMBER โ†’ MDC System

  • If neither โ†’ Single-Container

๐Ÿ—๏ธ Architecture

System Architecture

HANA MCP Server Architecture

Component Structure

hana-mcp-server/ โ”œโ”€โ”€ ๐Ÿ“ src/ โ”‚ โ”œโ”€โ”€ ๐Ÿ—๏ธ server/ # MCP Protocol & Server Management โ”‚ โ”‚ โ”œโ”€โ”€ index.js # Main server entry point โ”‚ โ”‚ โ”œโ”€โ”€ mcp-handler.js # JSON-RPC 2.0 implementation โ”‚ โ”‚ โ””โ”€โ”€ lifecycle-manager.js # Server lifecycle management โ”‚ โ”œโ”€โ”€ ๐Ÿ› ๏ธ tools/ # Tool Implementations โ”‚ โ”‚ โ”œโ”€โ”€ index.js # Tool registry & discovery โ”‚ โ”‚ โ”œโ”€โ”€ config-tools.js # Configuration management โ”‚ โ”‚ โ”œโ”€โ”€ schema-tools.js # Schema exploration โ”‚ โ”‚ โ”œโ”€โ”€ table-tools.js # Table operations โ”‚ โ”‚ โ”œโ”€โ”€ index-tools.js # Index management โ”‚ โ”‚ โ””โ”€โ”€ query-tools.js # Query execution โ”‚ โ”œโ”€โ”€ ๐Ÿ—„๏ธ database/ # Database Layer โ”‚ โ”‚ โ”œโ”€โ”€ hana-client.js # HANA client wrapper โ”‚ โ”‚ โ”œโ”€โ”€ connection-manager.js # Connection management โ”‚ โ”‚ โ””โ”€โ”€ query-executor.js # Query execution utilities โ”‚ โ”œโ”€โ”€ ๐Ÿ”ง utils/ # Shared Utilities โ”‚ โ”‚ โ”œโ”€โ”€ logger.js # Structured logging โ”‚ โ”‚ โ”œโ”€โ”€ config.js # Configuration management โ”‚ โ”‚ โ”œโ”€โ”€ validators.js # Input validation โ”‚ โ”‚ โ””โ”€โ”€ formatters.js # Response formatting โ”‚ โ””โ”€โ”€ ๐Ÿ“‹ constants/ # Constants & Definitions โ”‚ โ”œโ”€โ”€ mcp-constants.js # MCP protocol constants โ”‚ โ””โ”€โ”€ tool-definitions.js # Tool schemas โ”œโ”€โ”€ ๐Ÿงช tests/ # Testing Framework โ”œโ”€โ”€ ๐Ÿ“š docs/ # Documentation โ”œโ”€โ”€ ๐Ÿ“ฆ package.json # Dependencies & Scripts โ””โ”€โ”€ ๐Ÿš€ hana-mcp-server.js # Main entry point

๐Ÿ“š Available Commands

Once configured, you can ask Claude to:

  • "List all schemas in the database"

  • "Show me tables in the SYSTEM schema"

  • "Describe the CUSTOMERS table structure"

  • "Execute: SELECT * FROM SYSTEM.TABLES LIMIT 10"

  • "Get sample data from ORDERS table"

  • "Count rows in CUSTOMERS table"

๐Ÿ”ง Troubleshooting

Connection Issues

  • "Connection refused": Check HANA host and port

  • "Authentication failed": Verify username/password

  • "SSL certificate error": Set HANA_VALIDATE_CERT=false or install valid certificates

Debug Mode

export LOG_LEVEL="debug" export ENABLE_CONSOLE_LOGGING="true" hana-mcp-server

๐Ÿ“ฆ Package Info

  • Size: 21.7 kB

  • Dependencies: @sap/hana-client, axios

  • Node.js: 18+ required

  • Platforms: macOS, Linux, Windows

๐Ÿค Support

๐Ÿ“„ License

MIT License - see LICENSE file for details.

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/HatriGt/hana-mcp-server'

If you have feedback or need assistance with the MCP directory API, please join our Discord server