|
| 1 | +--- |
| 2 | +description: >- |
| 3 | + DSC includes a Model Context Protocol (MCP) server that enables AI agents and tools to |
| 4 | + interact with DSC resources and functions through a standardized interface. This integration |
| 5 | + enhances the authoring experience in supported editors like VS Code. |
| 6 | +ms.date: 09/26/2025 |
| 7 | +title: Using DSC with Model Context Protocol (MCP) Server |
| 8 | +--- |
| 9 | + |
| 10 | +# Using DSC with Model Context Protocol (MCP) Server |
| 11 | + |
| 12 | +Microsoft's Desired State Configuration (DSC) platform includes a built-in Model Context Protocol |
| 13 | +(MCP) server that enables AI agents and development tools to interact with DSC resources and |
| 14 | +functions through a standardized interface. This integration provides intelligent assistance for |
| 15 | +discovering, invoking, and understanding DSC resources and functions on your system. |
| 16 | + |
| 17 | +The DSC MCP server exposes DSC's core functionality to AI agents, enabling them to help you |
| 18 | +discover resources, understand their schemas, and work with DSC functions in an intelligent way. |
| 19 | +This enhances the overall authoring experience by providing contextual information about your |
| 20 | +local DSC environment directly to AI-powered tools. |
| 21 | + |
| 22 | +> [!IMPORTANT] |
| 23 | +> The DSC MCP server is focused on discovery and information retrieval. It does not |
| 24 | +> directly perform any configuration changes or resource modifications unless requested to do so. |
| 25 | +> The information it provides to AI agents can be used to generate configurations and commands |
| 26 | +> that, when executed, will impact your system. Always review and validate any generated |
| 27 | +> content before execution. |
| 28 | +
|
| 29 | +## What is Model Context Protocol (MCP)? |
| 30 | + |
| 31 | +Model Context Protocol (MCP) is an open standard that enables AI agents to securely connect to |
| 32 | +external data sources and tools. To learn more about MCP and how it works with AI agents, see |
| 33 | +[Use MCP servers in VS Code][00]. |
| 34 | + |
| 35 | +## Available DSC MCP tools |
| 36 | + |
| 37 | +The DSC MCP server provides three core tools for AI agents to interact with your DSC environment: |
| 38 | + |
| 39 | +### `list_dsc_resources` |
| 40 | + |
| 41 | +Lists summary information for all DSC resources available on the local machine, including: |
| 42 | + |
| 43 | +- Resource type name and kind |
| 44 | +- Description and capabilities |
| 45 | +- Adapter requirements (for adapted resources) |
| 46 | + |
| 47 | +You can optionally filter to show only adapted resources that require a specific adapter type. |
| 48 | + |
| 49 | +### `show_dsc_resource` |
| 50 | + |
| 51 | +Retrieves detailed information about a specific DSC resource, including: |
| 52 | + |
| 53 | +- Complete resource metadata (type, version, capabilities, author) |
| 54 | +- Full JSON schema for the resource's properties |
| 55 | +- Resource kind and description |
| 56 | + |
| 57 | +### `list_dsc_functions` |
| 58 | + |
| 59 | +Enumerates all available DSC functions that can be used in configuration expressions, with: |
| 60 | + |
| 61 | +- Function names, categories, and descriptions |
| 62 | +- Function metadata and usage information |
| 63 | +- Optional filtering by function name patterns (supports wildcards) |
| 64 | + |
| 65 | +These tools provide AI agents with information about your local DSC environment, |
| 66 | +enabling them to provide guidance and assistance when working with DSC configurations. |
| 67 | + |
| 68 | +> [!NOTE] |
| 69 | +> Additional MCP tools will become available in future releases to expand the capabilities |
| 70 | +> of the DSC MCP server integration. For the latest updates and feature announcements, |
| 71 | +> visit the [official DSC repository][01] on GitHub. |
| 72 | +
|
| 73 | +## How DSC MCP integrates with VS Code |
| 74 | + |
| 75 | +The following diagram illustrates how the DSC MCP server integrates with VS Code and AI agents: |
| 76 | + |
| 77 | +```mermaid |
| 78 | +graph TD |
| 79 | + A[VS Code] -->|Copilot Chat| B[AI Agent] |
| 80 | + B -->|MCP Protocol| C[DSC MCP Server] |
| 81 | + C -->|dsc commands| D[DSC CLI] |
| 82 | + D -->|Discovery| E[Local DSC Resources] |
| 83 | + D -->|Schema| F[Resource Manifests] |
| 84 | + D -->|Functions| G[DSC Function Registry] |
| 85 | + |
| 86 | + B -->|Enhanced assistance| H[Configuration Document] |
| 87 | + B -->|Resource suggestions| I[IntelliSense] |
| 88 | + B -->|Schema validation| J[Error messages] |
| 89 | + |
| 90 | + style C fill:#e1f5fe |
| 91 | + style D fill:#f3e5f5 |
| 92 | + style A fill:#e8f5e8 |
| 93 | +``` |
| 94 | + |
| 95 | +The integration works as follows: |
| 96 | + |
| 97 | +1. **VS Code Copilot** communicates with AI agents that can access MCP servers |
| 98 | +2. **AI agents** use the MCP protocol to query the DSC MCP server for information |
| 99 | +3. **DSC MCP server** processes requests and calls the appropriate DSC CLI commands |
| 100 | +4. **DSC CLI** performs resource discovery, schema retrieval, and function enumeration |
| 101 | +5. **Results** flow back through the chain to provide enhanced authoring assistance |
| 102 | + |
| 103 | +## Prerequisites |
| 104 | + |
| 105 | +Before using the DSC MCP server integration, ensure you have: |
| 106 | + |
| 107 | +- DSC v3.2.0-preview.5 or later installed on your system |
| 108 | +- VS Code v1.104 or above with [GitHub Copilot extension][02] enabled |
| 109 | +- Access to [Copilot in VS Code][03] |
| 110 | + |
| 111 | +## Setting up DSC MCP Server |
| 112 | + |
| 113 | +### Method 1: Using mcp.json configuration file |
| 114 | + |
| 115 | +The recommended way to configure the DSC MCP server is through an `mcp.json` configuration file. |
| 116 | +Create or update your MCP configuration file with the following content in the `.vscode` folder: |
| 117 | + |
| 118 | +```json |
| 119 | +{ |
| 120 | + "servers": { |
| 121 | + "dsc-mcp": { |
| 122 | + "type": "stdio", |
| 123 | + "command": "dsc", |
| 124 | + "args": [ |
| 125 | + "mcp" |
| 126 | + ] |
| 127 | + } |
| 128 | + }, |
| 129 | + "inputs": [] |
| 130 | +} |
| 131 | +``` |
| 132 | + |
| 133 | +This configuration tells MCP clients to: |
| 134 | + |
| 135 | +- Run the `dsc mcp` command to start the DSC MCP server. |
| 136 | +- Use standard I/O communication between the client and server. |
| 137 | +- Register the server with the identifier `dsc-mcp`. |
| 138 | + |
| 139 | +For detailed information about MCP configuration and setup in VS Code, refer to the |
| 140 | +[official MCP documentation][04]. |
| 141 | + |
| 142 | +### Method 2: Manual command-line setup |
| 143 | + |
| 144 | +You can also start the DSC MCP server manually for testing or development purposes: |
| 145 | + |
| 146 | +```powershell |
| 147 | +dsc mcp |
| 148 | +``` |
| 149 | + |
| 150 | +This command starts the DSC MCP server and waits for MCP protocol messages on standard input. |
| 151 | +The server will continue running until terminated or the input stream is closed. |
| 152 | + |
| 153 | +:::image type="complex" source="media/dsc-mcp-server/dsc-mcp-startup.png" alt-text="Screenshot showing DSC MCP server startup in terminal"::: |
| 154 | + This screenshot shows the DSC MCP server starting up in a PowerShell terminal window. The command `dsc mcp` has been executed and the server is running, waiting for MCP protocol messages on standard input. |
| 155 | +:::image-end::: |
| 156 | + |
| 157 | +## Using DSC MCP tools in VS Code |
| 158 | + |
| 159 | +### Step 1: Open Copilot Chat in Agent Mode |
| 160 | + |
| 161 | +1. Open the GitHub Copilot extension window in VS Code |
| 162 | +2. Select "Agent Mode" to enable MCP tool integration |
| 163 | + |
| 164 | +:::image type="complex" source="media/dsc-mcp-server/agent-mode-selection.png" alt-text="Screenshot showing Agent Mode selection in VS Code"::: |
| 165 | + This screenshot shows the GitHub Copilot extension window in VS Code with Agent Mode being selected to enable MCP tool integration. |
| 166 | +:::image-end::: |
| 167 | + |
| 168 | +### Step 2: Access DSC MCP tools |
| 169 | + |
| 170 | +1. Click on the tool icon in the GitHub Copilot chat window. |
| 171 | +2. Search for "MCP Server: dsc-mcp" in the available tools list. |
| 172 | +3. Verify that the DSC MCP server tools are available and loaded. |
| 173 | + |
| 174 | +:::image type="complex" source="media/dsc-mcp-server/dsc-mcp-tools-selection.png" alt-text="Screenshot showing DSC MCP tools selection interface"::: |
| 175 | + This screenshot shows the GitHub Copilot chat window with the tools list displayed, highlighting the DSC MCP server tools that are available for selection. |
| 176 | +:::image-end::: |
| 177 | + |
| 178 | +### Step 3: Start using DSC MCP integration |
| 179 | + |
| 180 | +Begin asking questions or requesting assistance with DSC-related tasks. The AI agent will |
| 181 | +automatically use the DSC MCP tools when appropriate to provide accurate, context-aware help. |
| 182 | + |
| 183 | +Example prompts that work well with DSC MCP integration: |
| 184 | + |
| 185 | +- "What DSC resources are available on this machine?" |
| 186 | +- "Show me the schema for the Microsoft.Windows/Registry resource" |
| 187 | +- "List all available DSC functions I can use in expressions" |
| 188 | + |
| 189 | +:::image type="complex" source="media/dsc-mcp-server/dsc-mcp-usage-example.png" alt-text="Screenshot showing DSC MCP usage example in VS Code"::: |
| 190 | + This screenshot demonstrates the DSC MCP integration in action, showing how AI agents use the MCP tools to provide contextual assistance with DSC-related tasks in VS Code. |
| 191 | +:::image-end::: |
| 192 | + |
| 193 | +## Troubleshooting |
| 194 | + |
| 195 | +### Connection issues |
| 196 | + |
| 197 | +If you encounter connection issues between VS Code and the DSC MCP server: |
| 198 | + |
| 199 | +1. Verify your `mcp.json` configuration file syntax |
| 200 | +2. Check that the `dsc` command is available in your system PATH |
| 201 | +3. Review VS Code's output panel for detailed error messages |
| 202 | +4. Try restarting the MCP integration in VS Code |
| 203 | + |
| 204 | +### Limited or no response from AI Agent |
| 205 | + |
| 206 | +If the AI agent doesn't seem to be using DSC MCP tools: |
| 207 | + |
| 208 | +- Use specific prompts that clearly indicate you want DSC-related information |
| 209 | +- Try phrases like "List DSC resources" or "Show me DSC functions" |
| 210 | +- Verify that Agent Mode is enabled in Copilot Chat |
| 211 | +- Check if the DSC MCP tools are visible in the tools list |
| 212 | + |
| 213 | +## Limitations |
| 214 | + |
| 215 | +> [!IMPORTANT] |
| 216 | +> It is your responsibility to review all configuration documents and commands generated with |
| 217 | +> AI assistance. **Always validate configurations in a test environment before applying them |
| 218 | +> to production systems.** |
| 219 | +
|
| 220 | +Current limitations of the DSC MCP server integration include: |
| 221 | + |
| 222 | +- **Local machine scope**: Information is limited to resources and functions available on the |
| 223 | + local machine where the server runs |
| 224 | +- **Agent behavior**: There is no guarantee that AI agents will use DSC MCP tools for any |
| 225 | + particular query, though specific prompting can help guide tool usage |
| 226 | + |
| 227 | +## See also |
| 228 | + |
| 229 | +- [DSC Configuration document schema reference][05] |
| 230 | +- [DSC resource manifest schema reference][06] |
| 231 | +- [Use MCP servers in VS Code][00] |
| 232 | +- [Model Context Protocol documentation][07] |
| 233 | +- [Enhanced authoring with schemas][08] |
| 234 | +- [Improving output accessibility][09] |
| 235 | + |
| 236 | +<!-- Link reference definitions --> |
| 237 | +[00]: https://code.visualstudio.com/docs/copilot/chat/mcp-servers |
| 238 | +[01]: https://github.com/PowerShell/DSC |
| 239 | +[02]: https://marketplace.visualstudio.com/items?itemName=GitHub.copilot |
| 240 | +[03]: https://code.visualstudio.com/docs/copilot/overview |
| 241 | +[04]: https://code.visualstudio.com/docs/copilot/customization/mcp-servers |
| 242 | +[05]: ../reference/schemas/config/document.md |
| 243 | +[06]: ../reference/schemas/resource/manifest/root.md |
| 244 | +[07]: https://modelcontextprotocol.io/docs |
| 245 | +[08]: enhanced-authoring.md |
| 246 | +[09]: output-accessibility.md |
0 commit comments