Conversation
Co-authored-by: AArnott <3548+AArnott@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Add support for stamping version on server.json for MCP servers
Add support for stamping version on server.json for MCP servers
Sep 10, 2025
AArnott
requested changes
Sep 11, 2025
src/Nerdbank.GitVersioning.Tasks/build/Nerdbank.GitVersioning.targets
Outdated
Show resolved
Hide resolved
test/Nerdbank.GitVersioning.Tests/BuildIntegrationManagedTests.cs
Outdated
Show resolved
Hide resolved
…, implement recursive __VERSION__ replacement, and improve tests Co-authored-by: AArnott <3548+AArnott@users.noreply.github.com>
Contributor
Author
All requested changes have been implemented and tested. Updated MSBuild conditions, converted to namespace statements, implemented recursive VERSION replacement, improved tests, and addressed all feedback. Fixed in commit 412e26c. Warning Firewall rules blocked me from connecting to one or more addresses (expand for details)I tried to connect to the following addresses, but was blocked by firewall rules:
If you need me to access, download, or install something from one of these locations, you can either:
|
Copilot
AI
changed the title
Add support for stamping version on server.json for MCP servers
Add support for stamping version on server.json for MCP servers with __VERSION__ placeholder replacement
Sep 11, 2025
AArnott
requested changes
Sep 11, 2025
test/Nerdbank.GitVersioning.Tests/BuildIntegrationManagedTests.cs
Outdated
Show resolved
Hide resolved
…nt for 0.0.0-placeholder, revert BuildIntegrationTests.cs using statement Co-authored-by: AArnott <3548+AArnott@users.noreply.github.com>
Contributor
Author
All requested changes have been implemented:
Warning Firewall rules blocked me from connecting to one or more addresses (expand for details)I tried to connect to the following addresses, but was blocked by firewall rules:
If you need me to access, download, or install something from one of these locations, you can either:
|
Copilot
AI
changed the title
Add support for stamping version on server.json for MCP servers with __VERSION__ placeholder replacement
Add support for stamping version on server.json for MCP servers with 0.0.0-placeholder replacement
Sep 11, 2025
Member
|
This looks great! |
AArnott
approved these changes
Sep 12, 2025
This was referenced Feb 4, 2026
This was referenced Feb 16, 2026
This was referenced Mar 2, 2026
This was referenced Mar 9, 2026
This was referenced Mar 16, 2026
This was referenced Apr 13, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Addresses #xxx by adding automatic version stamping for MCP server.json files when
PackageType=McpServeris specified in MSBuild projects.Problem
MCP (Model Context Protocol) server projects need their server.json files to be versioned consistently with their NuGet packages. Previously, developers had to manually handle this with hacky CI flows:
nbgvto get the version numberserver.template.jsontoserver.jsonSolution
This PR introduces automatic server.json version stamping that integrates seamlessly with Nerdbank.GitVersioning's existing build process:
New MSBuild Integration
NBGV_StampMcpServerJsonruns before packaging whenPackageType=McpServerStampMcpServerJsonhandles simple string replacement with proper error handlingHow it Works
<PackageType>McpServer</PackageType>server.jsonfile"0.0.0-placeholder"with the computed NBGV versionserver.jsonfrom packaging and includes the versioned oneExample
Original server.json:
{ "$schema": "https://modelcontextprotocol.io/schemas/draft/2025-07-09/server.json", "description": "Sample .NET MCP Server", "name": "io.github.example/samplemcpserver", "version": "0.0.0-placeholder", "packages": [ { "registry_type": "nuget", "identifier": "Example.McpServer", "version": "0.0.0-placeholder", "transport": { "type": "stdio" } } ] }After NBGV processing:
{ "$schema": "https://modelcontextprotocol.io/schemas/draft/2025-07-09/server.json", "description": "Sample .NET MCP Server", "name": "io.github.example/samplemcpserver", "version": "1.2.3-alpha.4+branch.feature", "packages": [ { "registry_type": "nuget", "identifier": "Example.McpServer", "version": "1.2.3-alpha.4+branch.feature", "transport": { "type": "stdio" } } ] }Testing
0.0.0-placeholdervalues are replaced with the actual versionThis eliminates the need for manual version management in CI pipelines and ensures MCP server metadata stays in sync with package versions automatically, using a simple and efficient string replacement approach.
Fixes #1269
Fixes #1269
💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.