DataverseSP 0.1.2
dotnet tool install --global DataverseSP --version 0.1.2
dotnet new tool-manifest
dotnet tool install --local DataverseSP --version 0.1.2
#tool dotnet:?package=DataverseSP&version=0.1.2
nuke :add-package DataverseSP --version 0.1.2
Tim's Dataverse MCP Server
Lightweight MCP server that allows an agent to interface with Dataverse (Create, Read, Update, Delete) using a Service Principal. Designed to keep authentication very controlled and intentional!
Available on nuget: DataverseSP
How to use this
This MCP server leverage a Service Principle to perform operations against Dataverse. This means your agent uses Dataverse as its own user account. Not you!
Setup steps:
- Create a Service Principle in Azure Entra ID. Note the Tenant ID, Client ID, Client Secret
- In the Power Platform Admin Center, add this Service Principle as an Application User in the environment with a security role that gives it permissions to do what you intend for the agent to be able to do.
Here is the JSON you can add to your client's MCP Configuration json file:
{
"mcpServers": {
"DataverseSP": {
"tools": [
"*"
],
"type": "stdio",
"command": "dnx",
"args": ["DataverseSP"],
"env": {
"DSP_TENANT_ID": "1b70d84e-bde9-4a11-ba5d-1305bb72ccb4",
"DSP_CLIENT_ID": "d8d754d6-10e0-4363-841a-18476f473e0a",
"DSP_CLIENT_SECRET": "Qw39Q~2Nzlp6nheqWM_Hy_m-BsrYKkg1tayO3cIV",
"DSP_ENV_URL": "https://org63194471.crm.dynamics.com"
}
}
}
}
For example, in GitHub Copilot, you will find the mcp-config.json file at ~\.copilot\mcp-config.json (C:\Users\timh\.copilot\mcp-config.json for me). Alternatively, in GitHub Copilot CLI, you can also use the /mcp add wizard, adding the environment variables as a JSON object.
There are four environment variables to pass to the agent shown above:
- DSP_TENANT_ID: The Tenant ID of the Service Principle you created
- DSP_CLIENT_ID: The Client ID ("Application ID") of the Service Principle you created.
- DSP_CLIENT_SECRET: The secret of the client you created.
- DSP_ENV_URL: the Dataverse environment URL.
After you provide those to your agent, five tools will be exposed to it that it can use:
- authenticate: use the Service Principle to authenticate into the Dataverse environment, fetching an access token (bearer token) which it will save as a private environment variable and use in other subsequent calls.
- create: create a record in Dataverse (HTTP POST)
- read: query a record/records in Dataverse (HTTP GET)
- update: update a record in Dataverse (HTTP PATCH)
- delete: delete a record in Dataverse (HTTP DELETE)
With those four key capabilities, your agent can theoretically now do anything against Dataverse from data manipulation to table schema manipulation. However, the agent may need a bit of guidance on how to use those tools to accomplish a goal (e.g. creating a table), so I added the agent-guide.md you can have your agent read which will help guide it on how to use those four tools!
Run the Inspector
You may want to test this MCP server manually. If so, run the official MCP inspector tool:
npx @modelcontextprotocol/inspector
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net10.0 is compatible. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
This package has no dependencies.