Skip to main content
Glama
Dynamics 365 Business Central MCP Server

Dynamics 365 Business Central MCP Server

by Code-Ninety

Dynamics 365 Business Central MCP Server

A governed, read-only-by-default Model Context Protocol (MCP) server for Microsoft Dynamics 365 Business Central OData v4 APIs. Built in Python for finance, ERP operations, and engineering teams that need AI assistants to query ledgers, trial balances, and purchase orders without exposing unredacted PII or granting unrestricted write access.

Maintained by Code Ninety Dynamics 365 Engineering.

Architecture Overview

Every tool call passes through a strict governance pipeline before reaching either the zero-credential in-memory sandbox or live Microsoft Dynamics 365 Business Central OData v4 endpoints.

flowchart LR
    Client["MCP Client (Claude Desktop / Cursor)"] -->|stdio JSON-RPC| Server["MCPServer (6 Typed Tools)"]
    Server --> RBAC["RBAC & HMAC Approval Gate"]
    RBAC -->|Read Allowed / Draft Approved| Mode{"D365_MODE"}
    Mode -->|sandbox| Sandbox["In-Memory BC Sandbox Dataset"]
    Mode -->|live| OAuth["Entra ID OAuth 2.0 Token Cache"]
    OAuth -->|Bearer Token + Retry| OData["Business Central OData v4 API"]
    Sandbox --> Redactor["Deterministic PII Redactor"]
    OData --> Redactor
    Redactor --> Audit["SHA-256 JSON Audit Logger"]
    Audit --> Client

Related MCP server: d365-bc-mcp

Governance and Security Controls

  1. Read-Only Default (D365_READ_ONLY=true): All mutation paths are disabled out of the box. Even if an approval token is supplied, writes fail with D365_GOVERNANCE_ERROR unless D365_READ_ONLY=false is explicitly configured by the operator.

  2. Scoped HMAC-SHA256 Write Approvals: When controlled draft writes are enabled, bc_create_draft_journal requires a short-lived HMAC-SHA256 token issued by bc_request_write_approval. Each token is cryptographically bound to the action name, canonical SHA-256 payload digest, and expiration epoch.

  3. Deterministic Recursive PII Redaction (D365_REDACT_PII=true): Nested dictionaries, lists, tuples, and strings are scrubbed before leaving the server for IBANs, Pakistani CNICs, US SSNs, email addresses, and phone numbers while preserving invoice numbers and GL account codes.

  4. Entra ID OAuth 2.0 Token Buffering: Client-credentials bearer tokens are cached per process and proactively refreshed 60 seconds prior to expiration, with exponential backoff on HTTP 429 (Retry-After honored) and 503.

  5. SHA-256 Parameter Audit Trail: Every tool invocation emits a structured JSON audit record containing the UTC timestamp, tool name, mode, outcome, and canonical SHA-256 parameter hash—never raw PII or secrets.

Exposed MCP Tools

Tool Name

Access Level

Description

bc_get_customer_ledger

Read

Query customer ledger entries filtered by customer number or open status.

bc_get_gl_trial_balance

Read

Retrieve general ledger trial balance rows by period or account prefix.

bc_get_purchase_orders

Read

List purchase orders filtered by document status or vendor number.

bc_validate_tax_invoice

Read / Validate

Validate invoice payloads for PK_FBR_IRIS, SA_ZATCA_P2, or AE_UAE_VAT.

bc_request_write_approval

Governance

Issue an HMAC-SHA256 approval token bound to a write action and payload.

bc_create_draft_journal

Controlled Write

Create an unposted, balanced draft general journal batch (D365_READ_ONLY=false).

Quickstart (Sandbox Mode)

Sandbox mode runs immediately with zero Azure or Dynamics 365 credentials.

pip install dynamics365-mcp-server
dynamics365-mcp-server

Or install from source in an isolated virtual environment:

git clone https://github.com/Code-Ninety/dynamics-365-mcp-server.git
cd dynamics-365-mcp-server
python3 -m venv .venv
.venv/bin/pip install -e ".[dev]"
.venv/bin/pytest -v

Claude Desktop and Cursor Configuration

Add the server to your claude_desktop_config.json or .cursor/mcp.json:

{
  "mcpServers": {
    "dynamics365-business-central": {
      "command": "dynamics365-mcp-server",
      "env": {
        "D365_MODE": "sandbox",
        "D365_READ_ONLY": "true",
        "D365_REDACT_PII": "true"
      }
    }
  }
}

To connect to a live Microsoft Dynamics 365 Business Central tenant, copy .env.example, set D365_MODE=live, and supply D365_TENANT_ID, D365_CLIENT_ID, D365_CLIENT_SECRET, D365_ENVIRONMENT_NAME, and D365_COMPANY_ID.

Architecture Decision Records

Enterprise Dynamics 365 Services

This repository is published as an open-source reference architecture by Code Ninety. For production Business Central deployments, custom AL extensions, ZATCA Phase 2 / FBR IRIS integrations, or managed Entra ID governance, visit Code Ninety Microsoft Dynamics 365 Services.

License

MIT License. Copyright (c) 2026 Code Ninety (Private) Limited. See LICENSE.

Available Tools

6 tools
bc_create_draft_journalB

Create an unposted draft general journal batch. Requires D365_READ_ONLY=false and a valid HMAC approval token.

Inputs: lines (required), posting_date (required), journal_batch (required), approval_token. Returns: object

bc_get_customer_ledgerC

Read Business Central customer ledger entries with PII redaction.

Inputs: limit, open_only, customer_no. Returns: object

bc_get_gl_trial_balanceC

Read Business Central general ledger trial balance rows.

Inputs: period, account_prefix. Returns: object

bc_get_purchase_ordersC

Read Business Central purchase orders filtered by status or vendor number.

Inputs: limit, status, vendor_no. Returns: object

bc_request_write_approvalB

Issue a short-lived HMAC-SHA256 approval token for a controlled draft write.

Inputs: action (required), payload (required), requester (required). Returns: object

bc_validate_tax_invoiceC

Validate an invoice payload against PK_FBR_IRIS, SA_ZATCA_P2, or AE_UAE_VAT.

Inputs: jurisdiction (required), invoice_payload (required). Returns: object

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    B3.2/5.0

    Scored across 6 tools

    Disambiguation5/5

    Each tool targets a distinct resource or action: three different read surfaces, one tax validation, one approval-token issuance, and one draft-journal creation. The approval-token tool and draft-journal tool are related but clearly differentiated by their descriptions.

    Naming Consistency5/5

    All tools use a consistent `bc_` prefix followed by a snake_case verb_noun pattern, such as `bc_get_customer_ledger`, `bc_validate_tax_invoice`, and `bc_create_draft_journal`. The convention is predictable throughout the set.

    Tool Count4/5

    Six tools is a reasonable, well-scoped size for a focused finance and compliance subset, and each tool has a clear role. It is slightly thin for a broad Dynamics 365 Business Central server, but not unreasonably so.

    Completeness3/5

    The set covers several read scenarios plus a controlled draft-write workflow, but lifecycle coverage is notably incomplete: there is no way to read, update, post, or delete the created draft journal. Broader Business Central operations such as vendor, item, sales-order, or posting workflows are also absent.

    Maintenance

    ActivityMaintained
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      Not graded
      quality
      D
      maintenance
      Enables AI assistants to explore metadata, query data, and perform write operations across multiple Microsoft Dynamics 365 Finance & Operations environments. It features specialized tools for OData execution and data analysis with built-in read-only safety for production environments.
      45 npm
      10
      MIT
    • A
      license
      A
      quality
      D
      maintenance
      Read-only MCP server for Dynamics 365 Business Central, enabling AI clients to query live ERP data like customers, items, orders, and invoices via GET-only APIs with dual authentication and stdio/HTTP transports.
      10
      MIT
    • A
      license
      Not graded
      quality
      C
      maintenance
      Enables AI assistants to securely access and interact with Acumatica ERP data using per-user OAuth, role-based permissions, and automatic redaction of sensitive fields.
      Apache 2.0
    • A
      license
      Not graded
      quality
      B
      maintenance
      Enables AI assistants to read and write accounting data in PowerOffice Go, including bookkeeping, sales, purchases, payroll, time tracking, and read-only bank access, with support for multiple companies and strict isolation.
      MIT