diff --git a/eng/pipelines/templates/jobs/build.yml b/eng/pipelines/templates/jobs/build.yml index a0d3a7ee3..4ba5438f2 100644 --- a/eng/pipelines/templates/jobs/build.yml +++ b/eng/pipelines/templates/jobs/build.yml @@ -97,7 +97,7 @@ jobs: pwsh: true filePath: $(Build.SourcesDirectory)/eng/scripts/Build-Module.ps1 arguments: > - -OutputPath '$(Agent.TempDirectory)/native-build' + -OutputPath '$(Build.ArtifactStagingDirectory)' -VersionSuffix '$(VersionSuffix)' -OperatingSystem '${{ parameters.OSName }}' -Architecture '$(Architecture)' diff --git a/eng/pipelines/templates/jobs/sign-and-pack.yml b/eng/pipelines/templates/jobs/sign-and-pack.yml index 777fc049a..4007a877d 100644 --- a/eng/pipelines/templates/jobs/sign-and-pack.yml +++ b/eng/pipelines/templates/jobs/sign-and-pack.yml @@ -67,13 +67,52 @@ jobs: SbomEnabled: ${{ ne(variables['Build.Reason'], 'PullRequest') }} - task: Powershell@2 - displayName: "Pack modules" + displayName: "Organize signed dotnet and native artifacts for packaging" + inputs: + pwsh: true + targetType: 'inline' + script: | + $signedPath = "$(Build.ArtifactStagingDirectory)/signed" + $toPackPath = "$(Build.ArtifactStagingDirectory)/topack" + + New-Item -ItemType Directory -Force -Path "$toPackPath/dotnet" | Out-Null + New-Item -ItemType Directory -Force -Path "$toPackPath/native" | Out-Null + + $directories = Get-ChildItem -Path $signedPath -Directory + + foreach ($packageDir in $directories) { + $packageJsonPath = Join-Path $packageDir.FullName "package.json" + if (Test-Path $packageJsonPath) { + $packageName = $packageDir.Name + Write-Host "Processing platform package: $packageName" + if ($packageName.EndsWith("-native")) { + $destinationPath = Join-Path "$toPackPath/native" $packageName + Write-Host " → Moving to native artifacts folder" + } else { + $destinationPath = Join-Path "$toPackPath/dotnet" $packageName + Write-Host " → Moving to dotnet artifacts folder" + } + Copy-Item -Path $packageDir.FullName -Destination $destinationPath -Recurse -Force + } + } + + - task: Powershell@2 + displayName: "(Dotnet) Pack modules" + inputs: + pwsh: true + filePath: $(Build.SourcesDirectory)/eng/scripts/Pack-Modules.ps1 + arguments: > + -ArtifactsPath '$(Build.ArtifactStagingDirectory)/topack/dotnet' + -OutputPath '$(Build.ArtifactStagingDirectory)/packed/dotnet' + + - task: Powershell@2 + displayName: "(Native) Pack modules" inputs: pwsh: true filePath: $(Build.SourcesDirectory)/eng/scripts/Pack-Modules.ps1 arguments: > - -ArtifactsPath '$(Build.ArtifactStagingDirectory)/signed' - -OutputPath '$(Build.ArtifactStagingDirectory)/packed' + -ArtifactsPath '$(Build.ArtifactStagingDirectory)/topack/native' + -OutputPath '$(Build.ArtifactStagingDirectory)/packed/native' - template: /eng/common/pipelines/templates/steps/publish-1es-artifact.yml parameters: diff --git a/eng/pipelines/templates/steps/publish-to-dev-feed.yml b/eng/pipelines/templates/steps/publish-to-dev-feed.yml index 9dd7180b4..2d8369334 100644 --- a/eng/pipelines/templates/steps/publish-to-dev-feed.yml +++ b/eng/pipelines/templates/steps/publish-to-dev-feed.yml @@ -15,15 +15,26 @@ steps: registryUrl: ${{parameters.Registry}} - pwsh: | - $platformFiles = Get-ChildItem -Path ./platform -Filter *.tgz - $wrapperFiles = Get-ChildItem -Path ./wrapper -Filter *.tgz - $tgzFiles = $platformFiles + $wrapperFiles + $dotnetPlatformFiles = Get-ChildItem -Path ./dotnet/Azure.Mcp.Server/platform -Filter *.tgz + $dotnetWrapperFiles = Get-ChildItem -Path ./dotnet/Azure.Mcp.Server/wrapper -Filter *.tgz + $tgzDotnetFiles = $dotnetPlatformFiles + $dotnetWrapperFiles - if ($tgzFiles.Count -eq 0) { - Write-Host "No .tgz files found in ${{parameters.PathToArtifacts}}" + if ($tgzDotnetFiles.Count -eq 0) { + Write-Host "No dotnet .tgz files found in ${{parameters.PathToArtifacts}}" exit 1 } + $nativePlatformFiles = Get-ChildItem -Path ./native/Azure.Mcp.Server-native/platform -Filter *.tgz + $nativeWrapperFiles = Get-ChildItem -Path ./native/Azure.Mcp.Server-native/wrapper -Filter *.tgz + $tgzNativeFiles = $nativePlatformFiles + $nativeWrapperFiles + + if ($tgzNativeFiles.Count -eq 0) { + Write-Host "No native .tgz files found in ${{parameters.PathToArtifacts}}" + exit 1 + } + + $tgzFiles = $tgzDotnetFiles + $tgzNativeFiles + Write-Host "Publishing the following files to ${{parameters.Registry}}:" foreach ($file in $tgzFiles) { Write-Host " - $($file.FullName)" @@ -56,20 +67,36 @@ steps: $markdown = @" $connectInstructions To run the dev version of the package, you can use the following command: + ``````bash + # dotnet variant npx --yes --registry '$registryUrl' @azure/mcp@$version --version `````` - You can also globally install the package and run it like: ``````bash + # Native AOT variant + npx --yes --registry '$registryUrl' @azure/mcp-native@$version --version + `````` + + You can also globally install either package and run it like: + + ``````bash + # dotnet variant npm install --registry '$registryUrl' -g @azure/mcp@$version azmcp --version `````` + ``````bash + # Native AOT variant + npm install --registry '$registryUrl' -g @azure/mcp-native@$version + + azmcp --version + `````` + ## mcp.json - Configure the server in ``.vscode/mcp.json`` with: + Configure the server in ``.vscode/mcp.json`` with dotnet variant: ``````json { "servers": { @@ -87,6 +114,25 @@ steps: } } `````` + + Or with native AOT variant: + ``````json + { + "servers": { + "Azure MCP Server (Native)": { + "command": "npx", + "args": [ + "-y", + "--registry", + "$registryUrl", + "@azure/mcp-native@$version", + "server", + "start" + ] + } + } + } + `````` "@ New-Item './.work' -ItemType Directory -Force | Out-Null @@ -100,4 +146,4 @@ steps: env: REGISTRY_URL: ${{parameters.Registry}} VERSION: $(Version) - workingDirectory: $(Pipeline.Workspace) + workingDirectory: $(Pipeline.Workspace) \ No newline at end of file diff --git a/servers/Fabric.Mcp.Server/src/Fabric.Mcp.Server.csproj b/servers/Fabric.Mcp.Server/src/Fabric.Mcp.Server.csproj index c8065039c..9d30bc84a 100644 --- a/servers/Fabric.Mcp.Server/src/Fabric.Mcp.Server.csproj +++ b/servers/Fabric.Mcp.Server/src/Fabric.Mcp.Server.csproj @@ -46,6 +46,11 @@ true + + + Guard + + false diff --git a/servers/Template.Mcp.Server/src/Template.Mcp.Server.csproj b/servers/Template.Mcp.Server/src/Template.Mcp.Server.csproj index 3f52ec648..804269d3a 100644 --- a/servers/Template.Mcp.Server/src/Template.Mcp.Server.csproj +++ b/servers/Template.Mcp.Server/src/Template.Mcp.Server.csproj @@ -46,6 +46,11 @@ true + + + Guard + + false