Dataverse MCP Server
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@Dataverse MCP Server Query all active accounts and show their name and revenue"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
Dataverse MCP Server
A production-grade Model Context Protocol (MCP) server for Microsoft Dataverse, built with Node.js/TypeScript. Connects Claude Desktop directly to your Dataverse / Power Platform environment with full CRUD, bulk operations, FetchXML, Dataverse actions, and metadata discovery.
Tool Catalog
Auth
Tool | Description |
| Show the currently signed-in Microsoft account |
| Sign out and clear the cached credentials |
Read
Tool | Description |
| Fetch a single record by GUID with optional field selection and expand |
| Query records using OData |
| Run a FetchXML query — supports aggregates, linked entities, and grouping |
Write
Tool | Description |
| Create a single record, returns the new GUID |
| Update specific fields on an existing record (PATCH — only provided fields change) |
| Create or update a record with a known GUID (PUT semantics) |
| Delete a single record by GUID |
| Link two records via a navigation property |
| Remove a relationship link between two records |
Bulk
Tool | Description |
| Create up to 1000 records in one call via OData |
| Update up to 1000 records in one call via OData |
| Delete up to 1000 records in one call via OData |
| Execute up to 100 mixed operations atomically — if any fails, all roll back |
Actions
Tool | Description |
| Execute a Dataverse bound or unbound action (e.g. |
Metadata
Tool | Description |
| Full schema for a table: all columns, types, required levels, and all relationships. Cached 5 min. |
| List all available tables, filterable by name or custom-only. Cached 5 min. |
| Fetch all choice values (code + label) for a local choice column or global option set |
| Invalidate cached schema so the next call fetches fresh data from Dataverse |
Related MCP server: Dataverse MCP Server
Features
Authentication — Microsoft Device Code flow (MSAL). No client secret or redirect URI needed. Silent token renewal; persistent token cache.
Retry with backoff — Automatic exponential backoff on
429 Too Many Requestsand5xxerrors, withRetry-Afterheader support.Metadata caching —
describe_tableandlist_tablesresults cached in-memory (TTL configurable, default 5 min), eliminating redundant API calls.Atomic batch transactions —
batch_transactionwraps all operations in a single OData changeset. Dataverse rolls back everything on any failure.Structured logging — JSON-formatted logs to
stderr(stdout is reserved for MCP JSON-RPC). Log level configurable via env var.Strong input validation — All tool inputs validated with Zod before hitting the API. Validation errors return clear, actionable messages.
Request timeouts — All HTTP calls have a configurable timeout (default 30s). Batch calls have extended timeouts (60–120s).
Prerequisites
Node.js 18+
A Microsoft Dataverse / Power Platform environment URL
A Microsoft account with access to that environment
No Azure App Registration is required — the server uses the well-known Azure CLI public client by default.
Setup
1. Install dependencies
npm install2. Configure environment
macOS / Linux:
cp .env.example .envWindows (PowerShell):
copy .env.example .envEdit .env — only DATAVERSE_URL is required:
# Required
DATAVERSE_URL=https://yourorg.crm.dynamics.com
# Optional — only needed if you want your own Azure App Registration
# AZURE_CLIENT_ID=xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
# AZURE_TENANT_ID=xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
# Optional — tuning
# TOKEN_CACHE_PATH=./.token-cache.json
# LOG_LEVEL=info # debug | info | warn | error
# REQUEST_TIMEOUT_MS=30000
# MAX_RETRIES=3
# METADATA_CACHE_TTL_MS=3000003. Build
npm run buildClaude Desktop Integration
1. Locate your configuration file
macOS:
~/Library/Application Support/Claude/claude_desktop_config.jsonWindows:
%APPDATA%\Claude\claude_desktop_config.json
2. Add the server configuration
Add the following to the mcpServers section of your configuration file, adjusting the paths to match your installation:
macOS
{
"mcpServers": {
"dataverse": {
"command": "node",
"args": ["/Users/YOUR_USERNAME/path/to/dataverse-mcp/dist/index.js"],
"env": {
"DATAVERSE_URL": "https://yourorg.crm.dynamics.com",
"TOKEN_CACHE_PATH": "/Users/YOUR_USERNAME/path/to/dataverse-mcp/.token-cache.json"
}
}
}
}Windows
{
"mcpServers": {
"dataverse": {
"command": "node",
"args": ["C:\\Users\\YOUR_USERNAME\\path\\to\\dataverse-mcp\\dist\\index.js"],
"env": {
"DATAVERSE_URL": "https://yourorg.crm.dynamics.com",
"TOKEN_CACHE_PATH": "C:\\Users\\YOUR_USERNAME\\path\\to\\dataverse-mcp\\.token-cache.json"
}
}
}
}Note: On Windows, make sure to use double backslashes (
\\) in paths.
On first use, a device code login prompt will appear in the Claude Desktop logs. Open the URL shown and enter the code to authenticate. Subsequent calls use the cached token silently.
Usage Examples
Query records with a filter
Show me all active accounts in Dataverse, just the name and email fieldsClaude calls query_records:
{
"tableName": "account",
"select": ["name", "emailaddress1"],
"filter": "statecode eq 0",
"orderBy": "name asc",
"top": 50
}Discover a table's schema before writing
What fields does the 'contact' table have?Claude calls describe_table → returns all attributes, types, required levels, and relationships.
Create a single record
{
"tableName": "contact",
"data": {
"firstname": "Jane",
"lastname": "Smith",
"emailaddress1": "jane@contoso.com"
}
}Bulk update records
{
"tableName": "contact",
"items": [
{ "recordId": "00000000-0000-0000-0000-000000000001", "data": { "jobtitle": "Manager" } },
{ "recordId": "00000000-0000-0000-0000-000000000002", "data": { "jobtitle": "Director", "emailaddress1": "d@contoso.com" } }
]
}Returns per-record success/failure — partial success is fully supported.
Bulk create 1000 records
{
"tableName": "contact",
"items": [
{ "firstname": "Alice", "emailaddress1": "alice@contoso.com" },
{ "firstname": "Bob", "emailaddress1": "bob@contoso.com" }
]
}Returns per-record success/failure — partial success is fully supported.
Atomic batch transaction
{
"operations": [
{ "type": "create", "tableName": "account", "data": { "name": "Contoso" } },
{ "type": "update", "tableName": "contact", "recordId": "00000000-...", "data": { "jobtitle": "CEO" } },
{ "type": "delete", "tableName": "lead", "recordId": "00000000-..." }
]
}All three operations succeed together or all roll back — no partial state.
FetchXML for complex queries
{
"tableName": "account",
"fetchXml": "<fetch aggregate='true'><entity name='account'><attribute name='revenue' aggregate='sum' alias='total_revenue'/><filter><condition attribute='statecode' operator='eq' value='0'/></filter></entity></fetch>"
}Execute a Dataverse action
{
"actionName": "WinOpportunity",
"parameters": {
"OpportunityClose": { "subject": "Won deal", "opportunityid": { "@odata.type": "Microsoft.Dynamics.CRM.opportunity", "opportunityid": "00000000-..." } },
"Status": 3
},
"boundTableName": "opportunity",
"boundRecordId": "00000000-..."
}Architecture
src/
├── config.ts # Env config + validation
├── index.ts # MCP server + dynamic tool dispatch
├── auth/
│ └── AuthManager.ts # MSAL token lifecycle (silent → device code)
├── services/dataverse/
│ ├── DataverseClient.ts # HTTP client, retry, timeout, auth interceptors
│ ├── BatchBuilder.ts # OData $batch body construction
│ ├── BatchParser.ts # Multipart response parser
│ ├── MetadataCache.ts # TTL-based metadata cache
│ └── types.ts # Shared interfaces
├── tools/
│ ├── registry.ts # Tool name → handler map
│ ├── schemas.ts # Zod input schemas
│ ├── definitions.ts # MCP ListTools definitions
│ └── handlers/
│ ├── auth.ts # whoami, sign_out
│ ├── read.ts # get_record, query_records, execute_fetchxml
│ ├── write.ts # create, update, upsert, delete, associate, disassociate
│ ├── bulk.ts # bulk_create, bulk_delete, batch_transaction
│ ├── metadata.ts # describe_table, list_tables, refresh_metadata_cache
│ └── actions.ts # execute_action
└── utils/
├── logger.ts # Structured JSON logger → stderr
├── errors.ts # Typed errors + MCP error formatter
└── retry.ts # Exponential backoff + Retry-AfterHow Bulk Operations Work
OData $batch packs multiple operations into a single HTTP request. This server processes up to 100 records per batch request, chunking automatically for larger payloads.
Parallel bulk (bulk_create_records, bulk_delete_records): each operation is in its own changeset — partial success is tracked per record. One failure does not block others.
Atomic batch (batch_transaction): all operations share a single changeset. Dataverse treats it as a transaction — any failure rolls back all operations in the batch.
Running Tests
npm test60 tests across 6 suites: tool handler validation, schema validation, batch response parsing, retry logic.
Optional: Custom Azure App Registration
If you need specific API permissions or want to restrict the application identity, register your own app:
portal.azure.com → Azure Active Directory → App registrations → New registration
Supported account types: Single tenant
Platform: Mobile and desktop applications (no redirect URI needed for device code flow)
API permissions → Add a permission → Dynamics CRM → Delegated →
user_impersonationGrant admin consent
Copy the Application (client) ID and Directory (tenant) ID to your
.env
Available Tools
20 toolsassociate_recordsA
Create a relationship link between two Dataverse records via a navigation property. Use isSingleValued=true for lookup (N:1) properties; false for collection (1:N) navigation.
Inputs: recordId (required), tableName (required), isSingleValued (required), relatedRecordId (required), +2 more.
batch_transactionA
Execute multiple Dataverse write operations atomically in a single batch. If ANY operation fails, ALL are rolled back — all-or-nothing semantics. Supports mixed operations: create, update, delete, upsert across different tables.
Inputs: operations (required).
bulk_create_recordsA
Create multiple records in a single OData $batch operation. Up to 1000 records per call (processed in chunks of 100). Tracks per-record success/failure — partial success is supported.
Inputs: items (required), tableName (required).
bulk_delete_recordsA
Delete multiple records in a single OData $batch operation. Up to 1000 GUIDs per call. Tracks per-record success/failure — partial success is supported.
Inputs: recordIds (required), tableName (required).
bulk_update_recordsA
Update multiple records in a single OData $batch operation. Up to 1000 records per call (processed in chunks of 100). Each item requires a recordId and a data object (PATCH semantics — only provided fields change). Tracks per-record success/failure — partial success is supported.
Inputs: items (required), tableName (required).
create_recordA
Create a single record in a Dataverse table. Returns the new record's GUID. Use describe_table first to discover correct field names and types.
Inputs: data (required), tableName (required).
delete_recordA
Delete a single Dataverse record by its GUID. This is irreversible.
Inputs: recordId (required), tableName (required).
describe_tableA
Fetch the full metadata schema for a Dataverse table: all columns (names, types, required level, create/update validity), plus all 1:N, N:1, and N:N relationships. ALWAYS call this before creating or updating records to discover correct field names and types. For Lookup fields, the response includes 'targets' (the entity the lookup points to) — use the target's entitySetName with @odata.bind syntax to set the value: { "fieldname@odata.bind": "/entitysetname(guid)" }. Results are cached for 5 minutes.
Inputs: tableName (required).
disassociate_recordsA
Remove a relationship link between two Dataverse records. For collection navigation properties, provide relatedRecordId to remove a specific link. For single-valued (lookup) navigation, omit relatedRecordId.
Inputs: recordId (required), tableName (required), navigationProperty (required), relatedRecordId.
execute_actionA
Execute a Dataverse unbound or bound action. Examples: WinOpportunity, SendEmail, custom workflow actions. For bound actions, provide boundTableName and boundRecordId.
Inputs: actionName (required), parameters, boundRecordId, boundTableName.
execute_fetchxmlA
Execute a FetchXML query against Dataverse. FetchXML supports aggregate functions, linked entities, and grouping that cannot be expressed in OData. Use this for complex reporting or analytical queries.
Inputs: fetchXml (required), tableName (required), nextLink.
get_option_set_valuesA
Fetch all option values (integer code + label) for a Dataverse choice column or global option set. Use tableName + attributeName for a local choice/picklist/status/state column. Use optionSetName for a global option set shared across tables. Returns every option with its numeric value and display label — use these values when filtering or writing records.
Inputs: tableName, attributeName, optionSetName.
get_recordA
Fetch a single Dataverse record by its GUID. Use 'select' to limit returned fields and 'expand' to include related records.
Inputs: recordId (required), tableName (required), expand, select.
list_tablesA
List all available Dataverse tables (entities). Use customOnly=true to see only custom tables. Use nameContains to search by name substring. Results are cached for 5 minutes.
Inputs: top, customOnly, nameContains.
query_recordsA
Query records from a Dataverse table using OData. Supports $filter, $select, $orderby, $top, $expand, and pagination. When the result has hasNextPage=true, pass the returned nextLink to fetch subsequent pages.
Inputs: tableName (required), top, expand, filter, +3 more.
refresh_metadata_cacheA
Invalidate cached table metadata so the next call to describe_table or list_tables fetches fresh data. Use this after schema changes (new fields, new relationships) in your Dataverse environment.
Inputs: tableName.
sign_outA
Sign out and clear the cached Microsoft credentials. The next Dataverse operation will trigger a fresh login.
Inputs: no named parameters.
update_recordA
Update specific fields on an existing Dataverse record (PATCH semantics — only provided fields are changed). Fails with an error if the record does not exist.
Inputs: data (required), recordId (required), tableName (required).
upsert_recordA
Create or update a Dataverse record with a known GUID (PUT semantics). Use mode='createOrUpdate' to create if not exists, update if exists. 'createOnly' fails if the record exists. 'updateOnly' fails if it does not exist.
Inputs: data (required), recordId (required), tableName (required), mode.
whoamiA
Show the currently signed-in Microsoft account. Use this to verify authentication status before running Dataverse operations.
Inputs: no named parameters.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 20 tools
Each tool targets a distinct operation or resource: single vs bulk vs atomic batch operations are clearly separated, queries are differentiated by OData vs FetchXML, and metadata/auth tools are unique. No two tools appear to do the same thing.
Most tools follow a consistent verb_noun pattern (get_record, create_record, list_tables, describe_table). Minor deviations like whoami, sign_out, and batch_transaction break the pattern slightly, but naming remains readable and predictable with no mixed casing styles.
20 tools is above the typical 3-15 well-scoped range, but each tool earns its place given Dataverse's broad domain (CRUD, batch, queries, metadata, relationships, actions, auth). The count feels slightly heavy but remains justified and not excessive.
The tool set provides comprehensive coverage: full CRUD plus upsert, bulk operations, atomic batch transactions, OData and FetchXML queries, metadata discovery (tables, fields, option sets), relationship management, custom actions, and authentication. There are no obvious gaps or dead ends for agents.
Maintenance
Related MCP Connectors
Create contacts, move deals, send proposals and invoices, read your inbox, from Claude or ChatGPT.
Connect Claude to your Platform7n workspaces: chat, links, work and decks. One-click OAuth.
Connect Claude to your Platform7n workspaces: chat, links, work and decks. One-click OAuth.
Give Claude a second brain for your notes, tasks and contacts. OAuth; it can't delete anything.
1
Related MCP Servers
- AlicenseAqualityCmaintenanceEnables AI agents to query, inspect, and manage Microsoft Dataverse records, metadata, schema, forms, views, and Power Platform environments via the Dataverse OData Web API.9774 PyPI3MIT
- FlicenseNot gradedqualityDmaintenanceConnects Claude to Microsoft Dataverse for everyday record operations like listing, creating, updating, and deleting records, with interactive authentication and caching.-
- AlicenseBqualityDmaintenanceEnables AI agents to perform CRUD operations, query data, fetch schemas, and execute custom operations on Microsoft Dynamics 365 CRM entities.1024 npm2MIT
- FlicenseNot gradedqualityDmaintenanceEnables querying and managing a CRM database through natural language conversations with Claude Desktop.-