sap-b1-hana-mcp
Provides direct SQL access to SAP Business One HANA databases, including tools for executing read-only queries, verifying connections, listing schemas and tables, and retrieving table structure information.
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-b1-hana-mcpShow me the schema of the OITM table"
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-b1-hana-mcp
MCP (Model Context Protocol) server for querying SAP B1 HANA using direct SQL through SAP's official driver (@aps/ana-driver).
No installation required: it runs with npx directly from this GitHub repository. You only need to define environment variables.
Usage
1. Requirements
Node.js 20+ (only on the machine running the agent; nothing from the MCP is installed).
2. Register in opencode (or another MCP client)
Add this block to your opencode configuration (for example ~/ .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
}
}
}Note: the first time
npxruns, it downloads and installs the package and may take more than 5 seconds. If the MCP client reports a timeout at startup, increase "timeout": 60000 in the block.
3. Environment variables
Variable | Required | Description | Example |
| Yes | HANA server host |
|
| No (default 30015) | HANA port (tenant) |
|
| Yes | HANA user |
|
| Yes | Password |
|
| No | HANA tenant (MDC) |
|
| No | Schema (SAP B1 company database) |
|
| No (default |
|
|
| No (default |
|
|
Related MCP server: SAP MCP Server
MCP tools
Tool | Description |
| Executes SQL and returns rows in JSON ( |
| Checks the connection: database, version, and current schema. |
| Lists schemas on the instance (optional pattern filter). |
| Lists tables of a schema (optional pattern filter). |
| Table structure: columns, types, length, scale, nullability. |
Important note about SQL and SAP B1
SAP B1 tables and columns use mixed capitalization and are case‑sensitive: column names must be written between double quotes:
SELECT "ItemCode", "ItemName", "OnHand" FROM OITM WHERE "OnHand" > 0 ORDER BY "OnHand" DESCWithout quotes, HANA converts to uppercase and the query fail with invalid column name.
Read‑only mode
With HANA_READONLY=true (default), the server will not accept any statement that is not SELECT, WITH, EXPLAIN, SHOW or DESCRIBE. To enable writes, use HANA_READONLY=false — at your own risk.
Development
npm install
npm run build # compila TypeScript a dist/
npm test # tests unitarios (vitest)The dist/ folder is compiled and versioned: that is what runs when using npx github… without requiring a build on the user’s machine.
Architecture
Layers with manual dependency injection and SOLID principles:
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 MCPLicenses
This project: MIT.
Driver
@sap/hana-client: SAP Developer License Agreement (distributed through npm dependency, not versioned in this repository). Seenode_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