sap-b1-hana-mcp
sap-b1-hana-mcp
MCP-Server (Model Context Protocol) zum Abfragen von SAP B1 HANA mit direktem SQL über den offiziellen SAP-Treiber (@sap/hana-client).
Ohne Installation: Er wird mit npx direkt aus diesem GitHub-Repository ausgeführt. Es müssen lediglich Umgebungsvariablen definiert werden.
Verwendung
1. Voraussetzungen
Node.js 20+ (nur auf der Maschine, die den Agenten ausführt; vom MCP wird nichts installiert).
2. Registrierung in opencode (oder einem anderen MCP-Client)
Füge diesen Block zu deiner opencode-Konfiguration hinzu (z. B. ~/.config/opencode/opencode.json):
{
"mcp": {
"sap-b1-hana": {
"type": "local",
"command": ["npx", "-y", "github:leonardows1/sap-b1-hana-mcp"],
"environment": {
"HANA_HOST": "192.168.1.100",
"HANA_PORT": "30015",
"HANA_USER": "USUARIO_HANA",
"HANA_PASSWORD": "TU_CONTRASEÑA",
"HANA_DATABASE": "MI_TENANT",
"HANA_SCHEMA": "MI_EMPRESA",
"HANA_READONLY": "true"
},
"enabled": true
}
}
}Hinweis: Die erste Ausführung von
npxlädt das Paket herunter und installiert es; das kann mehr als 5 Sekunden dauern. Wenn der MCP-Client beim Start einen Timeout meldet, erhöhe"timeout": 60000im Block.
3. Umgebungsvariablen
Variable | Obligatorisch | Beschreibung | Beispiel |
| Ja | Host des HANA-Servers |
|
| Nein (Standard | HANA-Port (Tenant) |
|
| Ja | HANA-Benutzer |
|
| Ja | Passwort |
|
| Nein | HANA-Tenant (MDC) |
|
| Nein | Schema (Firmendatenbank von SAP B1) |
|
| Nein (Standard |
|
|
| Nein (Standard |
|
|
Related MCP server: SAP MCP Server
MCP-Tools
Tool | Beschreibung |
| Führt SQL aus und liefert Zeilen im JSON-Format ( |
| Prüft die Verbindung: Datenbank, Version und aktuelles Schema. |
| Listet die Schemas der Instanz auf (optionaler Filter nach Muster). |
| Listet die Tabellen eines Schemas auf (optionaler Filter nach Muster). |
| Struktur einer Tabelle: Spalten, Typen, Länge, Skala, Null-Zulässigkeit. |
Wichtig zu SQL und SAP B1
Die Tabellen und Spalten von SAP B1 verwenden gemischte Groß- und Kleinschreibung und sind groß-/kleinschreibungsempfindlich: Spaltennamen müssen in doppelte Anführungszeichen gesetzt werden:
SELECT "ItemCode", "ItemName", "OnHand" FROM OITM WHERE "OnHand" > 0 ORDER BY "OnHand" DESCOhne Anführungszeichen wandelt HANA in Großbuchstaben um und die Abfrage schlägt mit invalid column name fehl.
Nur-Lese-Modus
Mit HANA_READONLY=true (Standard) lehnt der Server jede Anweisung ab, die nicht SELECT, WITH, EXPLAIN, SHOW oder DESCRIBE ist. Zum Aktivieren von Schreibzugriffen verwende HANA_READONLY=false — auf eigene Verantwortung.
Entwicklung
npm install
npm run build # compila TypeScript a dist/
npm test # tests unitarios (vitest)Der Ordner dist/ wird kompiliert und versioniert. Das ist es, was npx github:... ausführt, ohne dass auf der Maschine des Benutzers ein Build nötig ist.
Architektur
Schichten mit manueller Abhängigkeitsinjektion und SOLID-Prinzipien:
src/
├── index.ts Composition root: DI, host MCP (stdio)
├── configuration/ HanaOptions + validación de variables de entorno
├── domain/ Modelos: QueryResult, SchemaInfo, TableInfo, ColumnInfo, StatementKind
├── application/ Abstracciones de servicios + ISqlGuard (Strategy) + clasificador SQL
├── infrastructure/ Única capa que toca @sap/hana-client: factory de conexión,
│ servicios de consulta/esquema, mapeo de datos (Buffer→base64, Date→ISO)
└── mcp/ Adaptadores delgados: registro de tools MCPLizenzen
Dieses Projekt: MIT.
Treiber
@sap/hana-client: SAP Developer License Agreement (wird als npm-Abhängigkeit vertrieben, nicht in diesem Repository versioniert). Siehenode_modules/@sap/hana-client/developer-license-3_2.txt.
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Related MCP Servers
- AlicenseNot gradedqualityDmaintenanceProvides database interaction and business intelligence capabilities, enabling users to run SQL queries, analyze business data, and automatically generate business insight memos for Microsoft SQL Server databases.39MIT
- AlicenseNot gradedqualityDmaintenanceEnables AI clients to query live data from SAP HANA and SQL databases through read-only SELECT queries with CSV-formatted results.MIT
- FlicenseNot gradedqualityDmaintenanceProvides secure, read-only access to Microsoft SQL Server with multi-layer protection, enabling safe query execution, schema discovery, and SQL script analysis through natural language.1
- AlicenseNot gradedqualityCmaintenanceEnables safe, read-only querying and schema exploration for Microsoft SQL Server databases with preconfigured Diamond Inventory support, multiple database management, and optional HTTP API.MIT
Related MCP Connectors
Explore, query, and inspect SQLite databases with ease. List tables, preview results, and view det…
Run SOQL queries to explore and retrieve Salesforce data. Access accounts, contacts, opportunities…
Run SOQL queries to explore and retrieve Salesforce data. Inspect records, fields, and relationshi…
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
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/leonardows1/sap-b1-hana-mcp'
If you have feedback or need assistance with the MCP directory API, please join our Discord server