Repository navigation
Update MCP SDK and use new features - #6533
Conversation
This comment was marked as outdated.
This comment was marked as outdated.
|
/azp run |
|
Azure Pipelines: Successfully started running 1 pipeline(s). |
|
/azp run |
|
Azure Pipelines: Successfully started running 1 pipeline(s). |
There was a problem hiding this comment.
Copilot review overview
🟡 Changes recommended
The server instructions inaccurately promise structured JSON for error paths that return text only.
Get a fresh assessment by requesting another Copilot review.
Review effort: Balanced
Findings: 1
Open (1)
What changed in this PR
Updates the WinGet MCP server to MCP SDK 2.2.0 and adopts structured results, server guidance, and icon metadata.
Changes:
- Adds structured JSON tool responses and server instructions.
- Adds package-derived icons for the server and tools.
- Updates dependencies and CsWinRT incremental source generation.
| File | Description |
|---|---|
.github/actions/spelling/expect.txt |
Allows the PNG IHDR token. |
src/Directory.Packages.props |
Updates MCP and .NET dependencies. |
src/targets/EmbeddedCsWinRT.targets |
Generates warning-suppressed source copies incrementally. |
src/WinGetMCPServer/Extensions/McpServerBuilderExtensions.cs |
Registers tools with icon metadata. |
src/WinGetMCPServer/Program.cs |
Configures instructions and icons. |
src/WinGetMCPServer/Response/ToolResponse.cs |
Adds structured response serialization. |
src/WinGetMCPServer/ServerIcons.cs |
Discovers and encodes packaged icons. |
src/WinGetMCPServer/WingetPackageTools.cs |
Wraps package collections for structured output. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| Only install or upgrade packages the user has actually asked for, and report the status it | ||
| returns rather than assuming that it succeeded. | ||
|
|
||
| Tool results are JSON, provided both as text and as structured content. |
| private static string DescribePngSize(byte[] bytes, int requestedSize) | ||
| { | ||
| // A PNG begins with an 8 byte signature that includes the characters "PNG". | ||
| // The first chunk must be the image header with its designation "IHDR". | ||
| // The width and height immediately follow the header type. | ||
| if (bytes.Length >= 24 && | ||
| bytes[1] == (byte)'P' && bytes[2] == (byte)'N' && bytes[3] == (byte)'G' && | ||
| bytes[12] == (byte)'I' && bytes[13] == (byte)'H' && | ||
| bytes[14] == (byte)'D' && bytes[15] == (byte)'R') | ||
| { | ||
| int width = BinaryPrimitives.ReadInt32BigEndian(bytes.AsSpan(16, 4)); | ||
| int height = BinaryPrimitives.ReadInt32BigEndian(bytes.AsSpan(20, 4)); | ||
|
|
||
| if (width > 0 && height > 0) | ||
| { | ||
| return $"{width}x{height}"; | ||
| } | ||
| } | ||
|
|
||
| return $"{requestedSize}x{requestedSize}"; | ||
| } |
There was a problem hiding this comment.
Parsing the image header feels wrong...
Does .NET not have built in libraries for handling images? Or would they add too much to the package size?
There was a problem hiding this comment.
.NET Core does not have built in image handling. This code is a best effort attempt to get correct dimensions and falls back to assuming we got what we asked for if the header does not look correct. And the images should only ever be coming from our package.

📖 Description
Updates the MCP server SDK to the latest and integrates new features in:
🔍 Validation
Tested in VS Code.
Microsoft Reviewers: Open in CodeFlow