Weekend Project: Teaching AI to Talk to Business Central

Share This Post

This weekend, I went down the rabbit hole of connecting AI to Business Central using the Model Context Protocol (MCP). MCP is essentially a “USB port for AI” — a universal standard that lets AI assistants talk directly to business systems.

The setup involved three key pieces:

1. Azure AD App Registration — Creating an app with Application permissions (not Delegated — learned that the hard way!) You need `API.ReadWrite.All` and `Automation.ReadWrite.All` permissions, plus admin consent.

2. Business Central Configuration — This is where BC’s new MCP capabilities shine:

Feature Management — Search for “Feature Management” and enable “Enable MCP Server access” for all users

Azure Active Directory Applications — Register your Azure AD app’s Client ID and assign permission sets (like `D365 BUS FULL ACCESS` for testing)

MCP Server Configurations — The new page where the magic happens:

  – Create a configuration (e.g., “Sales Agent”)

  – Click “Add all standard APIs as tools” — this automatically exposes customers, items, orders, vendors, and more

  – Set Active = Yes to enable it

  – Optionally enable Dynamic Tool Mode” for auto-discovery of 50+ APIs

  – Toggle “Unblock Edit Tools” to allow create/update/delete operations (careful in production!)

3. Python MCP Server — A lightweight server that translates AI tool calls into BC API requests. It handles OAuth token caching, company ID lookups, and OData query building. More on this in a future blog post.

The result? Instead of navigating menus and running reports, I can now ask questions in plain English and get answers from live BC data.

Beyond basic queries, I’m planning to generate agents for different business functions:

AgentPurpose
Sales Manager AgentSales performance, quote tracking, customer analytics
Payables AgentA/P management, vendor balances, payment planning
Fixed Assets AgentAsset tracking, depreciation schedules
Jobs AgentProject costing, budget vs actual analysis

Each agent will understand its domain deeply and answer role-specific questions like “Who are my top 10 salespeople by quotes this month?” or “What invoices are due this week?”

Included below are a few examples of interrogating the Payables Agent:

MCP Tool Call: `bc_list_aged_ap`

{
  "top": 10
}
```

Result:

Vendor Balance DueAging
Wide World Importers$18,193.1090+ days
Nod Publishers$17,273.8790+ days
Graphic Design Institute$6,979.5790+ days
First Up Consultants$4,903.88 90+ days
Fabrikam, Inc.$2,082.1390+ days

One question. Instant answer. No report navigation required.

But reading data is just the beginning. The real power is when AI can create transactions. Here’s a complete example of creating a sales quote through natural conversation.

Step 1: Find the Customer

MCP Tool: `bc_list_customers`

`json
{
  "filter": "contains(displayName,'Adatum')",
  "top": 5
}

API Response:

```json
{
  "value": [{
    "id": "92f5e1bd-1b4e-ef11-bfe7-6045bde9c989",
    "number": "10000",
    "displayName": "Adatum Corporation",
    "city": "Atlanta",
    "state": "GA"
  }]
}
```

Step 2: Find the Item

MCP Tool: `bc_list_items`

```json
{
  "value": [{
    "id": "92f5e1bd-1b4e-ef11-bfe7-6045bde9c989",
    "number": "10000",
    "displayName": "Adatum Corporation",
    "city": "Atlanta",
    "state": "GA"
  }]
}
```
```json
{
  "filter": "contains(displayName,'Desk')",
  "top": 10
}
```

**API Response:**

```json
{
  "value": [{
    "id": "7294b9c2-1b4e-ef11-bfe7-6045bde9c989",
    "number": "1896-S",
    "displayName": "ATHENS Desk",
    "unitPrice": 1000.8,
    "inventory": 4
  }]
}
```

**MCP Tool:** `bc_create_sales_quote`

```json
{
  "customerNumber": "10000"
}
```

**API Response:**

```json
{
  "id": "1a59f93f-3500-f111-8405-6045bda74b53",
  "number": "S-QUO1005",
  "documentDate": "2026-02-02",
  "customerNumber": "10000",
  "customerName": "Adatum Corporation",
  "status": "Draft"
}
```

MCP Tool:** `bc_add_sales_quote_line`

```json
{
  "quoteId": "1a59f93f-3500-f111-8405-6045bda74b53",
  "itemNumber": "1896-S",
  "quantity": 2
}
```

API Response:

```json
{
  "id": "0397fd45-3500-f111-8405-6045bda74b53",
  "lineObjectNumber": "1896-S",
  "description": "ATHENS Desk",
  "quantity": 2,
  "unitPrice": 1000.8,
  "amountExcludingTax": 2001.6,
  "taxPercent": 6.0002,
  "totalTaxAmount": 120.1,
  "amountIncludingTax": 2121.7
}
```

While this proof-of-concept is exciting, there’s still work to be done. More investigation is needed to understand the full capabilities and limitations of BC’s native MCP endpoint. More tests are needed to integrate custom APIs …. More exploration is needed to learn how to make this accessible to regular business users — not just developers comfortable with VS Code, Python and JSON.

The real opportunity lies in integrating these AI capabilities with the tools people already use.

This is just the first in a series of blog posts documenting this journey. In upcoming posts, I’ll dive deeper into specific agents, explore the quote-to-cash flow, and share lessons learned along the way.

And maybe the future is not learning the ERP user interface but AI tools to talk to ERP directly via exposed APIS without clicking through menus.

Stay tuned.

Share This Post

Related Articles

2 Responses

Leave a Reply

Recent Posts

Get Notified About New Posts

Categories

Discover more from Business Central Musings

Subscribe now to keep reading and get access to the full archive.

Continue reading