This Model Context Protocol server enables integration between SAP HANA Cloud Database and Cursor IDE, providing standardized interfaces for managing ML models, execution environments, and communication protocols. It acts as a bridge that allows applications to interact with models deployed on HANA Cloud.
Before installing the MCP server, ensure you have:
git clone https://github.com/yourusername/hana-mcp-server.git
cd hana-mcp-server
Create and activate a Python virtual environment, then install the required dependencies:
python -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate
pip install -r requirements.txt
Execute the setup script and follow the interactive prompts to configure your HANA Cloud connection:
python setup.py
The server is configured using environment variables, which can be set in a .env
file in the project root:
# HANA Cloud Connection
HANA_HOST=your-hana-host.hanacloud.ondemand.com
HANA_PORT=443
HANA_USER=DBADMIN
HANA_PASSWORD=your-secure-password
# Server Configuration
SERVER_PORT=5000
LOG_LEVEL=INFO
ENABLE_SSL=false
SSL_CERT_PATH=/path/to/cert.pem
SSL_KEY_PATH=/path/to/key.pem
# Security Settings
AUTH_REQUIRED=true
API_KEY=your-api-key
ALLOWED_ORIGINS=https://cursor.sh,http://localhost:3000
HANA Connection:
HANA_HOST
: Your HANA Cloud instance hostnameHANA_PORT
: Port number (typically 443 for cloud instances)HANA_USER
: Database usernameHANA_PASSWORD
: Database passwordServer Settings:
SERVER_PORT
: Port on which the MCP server will listenLOG_LEVEL
: Logging detail level (DEBUG, INFO, WARNING, ERROR)ENABLE_SSL
: Whether to use HTTPS (true/false)SSL_CERT_PATH
and SSL_KEY_PATH
: Paths to SSL certificates if enabledSecurity:
AUTH_REQUIRED
: Whether API authentication is requiredAPI_KEY
: Authentication key for accessing the APIALLOWED_ORIGINS
: Comma-separated list of allowed CORS originsOnce configured, start the MCP server with:
python server.py
For production environments, consider using a WSGI server like Gunicorn:
gunicorn -w 4 -b 0.0.0.0:5000 server:app
Check if the server is running correctly by accessing the health endpoint:
curl http://localhost:5000/api/health
You should receive a JSON response with status information.
If authentication is enabled, include the API key in all requests:
curl -H "X-API-Key: your-api-key" http://localhost:5000/api/models
curl -H "X-API-Key: your-api-key" http://localhost:5000/api/models
curl -X POST -H "Content-Type: application/json" -H "X-API-Key: your-api-key" \
-d '{"name": "sentiment_analysis", "version": "1.0", "description": "Sentiment analysis model", "schema": {"input": "string", "output": "classification"}}' \
http://localhost:5000/api/models
curl -H "X-API-Key: your-api-key" http://localhost:5000/api/models/sentiment_analysis/1.0
curl -X POST -H "Content-Type: application/json" -H "X-API-Key: your-api-key" \
-d '{"model_id": "sentiment_analysis", "model_version": "1.0", "parameters": {"batch_size": 32}}' \
http://localhost:5000/api/contexts
curl -X POST -H "Content-Type: application/json" -H "X-API-Key: your-api-key" \
-d '{"input": "This product is amazing!"}' \
http://localhost:5000/api/contexts/{context_id}/execute
The MCP server integrates with Cursor IDE through a dedicated endpoint:
curl -X POST -H "Content-Type: application/json" -H "X-API-Key: your-api-key" \
-d '{"query": "SELECT * FROM CUSTOMER WHERE REGION = \"EAST\"", "context": "data_exploration"}' \
http://localhost:5000/api/cursor/execute
Check the server logs for detailed error information:
tail -f logs/mcp_server.log
You can increase verbosity by setting LOG_LEVEL=DEBUG
in your .env
file.
There are two ways to add an MCP server to Cursor. The most common way is to add the server globally in the ~/.cursor/mcp.json
file so that it is available in all of your projects.
If you only need the server in a single project, you can add it to the project instead by creating or adding it to the .cursor/mcp.json
file.
To add a global MCP server go to Cursor Settings > MCP and click "Add new global MCP server".
When you click that button the ~/.cursor/mcp.json
file will be opened and you can add your server like this:
{
"mcpServers": {
"cursor-rules-mcp": {
"command": "npx",
"args": [
"-y",
"cursor-rules-mcp"
]
}
}
}
To add an MCP server to a project you can create a new .cursor/mcp.json
file or add it to the existing one. This will look exactly the same as the global MCP server example above.
Once the server is installed, you might need to head back to Settings > MCP and click the refresh button.
The Cursor agent will then be able to see the available tools the added MCP server has available and will call them when it needs to.
You can also explictly ask the agent to use the tool by mentioning the tool name and describing what the function does.