# Connect Microsoft Dynamics 365

Reach every Dynamics 365 product, either through Liyagent's managed connectors on Microsoft's own APIs or through Microsoft's hosted MCP servers, as the signed-in person.

Liya reaches every Dynamics 365 product in one of two ways. Both act as the person who connected, with that person's Dynamics 365 security roles, so an agent can see and change only what that person could. The two ERP connectors can also act as an Entra app.

| | Managed connectors | Microsoft's hosted MCP servers |
| --- | --- | --- |
| In Liyagent | The **Dynamics 365**, **Dynamics 365 Business Central** and **Dynamics 365 Finance and Operations** cards, run by Liyagent | The **Dataverse MCP**, **ERP MCP**, **ERP Analytics MCP**, **Business Central MCP**, **Sales MCP** and **Customer Service MCP** cards: remote servers that Microsoft runs |
| Calls | The Dataverse Web API, Business Central's API v2.0, and the finance and operations OData endpoint | Microsoft's MCP endpoints |
| Tools | A fixed set, listed below, including Liya Finance's invoice matching | Whatever tools Microsoft publishes on that server |
| Cost | Your environment's usual API limits | Microsoft bills tool calls from clients other than Copilot Studio (see each server's limits) |

Type `dynamics` in the MCP catalogue's search box to list every route together. Each card shows which products it covers.

## Which route for which product

| Product | Managed connector | Hosted MCP server |
| --- | --- | --- |
| Sales | **Dynamics 365** (Dataverse), product `sales` | **Dataverse MCP**, or **Sales MCP** |
| Customer Service | **Dynamics 365**, product `customer-service` | **Dataverse MCP**, or **Customer Service MCP** |
| Field Service | **Dynamics 365**, product `field-service` | **Dataverse MCP** |
| Contact Center | **Dynamics 365**, product `contact-center` | **Dataverse MCP** |
| Customer Insights | **Dynamics 365**, product `customer-insights` | **Dataverse MCP** |
| Finance | **Dynamics 365 Finance and Operations** (OData), or **Dynamics 365** with product `finance` (Dataverse virtual tables) | **ERP MCP**, plus **ERP Analytics MCP** (preview) for analytics |
| Supply Chain Management | **Dynamics 365 Finance and Operations** | **ERP MCP**, plus **ERP Analytics MCP** (preview) |
| Commerce | **Dynamics 365 Finance and Operations** | **ERP MCP** |
| Project Operations (ERP-based) | **Dynamics 365 Finance and Operations** | **ERP MCP** |
| Human Resources | **Dynamics 365 Finance and Operations** | **ERP MCP** |
| Business Central | **Dynamics 365 Business Central** (API v2.0) | **Business Central MCP** |

Liya Finance matches invoices on three managed connectors: **Dynamics 365 Finance and Operations**, **Dynamics 365** reading Finance's virtual tables, and **Dynamics 365 Business Central**. The hosted servers give agents Microsoft's own tools, but Liya Finance's matching does not run on them.

## Prerequisites

- The **admin** or **owner** role in Liyagent.
- `TICKETIQ_PUBLIC_BASE_URL` set, so Microsoft can send people back to Liyagent after they sign in.
- A Microsoft Entra app registration in your tenant, with this instance's callback URL as a **Web** redirect URI. The callback URL is shown as **Callback URL to register at the provider** on **Integrations setup**.

## 1. Register the sign-in (admin)

A Microsoft token is issued for one resource. Each Dynamics resource is therefore its own OAuth provider in Liyagent, but one Entra app registration can serve all of them.

1. In the Entra admin center, open the app registration's **API permissions** and add the delegated permission each route needs. Then grant admin consent.

   | Route | API | Delegated permission |
   | --- | --- | --- |
   | Dynamics 365 (Dataverse), Dataverse MCP | Dynamics CRM | `user_impersonation`, plus `mcp.tools` for the Dataverse MCP server |
   | Dynamics 365 Finance and Operations, ERP MCP | Microsoft Dynamics ERP | The permissions your agents need |
   | Business Central, Business Central MCP | Dynamics 365 Business Central | `Financials.ReadWrite.All` |
   | Customer Service MCP | Agent 365 tooling gateway | `McpServers.D365Service.All` |

