Skip to main content
Glama

HANA Cloud MCP Server

by HatriGt

SAP HANA MCP Server

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

Table of Contents

🎯 Overview

The SAP HANA MCP Server provides a robust, production-ready bridge between AI applications and SAP HANA databases through the Model Context Protocol (MCP). Designed for enterprise environments, it offers comprehensive database management capabilities with secure, scalable architecture.

Available in two formats:

  • CLI Server: Command-line interface for direct integration
  • Web UI: Professional React interface for visual configuration management

Supported Platforms

  • AI Agents: Custom AI Applications, Claude Desktop, VSCode Extensions
  • Databases: SAP HANA (All versions)
  • Operating Systems: macOS, Linux, Windows
  • Node.js: 18.x and above

✨ Key Features

Enterprise Security

  • Secure Credential Management: Environment-based configuration
  • SSL/TLS Support: Full encryption for database communications
  • Certificate Validation: Configurable certificate verification

Database Operations

  • Schema Exploration: Complete database schema discovery and navigation
  • Query Execution: Advanced SQL query execution with parameterized support
  • Administrative Tools: System monitoring, user management, and performance insights
  • Data Management: Sample data retrieval, row counting, and metadata analysis

Architecture Excellence

  • Modular Design: Clean separation of concerns with maintainable codebase
  • Scalable Architecture: Easy extension and customization for enterprise needs
  • Comprehensive Logging: Structured logging with configurable levels
  • Error Handling: Robust error management with detailed diagnostics

Developer Experience

  • MCP Protocol Compliance: Full Model Context Protocol 2.0 implementation
  • Tool Discovery: Automatic tool registration and discovery
  • JSON-RPC 2.0: Standardized communication protocol
  • Testing Framework: Comprehensive testing suite with multiple validation methods

🏗️ Architecture

System Architecture

HANA MCP Server Architecture

Component Architecture

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

📋 Prerequisites

System Requirements

  • Node.js: Version 18.x or higher
  • Memory: Minimum 512MB RAM (2GB recommended)
  • Storage: 100MB available disk space
  • Network: Access to SAP HANA database

Database Requirements

  • SAP HANA: Version 2.0 or higher
  • User Permissions: SELECT, DESCRIBE, and administrative privileges
  • Network Access: TCP/IP connectivity to HANA instance

Development Tools

  • Claude Desktop: For AI agent integration
  • VSCode: For development and testing (optional)
  • Git: For version control

🚀 Quick Setup

Step 1: Install the Package

npm install -g hana-mcp-server

Step 2: Configure Claude Desktop

Update your Claude Desktop configuration file:

macOS: ~/.config/claude/claude_desktop_config.json
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" } } } }

Step 3: Restart Claude Desktop

Close and reopen Claude Desktop to load the new configuration.

Step 4: Test Connection

Ask Claude: "Test the HANA database connection" or "Show me the available schemas"

That's it! 🎉 Your HANA MCP Server is now ready to use.

🖥️ Configure Using UI

For users who prefer a graphical interface, there is a HANA MCP UI - a React-based web application for managing server configurations.

HANA MCP UI

🌟 Why Use the UI?

  • Visual Configuration: Intuitive web interface for server management
  • Multi-Environment Support: Configure Production, Development, and Staging environments
  • Claude Desktop Integration: Deploy configurations directly to Claude Desktop
  • Real-time Monitoring: Visual status tracking of active servers
  • Backup & Restore: Configuration management with history

🚀 Quick UI Setup

# Install and run the UI in one command npx hana-mcp-ui

The UI will automatically:

  1. Start a local web server on port 3001
  2. Open your browser to the configuration interface
  3. Guide you through server setup and Claude Desktop integration

📚 UI Documentation

For detailed UI documentation, configuration schemas, and advanced features, visit: HANA MCP UI Documentation

⚙️ Configuration

Environment Variables

VariableRequiredDescriptionDefault
HANA_HOSTHANA database hostname-
HANA_PORTHANA database port443
HANA_USERDatabase username-
HANA_PASSWORDDatabase password-
HANA_SCHEMADefault schema-
HANA_SSLEnable SSL connectiontrue
HANA_ENCRYPTEnable encryptiontrue
HANA_VALIDATE_CERTValidate SSL certificatetrue
LOG_LEVELLogging levelinfo

Default Schema Behavior

The server intelligently handles schema selection:

ScenarioBehavior
HANA_SCHEMA setUses default schema for optional parameters
HANA_SCHEMA not setRequires explicit schema specification
Schema parameter providedOverrides default schema

🚀 Usage

Claude Desktop Integration

Once configured, you can interact with your HANA database using natural language:

  • "Show me all schemas in the database"
  • "List tables in the SYSTEM schema"
  • "Describe the structure of table CUSTOMERS"
  • "Execute this query: SELECT * FROM SYSTEM.TABLES LIMIT 10"
  • "Get sample data from table ORDERS"

Command Line Usage

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

📚 API Reference

Configuration Tools

ToolDescriptionParameters
hana_show_configDisplay current HANA configurationNone
hana_test_connectionTest database connectivityNone
hana_show_env_varsShow environment variables (debug)None

Schema Exploration Tools

ToolDescriptionParameters
hana_list_schemasList all database schemasNone
hana_list_tablesList tables in a schemaschema_name (optional)
hana_describe_tableShow table structureschema_name, table_name
hana_list_indexesList indexes for a tableschema_name, table_name
hana_describe_indexShow index detailsschema_name, table_name, index_name

Query Execution Tools

ToolDescriptionParameters
hana_execute_queryExecute SQL queriesquery
hana_execute_parameterized_queryExecute parameterized queriesquery, parameters
hana_get_sample_dataGet sample data from tableschema_name, table_name, limit
hana_count_rowsCount rows in a tableschema_name, table_name

Administrative Tools

ToolDescriptionParameters
hana_get_system_infoGet system informationNone
hana_get_user_infoGet current user informationNone
hana_get_memory_usageGet memory usage statisticsNone

Tool Response Format

All tools return standardized JSON responses:

{ "content": [ { "type": "text", "text": "Tool execution result" } ], "isError": false, "error": null }

🔧 Development

Development Setup

# Clone repository git clone https://github.com/hatrigt/hana-mcp-server.git cd hana-mcp-server # Install dependencies npm install # Start development server with auto-reload npm run dev

Adding New Tools

1. Create Tool Implementation
// src/tools/my-tools.js const { logger } = require('../utils/logger'); const Formatters = require('../utils/formatters'); class MyTools { static async myNewTool(args) { logger.tool('my_new_tool', args); try { // Tool implementation const result = await this.performOperation(args); return Formatters.createResponse(result); } catch (error) { logger.error('Tool execution failed', error); return Formatters.createErrorResponse(error.message); } } static async performOperation(args) { // Tool logic implementation return "Operation completed successfully"; } } module.exports = MyTools;
2. Register Tool
// src/tools/index.js const MyTools = require('./my-tools'); const TOOL_IMPLEMENTATIONS = { // ... existing tools my_new_tool: MyTools.myNewTool };
3. Define Tool Schema
// src/constants/tool-definitions.js { name: "my_new_tool", description: "Performs a specific operation with detailed description", inputSchema: { type: "object", properties: { parameter1: { type: "string", description: "Description of parameter1" }, parameter2: { type: "number", description: "Description of parameter2" } }, required: ["parameter1"] } }

Development Scripts

{ "scripts": { "start": "node hana-mcp-server.js", "dev": "nodemon hana-mcp-server.js", "test": "node tests/automated/test-mcp-inspector.js" } }

🐛 Troubleshooting

Common Issues & Solutions

Connection Issues
IssueCauseSolution
"Connection refused"Network connectivityVerify HANA host and port accessibility
"Authentication failed"Invalid credentialsCheck username/password in configuration
"SSL certificate error"Certificate validationConfigure HANA_VALIDATE_CERT=false or install valid certificates
MCP Protocol Issues
IssueCauseSolution
"MCP server not visible"Configuration pathVerify Claude Desktop config file location
"Tools disabled"Protocol complianceCheck JSON-RPC implementation and tool structure
"Handler is not a function"Tool registrationVerify tool implementation and registration

