Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion eng/pipelines/templates/jobs/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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)'
Expand Down
45 changes: 42 additions & 3 deletions eng/pipelines/templates/jobs/sign-and-pack.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
62 changes: 54 additions & 8 deletions eng/pipelines/templates/steps/publish-to-dev-feed.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Copy link

Copilot AI Aug 26, 2025

Choose a reason for hiding this comment

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

[nitpick] The logic for combining dotnet and native files could be simplified. Consider extracting the file discovery logic into a helper function to reduce code duplication and improve readability.

Copilot uses AI. Check for mistakes.

Write-Host "Publishing the following files to ${{parameters.Registry}}:"
foreach ($file in $tgzFiles) {
Write-Host " - $($file.FullName)"
Expand Down Expand Up @@ -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": {
Expand All @@ -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
Expand All @@ -100,4 +146,4 @@ steps:
env:
REGISTRY_URL: ${{parameters.Registry}}
VERSION: $(Version)
workingDirectory: $(Pipeline.Workspace)
workingDirectory: $(Pipeline.Workspace)
5 changes: 5 additions & 0 deletions servers/Fabric.Mcp.Server/src/Fabric.Mcp.Server.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,11 @@
<IlcFoldIdenticalMethodBodies>true</IlcFoldIdenticalMethodBodies>
</PropertyGroup>

<!-- Windows AOT native build security flags to enable 'Control Flow Guard' (CFG) -->
<PropertyGroup Condition="'$(BuildNative)' == 'true' and $(RuntimeIdentifier.StartsWith('win'))">
<ControlFlowGuard>Guard</ControlFlowGuard>
</PropertyGroup>

<!-- Debug configuration -->
<PropertyGroup Condition="'$(Configuration)'=='Debug'">
<PublishSingleFile>false</PublishSingleFile>
Expand Down
5 changes: 5 additions & 0 deletions servers/Template.Mcp.Server/src/Template.Mcp.Server.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,11 @@
<IlcFoldIdenticalMethodBodies>true</IlcFoldIdenticalMethodBodies>
</PropertyGroup>

<!-- Windows AOT native build security flags to enable 'Control Flow Guard' (CFG) -->
<PropertyGroup Condition="'$(BuildNative)' == 'true' and $(RuntimeIdentifier.StartsWith('win'))">
<ControlFlowGuard>Guard</ControlFlowGuard>
</PropertyGroup>

<!-- Debug configuration -->
<PropertyGroup Condition="'$(Configuration)'=='Debug'">
<PublishSingleFile>false</PublishSingleFile>
Expand Down
Loading