Model Context Protocol (MCP) Integration
Integrate HANA CLI with AI coding assistants via the Model Context Protocol for intelligent database operations.
What is MCP?
The Model Context Protocol enables AI assistants to interact with external tools and databases. The HANA CLI MCP Server exposes all CLI commands as standardized tools that AI agents can discover and use intelligently.
Key Capabilities:
- 150+ Tools - All CLI commands accessible via MCP interface
- Discovery - AI-guided command recommendations and smart search
- Workflows - Pre-built multi-step task templates
- Examples - Real-world usage scenarios and parameter presets
- Documentation - Integrated access to 279 documentation pages
- Resources - Browsable metadata, schemas, and command catalog
- Prompts - Guided conversation workflows for common tasks
Quick Start
Installation
cd mcp-server
npm install
npm run buildConfiguration
Add to your IDE's MCP settings:
VS Code with Claude Dev or Cline:
{
"mcpServers": {
"hana-cli": {
"command": "node",
"args": [
"D:/projects/hana-developer-cli-tool-example/mcp-server/build/index.js"
],
"env": {}
}
}
}TIP
Replace the path with your actual project location. Connection credentials are read from default-env.json in the project root. Use hana-cli connect or hana-cli serviceKey to configure database connections.
Core Features
1. Command Tools
All CLI commands are exposed with the hana_ prefix:
hana_status Check database connection
hana_tables List tables in a schema
hana_import Import data from CSV/Excel
hana_dataProfile Analyze data quality
hana_duplicateDetection Find duplicate rows
hana_compareSchema Compare database schemas
hana_inspectTable View table structure and metadataCommand aliases are also available (e.g., hana_s for status, hana_imp for import).
2. Discovery Tools
Help AI agents find the right tools:
hana_recommend - Get command suggestions based on natural language intent:
Input: "find duplicate rows in my customer table"
Output: Top 5 matching commands with confidence scores and parameter templateshana_smart_search - Search across commands, workflows, examples, and presets:
Input: "csv import"
Output: Related commands, workflows, examples, and documentationhana_quickstart - Essential commands guide for new users covering the 6 most common operations.
3. Examples and Presets
hana_examples - Get real-world usage scenarios:
Input: { command: "import" }
Output: Multiple scenarios with complete parameter sets and best practiceshana_parameter_presets - Pre-configured parameter combinations for common use cases:
Input: { command: "dataProfile", useCase: "data_quality" }
Output: Recommended parameters for comprehensive analysis4. Workflows
hana_execute_workflow - Run pre-built multi-step workflows:
Available workflows:
- data-quality-check
- schema-comparison
- performance-optimization
- safe-import
- data-migration
... and 15+ more5. Documentation Access
hana_search_docs - Full-text search across all documentation:
Input: "import csv with errors"
Output: Top 10 relevant documentation pages with excerptshana_get_doc - Retrieve complete documentation page content.
hana_list_doc_categories - Browse documentation by category.
Use Cases
Database Exploration
Ask your AI assistant:
"Show me the structure of tables in the HR schema"
The AI will:
- Use
hana_recommendto find relevant commands - Execute
hana_tablesto list tables - Use
hana_inspectTableto examine structure - Format results in a readable summary
Data Quality Analysis
"Analyze data quality in my SALES.ORDERS table"
The AI will:
- Execute
hana_dataProfilefor statistical analysis - Run
hana_duplicateDetectionto find duplicates - Use
hana_dataValidatorto check constraints - Provide a comprehensive quality report
Import Automation
"Import all CSV files from the data/ folder into my schema"
The AI will:
- Check available tables with
hana_tables - Use
hana_examplesto get import templates - Generate appropriate import commands for each file
- Provide error handling recommendations
Schema Migration
"Compare my DEV and PROD schemas and show differences"
The AI will:
- Use
hana_recommendto find schema comparison tools - Execute
hana_compareSchemawith both connections - Use result interpretation to highlight key differences
- Suggest next steps for migration
Advanced Features
Workflow Execution
Run complex multi-step workflows:
hana_preview_workflow - Preview workflow steps before execution
hana_execute_workflow - Execute complete workflow with automated stepsResult Interpretation
hana_interpret_result - AI-friendly analysis and insights from command output, automatically providing context-aware explanations.
Conversation Templates
hana_get_conversation_template - Pre-built dialogue flows for guided troubleshooting and task completion.
Connection Management
Default Connection
The MCP server reads connection details from default-env.json in the project root. Configure using:
# SAP BTP HANA Cloud
hana-cli serviceKey -i instance-name -k key-name
# Interactive setup
hana-cli connectProject-Specific Connections
Tools accept an optional __projectContext parameter:
{
"projectPath": "/path/to/project",
"connectionFile": "default-env.json"
}This allows AI agents to work with multiple database connections across different projects.
Complete Documentation
For comprehensive guides, implementation details, and troubleshooting:
- MCP Server Overview - Complete feature documentation
- Setup and Configuration - Installation and IDE configuration
- Discovery Tools - Recommendations, search, and workflows
- Advanced Features - Workflow execution and result interpretation
- Troubleshooting - Common issues and solutions
See Also
- API Server - REST API access to CLI commands
- CLI Features - Command syntax and Options
- Knowledge Base - Built-in help and documentation