2. In Liyagent, open **Integrations setup**, choose **Add provider** and pick the matching entry from the catalogue's **CRM** or **ERP and finance** chips:

   | Catalogue entry | Asks for | You fill in |
   | --- | --- | --- |
   | **Dynamics 365 (Dataverse)** (`dynamics-dataverse`) | `https://<org>.crm.dynamics.com/.default`, `offline_access` | Tenant, Dataverse host |
   | **Dynamics 365 finance and operations** (`dynamics-erp`) | `https://<environment>.operations.dynamics.com/.default`, `offline_access` | Tenant, environment host |
   | **Dynamics 365 Business Central** (`dynamics-business-central`) | `https://api.businesscentral.dynamics.com/.default`, `offline_access` | Tenant |
   | **Dynamics 365 Sales MCP**, **Customer Service MCP**, **ERP Analytics MCP** | `https://agent365.svc.cloud.microsoft/mcp/environments/<id>/servers/<server>/.default`, `offline_access` | Tenant, Power Platform environment ID |

   The scopes fill in as you type the host or ID.

3. Enter the app's client ID and secret, then save. Keep the entry's id as the provider name: each card expects that name.

Each person then connects their own account on **Connections**. See [Connections](/docs/connect/connections).

## 2. Add a managed connector

### Dynamics 365 (Dataverse): Sales, Customer Service, Field Service, Contact Center, Customer Insights

1. Open **MCP servers**, choose **Add MCP server** and pick **Dynamics 365**.
2. Enter the environment URL, for example `https://contoso.crm.dynamics.com`.
3. Optionally choose the **product**. This labels the server, and `list_entity_sets` then suggests that app's standard tables, but only the ones your environment has. The tools are the same for every product.
4. Choose the `dynamics-dataverse` connection and save.

| Tool | What it does |
| --- | --- |
| `list_entity_sets` | The environment's tables, and the product's suggested ones. |
| `query_records` | Queries a table with OData options. |
| `get_record` | One record by table and id. |
| `create_record` | **Creates** a record. |
| `update_record` | **Updates** fields on a record. |
| `match_vendor_invoice`, `list_invoice_variances`, `hold_vendor_invoice` | Liya Finance on Dynamics 365 Finance, through its Dataverse virtual tables. See [Finance agents](/docs/agents/finance-agents). |

### Dynamics 365 Business Central

1. Pick **Dynamics 365 Business Central**.
2. Enter the **tenant** (the Directory ID or primary domain) and the **environment** name, for example `production`. Both are part of every Business Central API URL.
3. Optionally enter a default **company** id. Without one, agents call `list_companies` first.
4. Choose the auth:
   - **User OAuth** with the `dynamics-business-central` connection, which acts as each person.
   - **App (client credentials)**, which acts as the app. The app needs the `API.ReadWrite.All` application permission, admin consent, and an entry on Business Central's **Microsoft Entra Applications** page.

| Tool | What it does |
| --- | --- |
| `list_companies` | The environment's companies and their ids. |
| `list_vendors`, `list_customers`, `list_items` | Master data, with OData options. |
| `list_purchase_orders`, `list_purchase_invoices`, `list_sales_orders`, `list_sales_invoices` | Documents. Expand the lines with `expand`. |
| `list_records`, `get_record` | Any of the API v2.0 entity sets this connector reads. |
| `match_purchase_invoice` | Matches a purchase invoice to its purchase order line by line. Read only. |
| `list_invoice_variances` | Lists the unpaid invoices (Draft, In Review, Open) that differ beyond tolerance. Read only. |
| `block_vendor_payments` | **Blocks payments** to a vendor. Held for approval. |

> [!IMPORTANT]
> Business Central's API v2.0 has no per-invoice hold: the purchase invoice resource has no on-hold property. The closest write is `block_vendor_payments`, which sets the vendor's **Blocked** field to `Payment`. That blocks every payment to that vendor, not just one invoice. It never loosens an existing block. A draft invoice is held simply by not posting it.

### Dynamics 365 Finance and Operations: Finance, Supply Chain Management, Commerce, Project Operations, Human Resources

1. Pick **Dynamics 365 Finance and Operations**.
2. Enter the environment URL, for example `https://contoso.operations.dynamics.com`.
3. Optionally enter a default **company** (legal entity, `dataAreaId`). Without one, reads span every legal entity (`cross-company=true`).
4. Choose the auth:
   - **User OAuth** with the `dynamics-erp` connection.
   - **App (client credentials)** with the tenant. Register the app in finance and operations under **System administration > Setup > Microsoft Entra applications**, mapped to a user whose roles it acts with.

