Connect Microsoft Dynamics 365 Business Central to ChatGPT: Audit & GL
Learn how to connect Microsoft Dynamics 365 Business Central to ChatGPT using Truto's MCP server. A technical guide to automating GL auditing and trial balances.
If you need to connect Microsoft Dynamics 365 Business Central to ChatGPT to automate financial audits, extract general ledger entries, or track trial balances in real time, you need a Model Context Protocol (MCP) server. This server acts as the translation layer between ChatGPT's JSON-RPC tool calls and Business Central's complex OData REST APIs.
If your team uses Claude, check out our guide on connecting Microsoft Dynamics 365 Business Central to Claude or explore our broader architectural overview on connecting Microsoft Dynamics 365 Business Central to AI Agents.
Giving a Large Language Model (LLM) access to an Enterprise Resource Planning (ERP) platform is an architectural hurdle. You must handle strict multi-company tenant boundaries, complex concurrency tokens (ETags), and deeply nested financial dimensions. Every time you query a ledger, you are navigating a maze of relational data. You can either spend months building, hosting, and maintaining a custom MCP server to map these endpoints, or you can use Truto to dynamically generate a secure, authenticated MCP server URL in seconds.
This guide breaks down exactly how to use Truto to generate a managed MCP server for Microsoft Dynamics 365 Business Central, connect it natively to ChatGPT, and execute complex financial auditing workflows using natural language.
Stop writing boilerplate API integration code. Let Truto generate secure, managed MCP servers for your AI agents in seconds. :::
The Engineering Reality of the Business Central API
A custom MCP server is a self-hosted integration layer. While the open MCP standard provides a predictable way for models to discover tools, implementing it against Microsoft Dynamics 365 Business Central is exceptionally painful.
If you decide to build a Microsoft Dynamics 365 Business Central MCP server from scratch, you own the entire API lifecycle. Here are the specific integration challenges that break standard CRUD assumptions when working with this ERP:
Mandatory Company Isolation and Routing
Business Central does not operate on a flat data model. Almost every meaningful financial record - ledger entries, invoices, trial balances - exists strictly within the context of a "Company". The API requires a company_id to be explicitly passed in the URL path for nearly every endpoint. When building custom MCP tools, you must ensure the LLM understands it cannot simply ask for "all ledger entries." It must first retrieve the correct company_id and inject it into subsequent tool calls. If your tool schemas do not enforce this dependency, ChatGPT will hallucinate IDs or drop them entirely, resulting in immediate API rejections.
Concurrency Control via ETags
Business Central enforces strict concurrency control using OData ETags. If an LLM needs to update a vendor record, patch an invoice, or modify a customer, it cannot just send a PATCH request with the new data. The system requires the client to fetch the record first, extract the @odata.etag property, and pass it back exactly as received in an If-Match header. If another user modifies the record in the interim, the ETag changes, and the request fails. Writing tool schemas that force an LLM to accurately handle and pass ETag strings across multi-step execution chains is a notoriously brittle task. Truto's proxy API handlers simplify this by structurally requiring the etag field in update tools.
Handling Rate Limits and HTTP 429s
Enterprise ERPs heavily throttle API traffic. When Business Central hits its threshold, it returns an HTTP 429 status code. It is critical to understand that Truto does not retry, throttle, or apply automatic backoff on rate limit errors. When the upstream API returns HTTP 429, Truto passes that error directly to the caller. Truto normalizes the upstream rate limit information into standardized headers (ratelimit-limit, ratelimit-remaining, ratelimit-reset) per the IETF specification. Your client architecture - whether that is ChatGPT's internal retry logic or a custom agent orchestrator - is entirely responsible for reading these headers and executing the appropriate exponential backoff.
How to Create the MCP Server
Truto automatically generates MCP tools based on the resources and documentation available for the Business Central integration. You can create the MCP server either through the Truto Dashboard or programmatically via the API.
Method 1: Via the Truto UI
For teams who prefer a visual setup, generating the server takes only a few clicks.
- Log into your Truto account and navigate to your Integrated Accounts.
- Select the specific Microsoft Dynamics 365 Business Central account you want to connect to ChatGPT.
- Click on the MCP Servers tab.
- Click Create MCP Server.
- Select your desired configuration. For an Audit & GL use case, you might choose to restrict access to
readoperations to ensure the LLM cannot accidentally modify accounting periods. - Click save and copy the generated MCP server URL (e.g.,
https://api.truto.one/mcp/a1b2c3d4e5f6...).
Method 2: Via the Truto API
If you are dynamically provisioning AI workspaces for your users, you can generate MCP servers programmatically.
Make a POST request to the /integrated-account/:id/mcp endpoint. You can enforce method filtering and tag filtering directly in the payload.
const response = await fetch('https://api.truto.one/integrated-account/<YOUR_INTEGRATED_ACCOUNT_ID>/mcp', {
method: 'POST',
headers: {
'Authorization': 'Bearer <YOUR_TRUTO_API_TOKEN>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
name: "Business Central Audit MCP",
config: {
methods: ["read"], // Restricts the LLM to GET/LIST operations
require_api_token_auth: false
},
expires_at: "2026-12-31T23:59:59Z"
})
});
const mcpServer = await response.json();
console.log(mcpServer.url);
// Output: https://api.truto.one/mcp/a1b2c3d4e5f6...The returned URL contains a cryptographic token that securely identifies the exact Business Central tenant.
How to Connect the MCP Server to ChatGPT
Once you have your Truto MCP URL, you need to expose it to ChatGPT. You can do this natively in the ChatGPT UI or by configuring a local proxy if you are running a custom desktop environment.
Method 1: Via the ChatGPT UI
OpenAI provides native support for connecting remote MCP servers directly in the ChatGPT interface.
- Open ChatGPT and navigate to Settings.
- Go to Apps and click on Advanced settings.
- Ensure Developer mode is enabled (this unlocks MCP support).
- Under the MCP servers / Custom connectors section, click Add new server.
- Provide a recognizable name (e.g., "Business Central Audit").
- Paste the Truto MCP URL into the Server URL field and click Save.
ChatGPT will immediately ping the endpoint, execute the initialize handshake, and register all available Business Central tools.
Method 2: Via Manual Configuration File (CLI)
If you are using developer environments, custom agent orchestrators, or local desktop clients that require standard SSE (Server-Sent Events) transport, you can proxy the Truto URL using the official MCP CLI tool.
Create an mcp-config.json file:
{
"mcpServers": {
"business_central": {
"command": "npx",
"args": [
"-y",
"@modelcontextprotocol/server-sse",
"https://api.truto.one/mcp/<YOUR_TOKEN_HERE>"
]
}
}
}This configuration instructs your local MCP client to wrap Truto's remote JSON-RPC HTTP endpoint into a standardized SSE stream.
Hero Tools for Audit & GL
Business Central has a massive API surface. Truto dynamically generates highly specific tools for every endpoint, injecting schemas and descriptions so the LLM knows exactly how to use them. Here are the core tools required for financial auditing.
List All Companies
Before ChatGPT can query any ledger, it must find the correct company_id. This tool returns all companies configured in the Business Central tenant.
Usage notes: The LLM should always execute this tool first to resolve the company name (e.g., "CRONUS USA, Inc.") to its GUID.
"I need to audit our accounts. Please list all companies in Business Central and find the ID for CRONUS USA."
List All General Ledger Entries
This is the core tool for extracting raw accounting data. It returns the GL entries including posting dates, document numbers, account IDs, debit amounts, credit amounts, and applied dimensions.
Usage notes: Requires the company_id. The response payload can be massive. If the LLM requests a specific date range, it should use query parameters to narrow the scope.
"Fetch all general ledger entries for CRONUS USA posted in November. Look for any debit entries over $50,000."
Get Trial Balance by ID
Extracts a specific trial balance record. It returns the total debits, total credits, and net balances for a specific account at a given date.
Usage notes: Useful for high-level reconciliation before digging into individual GL entries.
"Check the trial balance for account 10400. What is the current balance at date credit?"
List All Accounting Periods
Auditors need to know which financial periods are locked and which are open. This tool returns the starting dates, names, and lock status of all accounting periods.
Usage notes: The LLM can use this to determine if a requested transaction falls into a closed fiscal year.
"List the accounting periods. Are there any periods from last year that have not yet been marked as closed or locked?"
List All Purchase Invoices
Auditing the general ledger often requires cross-referencing payables. This tool fetches purchase invoices, expanding the invoice lines and dimension set lines automatically.
Usage notes: Essential for verifying that a GL expense entry matches a legitimate vendor invoice.
"Get the list of all recent purchase invoices. I need to cross-reference them against the GL entries we just pulled to ensure the vendor numbers match."
To view the complete inventory of available endpoints, schemas, and return types, review the Microsoft Dynamics 365 Business Central integration page.
Workflows in Action
When connected via MCP, ChatGPT stops acting as a basic text generator and becomes an autonomous financial auditor. Here is how the model handles real-world scenarios.
Scenario 1: Month-End GL Anomaly Detection
A financial controller needs to quickly identify unusual expenses before locking the period.
User Prompt: "Look up our company 'CRONUS USA'. Check if the current accounting period is closed. If it is open, pull the general ledger entries for the last 30 days and flag any single entry where the debit amount exceeds $25,000."
Step-by-step Execution:
list_all_microsoft_dynamics_365_business_central_companies: ChatGPT calls this tool to retrieve the environment's companies and extracts theidfor CRONUS USA.list_all_accounting_periods: Using thecompany_id, it fetches the periods. It identifies the current date, matches it to a period, and checks theclosedanddateLockedboolean fields.list_all_general_ledger_entries: Seeing the period is open, ChatGPT queries the GL. It processes the JSON array in memory.- Analysis & Response: ChatGPT filters the data, isolating the objects where
debitAmount> 25000, and presents a formatted markdown table to the user detailing thedocumentNumber,description, and exact amounts.
sequenceDiagram
participant User as User
participant GPT as ChatGPT (MCP Client)
participant Server as Truto MCP Server
participant Upstream as Business Central API
User->>GPT: "Check for GL anomalies in CRONUS USA..."
GPT->>Server: Call list_all_microsoft_dynamics_365_business_central_companies
Server->>Upstream: GET /v2.0/companies
Upstream-->>Server: Return [{ id: "abc-123", name: "CRONUS USA" }]
Server-->>GPT: Return company ID
GPT->>Server: Call list_all_accounting_periods(company_id: "abc-123")
Server->>Upstream: GET /v2.0/companies(abc-123)/accountingPeriods
Upstream-->>Server: Return periods [ { closed: false } ]
Server-->>GPT: Return open status
GPT->>Server: Call list_all_general_ledger_entries(company_id: "abc-123")
Server->>Upstream: GET /v2.0/companies(abc-123)/generalLedgerEntries
Upstream-->>Server: Return GL array
Server-->>GPT: Return GL array
GPT-->>User: Present filtered anomalies tableScenario 2: Auditing Payable Discrepancies
An auditor notices a discrepancy in vendor spend and needs to trace a ledger entry back to its source invoice.
User Prompt: "Find the general ledger entry with document number 'PINV-10042' in CRONUS USA. Then, retrieve the actual purchase invoice for that document and verify if the total amount including tax matches the ledger credit amount."
Step-by-step Execution:
list_all_microsoft_dynamics_365_business_central_companies: Resolves thecompany_id.list_all_general_ledger_entries: ChatGPT fetches the ledger entries and searches the array fordocumentNumber== 'PINV-10042', noting thecreditAmount.list_all_purchase_invoices: ChatGPT fetches the purchase invoices for the company and locates the invoice matching that number.- Analysis & Response: ChatGPT compares the
creditAmountfrom the ledger against thetotalAmountIncludingTaxfrom the invoice object and explains whether they balance or if there is a discrepancy.
Security and Access Control
Giving an AI agent access to an ERP requires strict governance. Truto MCP servers are designed to operate securely with robust access controls built into the token lifecycle.
- Method Filtering: By passing
config.methods: ["read"]during server creation, you can physically block the LLM from executingPOST,PATCH, orDELETErequests, ensuring the agent remains completely read-only. - Tag Filtering: You can restrict the server to only expose tools relevant to specific domains (e.g., exposing only ledger tools and hiding HR or payroll resources).
- Require API Token Auth: Setting
require_api_token_auth: trueensures that possessing the MCP URL is not enough. The client must also pass a valid Truto API token in theAuthorizationheader, enforcing a secondary layer of authentication. - Time-to-Live (TTL): You can set an
expires_attimestamp. Once the time is reached, Cloudflare KV automatically invalidates the token and a scheduled alarm cleans up the database record, ensuring zero lingering access for temporary AI audit tasks.
Start Building AI Financial Automations
Integrating Microsoft Dynamics 365 Business Central with ChatGPT unlocks massive operational efficiency for finance teams. Instead of manually exporting CSVs and running pivot tables, teams can converse directly with their ERP data in real time.
By leveraging Truto's dynamically generated MCP servers, you eliminate the need to write schema parsers, handle OAuth flows, or maintain complex server infrastructure. You define the rules, generate the URL, and let the AI go to work.
Ready to put your AI agents in touch with your enterprise data? Talk to our engineering team to get started.
FAQ
- How does Truto handle API rate limits from Microsoft Dynamics 365 Business Central?
- Truto does not automatically retry or absorb rate limit errors. If Business Central returns an HTTP 429 status code, Truto passes the error back to the caller and maps the upstream rate limit data to standard IETF headers (`ratelimit-limit`, `ratelimit-remaining`, `ratelimit-reset`). The caller or MCP client must implement their own exponential backoff.
- Can I prevent ChatGPT from modifying financial data in Business Central?
- Yes. When creating the Truto MCP server via the UI or API, you can apply method filtering (e.g., config.methods: ["read"]). This ensures the server only exposes GET and LIST operations, making it impossible for the LLM to write or delete data.
- How do MCP tools handle Business Central's multi-company structure?
- Business Central requires a company_id for almost all operations. Truto generates specific tools (like `list_all_microsoft_dynamics_365_business_central_companies`) that allow the LLM to retrieve the required company_id first, which it then automatically injects into subsequent tool calls like querying the general ledger.
- Can I use the Truto MCP server with custom agent frameworks instead of ChatGPT?
- Yes. The Truto MCP server exposes a standard JSON-RPC 2.0 endpoint. You can connect it to custom agents built with LangGraph, AutoGen, CrewAI, or local IDEs like Cursor using standard Server-Sent Events (SSE) or HTTP transports.