How to build an MCP server for Baan IV and Baan V
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.
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.
What teams use it for
Item lookup
get_item returns description, unit, planner code, make or buy flag and lead time, reading from the item data tables.
Order status
get_sales_order and get_purchase_order return header, lines, promised dates and receipts, with filtered fields.
Inventory by warehouse
stock_by_item returns on hand, allocated and on order per warehouse, with an as-of timestamp.
BOM explosion
bom_explode walks a product structure to a chosen depth and returns components and quantities.
Production order shortages
shortages_for_order compares required components to available stock for a given production order.
Documentation resources
Expose exported session help and your internal runbooks as MCP resources so the model can cite them.
Baan IV / Baan V integration 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
- 1
Pick the SDK and language
Use the official TypeScript or Python MCP SDK, whichever your team can maintain.
- 2
Define five to ten read-only tools
Name them after business questions, with typed parameters and short descriptions the model can understand.
- 3
Implement parameterized queries
Each tool runs a fixed query with bound parameters. No raw SQL passes through from the model.
- 4
Choose a transport
Use stdio for a single-user desktop test. Use streamable HTTP for shared use, behind your reverse proxy with TLS.
- 5
Authenticate and scope
Validate a token per request and apply per-role filters, such as limiting to certain companies or warehouses.
- 6
Add logging
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.
- 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.
- 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.
Keeping data 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 checklist
- 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.
Ways to get it done
Open-source starter you adapt
Effort: Two to four weeks for a first set of tools.
Your team has Python or TypeScript skills and a clean replica.
Generic SQL-to-MCP gateway
Effort: Days, but loose control over what the model can query.
Quick experiments on a non-sensitive copy.
Partner-built connector with Netray
Effort: A scoped pilot, then add tools.
Customized schema, multiple companies, and a need for audit and on-prem models.
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.
Frequently asked questions
What is an MCP server for Baan?
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?
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?
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?
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?
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.
Want MCP server working on your Baan IV / Baan V?
A free 30 minute assessment: we map the integration path for your version and setup, and where it should run.
Get a free assessment