# b1-mcp-server: SAP Business One context for AI agents

> Connect AI agents to SAP Business One HANA/SQL databases and Service Layer with built-in read-only guardrails.

b1-mcp-server: SAP Business One context for AI agents is a free AI agent skill on Agensi by Bernardo Simão, in LLM Ops. It loads into your AI agent through the Agensi MCP server, always in its latest approved version.

- Price: Free
- Creator: [Bernardo Simão](https://www.agensi.io/creators/bersimao)
- Category: [LLM Ops](https://www.agensi.io/skills/llm-ops)
- Uses: 2
- Version: 1.0
- Last updated: 2026-10-19
- Security: scan passed (2026-10-19); every new listing is also reviewed by a person
- Listing: https://www.agensi.io/skills/b1-mcp-server-sap-business-one-context-for-ai-agents
- Tags: llm-ops, automation, database, sap-b1, mcp-server, sql-server, hana, odata

## About this skill

Querying SAP Business One directly through AI agents often hits a wall due to database engine differences and strict read-only requirements. This skill teaches your agent to use [b1-mcp-server](https://github.com/bersimao/b1-mcp-server) (github.com/bersimao/b1-mcp-server), an open-source MCP server that bridges AI agents and SAP B1 on HANA or MS SQL, plus the Service Layer, behind production-safe guardrails.

### What it does
- **Database Connection** guides the agent through your connection profiles for HANA and MS SQL, including the Service Layer OData API, and stops it after failed logins instead of locking the account.
- **Read-Only SQL** keeps the agent on SELECT queries and read-only blocks, and has it hand any data change back to you instead of trying to work around the server.
- **Schema Discovery** points the agent to the server's metadata tool for tables, columns, and procedures, instead of hand-written catalog queries.
- **Service Layer Access** covers OData GET, plus POST, PATCH, and DELETE when your profile allows them, with the server's approval workflow for each write.
- **Guardrail Handling** explains every refusal, engine-specific timeout, query length limit, and truncated result, so the agent fixes the query instead of retrying blindly.

### How it works
1. Use `connect_database` with "list" to view available B1 profiles and their connection capabilities.
2. Select a profile ID to establish a connection to the database, Service Layer, or both.
3. Run `execute_sql` for data retrieval or `execute_service_layer_write` for approved record updates.
4. Watch tool output for `TRUNCATED` notes or engine-specific timeouts, and refine the query.

### Frameworks & tools
Built for the Model Context Protocol (MCP) and b1-mcp-server. Compatible with SAP Business One Service Layer (OData v3/v4), SAP HANA, and Microsoft SQL Server.

### Why this beats prompting it yourself
Generic prompts don't know that a HANA timeout shows up as `Socket recv timeout` while MS SQL reports a plain request timeout, or which refusals can be fixed and which must go to a human. This skill gives the agent exact error meanings, readable SAP B1 SQL conventions (full table names instead of T0/T1 aliases), and the write rules that keep ERP data safe.

### Use cases
- Fetching real-time stock levels or Business Partner balances for analysis.
- Auditing user-defined tables (UDT) and system tables like OINV or OCRD.
- Updating documents via the Service Layer, with your approval for each write.
- Debugging SAP B1 stored procedure logic by rewriting it as a SELECT.

### What you get
One `SKILL.md` file. Copy it into your agent's skills folder, for example `~/.claude/skills/b1-mcp-server/` for Claude Code. Requires b1-mcp-server (`npx b1-mcp-server`). Open source (MIT); the same skill lives in the GitHub repository.

### Known limitations
No `PUT`, no `$batch`, and no SQL writes. Queries are capped at 8000 characters, and results at 500 rows and 100,000 characters by default. Service Layer writes are off unless your profile enables them.

## Requires

- B1 MCP
- Node.js 20+
- SAP Business One

SAP Business One on SAP HANA or Microsoft SQL Server.

## How to use this skill

1. Connect your AI agent to Agensi once: add the MCP server https://mcp.agensi.io/mcp/auth and sign in with your Agensi account (OAuth, no API key). Steps for Claude, ChatGPT, Claude Code, Codex, Cursor, VS Code and other agents: https://www.agensi.io/docs/mcp-setup
2. Ask your agent: "Use the b1-mcp-server: SAP Business One context for AI agents skill from Agensi" and describe your task.
3. Your agent loads the skill from Agensi when it needs it. Nothing is downloaded.

## Frequently asked questions

### How does this MCP server handle the differences between SAP HANA and MS SQL environments?

Each connection profile declares its engine (dbType "hana" or "mssql"), and the server uses the matching native driver. Schema discovery runs engine-specific catalog queries, and the read-only guardrails cover both dialects (CALL and EXEC, DO BEGIN and BEGIN blocks). Your agent still writes SQL in the engine's own syntax; the skill tells it what differs, such as HANA reporting a timeout as a dropped connection while MS SQL reports a plain request timeout.

### Is it safe to use this skill with a production SAP Business One database?

The database side is read-only, enforced by the server rather than by the prompt: only SELECT and read-only blocks run, and anything else is refused. On the Service Layer, profiles allow only GET by default; each write verb must be enabled per profile, and by default every write needs your approval. Reads still put load on the database, so queries are stopped after 60 seconds by default, and lock hints that could block users are refused. Keep production profiles on the default approval mode, and prefer a database user with read-only permissions.

### Which AI agents or platforms can I use with the b1 mcp server?

Any MCP client that runs local (stdio) servers. It is developed and tested with Claude Code. Service Layer writes in the default mode need a client that supports MCP approval forms (elicitation); without one, writes are refused. The skill itself is a standard SKILL.md file for agents that read skills.

### Can this skill access custom fields and User-Defined Tables (UDTs) within SAP B1?

Yes, for reading. User-defined fields (U_ columns) and UDTs ("@" tables) can be queried with SELECT like any other table, and schema discovery lists them. Through the Service Layer, user-defined fields travel in entity bodies, and UDOs are reached through their own endpoints, with writes subject to the same verb and approval rules.

### What is required to connect my SAP Business One instance to the AI agent?

Node.js 20 or newer, the server added to your MCP client (npx -y b1-mcp-server), and a connections file at ~/.claude/connections.json (or the path in MCP_CONNECTIONS_FILE) with one profile per company: database host, name, user and password, and/or the Service Layer URL, user and password. The machine running the agent needs network access to the database and/or the Service Layer. Credentials stay in that file; the server never sends them to the agent.

### Are there any specific limitations on query size or record retrieval?

Yes, all adjustable with environment variables. Queries are limited to 8,000 characters, results to 500 rows and then 100,000 characters (always announced with a TRUNCATED note), and each query to 60 seconds. Each tool allows 60 calls per minute. Service Layer write bodies are limited to 50,000 characters.

### Can the agent change my data?

Not through SQL: the server is read-only. Service Layer writes only work if your profile allows the verb, and by default each one needs your approval.

### Does it work without the MCP server?

No. It teaches the agent how to use b1-mcp-server's tools.

---

Source: [Agensi](https://www.agensi.io), the marketplace of skills for AI agents. Any MCP-compatible agent (Claude, ChatGPT, Claude Code, Codex, Cursor, VS Code and more) connects at https://mcp.agensi.io/mcp/auth and signs in with an Agensi account; setup for every agent: https://www.agensi.io/docs/mcp-setup. Append .md to any skill, guide or docs address on agensi.io for its markdown version.