| Tool | What it does |
| --- | --- |
| `list_entities` | The data entities the environment publishes. |
| `query_entity` | Queries an entity with OData options. |
| `get_record` | One record by its key fields and legal entity. |
| `match_vendor_invoice` | Matches a pending vendor invoice to its purchase order line by line, with prices per price unit. Read only. |
| `list_invoice_variances` | Lists the pending vendor invoices that differ beyond tolerance. Read only. |
| `hold_vendor_invoice` | **Sets** `IsOnHold` on the pending invoice header. Held for approval. |

### Which calls need approval

The tools in bold are writes. `block_vendor_payments` and `hold_vendor_invoice` always wait for a person's approval, even on a server whose **Agent writes** allows writes. Only an override for that one tool changes this. None of the tools pays, posts, approves or releases anything.

## 3. Add one of Microsoft's hosted MCP servers

1. Make sure your administrator has turned the server on for your client. Each server has its own steps:

   | Card | Endpoint | What to turn on |
   | --- | --- | --- |
   | **Dataverse MCP (Dynamics 365)** | `https://<org>.crm.dynamics.com/api/mcp` | Power Platform admin center → environment → **Settings › Product › Features › Dataverse Model Context Protocol**: allow MCP clients, then add your app's client ID under **Advanced settings** with **Is Enabled** set to Yes. |
   | **Dynamics 365 ERP MCP** | `https://<environment>.operations.dynamics.com/mcp` | Version 10.0.47, 10.0.46 PQU-2 or 10.0.45 PQU-7. The **Dynamics 365 ERP Model Context Protocol server** feature, which is on by default. Then add your app's client ID on **Allowed MCP clients** with **Allowed** checked. Needs a Tier 2+ or unified developer environment. |
   | **Dynamics 365 ERP Analytics MCP** (preview) | `https://agent365.svc.cloud.microsoft/mcp/environments/<environment-id>/servers/msdyn_ERPAnalyticsMCPServer` | Business performance analytics 2.4.3224+ on finance and operations 10.0.38+. |
   | **Business Central MCP** | `https://mcp.businesscentral.dynamics.com` | Page 8350, **Model Context Protocol (MCP) Server Configurations** (the **MCP - Admin** permission set). The default configuration is read-only until an admin turns on **Unblock Edit Tools**. |
   | **Dynamics 365 Sales MCP** | `https://agent365.svc.cloud.microsoft/mcp/environments/<environment-id>/servers/msdyn_SalesMCPServer` | The Sales MCP server, per Microsoft's setup page. |
   | **Dynamics 365 Customer Service MCP** | `https://agent365.svc.cloud.microsoft/mcp/environments/<environment-id>/servers/mcp_D365CX_Service` | The Customer Service MCP server, per Microsoft's setup page. |

2. Open **MCP servers**, choose **Add MCP server** and pick the card. Replace the placeholders in the URL with your environment's values.
3. For **Business Central MCP**, fill in the **fixed headers**: `TenantId`, `EnvironmentName` and `Company`, plus `ConfigurationName` to use a configuration other than the default. Headers are plain text kept with the server, never a credential. A value that is not ASCII goes in Business Central's `=?base64?<value>?=` form. Without the headers, an agent asks the server for its environments and companies first.
4. The card already names its connection. Choose **Save server**.

These are remote servers, so their tools are pinned when first seen. A tool whose MCP annotations mark it as read-only runs. Any other annotated tool goes by the server's **Agent writes** setting, which starts at **Require approval**.

## Limits

- **Business Central API v2.0:** at most 20,000 rows a page, and 6,000 requests per user every 5 minutes, with 5 at once. An operation times out after 8 minutes.
- **Finance and operations OData:** at most 10,000 rows a page, and `$expand` only one level deep. The V2 purchase order line entity carries no received quantity, so the match is two-way: billed against ordered.
- **Dataverse MCP:** from December 15, 2025, Microsoft bills tool calls from agents built outside Copilot Studio. Users with Dynamics 365 Premium licenses or a Microsoft 365 Copilot license are not charged for Dynamics 365 data. The allowed-clients list applies only to `/api/mcp`.
- **ERP MCP:** 0.1 Copilot Credits per tool call from clients other than Copilot Studio. Finance Premium and SCM Premium users are exempt. English (en-us) only, and unavailable while the environment is being serviced. The older static ERP MCP server retired on October 1, 2026.
- **ERP Analytics MCP (preview):** a 120-second query timeout and about 10 MB per query. Microsoft says clients other than its own might not work during the preview.
- **Business Central MCP:** Streamable HTTP only. Entra has no dynamic client registration, so you register your own app.

## What was checked, and what wasn't

The managed connectors follow Microsoft's API references and have not been run against a live Dynamics 365 environment. Check these against yours:

