# How to build an MCP server for Baan IV and Baan V

> Source: https://netray.co/integrations/baan-mcp-server
> Publisher: Netray (netray.co), AI and integration engineering for ERP and manufacturing systems.
> Section: Integrations

## Short answer

Build a small service that speaks the Model Context Protocol and exposes a handful of read-only tools backed by a Baan replica or ODBC. Any MCP client, such as Claude or ChatGPT, can then call it. Add write tools later, behind approvals and AFS.

## System

Baan IV / Baan V

## Capability

mcp-server

## Intro

The Model Context Protocol gives AI clients a standard way to call tools and read resources. For a system like Baan, without a REST layer, an MCP server is a practical way to publish a small, safe window onto the data. One server serves several clients.

The design question is not the protocol, which has SDKs in TypeScript and Python. It is which tools to expose, how to translate Baan table names into business concepts, and how to authenticate users without giving every client a database password.

This page walks through those decisions for a Baan IV or Baan V site, with an emphasis on starting small and read-only.

## Use Cases

### Item lookup

**Description:** get_item returns description, unit, planner code, make or buy flag and lead time, reading from the item data tables.

### Order status

**Description:** get_sales_order and get_purchase_order return header, lines, promised dates and receipts, with filtered fields.

### Inventory by warehouse

**Description:** stock_by_item returns on hand, allocated and on order per warehouse, with an as-of timestamp.

### BOM explosion

**Description:** bom_explode walks a product structure to a chosen depth and returns components and quantities.

### Production order shortages

**Description:** shortages_for_order compares required components to available stock for a given production order.

### Documentation resources

**Description:** Expose exported session help and your internal runbooks as MCP resources so the model can cite them.

## System Surface

- Read path: read-only ODBC or a replica of the Baan database, using a driver supported by your database vendor and Baan install.
- Naming: tables follow package, module and number, so your server needs a mapping layer from business names to table and field names; these differ by version and customization.
- Company numbers: Baan uses multi-company data, typically with a company suffix on tables, which the server must handle explicitly.
- Write path: AFS or a scripted session, only for tools added after the read-only phase.
- Authentication source: Baan users and roles are not exposed as OAuth identities, so map your directory users to a Baan user or role in the server.

## How It Works

### Pick the SDK and language

**Detail:** Use the official TypeScript or Python MCP SDK, whichever your team can maintain.

### Define five to ten read-only tools

**Detail:** Name them after business questions, with typed parameters and short descriptions the model can understand.

### Implement parameterized queries

**Detail:** Each tool runs a fixed query with bound parameters. No raw SQL passes through from the model.

### Choose a transport

**Detail:** Use stdio for a single-user desktop test. Use streamable HTTP for shared use, behind your reverse proxy with TLS.

### Authenticate and scope

**Detail:** Validate a token per request and apply per-role filters, such as limiting to certain companies or warehouses.

### Add logging

**Detail:** Record user, tool, arguments and row counts to a store your auditors can read.

## Example Flows

### Planner asks about a shortage

**Trigger:** A question in an MCP-capable chat client.

**Steps:**

- Client lists the server's tools.
- Model calls shortages_for_order with the order number.
- Server queries the replica and returns the short components.
- Model calls stock_by_item for one component to show where else it sits.

**Result:** Answer with sources from live data in one conversation.

### Proposed purchase order change

**Trigger:** User asks to move a due date.

**Steps:**

- Model calls propose_po_change, which writes to a pending table only.
- Buyer sees the proposal in a review screen.
- On approval, a separate worker applies the change via AFS.

**Result:** A traceable change with a human decision.

## On Prem

An MCP server is just a service you host, so it fits on-prem easily. Run it on a server that can reach the replica and nothing else, expose it only inside your network or over VPN, and pair it with a local model if data cannot leave. If your Baan machine is an old Unix host, the server never needs to run there; it talks to the database or ODBC endpoint from a modern host. The same server works whether the client is a hosted assistant or a local model.

## Security

- Read-only database account on a replica, never the production login used by Baan itself.
- Parameterized queries only; reject any input that is not a typed tool argument.
- Per-request authentication and role-based filtering.
- Write tools disabled by default and routed through an approval step.
- Full audit log with tool name, arguments and who asked.

## Options

### Open-source starter you adapt

**Fit:** Your team has Python or TypeScript skills and a clean replica.

**Effort:** Two to four weeks for a first set of tools.

### Generic SQL-to-MCP gateway

**Fit:** Quick experiments on a non-sensitive copy.

**Effort:** Days, but loose control over what the model can query.

### Partner-built connector with Netray

**Fit:** Customized schema, multiple companies, and a need for audit and on-prem models.

**Effort:** A scoped pilot, then add tools.

## Pitfalls

- Too many tools; models choose poorly past a dozen or so.
- Returning wide rows with every field, which wastes context and leaks data.
- Ignoring company numbers, so answers mix entities.
- No as-of timestamp, so users trust stale replica data.

## Faq

### What is an MCP server for Baan?

**Answer:** It is a small service that exposes Baan data as tools and resources through the Model Context Protocol. AI clients call it to get stock, orders or item data instead of guessing. It sits outside Baan and typically reads from a replica.

### Does it work with both Claude and ChatGPT?

**Answer:** MCP is supported by several clients, including Claude products, and support continues to spread, including in ChatGPT in some modes. Check the client's current MCP support and transport requirements before you choose how to host it.

### Should the server write to Baan?

**Answer:** Start read-only. Later, add narrow write tools that stage proposals and apply them through AFS after approval. Direct database writes are not advised because they bypass Baan logic.

### stdio or HTTP?

**Answer:** stdio suits a single developer testing on one machine. HTTP suits shared team use with central authentication, logging and TLS. Most production Baan deployments use HTTP inside the company network.

### How do we keep it fast on a large database?

**Answer:** Query a replica, index the columns your tools filter on, cap row counts and return summaries first. Avoid scanning big history tables on every call.

## Search terms

baan mcp server, mcp server for baan erp, model context protocol baan, baan iv mcp, baan v mcp connector, build mcp server erp, baan odbc mcp, mcp legacy erp

---
Talk to an engineer: https://netray.co/contact?intent=erp_ai | Machine catalog: https://netray.co/agent/catalog.json
