HatriGt/hana-mcp-server
If you are the rightful owner of hana-mcp-server and would like to certify it and/or have it hosted online, please leave a comment on the right or send an email to henry@mcphub.com.
A Model Context Protocol (MCP) server implementation for SAP HANA Cloud DB integration with Cursor IDE.
HANA MCP Server
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"
๐ฏ 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"
๐ฅ๏ธ Visual Configuration (Recommended)
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
๐ ๏ธ 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
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
- Issues: GitHub Issues
- UI Tool: HANA MCP UI
๐ License
MIT License - see file for details.