The SAP HANA MCP Server provides a bridge between AI applications and SAP HANA databases through the Model Context Protocol (MCP). It allows AI agents like Claude Desktop to directly interact with your SAP HANA database using natural language queries, making database exploration and management more intuitive.
Install the package globally using npm:
npm install -g hana-mcp-server
Update your Claude Desktop configuration file:
macOS/Linux: ~/.config/claude/claude_desktop_config.json
Windows: %APPDATA%\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",
"LOG_LEVEL": "info"
}
}
}
}
After updating the configuration, restart Claude Desktop to load the new settings.
The server can be configured using these environment variables:
Variable | Required | Description | Default |
---|---|---|---|
HANA_HOST |
✅ | HANA database hostname | - |
HANA_PORT |
✅ | HANA database port | 443 |
HANA_USER |
✅ | Database username | - |
HANA_PASSWORD |
✅ | Database password | - |
HANA_SCHEMA |
❌ | Default schema | - |
HANA_SSL |
❌ | Enable SSL connection | true |
HANA_ENCRYPT |
❌ | Enable encryption | true |
HANA_VALIDATE_CERT |
❌ | Validate SSL certificate | true |
LOG_LEVEL |
❌ | Logging level | info |
Once configured, you can interact with your HANA database using natural language queries in Claude Desktop:
You can also run the server directly:
# Start with environment variables
HANA_HOST="your-host" HANA_USER="your-user" HANA_PASSWORD="your-pass" hana-mcp-server
# Or set environment variables first
export HANA_HOST="your-host"
export HANA_USER="your-user"
export HANA_PASSWORD="your-pass"
hana-mcp-server
Tool | Description | Parameters |
---|---|---|
hana_show_config |
Display current HANA configuration | None |
hana_test_connection |
Test database connectivity | None |
hana_show_env_vars |
Show environment variables (debug) | None |
Tool | Description | Parameters |
---|---|---|
hana_list_schemas |
List all database schemas | None |
hana_list_tables |
List tables in a schema | schema_name (optional) |
hana_describe_table |
Show table structure | schema_name , table_name |
hana_list_indexes |
List indexes for a table | schema_name , table_name |
hana_describe_index |
Show index details | schema_name , table_name , index_name |
Tool | Description | Parameters |
---|---|---|
hana_execute_query |
Execute SQL queries | query |
hana_execute_parameterized_query |
Execute parameterized queries | query , parameters |
hana_get_sample_data |
Get sample data from table | schema_name , table_name , limit |
hana_count_rows |
Count rows in a table | schema_name , table_name |
Tool | Description | Parameters |
---|---|---|
hana_get_system_info |
Get system information | None |
hana_get_user_info |
Get current user information | None |
hana_get_memory_usage |
Get memory usage statistics | None |
Issue | Cause | Solution |
---|---|---|
"Connection refused" | Network connectivity | Verify HANA host and port accessibility |
"Authentication failed" | Invalid credentials | Check username/password in configuration |
"SSL certificate error" | Certificate validation | Configure HANA_VALIDATE_CERT=false or install valid certificates |
# Set debug logging
export LOG_LEVEL="debug"
export ENABLE_FILE_LOGGING="true"
export ENABLE_CONSOLE_LOGGING="true"
# Monitor logs
tail -f hana-mcp-server.log
To add this MCP server to Claude Code, run this command in your terminal:
claude mcp add-json "hana-mcp-server" '{"command":"python","args":["app.py"]}'
See the official Claude Code MCP documentation for more details.
There are two ways to add an MCP server to Cursor. The most common way is to add the server globally in the ~/.cursor/mcp.json
file so that it is available in all of your projects.
If you only need the server in a single project, you can add it to the project instead by creating or adding it to the .cursor/mcp.json
file.
To add a global MCP server go to Cursor Settings > Tools & Integrations and click "New MCP Server".
When you click that button the ~/.cursor/mcp.json
file will be opened and you can add your server like this:
{
"mcpServers": {
"hana-mcp-server": {
"command": "python",
"args": [
"app.py"
]
}
}
}
To add an MCP server to a project you can create a new .cursor/mcp.json
file or add it to the existing one. This will look exactly the same as the global MCP server example above.
Once the server is installed, you might need to head back to Settings > MCP and click the refresh button.
The Cursor agent will then be able to see the available tools the added MCP server has available and will call them when it needs to.
You can also explicitly ask the agent to use the tool by mentioning the tool name and describing what the function does.
To add this MCP server to Claude Desktop:
1. Find your configuration file:
~/Library/Application Support/Claude/claude_desktop_config.json
%APPDATA%\Claude\claude_desktop_config.json
~/.config/Claude/claude_desktop_config.json
2. Add this to your configuration file:
{
"mcpServers": {
"hana-mcp-server": {
"command": "python",
"args": [
"app.py"
]
}
}
}
3. Restart Claude Desktop for the changes to take effect