Skip to content

Commit 3f669c2

Browse files
authored
Merge pull request #1137 from Gijsreyn/docs/main/dsc-mcp-server
Add DSC MCP server concept doc
2 parents befe473 + fdfe57e commit 3f669c2

File tree

5 files changed

+255
-0
lines changed

5 files changed

+255
-0
lines changed

docs/concepts/dsc-mcp-server.md

Lines changed: 255 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,255 @@
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+
configurations through a standardized interface. This integration provides intelligent assistance
15+
for 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+
## How AI agents use DSC MCP tools
36+
37+
The DSC MCP server enables AI agents to intelligently assist you by understanding what's
38+
available in your local DSC environment. Here's how agents use these capabilities to help
39+
fulfill your requests:
40+
41+
### Discovering available resources
42+
43+
When you ask an agent to help with system configuration tasks, the agent can discover what DSC
44+
resources are available on your machine. For example:
45+
46+
- **You ask**: "How can I manage Windows registry settings?"
47+
- **Agent discovers**: The `Microsoft.Windows/Registry` resource is available
48+
- **Agent provides**: Specific guidance on using that resource for your registry management
49+
needs
50+
51+
This discovery helps agents provide accurate, system-specific recommendations rather than
52+
generic advice.
53+
54+
### Understanding resource capabilities
55+
56+
When you need to configure something specific, agents can examine the exact properties and
57+
capabilities of relevant resources. For instance:
58+
59+
- **You ask**: "I need to install packages on my Linux system using apt"
60+
- **Agent examines**: The `Microsoft.Linux.Apt/Package` resource schema
61+
- **Agent provides**: The exact property names and valid values needed for your package
62+
installation configuration
63+
64+
This ensures the guidance you receive matches what's actually available on your system.
65+
66+
### Working with DSC functions
67+
68+
When you're building configuration expressions, agents can discover what functions are available
69+
to help solve your specific needs:
70+
71+
- **You ask**: "How do I combine multiple arrays in a DSC configuration?"
72+
- **Agent discovers**: Functions like `union()`, `intersection()`, and `concat()` are available
73+
- **Agent provides**: Examples using the appropriate function for your use case
74+
75+
This helps agents suggest the most suitable approach using your available DSC capabilities.
76+
77+
> [!NOTE]
78+
> Additional MCP tools will become available in future releases to expand the capabilities
79+
> of the DSC MCP server integration. For the latest updates and feature announcements,
80+
> visit the [official DSC repository][01] on GitHub.
81+
82+
## How DSC MCP integrates with VS Code
83+
84+
The following diagram illustrates how the DSC MCP server integrates with VS Code and AI agents:
85+
86+
```mermaid
87+
graph TD
88+
A[VS Code] -->|Copilot Chat| B[AI Agent]
89+
B -->|MCP Protocol| C[DSC MCP Server]
90+
C -->|dsc commands| D[DSC CLI]
91+
D -->|Discovery| E[Local DSC Resources]
92+
D -->|Schema| F[Resource Manifests]
93+
D -->|Functions| G[DSC Function Registry]
94+
95+
B -->|Enhanced assistance| H[Configuration Document]
96+
B -->|Resource suggestions| I[IntelliSense]
97+
B -->|Schema validation| J[Error messages]
98+
99+
style C fill:#e1f5fe
100+
style D fill:#f3e5f5
101+
style A fill:#e8f5e8
102+
```
103+
104+
The integration works as follows:
105+
106+
1. **VS Code Copilot** communicates with AI agents that can access MCP servers
107+
2. **AI agents** use the MCP protocol to query the DSC MCP server for information
108+
3. **DSC MCP server** processes requests and calls the appropriate DSC CLI commands
109+
4. **DSC CLI** performs resource discovery, schema retrieval, and function enumeration
110+
5. **Results** flow back through the chain to provide enhanced authoring assistance
111+
112+
## Prerequisites
113+
114+
Before using the DSC MCP server integration, ensure you have:
115+
116+
- DSC v3.2.0-preview.5 or later installed on your system
117+
- VS Code v1.104 or above with [GitHub Copilot extension][02] enabled
118+
- Access to [Copilot in VS Code][03]
119+
120+
## Setting up DSC MCP Server
121+
122+
### Method 1: Using mcp.json configuration file
123+
124+
The recommended way to configure the DSC MCP server is through an `mcp.json` configuration file.
125+
Create or update your MCP configuration file with the following content in the `.vscode` folder:
126+
127+
```json
128+
{
129+
"servers": {
130+
"dsc-mcp": {
131+
"type": "stdio",
132+
"command": "dsc",
133+
"args": [
134+
"mcp"
135+
]
136+
}
137+
},
138+
"inputs": []
139+
}
140+
```
141+
142+
This configuration tells MCP clients to:
143+
144+
- Run the `dsc mcp` command to start the DSC MCP server.
145+
- Use standard I/O communication between the client and server.
146+
- Register the server with the identifier `dsc-mcp`.
147+
148+
For detailed information about MCP configuration and setup in VS Code, refer to the
149+
[official MCP documentation][04].
150+
151+
### Method 2: Manual command-line setup
152+
153+
You can also start the DSC MCP server manually for testing or development purposes:
154+
155+
```powershell
156+
dsc mcp
157+
```
158+
159+
This command starts the DSC MCP server and waits for MCP protocol messages on standard input.
160+
The server will continue running until terminated or the input stream is closed.
161+
162+
:::image type="complex" source="media/dsc-mcp-server/dsc-mcp-startup.png" alt-text="Screenshot showing DSC MCP server startup in terminal":::
163+
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.
164+
:::image-end:::
165+
166+
## Using DSC MCP tools in VS Code
167+
168+
### Step 1: Open Copilot Chat in Agent Mode
169+
170+
1. Open the GitHub Copilot extension window in VS Code
171+
2. Select "Agent Mode" to enable MCP tool integration
172+
173+
:::image type="complex" source="media/dsc-mcp-server/agent-mode-selection.png" alt-text="Screenshot showing Agent Mode selection in VS Code":::
174+
This screenshot shows the GitHub Copilot extension window in VS Code with Agent Mode being selected to enable MCP tool integration.
175+
:::image-end:::
176+
177+
### Step 2: Access DSC MCP tools
178+
179+
1. Click on the tool icon in the GitHub Copilot chat window.
180+
2. Search for "MCP Server: dsc-mcp" in the available tools list.
181+
3. Verify that the DSC MCP server tools are available and loaded.
182+
183+
:::image type="complex" source="media/dsc-mcp-server/dsc-mcp-tools-selection.png" alt-text="Screenshot showing DSC MCP tools selection interface":::
184+
This screenshot shows the GitHub Copilot chat window with the tools list displayed, highlighting the DSC MCP server tools that are available for selection.
185+
:::image-end:::
186+
187+
### Step 3: Start using DSC MCP integration
188+
189+
Begin asking questions or requesting assistance with DSC-related tasks. The AI agent will
190+
automatically use the DSC MCP tools when appropriate to provide accurate, context-aware help.
191+
192+
Example prompts that work well with DSC MCP integration:
193+
194+
- "What DSC resources are available on this machine?"
195+
- "Show me the schema for the Microsoft.Windows/Registry resource"
196+
- "List all available DSC functions I can use in expressions"
197+
198+
:::image type="complex" source="media/dsc-mcp-server/dsc-mcp-usage-example.png" alt-text="Screenshot showing DSC MCP usage example in VS Code":::
199+
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.
200+
:::image-end:::
201+
202+
## Troubleshooting
203+
204+
### Connection issues
205+
206+
If you encounter connection issues between VS Code and the DSC MCP server:
207+
208+
1. Verify your `mcp.json` configuration file syntax
209+
2. Check that the `dsc` command is available in your system PATH
210+
3. Review VS Code's output panel for detailed error messages
211+
4. Try restarting the MCP integration in VS Code
212+
213+
### Limited or no response from AI Agent
214+
215+
If the AI agent doesn't seem to be using DSC MCP tools:
216+
217+
- Use specific prompts that clearly indicate you want DSC-related information
218+
- Try phrases like "List DSC resources" or "Show me DSC functions"
219+
- Verify that Agent Mode is enabled in Copilot Chat
220+
- Check if the DSC MCP tools are visible in the tools list
221+
222+
## Limitations
223+
224+
> [!IMPORTANT]
225+
> It is your responsibility to review all configuration documents and commands generated with
226+
> AI assistance. **Always validate configurations in a test environment before applying them
227+
> to production systems.**
228+
229+
Current limitations of the DSC MCP server integration include:
230+
231+
- **Local machine scope**: Information is limited to resources and functions available on the
232+
local machine where the server runs
233+
- **Agent behavior**: There is no guarantee that AI agents will use DSC MCP tools for any
234+
particular query, though specific prompting can help guide tool usage
235+
236+
## See also
237+
238+
- [DSC Configuration document schema reference][05]
239+
- [DSC resource manifest schema reference][06]
240+
- [Use MCP servers in VS Code][00]
241+
- [Model Context Protocol documentation][07]
242+
- [Enhanced authoring with schemas][08]
243+
- [Improving output accessibility][09]
244+
245+
<!-- Link reference definitions -->
246+
[00]: https://code.visualstudio.com/docs/copilot/chat/mcp-servers
247+
[01]: https://github.com/PowerShell/DSC
248+
[02]: https://marketplace.visualstudio.com/items?itemName=GitHub.copilot
249+
[03]: https://code.visualstudio.com/docs/copilot/overview
250+
[04]: https://code.visualstudio.com/docs/copilot/customization/mcp-servers
251+
[05]: ../reference/schemas/config/document.md
252+
[06]: ../reference/schemas/resource/manifest/root.md
253+
[07]: https://modelcontextprotocol.io/docs
254+
[08]: enhanced-authoring.md
255+
[09]: output-accessibility.md
45.3 KB
Loading
28.8 KB
Loading
58 KB
Loading
52.8 KB
Loading

0 commit comments

Comments
 (0)