@microsoft/dataversecli
v0.0.31
Published
CLI tool for Dataverse, including stdio MCP server
Readme
Dataverse CLI
A command-line tool for Microsoft Dataverse that provides multiple capabilities for working with Dataverse environments.
Installation
Global Installation
npm install -g @microsoft/dataversecliUse with npx (No Installation Required)
npx @microsoft/dataversecli <command> [options]Prerequisites
Before you can use the Dataverse MCP server, the following setup steps must be completed by your administrators:
1. Azure Tenant Admin: Grant Admin Consent
An Azure tenant administrator must grant admin consent for the Dataverse MCP CLI tool application.
Steps:
- Navigate to:
https://login.microsoftonline.com/{your-tenant-id}/adminconsent?client_id=0c412cc3-0dd6-449b-987f-05b053db9457- Replace
{your-tenant-id}with your actual Azure tenant ID
- Replace
- Sign in as an Azure tenant administrator
- Review and grant the requested permissions
2. Dataverse Admin: Enable MCP Server
A Dataverse organization administrator must enable the MCP server feature for your environment.
Resources:
3. Dataverse Admin: Allow the MCP CLI Tool
A Dataverse organization administrator must add the Dataverse MCP CLI tool to the allowed client applications list.
Steps:
- Follow the instructions at: Configure MCP Client List
- Add the application with App ID:
0c412cc3-0dd6-449b-987f-05b053db9457- This will appear as "Dataverse MCP CLI tool" in the UI
Note: All three prerequisite steps must be completed before you can successfully authenticate and connect to your Dataverse environment.
Available Commands
mcp - MCP Server for Dataverse
Starts an MCP (Model Context Protocol) server that connects to your Dataverse environment, enabling AI assistants like Claude to interact with your Dataverse data.
Usage
dataversecli mcp <orgUrl> [options]Arguments:
<orgUrl>- Your Dataverse organization URL (e.g.,https://myorg.crm.dynamics.com)
Options:
--validate- Validate MCP endpoints and authentication setup without starting the server--log-level <level>- Set logging level: Trace, Debug, Information, Warning, Error, Critical (default: Warning)--log-file- Enable logging to a file in the temp directory--preview- Use preview MCP endpoint (api/mcp_previewinstead ofapi/mcp)
Examples
Validate setup (recommended first step):
dataversecli mcp https://myorg.crm.dynamics.com --validateThis will test both the GA and Preview endpoints and verify that:
- Authentication is working correctly
- The MCP server is enabled
- The MCP CLI tool is in the allowed applications list
If validation fails, the output will provide specific guidance on which prerequisite steps need to be completed.
Basic usage with stdio transport:
dataversecli mcp https://myorg.crm.dynamics.comWith npx:
npx @microsoft/dataversecli mcp https://myorg.crm.dynamics.comUse preview endpoint:
dataversecli mcp https://myorg.crm.dynamics.com --previewEnable debug logging:
dataversecli mcp https://myorg.crm.dynamics.com --log-level DebugEnable file logging (useful for troubleshooting):
dataversecli mcp https://myorg.crm.dynamics.com --log-fileUsing with Claude Desktop
To use the Dataverse MCP server with Claude Desktop, add it to your MCP configuration.
Quick Setup
claude mcp add dataverse -t stdio -- npx -y @microsoft/dataversecli mcp https://yourorg.crm.dynamics.comManual Configuration
Edit your Claude Desktop MCP configuration file:
Location:
- Windows:
%APPDATA%\Claude\claude_desktop_config.json - macOS:
~/Library/Application Support/Claude/claude_desktop_config.json - Linux:
~/.config/Claude/claude_desktop_config.json
Configuration:
{
"mcpServers": {
"dataverse": {
"command": "npx",
"args": ["-y", "@microsoft/dataversecli", "mcp", "https://yourorg.crm.dynamics.com"],
"type": "stdio"
}
}
}With logging enabled for troubleshooting:
{
"mcpServers": {
"dataverse": {
"command": "npx",
"args": [
"-y",
"@microsoft/dataversecli",
"mcp",
"https://yourorg.crm.dynamics.com",
"--log-level", "Debug",
"--log-file"
],
"type": "stdio"
}
}
}Using the preview endpoint:
{
"mcpServers": {
"dataverse": {
"command": "npx",
"args": [
"-y",
"@microsoft/dataversecli",
"mcp",
"https://yourorg.crm.dynamics.com",
"--preview"
],
"type": "stdio"
}
}
}Authentication
The MCP server uses Microsoft Authentication Library (MSAL) with device code flow for authentication. When you start the server:
- A browser window will open automatically
- Sign in with your Microsoft account that has access to the Dataverse environment
- The server will cache your authentication token for future use
Supported Platforms
- Windows (x64)
- macOS (ARM64 - Apple Silicon)
Troubleshooting
Enable Logging
If you encounter issues, enable file logging to capture detailed diagnostic information:
dataversecli mcp https://yourorg.crm.dynamics.com --log-level Debug --log-fileLog files are written to your system's temporary directory. The exact location will be displayed when logging starts.
Common Issues
"No compatible binary found for your platform"
- This package currently supports Windows (x64) and macOS (ARM64/Apple Silicon)
- For other platforms, please use the .NET version directly
Authentication failures
- Ensure you have access to the Dataverse environment
- Check that your organization URL is correct
- Try clearing your token cache and re-authenticating
MCP connection issues in Claude Desktop
- Verify the configuration JSON syntax is correct
- Check that the organization URL is accessible
- Enable
--log-fileto capture detailed error messages - Restart Claude Desktop after configuration changes
Getting Help
# General help
dataversecli --help
# MCP command help
dataversecli mcp --helpSupport MCP Operations
The MCP server supports the following operations:
- Tools: List and call Dataverse tools
- Prompts: List and retrieve prompts
- Resources: List and read Dataverse resources
License
MIT
