Skip to content

Conversation

SteveL-MSFT
Copy link
Member

PR Summary

Enable DSC to be MCP Server. First tool is list_resources

@Gijsreyn
Copy link
Contributor

Gijsreyn commented Sep 3, 2025

image

Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR enables DSC (Desired State Configuration) to function as an MCP (Model Context Protocol) server, providing tools for interacting with DSC resources programmatically. The implementation adds the initial list_resources tool that allows MCP clients to enumerate available DSC resources.

  • Added MCP server functionality with initialization and tool handling capabilities
  • Implemented list_resources tool for enumerating DSC resources via MCP protocol
  • Modified core functions to support async operation patterns required by MCP

Reviewed Changes

Copilot reviewed 13 out of 16 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
dsc/src/main.rs Added MCP subcommand and async main function
dsc/src/args.rs Added MCP command line argument
dsc/src/mcp/mod.rs Core MCP server implementation with initialization logic
dsc/src/mcp/list_resources.rs Implementation of list_resources MCP tool
dsc/src/subcommand.rs Made list_resources function public for MCP usage
dsc_lib/src/dscresources/command_resource.rs Converted invoke_command to async function
dsc_lib/src/discovery/command_discovery.rs Added serialization traits to ImportedManifest
dsc/Cargo.toml Added MCP and async runtime dependencies
dsc_lib/Cargo.toml Updated tokio configuration for targeted feature usage
dsc/tests/dsc_mcp.tests.ps1 Added comprehensive MCP server integration tests
dsc/locales/en-us.toml Added localization strings for MCP functionality
dsc_lib/locales/en-us.toml Added error message for process execution failures
dsc/src/util.rs Added MCP-specific exit code

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@michaeltlombardi michaeltlombardi added the Schema-Impact Change requires updating a canonical schema for configs or manifests label Sep 3, 2025
@SteveL-MSFT SteveL-MSFT marked this pull request as draft September 3, 2025 23:01
Copy link
Collaborator

@JohnMcPMS JohnMcPMS left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since I'm here, leaving my thoughts on a find_dsc_resource tool. My expectations are:

  1. There will be a very large number of DSC resources eventually
  2. The context window will not be able to accommodate all of the information about every DSC resource

The general flow of the tool would be:

  1. Takes in a string user_query that is intended to be a distillation of the user request.
  2. Server uses sampling to request a list of keywords to use when searching.
  3. Server filters resources based on given keywords.
  4. Server uses sampling to have model choose the best resource from the results of 3.
  5. Server responds with resource information sufficient for agent to use invoke_dsc_resource tool (includes capabilities and schema).

@Gijsreyn
Copy link
Contributor

Gijsreyn commented Sep 4, 2025

@SteveL-MSFT forgot to ask during the community call, but will this be just as simple to invoke as the Bicep experimental MCP server? Would love to see it in VSCode, or instructions how to enable it.

@SteveL-MSFT SteveL-MSFT marked this pull request as ready for review September 4, 2025 14:36
@SteveL-MSFT
Copy link
Member Author

@JohnMcPMS add your thoughts here #1093 on MCP strategy for DSC

@SteveL-MSFT
Copy link
Member Author

@Gijsreyn to play with this, see https://code.visualstudio.com/docs/copilot/customization/mcp-servers on how to add MCP servers to VSCode. This one is simply executed as dsc mcp.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Doc-Impact Schema-Impact Change requires updating a canonical schema for configs or manifests
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants