Skip to content

Update MCP SDK and use new features - #6533

Merged
JohnMcPMS merged 6 commits into
microsoft:masterfrom
JohnMcPMS:update-mcp
Sep 25, 2026
Merged

JohnMcPMS merged 6 commits into
microsoft:masterfrom
JohnMcPMS:update-mcp

Conversation

@JohnMcPMS

@JohnMcPMS JohnMcPMS commented Sep 18, 2026 •

Copy link
Copy Markdown
Member

📖 Description

Updates the MCP server SDK to the latest and integrates new features in:

  • Icons
  • Server instructions
  • Structure results

🔍 Validation

Tested in VS Code.

Microsoft Reviewers: Open in CodeFlow

@JohnMcPMS
JohnMcPMS requested a review from a team as a code owner September 18, 2026 23:23
@github-actions

This comment was marked as outdated.

@JohnMcPMS

Copy link
Copy Markdown
Member Author

/azp run

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 1 pipeline(s).

@JohnMcPMS

Copy link
Copy Markdown
Member Author

/azp run

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 1 pipeline(s).

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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 Medium severity

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.
Comment on lines +172 to +192
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}";
}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

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?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

.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.

@JohnMcPMS
JohnMcPMS merged commit b199206 into microsoft:master Sep 25, 2026
9 checks passed
@JohnMcPMS
JohnMcPMS deleted the update-mcp branch September 25, 2026 17:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants