sap-hana-mcp
Provides tools for interacting with SAP HANA databases, enabling listing tables, columns, executing SQL queries, and looking up SAP table descriptions from leanx.eu.
Click on "Install Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@sap-hana-mcpShow me the columns in table MARA"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
SAP HANA MCP Server (Python)
A Model Context Protocol (MCP) server for SAP HANA, built with FastMCP and the official SAP HANA Python driver (hdbcli).
This server exposes SAP HANA database capabilities (listing tables, columns, running queries) as MCP tools that AI assistants can use.
Prerequisites
Python 3.12+
Access to a SAP HANA instance (on-premise or SAP HANA Cloud)
SAP HANA client libraries (installed automatically with
hdbcli)
Related MCP server: SAP ADT MCP Server
Installation
# Clone and enter the directory
cd sap-hana-mcp-server-python
# Install dependencies
pip install -r requirements.txtConfiguration
Copy the example environment file and fill in your SAP HANA connection details:
cp .env.example .envEdit .env with your server settings:
Variable | Description | Default |
| SAP HANA server hostname | (required) |
| SAP HANA server port |
|
| Default schema to filter tables | (optional) |
| MCP server HTTP port |
|
Authentication
SAP HANA credentials are provided by each MCP client via HTTP Basic Auth. The server does not store database credentials — each request must include an Authorization header with the user's SAP HANA username and password.
Authorization: Basic <base64(username:password)>If the header is missing or invalid, the server returns an error. This allows different users to connect with their own SAP HANA accounts.
Running the Server
Locally
python main.pyThe server starts on http://localhost:8000/sse using SSE transport.
With Docker
docker build -t sap-hana-mcp .
docker run -p 8000:8000 --env-file .env sap-hana-mcpMCP Tools
sap_hana_get_tables
Lists tables available in the SAP HANA instance. Returns CSV with columns: Schema, Table, Description.
Parameter | Type | Required | Description |
| string | No | Catalog name filter |
| string | No | Schema name filter (defaults to |
sap_hana_get_columns
Lists columns for a specific table. Returns CSV with columns: Schema, Table, Column, DataType, Remarks.
Parameter | Type | Required | Description |
| string | Yes | Table name |
| string | No | Catalog name filter |
| string | No | Schema name filter (defaults to |
sap_hana_run_query
Executes a SQL SELECT statement. Returns results in CSV format. The SQL dialect is based on SQL-92. Identifiers should be quoted with double quotes.
Parameter | Type | Required | Description |
| string | Yes | The SELECT statement to execute |
sap_hana_lookup_table_info
Looks up SAP table and field descriptions from leanx.eu. Useful when the SAP HANA system catalog has no comments or descriptions for tables and columns. Does not require database authentication.
Parameter | Type | Required | Description |
| string | Yes | SAP table name (e.g. ANLA, BKPF, MARA) |
Returns CSV with columns: Field, Description, DataElement, Datatype, Length, Decimals.
MCP Resources
sap_hana://tables/{schema}/{table}
Returns column metadata for a given schema and table in CSV format.
Connecting to AI Clients
Claude Desktop
Add to your claude_desktop_config.json:
{
"mcpServers": {
"sap-hana": {
"url": "http://localhost:8000/sse",
"headers": {
"Authorization": "Basic <base64(username:password)>"
}
}
}
}Cursor / Other MCP Clients
Use the SSE endpoint http://localhost:8000/sse and configure the Authorization: Basic header with your SAP HANA credentials.
Project Structure
sap-hana-mcp-server-python/
main.py # MCP server with tools and resources
requirements.txt # Python dependencies
.env.example # Environment variable template
Dockerfile # Docker container build
pyproject.toml # Project metadata
README.md # This fileLicense
MIT
This server cannot be installed
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Latest Blog Posts
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/Elkhn/sap-hana-mcp'
If you have feedback or need assistance with the MCP directory API, please join our Discord server