Debugging

Enable Debug Logging
# 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
Manual Server Testing
# Test with minimal configuration HANA_HOST="test" HANA_USER="test" HANA_PASSWORD="test" hana-mcp-server # Test specific functionality echo '{"jsonrpc":"2.0","id":1,"method":"tools/call","params":{"name":"hana_test_connection","arguments":{}}}' | hana-mcp-server

Error Codes

The server uses standard JSON-RPC 2.0 error codes:

CodeDescriptionAction
-32700Parse errorCheck JSON format
-32600Invalid requestVerify request structure
-32601Method not foundCheck method name
-32602Invalid paramsVerify parameter format
-32603Internal errorCheck server logs

🤝 Contributing

We welcome contributions from the community! Please follow these guidelines:

Contribution Process

  1. Fork the repository
  2. Create a feature branch: git checkout -b feature/amazing-feature
  3. Make your changes following coding standards
  4. Add tests for new functionality
  5. Update documentation as needed
  6. Test thoroughly using MCP Inspector
  7. Submit a pull request with detailed description

Development Guidelines

  • Code Style: Follow existing code patterns
  • Testing: Test new features with MCP Inspector
  • Documentation: Update README and inline documentation
  • Security: Follow security best practices for database operations
  • Performance: Consider performance implications of changes

Pull Request Template

We use a standardized PR template. When you create a pull request, GitHub will automatically load the template with the following sections:

  • Description: Brief description of changes
  • Type of Change: Bug fix, new feature, documentation, or performance improvement
  • Testing: MCP Inspector tests, manual testing, and breaking change verification
  • Checklist: Code review, documentation, and quality checks

The template is located at .github/pull_request_template.md

📄 License

This project is licensed under the MIT License - see the LICENSE file for details.

License Summary

  • Commercial Use: ✅ Allowed
  • Modification: ✅ Allowed
  • Distribution: ✅ Allowed
  • Private Use: ✅ Allowed
  • Liability: ❌ No liability
  • Warranty: ❌ No warranty

🙏 Acknowledgments

  • SAP for HANA database technology and support
  • Anthropic for Claude Desktop and MCP specification
  • MCP Community for protocol development and standards
  • Open Source Contributors for valuable feedback and contributions
Deploy Server
A
security – no known vulnerabilities
A
license - permissive license
A
quality - confirmed to work

remote-capable server

The server can be hosted and run remotely because it primarily relies on remote services or has no dependency on the local environment.

Enables integration between SAP HANA Cloud Database and Cursor IDE through the Model Context Protocol, providing standardized interfaces for managing ML models and execution contexts.

  1. Overview
    1. Architecture
      1. Prerequisites
        1. Installation
          1. Configuration

            Related MCP Servers

            • -
              security
              F
              license
              -
              quality
              A Model Context Protocol server that integrates with Cursor IDE, providing real-time communication, modern web dashboards, and extensible tools via SSE and WebSocket connections.
              Last updated -
              649
              1
            • -
              security
              F
              license
              -
              quality
              A Model Context Protocol server that enables AI assistants to explore and interact with Cursor IDE's SQLite databases, providing access to project data, chat history, and composer information.
              Last updated -
              21
              • Apple
            • A
              security
              A
              license
              A
              quality
              A powerful Model Context Protocol framework that extends Cursor IDE with tools for web content retrieval, PDF processing, and Word document parsing.
              Last updated -
              8
              13
              MIT License
              • Linux
              • Apple
            • A
              security
              A
              license
              A
              quality
              A Model Context Protocol (MCP) server for Cursor IDE that simplifies the installation and configuration of other MCP servers.
              Last updated -
              3
              80
              68
              MIT License
              • Apple
              • Linux

            View all related MCP servers

            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