Sponsored by Deepsite.site

Overview

Created By
rajyraman8 months ago
MCP Server for querying Dataverse using SQL
Content

Overview

The objective of this repo is to enable querying of Dataverse environment using SQL. You can use popular AI tools such as GitHub Copilot or Claude Desktop to query Dataverse, provided you add this MCP Server in the configuration.

A big thank you to Mark Carrington for creating Sql4Cds, without whom this project would not exist. 🙏

Prerequisites 🔍

  1. VSCode March (minimum March 2025 version) or Claude Desktop
  2. Azure CLI installed and authenticated on your local machine, if you are not using the DevContainer option. While interactive browser authentication is possible using Azure Identity framework, using Azure CLI to manage the authentication is little easier.
  3. Docker, if you want to run Dev Containers or the MCP Server inside DevContainer.
  4. dotnet 9.0 SDK if you want to install the dotnet tool.

Model Context Protocol (MCP) 📋

This is how Anthropic, the creators of MCP specification, defines Model Context Protocol

MCP is an open protocol that standardizes how applications provide context to LLMs. Think of MCP like a USB-C port for AI applications. Just as USB-C provides a standardized way to connect your devices to various peripherals and accessories, MCP provides a standardized way to connect AI models to different data sources and tools.

Installation 🚀

Install as dotnet

If the button above does not work, paste the below URL to the address bar.

vscode:mcp/install?%7B%0A%20%20%20%20%22name%22%3A%20%22dataverse-mcp-dotnet-tool%22%2C%0A%20%20%20%20%22type%22%3A%20%22stdio%22%2C%0A%20%20%20%20%22command%22%3A%20%22mcp-dataverse%22%2C%0A%20%20%20%20%22env%22%3A%20%7B%0A%20%20%20%20%20%20%20%20%22DATAVERSE_ENVIRONMENT_URL%22%3A%20%22https%3A%2F%2Fxyz.crm.dynamics.com%22%0A%20%20%20%20%7D%0A%7D

Install with Docker in VS Code

If the button above does not work, paste the below URL to the address bar.

vscode:mcp/install?%7B%0A%20%20%20%20%22name%22%3A%20%22dataverse-mcp-docker%22%2C%0A%20%20%20%20%22type%22%3A%20%22stdio%22%2C%0A%20%20%20%20%22command%22%3A%20%22docker%22%2C%0A%20%20%20%20%22args%22%3A%20%5B%0A%20%20%20%20%20%20%20%20%22run%22%2C%0A%20%20%20%20%20%20%20%20%22--env-file%22%2C%0A%20%20%20%20%20%20%20%20%22%24%7BworkspaceFolder%7D%2F.env%22%2C%0A%20%20%20%20%20%20%20%20%22-i%22%2C%0A%20%20%20%20%20%20%20%20%22--rm%22%2C%0A%20%20%20%20%20%20%20%20%22rajyraman%2Fmcp-stdio-dataverse%22%0A%20%20%20%20%5D%0A%7D

You can click the buttons above to get the MCP Server config settings. You have two options to use this MCP Server:

  1. Docker Container
  2. dotnet tool

Below is the recommendation based on the where you plan to use this MCP

InClientRecommendation
WindowsGitHub Copilotdotnet tool. Use Docker/Podman as fallback, if you have auth issues.
WindowsClaude Desktopdotnet tool
MacOSClaude Desktop, GitHub Copilotdotnet tool
LinuxClaude Desktop, GitHub Copilotdotnet tool
GitHub CodespacesGitHub Copilotdotnet tool

Since this MCP server is built with MCP C# SDK, it is distributed via nuget as a dotnet tool. dotnet 9.0 SDK can be installed in all major OSes.

You can install the Dataverse MCP Server as a global dotnet tool using the command below.

dotnet tool install -g Mcp.Dataverse.Stdio

Configuration

Below is a sample .env file that you can use if you choose to run the MCP Server inside a container. Create the .env on the workspace folder (same level as the README.md).

AZURE_CLIENT_ID=aba9829f-6288-44d7-9168-53eca9a1f4a5
AZURE_CLIENT_SECRET=abcd
AZURE_TENANT_ID=2caa17e6-884b-473b-80c5-c05d8859a2fa
DATAVERSE_ENVIRONMENT_URL=https://abc.crm6.dynamics.com
DOCKER_CONTAINER=true

If you are using this MCP Server on a new folder (not in the cloned repo), make sure that you are have .github/copilot-instructions.md setup. If you already have a different copilot-instructions.md file, you can also create this as a custom prompt under .github/prompts folder e.g. dataverse.main.prompt.md and use it in the chat.

Sample MCP Config

{
    "servers": {
        "dataverse-mcp-dotnet-tool": {
            "type": "stdio",
            "command": "mcp-dataverse",
            "env": {
                "DATAVERSE_ENVIRONMENT_URL": "https://abc.crm6.dynamics.com"
            }
        }
    }
}

Configuration for GitHub Codespaces

When you create you Codespace make sure you select the devcontainer.json inside the nuget-tool folder. You should also change the dataverse-nosecrets.env so that the DATAVERSE_ENVIRONMENT_URL environment variable is pointing to the right environment URL.

codespace-step-1

codespace-step-2

Prompts

If you are using GitHub Copilot, copilot-instructions.md file should automatically be used.

On Claude Desktop, you can clicking the "Attach from MCP" button.

Select Prompt

Examples

Example 1 - Get Unmanaged Solutions 📦

Unmanaged Solutions

Example 2 - Show Solutions by Publisher 🏢

Solutions by Publisher

Example 3 - Solutions Imported last week 📅

Solutions imported last week

Example 4 - Plugins registered on contact and account 🔌

Plugin Steps

Example 5 - Running SQL directly with #ExecuteSQL tool

Direct SQL

Example 6 - Only SELECT statements are allowed

This also means that Common Table Expressions are not allowed. This will change if and when GitHub Copilot supports Sampling in MCP spec.

Only SELECT statements allowed

Recommend Servers
TraeBuild with Free GPT-4.1 & Claude 3.7. Fully MCP-Ready.
Zhipu Web SearchZhipu Web Search MCP Server is a search engine specifically designed for large models. It integrates four search engines, allowing users to flexibly compare and switch between them. Building upon the web crawling and ranking capabilities of traditional search engines, it enhances intent recognition capabilities, returning results more suitable for large model processing (such as webpage titles, URLs, summaries, site names, site icons, etc.). This helps AI applications achieve "dynamic knowledge acquisition" and "precise scenario adaptation" capabilities.
DeepChatYour AI Partner on Desktop
TimeA Model Context Protocol server that provides time and timezone conversion capabilities. This server enables LLMs to get current time information and perform timezone conversions using IANA timezone names, with automatic system timezone detection.
EdgeOne Pages MCPAn MCP service designed for deploying HTML content to EdgeOne Pages and obtaining an accessible public URL.
Playwright McpPlaywright MCP server
Baidu Map百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Howtocook Mcp基于Anduin2017 / HowToCook (程序员在家做饭指南)的mcp server,帮你推荐菜谱、规划膳食,解决“今天吃什么“的世纪难题; Based on Anduin2017/HowToCook (Programmer's Guide to Cooking at Home), MCP Server helps you recommend recipes, plan meals, and solve the century old problem of "what to eat today"
ChatWiseThe second fastest AI chatbot™
AiimagemultistyleA Model Context Protocol (MCP) server for image generation and manipulation using fal.ai's Stable Diffusion model.
Jina AI MCP ToolsA Model Context Protocol (MCP) server that integrates with Jina AI Search Foundation APIs.
MCP AdvisorMCP Advisor & Installation - Use the right MCP server for your needs
Serper MCP ServerA Serper MCP Server
Amap Maps高德地图官方 MCP Server
Tavily Mcp
Context7Context7 MCP Server -- Up-to-date code documentation for LLMs and AI code editors
BlenderBlenderMCP connects Blender to Claude AI through the Model Context Protocol (MCP), allowing Claude to directly interact with and control Blender. This integration enables prompt assisted 3D modeling, scene creation, and manipulation.
WindsurfThe new purpose-built IDE to harness magic
MiniMax MCPOfficial MiniMax Model Context Protocol (MCP) server that enables interaction with powerful Text to Speech, image generation and video generation APIs.
CursorThe AI Code Editor
Visual Studio Code - Open Source ("Code - OSS")Visual Studio Code