hana-mcp-server

sucheno/hana-mcp-server

3.2

If you are the rightful owner of hana-mcp-server and would like to certify it and/or have it hosted online, please leave a comment on the right or send an email to henry@mcphub.com.

This project implements a Model Context Protocol (MCP) server for SAP HANA Cloud using FastMCP, providing a secure API endpoint to execute SQL queries on a HANA database and return results as JSON.

Tools
1
Resources
0
Prompts
0

HANA MCP Server

This project implements a Model Context Protocol (MCP) server for SAP HANA Cloud using FastMCP. It provides a secure API endpoint to execute SQL queries on a HANA database and return results as JSON.

Features

  • Exposes a single MCP tool for running SQL queries on SAP HANA Cloud
  • Uses environment variables for secure database connection configuration
  • Returns query results as a list of dictionaries (JSON)

Requirements

  • Python 3.7+
  • SAP HANA Cloud instance

Installation

  1. Clone this repository:
    git clone <repo-url>
    cd hana-mcp
    
  2. Install dependencies:
    pip install -r requirements.txt
    

Environment Variables

Create a .env file in the project root with the following variables:

HANA_HOST=<your_hana_host>
HANA_PORT=<your_hana_port>  # Default: 443
HANA_USER=<your_hana_user>
HANA_PASSWORD=<your_hana_password>

Usage

Start the MCP server:

python server.py

MCP Tool: hana_query

  • Input: Any SQL query string (except CREATE, DROP, UPDATE, or DELETE)
  • Output: JSON object with rows (list of dicts) or error
  • Security: CREATE, DROP, UPDATE, and DELETE queries are blocked for safety. All other queries are allowed by default.

Example

from fastmcp import FastMCP
mcp = FastMCP("hana-mcp")
result = mcp.tools.hana_query("SELECT * FROM MY_TABLE")
print(result)

License

MIT