MCP Server for Microsoft Dynamics 365 Business Central

Build 24.0.9300

Establishing a Connection

The CData MCP Server for Microsoft Dynamics 365 Business Central defines each connection to Microsoft Dynamics 365 Business Central as a named configuration that Claude can use when sending natural language queries.

You create and manage these configurations using the MCP Configuration Tool, which automatically handles formatting, storage, and registration with Claude Desktop.

Understanding Connection Configurations

Each connection configuration is stored in a .mcp file, located in ~/AppData/Roaming/CData/Microsoft Dynamics 365 Business Central Data Provider/, and includes the details needed to initialize the connector when Claude starts a session. For example, a connection called "MyConnection" is stored at ~/AppData/Roaming/CData/Microsoft Dynamics 365 Business Central Data Provider/MyConnection.mcp.

The .mcp file is a text file containing a line-delimited list of connection properties, plus a timestamp. For example, MyConnection.mcp contains the following text:

#Tue May 20 15:48:40 EDT 2025
AuthScheme=Basic
User=myUser
Password=myPassword
Security Token=myToken

The configuration tool handles these settings automatically. Each saved configuration enables Claude to launch a dedicated MCP Server instance with the correct connector and options — no manual file editing required.

Connecting to Microsoft Dynamics 365 Business Central

Cloud Endpoints

To connect to data, specify RSBDynamics365_p_OrganizationURL, where RSBDynamics365_p_OrganizationURL is one of the following:

  • The endpoint to your business central account, such as https://businesscentral.dynamics.com/abc123/.
  • The web services root.
  • The custom API base url.

On-Premises Endpoints

The following are examples of on-premises endpoints:

https://base URL:port/serverinstance/api/API publisher/API group/API version/
https://base URL:port//serverinstance/ODataV4  
https://myInstance/.local:7048/BC220/ODataV4
The URL is blocked by default; your administrator must enable access to it.

For information about on how to specify the RSBDynamics365_p_OrganizationURL and which endpoints are available, see Business Central Endpoints.

If you have multiple companies in your organization, you can specify the Company to identify the company to which you want to connect. If you leave Company blank, the server retrieves all companies as separate schemas.

User and Access Key

Note: User and Access key Authentication is no longer supported for the Cloud version. Web Service Access Key (Basic authentication) is still supported for on-premisees instances.

Microsoft recommends using User and Access Keys for testing and development, but discourages their use for production environments.

To obtain the User and AccessKey values, navigate to the Users page in Microsoft Dynamics 365 Business Central and then click on Edit. The User Name and Web Service Access Key values are what you will enter as the User and AccessKey connection string properties. Note that the User Name is not your email address. It is a shortened user name.

To use Access Key authentication, set these properties:

Authenticating to Microsoft Dynamics 365 Business Central

Before you can authenticate to the Microsoft Dynamics 365 Business Central source, you must set the RSBDynamics365_p_OrganizationURL to the URL of the organization you are connecting to. Depending on whether you are using v1 or v2, this could look quite different. For a discussion of the various possible formats for RSBDynamics365_p_OrganizationURL, see Business Central Endpoints.

You can authenticate to Microsoft Dynamics 365 Business Central in any of the following ways.

Access Key

Set the User along with the AccessKey to authenticate to the Microsoft Dynamics 365 Business Central source.

Authentication with Azure AD

Note: Microsoft Entra ID was formerly known as Azure Active Directory (Azure AD). To authenticate using Entra ID, you must set AuthScheme to AzureAD.

Microsoft Entra ID is a multi-tenant, cloud-based identity and access management platform. It supports OAuth-based authentication flows that enable the driver to access Microsoft Dynamics 365 Business Central endpoints securely.

Authentication to Entra ID via a web application always requires a custom OAuth application registration. This allows your application to define its own redirect URI, manage credential scope, and comply with organization-specific security policies.

For full instructions on how to register a custom OAuth application, see Creating an Entra ID Application (Formerly Azure AD).

After setting AuthScheme to AzureAD, the steps to authenticate vary by environment. See the sections below for details on how to connect from desktop applications, web-based workflows, or headless systems.

Desktop Applications

You can authenticate from a desktop application using either the driver's embedded OAuth application or a custom OAuth application registered in Microsoft Entra ID.

Option 1: Use the Embedded OAuth Application

This is a pre-registered app included with the driver. It simplifies setup and eliminates the need to register your own credentials and is ideal for development environments, single-user tools, or any setup where quick and easy authentication is preferred.

Set the following connection properties:

  • AuthScheme: AzureAD
  • InitiateOAuth:
    • GETANDREFRESH – Use for the initial login. Launches the login page and saves tokens.
    • REFRESH – Use this setting when you have already obtained valid access and refresh tokens. Reuses stored tokens without prompting the user again.

