-
Notifications
You must be signed in to change notification settings - Fork 436
[Onboard][Part One] Mcp Server for Azure DocumentDB (Index) #1968
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
xingfan-git
wants to merge
21
commits into
main
Choose a base branch
from
users/xingfan/onboardingvcoremcp_connection
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 11 commits
Commits
Show all changes
21 commits
Select commit
Hold shift + click to select a range
1edc300
Add DocumentDB connection MCP tools
xingfan-git 1f5ff7e
update pr number
xingfan-git 2442f7d
try fix build pipeline
xingfan-git ba35d97
livetest files & resolve comments
xingfan-git 08efc55
sync azmcp-commands.md
xingfan-git 2c11d8c
dotnet format
xingfan-git 383acaf
fix run recorded tests
xingfan-git 9599980
resolve comments
xingfan-git bb42d4a
update azmcp-commands.md & dotnet format fix
xingfan-git 2fe4f1c
fix build pipeline
xingfan-git 6088353
merge main & resolve conflicts
xingfan-git c6fe9f7
resolve comments
xingfan-git 225d9a3
update description in consolidated_tools
xingfan-git b084426
revert the metadata change and mark connection toggle tool as non-ope…
xingfan-git 6bd0d18
remove connection tools and implement index tools
xingfan-git 08d80c5
dotnet format
xingfan-git 9e0b67d
sync metadata
xingfan-git ccea698
update destructive for create index
xingfan-git cdbc996
fix livetest
xingfan-git 5ac4fc9
update live test
xingfan-git 14dec4c
update yaml file
xingfan-git File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -170,6 +170,53 @@ function CheckVariable($name) { | |
| return $value | ||
| } | ||
|
|
||
| function Test-ProjectUsesMongoDbDriver { | ||
| param( | ||
| [string] $ProjectPath | ||
| ) | ||
|
|
||
| if (!(Test-Path $ProjectPath)) { | ||
| return $false | ||
| } | ||
|
|
||
| $projectContent = Get-Content $ProjectPath -Raw | ||
| return $projectContent -match '<PackageReference\s+Include="MongoDB\.Driver"' | ||
| } | ||
|
|
||
| function Test-ServerHasMongoDbDependency { | ||
| param( | ||
| [System.IO.FileInfo] $ServerProject | ||
| ) | ||
|
|
||
| $serverProjectDirectory = Split-Path $ServerProject.FullName -Parent | ||
| $serverProjectContent = Get-Content $ServerProject.FullName -Raw | ||
| $projectReferenceMatches = [regex]::Matches($serverProjectContent, '<ProjectReference\s+Include="([^"]+)"') | ||
|
|
||
| foreach ($projectReferenceMatch in $projectReferenceMatches) { | ||
| $projectReference = $projectReferenceMatch.Groups[1].Value | ||
| if (-not $projectReference) { | ||
| continue | ||
| } | ||
|
|
||
| $expandedReference = $projectReference.Replace('$(RepoRoot)', $RepoRoot) | ||
| $expandedReference = $expandedReference.Replace('$(MSBuildThisFileDirectory)', "$serverProjectDirectory/") | ||
| $expandedReference = $expandedReference.Replace('\', '/') | ||
|
|
||
| if (-not [System.IO.Path]::IsPathRooted($expandedReference)) { | ||
| $expandedReference = (Join-Path $serverProjectDirectory $expandedReference).Replace('\', '/') | ||
| } | ||
|
|
||
| $referencedProjects = @(Get-ChildItem -Path $expandedReference -File -ErrorAction SilentlyContinue) | ||
| foreach ($referencedProject in $referencedProjects) { | ||
| if (Test-ProjectUsesMongoDbDriver -ProjectPath $referencedProject.FullName) { | ||
| return $true | ||
| } | ||
| } | ||
| } | ||
|
|
||
| return $false | ||
| } | ||
|
|
||
| $windowsPool = CheckVariable 'WINDOWSPOOL' | ||
| $linuxPool = CheckVariable 'LINUXPOOL' | ||
| $linuxArm64Pool = CheckVariable 'LINUXARM64POOL' | ||
|
|
@@ -387,6 +434,13 @@ function Get-ServerDetails { | |
| $version.PrereleaseNumber = $BuildId | ||
| } | ||
|
|
||
| # Check if this server depends on MongoDB.Driver (incompatible with IL trimming) | ||
| $hasMongoDbDependency = Test-ServerHasMongoDbDependency -ServerProject $serverProject | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is a odd place to put this test. If we know a server shouldn't be trimmed, we should just add a property to the project file like |
||
|
|
||
| if ($hasMongoDbDependency) { | ||
| Write-Host "Server $serverName depends on DocumentDb (with MongoDB.Driver) - trimming will be disabled" -ForegroundColor Yellow | ||
| } | ||
|
|
||
| # Calculate VSIX version based on server version | ||
| $vsixVersion = $null | ||
| $vsixIsPrerelease = $false | ||
|
|
@@ -473,7 +527,8 @@ function Get-ServerDetails { | |
| architecture = $arch | ||
| extension = $os.extension | ||
| native = $false | ||
| trimmed = $true | ||
| # Disable trimming for servers with MongoDB.Driver dependency (uses extensive reflection) | ||
| trimmed = !$hasMongoDbDependency | ||
| } | ||
| } | ||
| } | ||
|
|
@@ -498,7 +553,7 @@ function Get-ServerDetails { | |
| architecture = $additionalPlatform.architecture | ||
| extension = $os.extension | ||
| native = $additionalPlatform.native | ||
| trimmed = $additionalPlatform.trimmed | ||
| trimmed = $additionalPlatform.trimmed -and !$hasMongoDbDependency | ||
| specialPurpose = $additionalPlatform.specialPurpose | ||
| } | ||
| } | ||
|
|
||
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
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
4 changes: 4 additions & 0 deletions
4
servers/Azure.Mcp.Server/changelog-entries/1773124572664.yaml
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,4 @@ | ||
| pr: 1968 | ||
| changes: | ||
| - section: "Features Added" | ||
| description: "Added DocumentDB tools for managing Azure DocumentDB (with MongoDB compatibility) connection" |
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
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
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| // Copyright (c) Microsoft Corporation. | ||
| // Licensed under the MIT License. | ||
|
|
||
| using System.Runtime.CompilerServices; | ||
|
|
||
| [assembly: InternalsVisibleTo("Azure.Mcp.Tools.DocumentDb.UnitTests")] |
22 changes: 22 additions & 0 deletions
22
tools/Azure.Mcp.Tools.DocumentDb/src/Azure.Mcp.Tools.DocumentDb.csproj
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,22 @@ | ||
| <Project Sdk="Microsoft.NET.Sdk"> | ||
| <PropertyGroup> | ||
| <IsAotCompatible>true</IsAotCompatible> | ||
| <!-- Disable trim analyzer warnings for MongoDB.Driver which uses extensive reflection --> | ||
| <EnableTrimAnalyzer>false</EnableTrimAnalyzer> | ||
| </PropertyGroup> | ||
| <ItemGroup> | ||
| <EmbeddedResource Include="**\Resources\*.txt" /> | ||
| <EmbeddedResource Include="**\Resources\*.json" /> | ||
| </ItemGroup> | ||
| <ItemGroup> | ||
| <ProjectReference Include="..\..\..\core\Azure.Mcp.Core\src\Azure.Mcp.Core.csproj" /> | ||
| </ItemGroup> | ||
| <ItemGroup> | ||
| <PackageReference Include="Azure.ResourceManager" /> | ||
| <PackageReference Include="MongoDB.Driver" /> | ||
|
|
||
| <PackageReference Include="Microsoft.Extensions.DependencyInjection" /> | ||
| <PackageReference Include="ModelContextProtocol" /> | ||
| <PackageReference Include="System.CommandLine" /> | ||
| </ItemGroup> | ||
| </Project> |
14 changes: 14 additions & 0 deletions
14
tools/Azure.Mcp.Tools.DocumentDb/src/Commands/BaseDocumentDbCommand.cs
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,14 @@ | ||
| // Copyright (c) Microsoft Corporation. | ||
| // Licensed under the MIT License. | ||
|
|
||
| using System.Diagnostics.CodeAnalysis; | ||
| using Azure.Mcp.Core.Commands; | ||
| using Azure.Mcp.Tools.DocumentDb.Options; | ||
|
|
||
| namespace Azure.Mcp.Tools.DocumentDb.Commands; | ||
|
|
||
| public abstract class BaseDocumentDbCommand< | ||
| [DynamicallyAccessedMembers(TrimAnnotations.CommandAnnotations)] TOptions> | ||
| : GlobalCommand<TOptions> where TOptions : BaseDocumentDbOptions, new() | ||
| { | ||
| } |
Oops, something went wrong.
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@hallipr could you review this change, as I don't know the trimmed build usage well enough and this PR is added a dependency which doesn't support trimming.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why don't we see a CI failure for this ?
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think because they're disabling trimming in New-BuildInfo. We just stop trimming the server instead of failing to trim it