Dataverse MCP Server
A Model Context Protocol server that enables CRUD operations and querying on Microsoft Dataverse through natural language.
README
Dataverse MCP Server
A Model Context Protocol (MCP) server that provides comprehensive CRUD operations for Microsoft Dataverse. This server enables seamless integration with Dataverse environments, allowing you to create, read, update, delete, and query records using natural language through MCP-compatible clients like Claude.
Features
- ✅ Complete CRUD Operations: Create, read, update, and delete records
- ✅ Advanced Querying: Support for OData filters, sorting, pagination, and expansion
- ✅ Table Discovery: List available tables and their metadata
- ✅ Robust Authentication: OAuth 2.0 client credentials flow with automatic token refresh
- ✅ Comprehensive Logging: Detailed logging for debugging and monitoring
- ✅ Input Validation: Thorough validation of all inputs and OData queries
- ✅ Error Handling: Graceful error handling with detailed error messages
- ✅ Flexible Configuration: Support for both environment variables and MCP configuration arguments
Prerequisites
Before using this MCP server, you need:
- Microsoft Dataverse Environment: Access to a Dataverse environment
- Azure AD App Registration: An app registration with appropriate permissions
- Node.js: Version 18 or higher
Setup
1. Azure AD App Registration
- Go to Azure Portal → Microsoft Entra ID → Manage → App Registrations
- Click "New registration"
- Name your application (e.g., "Dataverse MCP Server")
- Leave Redirect URI blank
- Click "Register"
- Note down the Application (client) ID and Directory (tenant) ID
- Go to "Client credentials" → "Add a certificate or secret" → "New client secret"
- Add a description "Dataverse MCP Server" and an Expiration date.
- Create a secret and note down the Client Secret and Value
- Go to "API permissions" → "Add a permission" → "Dynamics CRM"
- Add "user_impersonation" permission (Application permission)
- Click "Add permissions"
2. Installation
# Install dependencies
npm install
# Build the project
npm run build
Configuration
You can configure the Dataverse MCP server in two ways:
Option 1: MCP Configuration Arguments (Recommended)
Pass credentials directly through the MCP configuration. This is the recommended approach as it keeps credentials secure within your MCP client configuration.
Option 2: Environment Variables
Use environment variables for configuration (backward compatibility).
-
Copy
.env.exampleto.env:cp .env.example .env -
Fill in your Dataverse credentials in
.env:# Dataverse Authentication (Required) DATAVERSE_CLIENT_ID=your-client-id-here DATAVERSE_CLIENT_SECRET=your-client-secret-here DATAVERSE_TENANT_ID=your-tenant-id-here DATAVERSE_ENVIRONMENT_URL=https://yourorg.crm.dynamics.com # Optional Configuration LOG_LEVEL=info RATE_LIMIT_REQUESTS_PER_MINUTE=60
MCP Configuration
For Claude Desktop
Add to your claude_desktop_config.json:
{
"mcpServers": {
"dataverse": {
"command": "node",
"args": [
"path/to/dataverse-mcp/build/src/index.js",
"--clientId", "your-client-id-here",
"--clientSecret", "your-client-secret-here",
"--tenantId", "your-tenant-id-here",
"--environmentUrl", "https://yourorg.crm.dynamics.com"
]
}
}
}
For Cursor
Add to your .vscode/mcp.json:
{
"servers": {
"dataverse": {
"type": "stdio",
"command": "node",
"args": [
"./build/src/index.js",
"--clientId", "your-client-id-here",
"--clientSecret", "your-client-secret-here",
"--tenantId", "your-tenant-id-here",
"--environmentUrl", "https://yourorg.crm.dynamics.com"
]
}
}
}
For Cline
Add to your Cline MCP configuration file (~/.cline/mcp_servers.json on macOS/Linux or %APPDATA%\.cline\mcp_servers.json on Windows):
{
"mcpServers": {
"dataverse": {
"command": "node",
"args": [
"path/to/dataverse-mcp/build/src/index.js",
"--clientId", "your-client-id-here",
"--clientSecret", "your-client-secret-here",
"--tenantId", "your-tenant-id-here",
"--environmentUrl", "https://yourorg.crm.dynamics.com"
]
}
}
}
Alternatively, if using Cline in VS Code, you can configure it in your workspace settings (.vscode/settings.json):
{
"cline.mcpServers": {
"dataverse": {
"command": "node",
"args": [
"./build/src/index.js",
"--clientId", "your-client-id-here",
"--clientSecret", "your-client-secret-here",
"--tenantId", "your-tenant-id-here",
"--environmentUrl", "https://yourorg.crm.dynamics.com"
]
}
}
}
Configuration Parameters
When using MCP configuration arguments, you can pass the following parameters:
--clientId: Azure AD Application (client) ID--clientSecret: Azure AD Client Secret--tenantId: Azure AD Directory (tenant) ID--environmentUrl: Dataverse environment URL (e.g., https://yourorg.crm.dynamics.com)--logLevel: Log level (error, warn, info, debug) - defaults to 'info'--rateLimit: Rate limit requests per minute - defaults to 60
Legacy Environment Variable Configuration
If you prefer to use environment variables (or for backward compatibility), you can still configure using .env file or environment variables:
{
"mcpServers": {
"dataverse": {
"command": "node",
"args": ["path/to/dataverse-mcp/build/src/index.js"],
"env": {
"DATAVERSE_CLIENT_ID": "your-client-id-here",
"DATAVERSE_CLIENT_SECRET": "your-client-secret-here",
"DATAVERSE_TENANT_ID": "your-tenant-id-here",
"DATAVERSE_ENVIRONMENT_URL": "https://yourorg.crm.dynamics.com"
}
}
}
}
Note: CLI arguments take precedence over environment variables, so you can mix both approaches if needed.
Available Tools
1. dataverse_create_record
Create a new record in a Dataverse table.
Parameters:
table(string, required): Table name (e.g., "contacts", "accounts")data(object, required): Record data as key-value pairs
Example:
{
"table": "contacts",
"data": {
"firstname": "John",
"lastname": "Doe",
"emailaddress1": "john.doe@example.com"
}
}
2. dataverse_read_record
Read a single record by ID.
Parameters:
table(string, required): Table nameid(string, required): Record GUIDselect(string, optional): Comma-separated columns to selectexpand(string, optional): Related entities to expand
Example:
{
"table": "contacts",
"id": "12345678-1234-1234-1234-123456789012",
"select": "firstname,lastname,emailaddress1"
}
3. dataverse_query_records
Query multiple records with OData filters.
Parameters:
table(string, required): Table nameselect(string, optional): Columns to selectfilter(string, optional): OData filter expressionorderby(string, optional): OData orderby expressiontop(number, optional): Maximum records to returnskip(number, optional): Records to skip (pagination)expand(string, optional): Related entities to expandcount(boolean, optional): Include total count
Example:
{
"table": "accounts",
"select": "name,revenue,industrycode",
"filter": "revenue gt 1000000",
"orderby": "name asc",
"top": 10
}
4. dataverse_update_record
Update an existing record.
Parameters:
table(string, required): Table nameid(string, required): Record GUIDdata(object, required): Data to update
Example:
{
"table": "contacts",
"id": "12345678-1234-1234-1234-123456789012",
"data": {
"jobtitle": "Senior Developer",
"telephone1": "555-0123"
}
}
5. dataverse_delete_record
Delete a record.
Parameters:
table(string, required): Table nameid(string, required): Record GUID
Example:
{
"table": "contacts",
"id": "12345678-1234-1234-1234-123456789012"
}
6. dataverse_list_tables
List all available tables in the environment.
Parameters: None
Usage Examples
Creating a Contact
Create a new contact with name "Jane Smith" and email "jane.smith@example.com"
Querying Accounts
Find all accounts with revenue greater than $1 million, ordered by name
Reading a Specific Record
Get the contact with ID 12345678-1234-1234-1234-123456789012, including their full name and email
Updating a Record
Update the job title of contact 12345678-1234-1234-1234-123456789012 to "Senior Manager"
OData Query Examples
Filtering
firstname eq 'John'- Exact matchrevenue gt 1000000- Greater thancreatedon ge 2024-01-01T00:00:00Z- Date comparisoncontains(name, 'Microsoft')- Contains text
Ordering
name asc- Ascending ordercreatedon desc- Descending orderrevenue desc, name asc- Multiple fields
Selecting Fields
firstname,lastname,emailaddress1- Specific fields*- All fields (not recommended for performance)
Troubleshooting
Common Issues
-
Authentication Failed
- Verify your client ID, secret, and tenant ID
- Ensure admin consent was granted for API permissions
- Check that the client secret hasn't expired
-
Environment URL Invalid
- Ensure the URL format is correct:
https://yourorg.crm.dynamics.com - Verify you have access to the Dataverse environment
- Ensure the URL format is correct:
-
Table Not Found
- Use
dataverse_list_tablesto see available tables - Check table name spelling (case-sensitive)
- Use
-
Permission Denied
- Verify your app registration has the correct permissions
- Ensure the user/app has access to the specific table
Logging
Set --logLevel=debug in your MCP configuration for detailed logging, or use environment variables:
LOG_LEVEL=debug
Security Considerations
- Never commit your
.envfile - It contains sensitive credentials - Use least privilege - Only grant necessary permissions to your app registration
- Rotate secrets regularly - Update client secrets periodically
- Monitor usage - Keep track of API calls and unusual activity
Development
Building
npm run build
Watching for Changes
npm run watch
Testing with MCP Inspector
npm run inspector
Contributing
- Fork the repository
- Create a feature branch
- Make your changes
- Add tests if applicable
- Submit a pull request
License
This project is licensed under the MIT License - see the LICENSE file for details.
Support
For issues and questions:
- Check the troubleshooting section above
- Review the Microsoft Dataverse documentation
- Open an issue in this repository
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。