When you connect, the driver opens the Microsoft Entra sign-in page in your default browser. After signing in and granting access, the driver retrieves the access and refresh tokens and saves them to the path specified by OAuthSettingsLocation.

Option 2: Use a Custom OAuth Application

If your organization requires more control, such as managing security policies, redirect URIs, or application branding, you can instead register a custom OAuth application in Microsoft Entra ID and provide its values during connection.

Before you begin: Register a custom OAuth application in the Azure portal. During registration, record the following values:

  • OAuthClientId: The client Id generated when registering your custom OAuth application.
  • OAuthClientSecret: The client secret generated when registering your custom OAuth application.
  • CallbackURL: A redirect URI you defined during app registration.

For full instructions on how to register a custom OAuth app and configure redirect URIs, see Creating an Entra ID Application (Formerly Azure AD).

Set the following connection properties:

After authentication, tokens are saved to OAuthSettingsLocation. These values persist across sessions and are used to automatically refresh the access token when it expires, so you don't need to log in again on future connections.

Web Applications

To authenticate from a web application, you must register a custom OAuth application in Microsoft Entra ID (formerly Azure Active Directory). Embedded OAuth apps are not supported in this context because web-based flows require a registered redirect URI and centralized credential management.

This approach is designed for hosted, multi-user environments where access must be delegated through a secure, standards-compliant OAuth workflow. It gives your organization control over the OAuth client, redirect URI, branding, and permissions scope.

Before you begin: Register a custom OAuth app in the Azure portal. During registration, collect the following values:

  • OAuthClientId: The client Id generated when registering your custom OAuth application.
  • OAuthClientSecret: The client secret generated when registering your custom OAuth application.
  • CallbackURL: A redirect URI you defined during app registration.

For full instructions on how to register a custom OAuth app and configure redirect URIs, see Creating an Entra ID Application (Formerly Azure AD).

To authenticate using AzureAD in a web application, configure the following connection properties:

Because web applications typically manage OAuth flows manually on the server-side, InitiateOAuth must be set to OFF. This allows you to explicitly control when and how tokens are retrieved and exchanged using stored procedures.

After configuring these properties, follow the steps below to obtain and exchange OAuth tokens:

  1. Call the GetOAuthAuthorizationUrl stored procedure:
    • CallbackURL: Set to your registered redirect URI
  2. Open the returned URL in a browser. Sign in with a Microsoft Entra ID account and grant access.
  3. After signing in, you are redirected to your CallbackURL with a code parameter in the query string.
  4. Extract the code and pass it to the GetOAuthAccessToken stored procedure:
    • AuthMode: WEB
    • Verifier: The authorization code from the CallbackURL
  5. The procedure returns:
    • OAuthAccessToken: Used for authentication.
    • OAuthRefreshToken: Used to refresh the access token.
    • ExpiresIn: The lifetime of the access token in seconds.

To enable automatic token refresh, configure the following connection properties:

When InitiateOAuth is set to REFRESH, the driver uses the provided refresh token to request a new access token automatically.

After a successful connection, the driver saves the updated access and refresh tokens to the file specified by OAuthSettingsLocation.

You only need to repeat the full OAuth authorization flow if the refresh token expires, is revoked, or becomes invalid.

For more background on OAuth flows in Microsoft Entra ID, see Microsoft Entra Authentication Overview.

Headless Machines

Headless environments like CI/CD pipelines, background services, or server-based integrations do not have an interactive browser. To authenticate using AzureAD, you must complete the OAuth flow on a separate device with a browser and transfer the authentication result to the headless system.

You have two setup options:

  • Option 1: Obtain and exchange a verifier code
    • Use another device to sign in and retrieve a verifier code, which the headless system uses to request tokens.
  • Option 2: Transfer an OAuth settings file
    • Authenticate on another device, then copy the stored token file to the headless environment.

Option 1: Using a Verifier Code

  1. On a device with a browser:
    • If using a custom OAuth app, set the following properties:
    • Call the GetOAuthAuthorizationUrl stored procedure to generate a sign-in URL.
    • Open the returned URL in a browser. Sign in and grant grant permissions to the driver. You are redirected to the callback URL, which contains the verifier code.
    • After signing in, save the value of the code parameter from the redirect URL. You will use this later to set the OAuthVerifier connection property.
  2. On the headless machine:
    • Set the following properties:
    • After tokens are saved, reuse them by setting:
      • InitiateOAuth: REFRESH
      • OAuthSettingsLocation: Make sure this location grants read and write permissions to the driver to enable the automatic refreshing of the access token.
      • For custom apps:
        • OAuthClientId: The client Id generated when registering your custom OAuth application.
        • OAuthClientSecret: The client secret generated when registering your custom OAuth application.

