hdbconnect-mcp
MCP (Model Context Protocol) server providing AI assistants with secure, programmatic access to SAP HANA databases.
Features
- Interactive Parameter Collection — Elicits missing schema names from users during tool execution
- 4 Core Tools —
ping,list_tables,describe_table,execute_sql - Security First — Read-only mode blocks DML/DDL, configurable row limits prevent data exfiltration
- Connection Pooling — Efficient resource management with deadpool
- Full JSON Schema — AI-discoverable tool definitions with comprehensive descriptions
- Zero Unsafe Code — Memory-safe Rust implementation
Installation
From crates.io
From source
[!IMPORTANT] Requires Rust 1.88 or later. See MSRV policy.
Quick Start
Standalone Server
Claude Desktop Integration
Add to claude_desktop_config.json:
[!TIP] Use environment variables for credentials:
--url "hdbsql://${HANA_USER}:${HANA_PASSWORD}@${HANA_HOST}:39017"
Configuration
| Flag | Default | Description |
|---|---|---|
--url |
required | HANA connection URL (hdbsql://user:password@host:port) |
--read-only |
true |
Block DML/DDL operations (SELECT/WITH/EXPLAIN only) |
--row-limit |
10000 |
Maximum rows per query result |
--pool-size |
4 |
Database connection pool size |
--verbose |
false |
Enable debug logging (RUST_LOG=debug) |
[!WARNING] Setting
--read-only falseallows INSERT/UPDATE/DELETE operations. Only use in trusted environments.
MCP Tools
ping
Check database connection health and measure latency.
Returns:
list_tables
List tables in a schema with interactive elicitation for missing schema parameter.
Parameters:
schema(optional) — Schema name (defaults toCURRENT_SCHEMA)
Returns:
describe_table
Get column definitions for a table with type information.
Parameters:
table(required) — Table nameschema(optional) — Schema name (elicited if missing)
Returns:
execute_sql
Execute SQL queries with configurable row limits.
Parameters:
sql(required) — SQL query (SELECT/WITH/EXPLAIN/CALL in read-only mode)limit(optional) — Row limit (overrides server default)
Returns:
[!CAUTION] In read-only mode (default), only
SELECT,WITH,EXPLAIN, andCALLstatements are permitted. Other SQL commands will be rejected.
Features
Default
Standard stdio transport for MCP integration.
http
Enable HTTP transport for remote MCP access.
[]
= { = "0.3", = ["http"] }
[!NOTE] HTTP transport requires additional authentication configuration. See HTTP Transport Guide for setup.
Architecture
┌─────────────────┐
│ MCP Client │ (Claude Desktop, Cline, etc.)
└────────┬────────┘
│ stdio/HTTP
┌────────▼────────┐
│ hdbconnect-mcp │
│ ├─ server.rs │ (Tool handlers with elicitation)
│ ├─ pool.rs │ (Connection pooling)
│ ├─ config.rs │ (CLI configuration)
│ ├─ types.rs │ (JSON Schema types)
│ └─ validation │ (SQL safety checks)
└────────┬────────┘
│ hdbconnect_async
┌────────▼────────┐
│ SAP HANA DB │
└─────────────────┘
Contributing
See CONTRIBUTING.md for development guidelines.
Development
# Build
# Run tests
# Lint
# Format
License
Licensed under either of:
- Apache License, Version 2.0 (LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0)
- MIT license (LICENSE-MIT or http://opensource.org/licenses/MIT)
at your option.