Skip to content

Connect Business Central (on-prem) to ChatGPT: Audit Financials

Learn how to build a secure MCP server to connect ChatGPT to Microsoft Dynamics 365 Business Central (on-premises) for automated financial auditing.

Sidharth Verma Sidharth Verma · · 10 min read
Connect Business Central (on-prem) to ChatGPT: Audit Financials

If you need to connect Microsoft Dynamics 365 Business Central (on-premises) to ChatGPT to automate financial audits, analyze trial balances, or query accounts payable, you need a Model Context Protocol (MCP) server. This server acts as the translation layer between ChatGPT's tool calls and your on-premises ERP's OData web services. You can either build and maintain this infrastructure yourself, or use a managed integration platform like Truto to dynamically generate a secure, authenticated MCP server URL.

If your team uses Claude, check out our guide on connecting Microsoft Dynamics 365 Business Central (on-premises) to Claude or explore our broader architectural overview on connecting Microsoft Dynamics 365 Business Central (on-premises) to AI Agents.

Giving a Large Language Model (LLM) read and write access to an on-premises ERP is a massive engineering challenge. You have to handle complex OData filtering payloads, map dynamic custom dimensions to MCP tool definitions, and deal with strict optimistic concurrency. Every time an admin publishes a new web service in Business Central, your custom server code must be updated, redeployed, and tested.

This guide breaks down exactly how to use Truto to generate a secure, managed MCP server for Business Central (on-premises), connect it natively to ChatGPT, and execute complex financial workflows using natural language.

The Engineering Reality of the Business Central On-Prem API

A custom MCP server is a self-hosted integration layer. While the open MCP standard provides a predictable JSON-RPC 2.0 interface for models to discover tools, implementing it against Business Central's specific architecture is exceptionally painful.

If you decide to build a custom MCP server for Business Central, you own the entire API lifecycle. Here are the specific integration challenges that break standard CRUD assumptions when working with this ERP:

The OData Web Services Maze and Company Context

Unlike standard REST APIs, Business Central (on-premises) exposes its data via OData v4 web services. This means every endpoint requires precise $filter, $expand, and $select semantics. If you provide an LLM with generic access, it will hallucinate query parameters that Business Central cannot parse. Furthermore, every single API call requires a strict company_id context. If your enterprise operates multiple legal entities, your MCP server must intercept the LLM's requests, validate the target entity, and inject the correct company_id into the path or query before proxying the request to the on-prem server.

Strict Optimistic Concurrency (ETags)

Business Central enforces strict optimistic concurrency on all write operations using ETags (@odata.etag). You cannot simply execute a PATCH request to update a general ledger entry or apply a vendor payment. You must first execute a GET request, extract the current ETag from the payload, and pass it back to the server in an If-Match header. If an LLM attempts to chain a sequence of writes without properly orchestrating this read-before-write lifecycle, the API will reject the requests with 412 Precondition Failed errors.

Nested Dimension Set Lines

Financial reporting in Business Central relies heavily on Dimensions (departments, projects, cost centers). When you query a journal line or sales invoice, the dimensions are not returned as a flat array. They are nested within dimensionSetLines, which often require explicit $expand directives to hydrate. If your MCP server doesn't provide explicit JSON schemas detailing how to map query arguments into these nested OData structures, ChatGPT will fail to filter ledgers by the correct financial dimensions.

Microsoft Dynamics 365 Business Central MCP Quickstart

If you want the fastest path from a fresh Truto account to ChatGPT calling the Business Central API, follow these steps.

What you need:

  • A Truto account with API access.
  • A connected Microsoft Dynamics 365 Business Central (on-premises) Integrated Account in Truto.
  • A ChatGPT Pro, Plus, Business, Enterprise, or Education seat with Developer Mode available.

Step 1: Create the MCP Server

An MCP server in Truto is scoped to a specific integrated account. You can create this server via the UI or programmatically via the API.

Method A: Via the Truto UI

  1. Navigate to the Integrated Account page for your Business Central connection.
  2. Click the MCP Servers tab.
  3. Click Create MCP Server.
  4. Select your desired configuration (e.g., restrict to read methods, select specific tags like financials).
  5. Copy the generated MCP server URL (it will look like https://api.truto.one/mcp/<token>).

Method B: Via the Truto API You can generate an MCP server dynamically by sending a POST request to Truto. This provisions a token backed by Cloudflare KV.

curl -X POST https://api.truto.one/integrated-account/$INTEGRATED_ACCOUNT_ID/mcp \
  -H "Authorization: Bearer $TRUTO_API_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Business Central Financial Auditor",
    "config": {
      "methods": ["read"],
      "tags": ["financials", "ledger", "accounting"]
    }
  }'

The response contains a url field. Treat this URL as a sensitive credential—it authenticates and routes requests directly to your ERP.

Step 2: Connect the MCP Server to ChatGPT

Now, you must register the generated URL with ChatGPT.

Method A: Via the ChatGPT UI

  1. Open ChatGPT and navigate to Settings -> Apps -> Advanced settings.
  2. Enable Developer mode.
  3. Under MCP servers / Custom connectors, click Add new server.
  4. Name: Give it a recognizable name (e.g., "Business Central Auditor").
  5. Server URL: Paste the Truto MCP URL you generated in Step 1.
  6. Click Save. ChatGPT will immediately perform a handshake and list the discovered tools.

Method B: Via Manual Config File (SSE Transport) If you are using a desktop client or custom MCP inspector that requires a configuration file to utilize Server-Sent Events (SSE) over HTTP, you can specify the MCP server using the @modelcontextprotocol/server-sse package.

{
  "mcpServers": {
    "business-central-auditor": {
      "command": "npx",
      "args": [
        "-y",
        "@modelcontextprotocol/server-sse",
        "--url",
        "https://api.truto.one/mcp/YOUR_SECURE_TOKEN"
      ]
    }
  }
}

Hero Tools for Financial Auditing

Once connected, Truto exposes Business Central's OData endpoints as native MCP tools. Rather than dumping the entire ERP schema into ChatGPT's context window, Truto dynamically derives a curated set of tools based on the documentation. Here are the highest-leverage tools for financial auditing.

list_all_general_ledger_entries

This tool allows the LLM to query the core accounting ledger. It supports pagination and filtering by date, account number, or document type. This is the foundational tool for any AI-driven audit or reconciliation task.

"Fetch the general ledger entries for account number 40100 for the last fiscal quarter. Return the data structured by posting date, debit amount, and credit amount, and highlight any entry exceeding $50,000."

list_all_trial_balances

Provides a high-level snapshot of all account balances. The LLM can use this tool to verify that total debits equal total credits, or to compare current balances against historical periods to detect anomalies before month-end close.

"Retrieve the current trial balance for company ID 'xyz-123'. Calculate the net change across all revenue accounts and compare it to the prior period balances. Let me know if any accounts are out of balance."

list_all_aged_accounts_payables

Extracts AP aging data natively. Instead of the LLM trying to calculate aging manually from raw invoices, this tool returns structured period buckets (e.g., current, 30 days, 60 days, 90+ days) per vendor.

"Pull the aged accounts payable report. List all vendors with a balance due greater than $10,000 in the 'period3Amount' (90+ days) bucket, and draft a summary email requesting a status update for each."

list_all_aged_accounts_receivables

The AR equivalent of the AP aging tool. It allows the agent to monitor cash flow and identify delinquent customers based on predefined aging buckets configured in the ERP.

"Get the aged accounts receivable for all customers. Identify the top 5 customers with the highest overdue balances over 60 days, and retrieve their contact information from the CRM so we can initiate collections."

get_purchase_invoice_by_id

Allows the LLM to drill down into the specific details of an expenditure. It automatically expands purchaseInvoiceLines, giving the model full visibility into item costs, tax codes, and applied discounts for a specific invoice.

"Retrieve purchase invoice ID 'PI-9942'. Check the line items to verify if the 'unitCost' for the server hardware matches our negotiated rate of $1,200, and ensure the correct tax group code was applied."

list_all_cash_flow_statements

Exposes top-level liquidity data. The LLM can ingest this structured OData response to generate cash flow narratives, identify negative net changes in operating activities, and forecast short-term cash availability.

"Fetch the cash flow statement for the current date filter. Summarize the net change in operating vs financing activities, and provide a bulleted list of potential liquidity concerns based on the current balances."

To view the complete schema details, query parameters, and the full inventory of supported operations, visit the Microsoft Dynamics 365 Business Central (on-premises) integration page.

Workflows in Action

When you connect Business Central to ChatGPT via Truto, the LLM becomes an autonomous financial analyst. Because Truto handles the complex OData translation and pagination, the LLM can chain multiple API calls together to execute complex runbooks.

Scenario 1: Month-End AR Audit and Collections

During month-end close, finance teams spend hours cross-referencing AR reports with customer records. An AI agent can automate this entirely.

"Run an audit on our accounts receivable. Pull the aged AR report, identify any customers with balances over 90 days past due, then cross-reference their customer ID to pull their contact info and recent payment history. Finally, draft a collections email for the worst offender."

Execution flow:

  1. ChatGPT calls list_all_aged_accounts_receivables to pull the structured aging report.
  2. The model parses the JSON, specifically looking at the period3Amount field, and identifies the highest delinquent balances.
  3. ChatGPT extracts the customerId for those records and calls get_customer_by_id to retrieve the associated email and phoneNumber.
  4. ChatGPT calls list_all_customer_payments filtering by that specific customer to check if any partial payments were recently applied.
  5. The model synthesizes this data and outputs a complete status report alongside a drafted collections email.
