Skip to content

GmsoftLtd/MCP-Manufacturing-Examples

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

MCP Manufacturing Examples for Business Central

License: MIT Business Central MCP

Companion code for the article How to Use AI and MCP to Automate Your Shop Floor in Business Central.

The one-line idea: Business Central does not talk to AI agents out of the box. You build a bridge — custom AL API pages that expose manufacturing data the way a planner thinks about it, plus a small Model Context Protocol (MCP) server that lets an agent (Claude, Copilot Studio, Azure OpenAI, …) query and act on that data in plain language.

This repo is that bridge, end to end, as a working example you can read, run, and adapt.

 ┌─────────────┐     natural language      ┌──────────────┐    HTTPS + OAuth2     ┌──────────────────┐
 │  AI agent   │ ───────────────────────►  │  MCP server  │ ───────────────────►  │ Business Central │
 │  (Claude)   │ ◄───────────────────────  │ (TypeScript) │ ◄───────────────────  │  custom AL API   │
 └─────────────┘   "which machine is the    └──────────────┘   /api/gmsoft/...     └──────────────────┘
                    bottleneck today?"          tools                                production orders,
                                                                                      work centres, actions

What's in here

Folder What it is Language
al-extension/ The bridge inside BC — custom API pages that expose production orders and work-centre load with pre-computed signals (isOverdue, completionPct, loadPct), plus an OData action codeunit to release/replan orders safely. AL
mcp-server/ The MCP server — a small Node/TypeScript server that authenticates to BC with OAuth2 client credentials and exposes a handful of MCP tools an agent can call. TypeScript
prompts/ Example shop-floor prompts that map to the tools, and what good answers look like. Markdown
docs/ Setup guide — register the Entra (Azure AD) app, publish the AL API, wire the MCP server, connect Claude Desktop. Markdown
examples/ Ready-to-paste client config (claude_desktop_config.json) and a worked "daily briefing" walkthrough. JSON / Markdown

Why pre-computed signals (the important bit)

The temptation is to expose raw BC tables and let the AI "figure it out". That is slow, expensive in tokens, and fragile. The pattern this repo demonstrates is the opposite:

  • Do the manufacturing logic in AL, where the data lives. Is an order overdue? What % complete is it? Is a work centre over 90% loaded? Compute it in OnAfterGetRecord, expose it as a clean boolean/number.
  • Give the agent decisions, not rows. isOverdue = true is a decision. A due date and a quantity table is homework.
  • Keep actions safe and validated. Status changes (Firm Planned → Released) go through an OData action that runs BC's own validation, so the agent can act, not just read, without bypassing business rules.

That is what turns "a 40-minute manual morning briefing" into "a 10-second question".

Quick start

# 1. Publish the AL extension to your BC sandbox (see al-extension/README.md)
#    -> exposes /api/gmsoft/manufacturing/v1.0/...

# 2. Configure and run the MCP server
cd mcp-server
cp .env.example .env          # fill in tenant, BC URL, client id/secret
npm install
npm run build
npm start                     # or wire it into Claude Desktop (see examples/)

Full, step-by-step instructions: docs/setup.md.

Tools the agent gets

MCP tool What it answers / does Backed by
list_production_orders "Show me the late orders for Work Center 2." productionOrders API page
get_work_center_load "Which machine is our bottleneck today?" workCenterLoad API page
get_shop_floor_briefing "Give me the morning shop-floor briefing." both pages, summarised
release_production_order "Release order 1001102 to production." ShopFloorActions OData action

Status & scope

This is example / teaching code, MIT-licensed, meant to be read and adapted — not a packaged product. The AL objects use ID range 50400–50499. Field names on standard manufacturing tables can vary slightly by BC version; the code is written for BC v27+ and commented where a version check is worth doing. See each subfolder's README for caveats.

Related GMSOFT open-source

License

MIT — see LICENSE.

Author

Grigorios Mavrogeorgis — Director and Founder of GMSOFT Limited Microsoft Dynamics 365 Business Central Community Super User, Season 1 2026 Blog: Inside Business Central

About

No description, website, or topics provided.

Resources

License

Stars

0 stars

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors