Dataverse MCP Server - Advanced MCP Features Showcase

This repository demonstrates a sophisticated Model Context Protocol (MCP) Server that integrates with Microsoft Dataverse and showcases advanced MCP capabilities.

Key MCP Features Implemented

๐Ÿ”„ MCP Elicitation

When FetchXML queries return large result sets (>20 records), the server prompts users to choose between receiving raw JSON or saving results as formatted resources.

๐Ÿง  MCP Sampling

Data transformation by internal calls to the LLM - sampling - to convert raw Dataverse JSON responses into user-friendly markdown tables with proper formatting and structure.

๐Ÿ“ MCP Resources

Dynamic resource creation that stores transformed data as accessible resources available from the MCP Server.

๐Ÿ“Š MCP Progress

Real-time progress notifications during bulk operations (e.g., creating multiple contact records) with status updates and completion tracking.

How It Works

  1. Query Execution: Execute FetchXML queries against Dataverse using the ExecuteFetch tool
  2. Smart Result Handling:
    • โ‰ค20 records: Return JSON directly
    • 20 records: Trigger MCP Elicitation workflow

  3. User Choice: Interactive prompt asking whether to save large results as resources
  4. Data Transformation: If user chooses resource storage, MCP Sampling transforms JSON to markdown
  5. Resource Creation: Formatted data saved as MCP Resource with descriptive metadata

Available MCP Tools

  • ExecuteFetch: FetchXML query execution with smart result handling
  • CreateTextResource: Basic resource creation for any text content
  • WhoAmI: Dataverse identity verification
  • BulkCreateRandomContacts: Bulk data creation with progress tracking

Demo

This video demonstrates VS Code using this MCP Server to:

  • Retrieve Dataverse data through FetchXML queries
  • Transform large result sets into Markdown formatted resources
  • Optional adding of resources to the AI context window.

Technical Implementation

Built with:

Getting Started

  1. Clone the repository
  2. Copy appsettings.json to appsettings.local.json and configure Dataverse credentials
  3. Run: dotnet run --project MyDataverseMcpServer --environment Development
  4. Server runs on http://localhost:3001

The server demonstrates how MCP can create sophisticated, interactive experiences that go far beyond simple request-response patterns.

MCP Server ยท Populars

MCP Server ยท New