sequenceDiagram
    participant User as User
    participant GPT as ChatGPT
    participant Truto as Truto MCP Server
    participant ERP as Business Central (On-Prem)
    
    User->>GPT: "Audit AR and draft collections email"
    GPT->>Truto: call tool: list_all_aged_accounts_receivables
    Truto->>ERP: GET /agedAccountsReceivable
    ERP-->>Truto: Return aging JSON array
    Truto-->>GPT: Return transformed tool result
    GPT->>Truto: call tool: get_customer_by_id (id: 104)
    Truto->>ERP: GET /customers(104)
    ERP-->>Truto: Return customer profile (email, phone)
    Truto-->>GPT: Return transformed tool result
    GPT->>Truto: call tool: list_all_customer_payments (filter: customerId eq 104)
    Truto->>ERP: GET /customerPayments?$filter=customerId eq 104
    ERP-->>Truto: Return recent payment history
    Truto-->>GPT: Return transformed tool result
    GPT-->>User: Present audit summary and drafted email

Scenario 2: Vendor Payment Anomaly Investigation

When discrepancies appear in the AP ledger, tracing the root cause across purchase orders, invoices, and journal entries is tedious.

"Investigate our relationship with vendor 'Acme Corp'. Pull their recent purchase invoices, check if there are any unapplied vendor entries, and compare the total invoiced amount against the general ledger entries mapped to their vendor ID for this month."

Execution flow:

  1. ChatGPT calls list_all_vendors with a search filter to resolve 'Acme Corp' to a specific vendorId.
  2. ChatGPT calls list_all_purchase_invoices filtering by that vendorId to see what has been billed.
  3. ChatGPT calls list_all_apply_vendor_entries to check if there are payments sitting in the journal that haven't been applied to those specific invoices.
  4. Finally, it calls list_all_general_ledger_entries to pull the raw debits and credits for that vendor's associated account number to reconcile the data.
  5. The model outputs a comprehensive variance report highlighting any unapplied funds or mismatched GL entries.

Security and Access Control

Exposing an on-premises ERP to an external LLM requires strict governance. Truto's MCP architecture provides multiple layers of access control, ensuring your agent only has the permissions you explicitly grant.

  • Method Filtering: When creating the MCP token, you can set config.methods: ["read"] to strictly forbid the LLM from executing create, update, or delete operations. This ensures your financial audit workflows are completely non-destructive.
  • Tag Filtering: You can restrict the MCP server's scope using config.tags. By setting tags: ["ledger", "banking"], you prevent the LLM from accessing HR data or inventory configurations, significantly reducing the blast radius of a compromised prompt.
  • Dual Authentication (require_api_token_auth): By default, possessing the MCP URL grants access. By enabling require_api_token_auth: true, the MCP client must also pass a valid Truto API token via the Authorization header. This ensures that even if the MCP URL leaks in a log file, the server remains secure.
  • Time-To-Live (expires_at): You can assign an ISO datetime to the expires_at field. Once the timestamp passes, Cloudflare KV automatically evicts the hashed token, and a Durable Object alarm destroys the database record, perfectly supporting temporary audit access for contractors.

Rate Limits and Error Handling

When your AI agent queries Business Central heavily, it may hit the ERP's internal throttling limits or reverse proxy constraints. It is crucial to understand that Truto does not retry, throttle, or apply backoff on rate limit errors.

When the upstream Business Central server returns an HTTP 429 Too Many Requests, Truto passes that 429 error directly back to the MCP client (ChatGPT). Truto actively normalizes the upstream rate limit information into standardized IETF headers (ratelimit-limit, ratelimit-remaining, ratelimit-reset).

The caller—your MCP client or AI agent framework—is entirely responsible for reading these headers and implementing its own retry and exponential backoff logic. Truto acts as a transparent, zero-retention conduit, ensuring you have deterministic control over how your agent handles ERP backpressure.

Summary

Connecting Microsoft Dynamics 365 Business Central (on-premises) to ChatGPT transforms how finance and IT teams interact with ERP data. By leveraging Truto's auto-generated MCP servers, you bypass the massive engineering overhead of building OData parsers, managing ETag concurrency, and maintaining custom REST wrappers. You get secure, scoped, and highly scalable AI access to your financial truth in minutes, not months.

FAQ

How does Truto handle Business Central's OData pagination?
Truto normalizes the OData next links into standardized `next_cursor` values. When an LLM calls a list tool, Truto includes instructions in the JSON schema explicitly telling the LLM to pass the cursor back unmodified for the next page.
Can I prevent the AI agent from deleting financial records?
Yes. When provisioning the MCP server in Truto, you can configure the method filters to only allow 'read' operations (which covers 'get' and 'list'). The Truto router will automatically block any 'create', 'update', or 'delete' tool calls.
What happens if Business Central rate limits the AI agent?
Truto does not retry, throttle, or apply backoff on rate limit errors. When the upstream API returns an HTTP 429, Truto passes that error directly to the caller, normalizing the rate limit data into standard IETF headers (ratelimit-limit, ratelimit-remaining, ratelimit-reset). The client is responsible for retries.
How do I secure the MCP server URL if it is used in a shared environment?
You can enable the 'require_api_token_auth' flag when generating the MCP token. This adds a second layer of authentication, requiring the MCP client to pass a valid Truto API token in the Authorization header alongside the URL.

More from our Blog