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
Option 1: Auto-Configure (Recommended)
If you already have hana-cli installed, use the built-in install command:
# Auto-detect installed clients and configure them
hana-cli mcp
# Preview what would be written without making changes
hana-cli mcp --dry-run
# Target a specific client
hana-cli mcp --client claude-desktop
hana-cli mcp --client claude-code --global
hana-cli mcp --client cursor
# Check configuration status across all clients
hana-cli mcp-statusSee mcpServerInstall for full documentation.
Option 2: npx (No Installation)
Run the MCP server directly via npx without installing anything:
npx -y -p hana-cli hana-cli-mcpUse this in your IDE's MCP configuration:
{
"mcpServers": {
"hana-cli": {
"type": "stdio",
"command": "npx",
"args": ["-y", "-p", "hana-cli", "hana-cli-mcp"]
}
}
}Option 3: VS Code Extension
Install the SAP HANA CLI MCP Server extension from the VS Code Marketplace. Search for @mcp in the Extensions view, or install from the command line:
code --install-extension SAPOSS.hana-cli-mcpThis registers the MCP server with VS Code automatically — no manual configuration needed. Works with GitHub Copilot agent mode and other AI assistants.
Source: SAP-samples/hana-cli-vscode-mcp
Option 4: Claude Code Plugin
Install the hana-cli plugin directly in Claude Code:
/plugin install https://github.com/SAP-samples/hana-cli-claude-pluginSource: SAP-samples/hana-cli-claude-plugin
Option 5: MCP Registry
The MCP server is published to the MCP Registry as io.github.SAP-samples/hana-cli. AI clients and aggregators that support the MCP Registry can discover and install it automatically.
Manual Configuration
You can also point directly to a local build:
{
"mcpServers": {
"hana-cli": {
"type": "stdio",
"command": "node",
"args": [
"/absolute/path/to/mcp-server/build/index.js"
]
}
}
}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 still work when called (e.g., hana_s for status, hana_imp for import), but they are not registered as separate tools to keep the tool list concise.
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_search - Search across commands, workflows, examples, presets, and documentation:
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_workflows - List available multi-step workflow templates:
Available workflows:
- data-quality-check
- schema-comparison
- performance-optimization
- safe-import
- data-migration
... and 15+ morehana_workflow_by_id - Get detailed steps for a specific workflow.
5. Documentation Access
hana_get_doc - Retrieve full content of a documentation page found via search:
Input: "import csv with errors"
Output: Top 10 relevant documentation pages with excerptshana_get_doc - Retrieve complete documentation page content.
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 Templates
Browse and use pre-built multi-step workflows:
hana_workflows - List available workflow templates
hana_workflow_by_id - Get detailed steps for a specific workflow
hana_search_workflows - Search workflows by tag or purposeThe AI agent orchestrates the individual steps — workflow templates provide the sequence and recommended parameters, while the LLM handles execution and decision-making between steps.
Result Interpretation
hana_interpret_result - AI-friendly analysis and insights from command output, automatically providing context-aware explanations.
Conversation Templates
hana_conversation_templates / hana_get_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
- VS Code Extension - MCP server as a VS Code extension for GitHub Copilot
- Claude Code Plugin - Plugin for the Claude Code marketplace
- MCP Registry - MCP Registry listing
- API Server - REST API access to CLI commands
- CLI Features - Command syntax and Options
- Knowledge Base - Built-in help and documentation