Model Context Protocol (MCP) server for seamless SAP HANA database integration with AI agents and development tools.
npm install -g hana-mcp-serverUpdate 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"
}
}
}
}Close and reopen Claude Desktop to load the configuration.
Ask Claude: "Show me the available schemas in my HANA database"
- 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
- 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-uiThis 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
| 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 |
| 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 |
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"
}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"
}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"
}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
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
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"
- "Connection refused": Check HANA host and port
- "Authentication failed": Verify username/password
- "SSL certificate error": Set
HANA_VALIDATE_CERT=falseor install valid certificates
export LOG_LEVEL="debug"
export ENABLE_CONSOLE_LOGGING="true"
hana-mcp-server- Size: 21.7 kB
- Dependencies: @sap/hana-client, axios
- Node.js: 18+ required
- Platforms: macOS, Linux, Windows
- Issues: GitHub Issues
- UI Tool: HANA MCP UI
MIT License - see LICENSE file for details.