Option 2: Transfer OAuth Settings

  1. On a device with a browser:
    • Connect using the instructions in the Desktop Applications section.
    • After connecting, tokens are saved to the file path in OAuthSettingsLocation. The default filename is OAuthSettings.txt.

  2. On the headless machine:
    • Copy the OAuth settings file to the machine.
    • Set the following properties:
      • AuthScheme: AzureAD
      • InitiateOAuth: REFRESH
      • OAuthSettingsLocation: Make sure this location grants read and write permissions to the driver to enable the automatic refreshing of the access token.
      • For custom apps:
        • OAuthClientId: The client Id generated when registering your custom OAuth application.
        • OAuthClientSecret: The client secret generated when registering your custom OAuth application.

After setup, the driver uses the stored tokens to refresh the access token automatically, no browser or manual login is required.

Azure Service Principal

Service principals are security objects within a Microsoft Entra ID application (formerly Azure Active Directory) that define what that application can do within a specific tenant. Service principals are created in the Entra admin center, also accessible through the Azure portal. As part of the creation process we also specify whether the service principal will access Microsoft Entra resources via a client secret or a certificate.

Instead of being tied to a particular user, service principal permissions are based on the roles assigned to them. These roles determine which resources the application can access and which operations it can perform.

When authenticating using a service principal, you must register an application with a Microsoft Entra tenant, as described in Creating a Service Principal Application in Microsoft Entra ID.

You are ready to connect after setting the properties described in this subsection. These vary, depending on whether you will authenticate via a client secret or a certificate.

Authentication with Client Secret

Authentication with Certificate

Managed Service Identity (MSI)

If you are running Microsoft Dynamics 365 Business Central on an Azure VM and want to automatically obtain Managed Service Identity (MSI) credentials to connect, set AuthScheme to AzureMSI.

User-Managed Identities

To obtain a token for a managed identity, use the OAuthClientId property to specify the managed identity's client_id.

If your VM has multiple user-assigned managed identities, you must also specify OAuthClientId.

NTLM

To authenticate using your Windows credentials, Set AuthScheme to NTLM.

Negotiate

To negotiate an authentication mechanism with the server, set AuthScheme to direct server. Used when authenticating with Kerberos.

Authenticating to Microsoft Dynamics 365 Business Central via Kerberos requires you to define authentication properties and to choose how Kerberos should retrieve authentication tickets.

To authenticate to Microsoft Dynamics 365 Business Central using Kerberos, set these properties:

  • hive.server2.authentication: Kerberos.
  • AuthScheme: NEGOTIATE.
  • KerberosKDC: The host name or IP Address of your Kerberos KDC machine.
  • KerberosRealm: The realm of the Microsoft Dynamics 365 Business Central Kerberos principal. Find this value immediately after the '@' symbol of the principal value.
  • KerberosSPN: The service and host of the Microsoft Dynamics 365 Business Central Kerberos Principal. Find this value just before the '@' symbol of the principal value.

In addition to the authentication values, set:

  • Server: The address of the Microsoft Dynamics 365 Business Central server you are connecting to.
  • Platform: The Microsoft Dynamics 365 Business Central version.
  • Schema: EWS.A.

Enabling Service-to-Service Authentication

Service-to-Service (S2S) authentication is used when an integration must run on its own, without being tied to any specific user account. S2S authentication uses the OAuth authentication flow with client credentials, rather than OAuth deleted flows, like those used for multifactor authentication (MFA).

To set up service-to-service authentication, you must first register an application in your Azure AD tenant for authenticating API calls against Business Central.

After you have registered the required app in your Azure AD tenant, do the following:

  1. In the Business Central client, search for Microsoft Entra applications.
  2. Open the page.
  3. Select New. The Business Central client opens the Microsoft Entra application card.
  4. Enter the Application (Client) ID for the registered application.
  5. Complete the Description field. If this application is set up by a partner, be sure to provide enough identifying information so all applications set up by this partner can be tracked in the future if necessary.
  6. Set the State to Enabled.
  7. Assign permissions to objects as needed. (For further information, see https://learn.microsoft.com/en-us/dynamics365/business-central/ui-define-granular-permissions.)

    Note: The D365 AUTOMATION and EXTEND. MGT. - ADMIN system permissions sets and user groups provide access to most typical objects used with automation. (EXTEND. MGT. - ADMIN replaces the earlier D365 EXTENSION MGT permission set.)

  8. (Optional:) If you have not granted consent from the Azure portal before now, select Grant Consent and follow the wizard. Be sure you have already configured a redirect URL in your custom Azure AD application before starting this wizard.

Copyright (c) 2025 CData Software, Inc. - All rights reserved.
Build 24.0.9300