sap-hana-mcp
An MCP server for SAP HANA that enables listing tables, columns, running SQL queries, and looking up SAP table descriptions, all through natural language via AI assistants.
README
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)
Installation
# Clone and enter the directory
cd sap-hana-mcp-server-python
# Install dependencies
pip install -r requirements.txt
Configuration
Copy the example environment file and fill in your SAP HANA connection details:
cp .env.example .env
Edit .env with your server settings:
| Variable | Description | Default |
|---|---|---|
HANA_HOST |
SAP HANA server hostname | (required) |
HANA_PORT |
SAP HANA server port | 443 |
HANA_SCHEMA |
Default schema to filter tables | (optional) |
SERVER_PORT |
MCP server HTTP port | 8000 |
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.py
The 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-mcp
MCP Tools
sap_hana_get_tables
Lists tables available in the SAP HANA instance. Returns CSV with columns: Schema, Table, Description.
| Parameter | Type | Required | Description |
|---|---|---|---|
catalog |
string | No | Catalog name filter |
schema |
string | No | Schema name filter (defaults to HANA_SCHEMA) |
sap_hana_get_columns
Lists columns for a specific table. Returns CSV with columns: Schema, Table, Column, DataType, Remarks.
| Parameter | Type | Required | Description |
|---|---|---|---|
table |
string | Yes | Table name |
catalog |
string | No | Catalog name filter |
schema |
string | No | Schema name filter (defaults to HANA_SCHEMA) |
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 |
|---|---|---|---|
sql |
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 |
|---|---|---|---|
table |
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 file
License
MIT
Recommended Servers
playwright-mcp
A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.
Magic Component Platform (MCP)
An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.
Audiense Insights MCP Server
Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.
VeyraX MCP
Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.
graphlit-mcp-server
The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.
Kagi MCP Server
An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.
E2B
Using MCP to run code via e2b.
Neon Database
MCP server for interacting with Neon Management API and databases
Exa Search
A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.
Qdrant Server
This repository is an example of how to create a MCP server for Qdrant, a vector search engine.