- **Finance and operations:** `VendorInvoiceHeaders` is the documented public collection name. `VendorInvoiceLines`, `PurchaseOrderHeadersV2` and `PurchaseOrderLinesV2` follow the platform's naming, but no Microsoft page confirms them. The field names come from the entities' Common Data Model schemas. Check them against `/data/$metadata`, and override any with `finance_fields` on the server.
- **Finance and operations hold:** `hold_vendor_invoice` sets `IsOnHold` to `Yes`, and assumes the entity's key is `dataAreaId` with `HeaderReference`.
- **Scope strings:** Microsoft documents the resources and permission names. The `/.default` scope strings used for Dataverse, finance and operations, Sales MCP and ERP Analytics MCP follow the Microsoft identity platform's convention. Microsoft gives the exact scope string only for Business Central and Customer Service MCP.
- **Dataverse product tables:** the suggested tables are each app's standard ones. `list_entity_sets` offers only the ones your environment has.
- **Agent 365 gateway (Sales, Customer Service, ERP Analytics):** Microsoft names the clients it supports for each server. Microsoft's Sales page says Claude Desktop isn't supported yet.

## Sources

- Dataverse MCP server: <https://learn.microsoft.com/en-us/power-apps/maker/data-platform/data-platform-mcp>, [other clients](https://learn.microsoft.com/en-us/power-apps/maker/data-platform/data-platform-mcp-other-clients), [configure](https://learn.microsoft.com/en-us/power-apps/maker/data-platform/data-platform-mcp-disable), [FAQ](https://learn.microsoft.com/en-us/power-apps/maker/data-platform/data-platform-mcp-faq)
- Dynamics 365 ERP MCP server: <https://learn.microsoft.com/en-us/dynamics365/fin-ops-core/dev-itpro/copilot/copilot-mcp>, [VS Code](https://learn.microsoft.com/en-us/dynamics365/fin-ops-core/dev-itpro/copilot/mcp/mcp-vscode), [security](https://learn.microsoft.com/en-us/dynamics365/fin-ops-core/dev-itpro/copilot/mcp/mcp-security)
- ERP analytics MCP server: <https://learn.microsoft.com/en-us/dynamics365/finance/business-performance-analytics/erp-analytics-mcp-technical-details>
- Business Central MCP server: [overview](https://learn.microsoft.com/en-us/dynamics365/business-central/dev-itpro/ai/mcp-overview), [configure](https://learn.microsoft.com/en-us/dynamics365/business-central/dev-itpro/ai/configure-mcp-server), [non-Microsoft clients](https://learn.microsoft.com/en-us/dynamics365/business-central/dev-itpro/ai/use-mcp-server-non-microsoft)
- Business Central API v2.0: [endpoints](https://learn.microsoft.com/en-us/dynamics365/business-central/dev-itpro/api-reference/v2.0/endpoints-apis-for-dynamics), [purchaseInvoice](https://learn.microsoft.com/en-us/dynamics365/business-central/dev-itpro/api-reference/v2.0/resources/dynamics_purchaseinvoice), [vendor](https://learn.microsoft.com/en-us/dynamics365/business-central/dev-itpro/api-reference/v2.0/resources/dynamics_vendor), [S2S authentication](https://learn.microsoft.com/en-us/dynamics365/business-central/dev-itpro/administration/automation-apis-using-s2s-authentication), [limits](https://learn.microsoft.com/en-us/dynamics365/business-central/dev-itpro/administration/operational-limits-online)
- Finance and operations OData: [OData](https://learn.microsoft.com/en-us/dynamics365/fin-ops-core/dev-itpro/data-entities/odata), [service endpoints](https://learn.microsoft.com/en-us/dynamics365/fin-ops-core/dev-itpro/data-entities/services-home-page), [vendor invoice header entity](https://learn.microsoft.com/en-us/dynamics365/fin-ops-core/dev-itpro/data-entities/entity-vendor-invoice-header-vendorinvoiceheader), [CDM schema](https://learn.microsoft.com/en-us/common-data-model/schema/core/operationscommon/entities/finance/accountspayable/vendorinvoiceheaderentity)
- Sales MCP server: <https://learn.microsoft.com/en-us/dynamics365/sales/connect-agents-to-model-context-protocol>
- Customer Service MCP server: <https://learn.microsoft.com/en-us/dynamics365/customer-service/develop/connect-agent-model-context-protocol>

## Next steps

- [Finance agents](/docs/agents/finance-agents)
- [Connections](/docs/connect/connections)
- [MCP servers](/docs/connect/mcp-servers)
