Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
1edc300
Add DocumentDB connection MCP tools
xingfan-git Mar 9, 2026
1f5ff7e
update pr number
xingfan-git Mar 9, 2026
2442f7d
try fix build pipeline
xingfan-git Mar 9, 2026
ba35d97
livetest files & resolve comments
xingfan-git Mar 9, 2026
08efc55
sync azmcp-commands.md
xingfan-git Mar 9, 2026
2c11d8c
dotnet format
xingfan-git Mar 9, 2026
383acaf
fix run recorded tests
xingfan-git Mar 9, 2026
9599980
resolve comments
xingfan-git Mar 10, 2026
bb42d4a
update azmcp-commands.md & dotnet format fix
xingfan-git Mar 10, 2026
2fe4f1c
fix build pipeline
xingfan-git Mar 10, 2026
6088353
merge main & resolve conflicts
xingfan-git Mar 12, 2026
c6fe9f7
resolve comments
xingfan-git Mar 13, 2026
225d9a3
update description in consolidated_tools
xingfan-git Mar 13, 2026
b084426
revert the metadata change and mark connection toggle tool as non-ope…
xingfan-git Mar 13, 2026
6bd0d18
remove connection tools and implement index tools
xingfan-git Mar 15, 2026
08d80c5
dotnet format
xingfan-git Mar 15, 2026
9e0b67d
sync metadata
xingfan-git Mar 15, 2026
ccea698
update destructive for create index
xingfan-git Mar 15, 2026
cdbc996
fix livetest
xingfan-git Mar 15, 2026
5ac4fc9
update live test
xingfan-git Mar 15, 2026
8dd8014
implement mcp tools for documentdb database commands
xingfan-git Mar 15, 2026
12bf8b3
implement mcp tools for managing documentdb collection
xingfan-git Mar 15, 2026
e166cef
remove legacy connect function
xingfan-git Mar 15, 2026
14dec4c
update yaml file
xingfan-git Mar 16, 2026
25edd6e
Merge branch 'users/xingfan/onboardingvcoremcp_connection' of https:/…
xingfan-git Mar 16, 2026
e9850fc
resolve comments
xingfan-git Mar 16, 2026
793beeb
Merge upstream PR changes
xingfan-git Mar 16, 2026
66e292f
remove legacy functions
xingfan-git Mar 16, 2026
3ecf473
update consolidated_tool.json to match tool metadata
xingfan-git Mar 16, 2026
a0f602c
dotnet format
xingfan-git Mar 16, 2026
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
6 changes: 6 additions & 0 deletions .github/CODEOWNERS
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,12 @@
# ServiceLabel: %tools-Docker
# ServiceOwners: @conniey @microsoft/azure-mcp

# PRLabel: %tools-DocumentDb
/tools/Azure.Mcp.Tools.DocumentDb/ @xingfan-git @microsoft/azure-mcp

# ServiceLabel: %tools-DocumentDb
# ServiceOwners: @xingfan-git

# ServiceLabel: %tools-Eclipse
# ServiceOwners: @srnagar @microsoft/azure-mcp

Expand Down
1 change: 1 addition & 0 deletions Directory.Packages.props
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@
<PackageVersion Include="Microsoft.Extensions.Hosting" Version="10.0.2" />
<PackageVersion Include="ModelContextProtocol" Version="1.0.0" />
<PackageVersion Include="ModelContextProtocol.AspNetCore" Version="1.0.0" />
<PackageVersion Include="MongoDB.Driver" Version="3.2.0" />
<PackageVersion Include="MySqlConnector" Version="2.4.0" />
<PackageVersion Include="Npgsql" Version="10.0.1" />
<PackageVersion Include="YamlDotNet" Version="16.3.0" />
Expand Down
59 changes: 57 additions & 2 deletions eng/scripts/New-BuildInfo.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down Expand Up @@ -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

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
Expand Down Expand Up @@ -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
}
}
}
Expand All @@ -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
}
}
Expand Down
8 changes: 8 additions & 0 deletions servers/Azure.Mcp.Server/Azure.Mcp.Server.slnx
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,14 @@
<Project Path="../../tools/Azure.Mcp.Tools.DeviceRegistry/tests/Azure.Mcp.Tools.DeviceRegistry.UnitTests/Azure.Mcp.Tools.DeviceRegistry.UnitTests.csproj" />
<Project Path="../../tools/Azure.Mcp.Tools.DeviceRegistry/tests/Azure.Mcp.Tools.DeviceRegistry.LiveTests/Azure.Mcp.Tools.DeviceRegistry.LiveTests.csproj" />
</Folder>
<Folder Name="/tools/Azure.Mcp.Tools.DocumentDb/" />
<Folder Name="/tools/Azure.Mcp.Tools.DocumentDb/src/">
<Project Path="../../tools/Azure.Mcp.Tools.DocumentDb/src/Azure.Mcp.Tools.DocumentDb.csproj" />
</Folder>
<Folder Name="/tools/Azure.Mcp.Tools.DocumentDb/tests/">
<Project Path="../../tools/Azure.Mcp.Tools.DocumentDb/tests/Azure.Mcp.Tools.DocumentDb.LiveTests/Azure.Mcp.Tools.DocumentDb.LiveTests.csproj" />
<Project Path="../../tools/Azure.Mcp.Tools.DocumentDb/tests/Azure.Mcp.Tools.DocumentDb.UnitTests/Azure.Mcp.Tools.DocumentDb.UnitTests.csproj" />
</Folder>
<Folder Name="/tools/Azure.Mcp.Tools.EventGrid/" />
<Folder Name="/tools/Azure.Mcp.Tools.EventGrid/src/">
<Project Path="../../tools/Azure.Mcp.Tools.EventGrid/src/Azure.Mcp.Tools.EventGrid.csproj" />
Expand Down
16 changes: 16 additions & 0 deletions servers/Azure.Mcp.Server/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -963,6 +963,22 @@ Example prompts that generate Azure CLI commands:
* "Get Azure Data Explorer databases in cluster 'mycluster'"
* "Sample 10 rows from table 'StormEvents' in Azure Data Explorer database 'db1'"

### 🗄️ Azure DocumentDB (with MongoDB compatibility)

* "List indexes for collection 'items' in DocumentDB database 'test'"
* "Create an index on field 'category' for collection 'items' in DocumentDB database 'test'"
* "Drop index 'category_1' from collection 'items' in DocumentDB database 'test'"
* "Show index statistics for collection 'items' in DocumentDB database 'test'"
* "Show current DocumentDB operations"
* "List all databases in DocumentDB"
* "Get statistics for database 'mydb'"
* "Get details for database 'analytics' in DocumentDB"
* "Drop database 'testdb'"
* "Show me collections in database 'mydb'"
* "Get statistics for collection 'users'"
* "Rename collection 'old-name' to 'new-name'"
* "Sample documents from collection 'products'"

### 📣 Azure Event Grid

* "List all Event Grid topics in subscription 'my-subscription'"
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
pr: 1968
changes:
- section: "Features Added"
description: "Added mcp tools for managing Azure DocumentDB (with MongoDB compatibility) index"
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
changes:
- section: "Features Added"
description: "Added mcp tools for managing Azure DocumentDB (with MongoDB compatibility) database"
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
changes:
- section: "Features Added"
description: "Added DocumentDB tools for managing Azure DocumentDB (with MongoDB compatibility) collection"
80 changes: 80 additions & 0 deletions servers/Azure.Mcp.Server/docs/azmcp-commands.md
Original file line number Diff line number Diff line change
Expand Up @@ -1694,6 +1694,86 @@ azmcp deviceregistry namespace list --subscription <subscription> \
[--resource-group <resource-group>]
```

### Azure DocumentDB (with MongoDB compatibility) Operations

```bash
# List all indexes on a collection
# ❌ Destructive | ✅ Idempotent | ❌ OpenWorld | ✅ ReadOnly | ❌ Secret | ❌ LocalRequired
azmcp documentdb index list indexes --connection-string <connection-string> \
--db-name <db-name> \
--collection-name <collection-name>

# Create an index on a collection
# ✅ Destructive | ❌ Idempotent | ❌ OpenWorld | ❌ ReadOnly | ❌ Secret | ❌ LocalRequired
azmcp documentdb index create index --connection-string <connection-string> \
--db-name <db-name> \
--collection-name <collection-name> \
--keys <json-index-keys> \
[--options <json-index-options>]

# Drop an index from a collection
# ✅ Destructive | ❌ Idempotent | ❌ OpenWorld | ❌ ReadOnly | ❌ Secret | ❌ LocalRequired
azmcp documentdb index drop index --connection-string <connection-string> \
--db-name <db-name> \
--collection-name <collection-name> \
--index-name <index-name>

# List all databases or inspect a single database
# ❌ Destructive | ✅ Idempotent | ❌ OpenWorld | ✅ ReadOnly | ❌ Secret | ❌ LocalRequired
azmcp documentdb database list databases --connection-string <connection-string> \
[--db-name <db-name>]

# Rename a collection
# ✅ Destructive | ❌ Idempotent | ❌ OpenWorld | ❌ ReadOnly | ❌ Secret | ❌ LocalRequired
azmcp documentdb collection rename collection --connection-string <connection-string> \
--db-name <db-name> \
--collection-name <collection-name> \
--new-collection-name <new-collection-name>

# Drop a collection
# ✅ Destructive | ❌ Idempotent | ❌ OpenWorld | ❌ ReadOnly | ❌ Secret | ❌ LocalRequired
azmcp documentdb collection drop collection --connection-string <connection-string> \
--db-name <db-name> \
--collection-name <collection-name>

# Sample documents from a collection
# ❌ Destructive | ❌ Idempotent | ❌ OpenWorld | ✅ ReadOnly | ❌ Secret | ❌ LocalRequired
azmcp documentdb collection sample documents --connection-string <connection-string> \
--db-name <db-name> \
--collection-name <collection-name> \
[--sample-size <sample-size>]

# Get DocumentDB statistics for a database
# ❌ Destructive | ✅ Idempotent | ❌ OpenWorld | ✅ ReadOnly | ❌ Secret | ❌ LocalRequired
azmcp documentdb others get stats --connection-string <connection-string> \
--resource-type database \
--db-name <db-name>

# Get DocumentDB statistics for a collection
# ❌ Destructive | ✅ Idempotent | ❌ OpenWorld | ✅ ReadOnly | ❌ Secret | ❌ LocalRequired
azmcp documentdb others get stats --connection-string <connection-string> \
--resource-type collection \
--db-name <db-name> \
--collection-name <collection-name>

# Get DocumentDB statistics for indexes on a collection
# ❌ Destructive | ✅ Idempotent | ❌ OpenWorld | ✅ ReadOnly | ❌ Secret | ❌ LocalRequired
azmcp documentdb others get stats --connection-string <connection-string> \
--resource-type index \
--db-name <db-name> \
--collection-name <collection-name>

# Get current DocumentDB operations
# ❌ Destructive | ✅ Idempotent | ❌ OpenWorld | ✅ ReadOnly | ❌ Secret | ❌ LocalRequired
azmcp documentdb others current ops --connection-string <connection-string> \
[--ops <json-filter>]

# Drop a database
# ✅ Destructive | ❌ Idempotent | ❌ OpenWorld | ❌ ReadOnly | ❌ Secret | ❌ LocalRequired
azmcp documentdb database drop database --connection-string <connection-string> \
--db-name <db-name>
```

### Azure Event Grid Operations

```bash
Expand Down
22 changes: 22 additions & 0 deletions servers/Azure.Mcp.Server/docs/e2eTestPrompts.md
Original file line number Diff line number Diff line change
Expand Up @@ -356,6 +356,28 @@ This file contains prompts used for end-to-end testing to ensure each tool is in
| deviceregistry_namespace_list | List Device Registry namespaces in resource group <resource_group_name> |
| deviceregistry_namespace_list | What Device Registry namespaces do I have in my Azure subscription? |

## Azure DocumentDB (with MongoDB compatibility)

| Tool Name | Test Prompt |
|:----------|:----------|
| documentdb_index_list_indexes | List indexes for collection <collection-name> in DocumentDB database <db-name> |
| documentdb_index_list_indexes | Show me all indexes on collection <collection-name> in database <db-name> |
| documentdb_index_create_index | Create an index on collection <collection-name> in DocumentDB database <db-name> using keys <keys> |
| documentdb_index_create_index | Add a DocumentDB index for collection <collection-name> in database <db-name> with keys <keys> and options <options> |
| documentdb_index_drop_index | Drop index <index-name> from collection <collection-name> in DocumentDB database <db-name> |
| documentdb_index_drop_index | Remove the <index-name> index from DocumentDB collection <collection-name> in database <db-name> |
| documentdb_others_get_stats | Show index statistics for collection <collection-name> in DocumentDB database <db-name> |
| documentdb_others_get_stats | Get DocumentDB index stats for collection <collection-name> in database <db-name> |
| documentdb_others_current_ops | Show current DocumentDB operations |
| documentdb_others_current_ops | Get current DocumentDB operations filtered by <ops> |
| documentdb_others_get_stats | Get statistics for database <db-name> |
| documentdb_others_get_stats | Show me stats for DocumentDB database <db-name> |
| documentdb_database_drop_database | Drop database <db-name> |
| documentdb_database_drop_database | Delete the database <db-name> from DocumentDB |
| documentdb_database_list_databases | List all databases in DocumentDB |
| documentdb_database_list_databases | Show me all DocumentDB databases |
| documentdb_database_list_databases | Get details for database <db-name> in DocumentDB |

## Azure Event Grid

| Tool Name | Test Prompt |
Expand Down
1 change: 1 addition & 0 deletions servers/Azure.Mcp.Server/src/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@ private static IAreaSetup[] RegisterAreas()
new Azure.Mcp.Tools.AzureTerraformBestPractices.AzureTerraformBestPracticesSetup(),
new Azure.Mcp.Tools.Deploy.DeploySetup(),
new Azure.Mcp.Tools.DeviceRegistry.DeviceRegistrySetup(),
new Azure.Mcp.Tools.DocumentDb.DocumentDbSetup(),
new Azure.Mcp.Tools.EventGrid.EventGridSetup(),
new Azure.Mcp.Tools.Acr.AcrSetup(),
new Azure.Mcp.Tools.Advisor.AdvisorSetup(),
Expand Down
78 changes: 76 additions & 2 deletions servers/Azure.Mcp.Server/src/Resources/consolidated-tools.json
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@
},
{
"name": "get_azure_databases_details",
"description": "Comprehensive Azure database management tool for MySQL, PostgreSQL, SQL Database, SQL Server, and Cosmos DB. List and query databases, retrieve server configurations and parameters, explore table schemas, execute database queries, manage Cosmos DB containers and items, list and view detailed information about SQL servers, and view database server details across all Azure database services.",
"description": "Comprehensive Azure database management tool for MySQL, PostgreSQL, SQL Database, SQL Server, Cosmos DB, and Azure DocumentDB (MongoDB-compatible). List and query databases, retrieve server configurations and parameters, explore table schemas, execute database queries, manage Cosmos DB containers and items, inspect DocumentDB databases, indexes, statistics, and current operations, list and view detailed information about SQL servers, and view database server details across Azure database services.",
"toolMetadata": {
"destructive": {
"value": false,
Expand Down Expand Up @@ -178,7 +178,81 @@
"sql_db_get",
"sql_server_get",
"cosmos_list",
"cosmos_database_container_item_query"
"cosmos_database_container_item_query",
"documentdb_database_list_databases",
"documentdb_index_list_indexes",
"documentdb_others_current_ops",
"documentdb_others_get_stats"
]
},
{
"name": "sample_azure_documentdb_collection_documents",
"description": "Retrieve sample documents from Azure DocumentDB collections to inspect document structure and infer schema patterns for query authoring.",
"toolMetadata": {
"destructive": {
"value": false,
"description": "This tool performs only additive updates without deleting or modifying existing resources."
},
"idempotent": {
"value": false,
"description": "Running this operation multiple times with the same arguments may have additional effects or produce different results."
},
"openWorld": {
"value": false,
"description": "This tool's domain of interaction is closed and well-defined, limited to a specific set of entities."
},
"readOnly": {
"value": true,
"description": "This tool only performs read operations without modifying any state or data."
},
"secret": {
"value": false,
"description": "This tool does not handle sensitive or secret information."
},
"localRequired": {
"value": false,
"description": "This tool is available in both local and remote server modes."
}
},
"mappedToolList": [
"documentdb_collection_sample_documents"
]
},
{
"name": "edit_azure_documentdb_databases_and_collections",
"description": "Manage Azure DocumentDB databases, collections, and indexes. Create and drop indexes, rename or drop collections, and drop databases.",
"toolMetadata": {
"destructive": {
"value": true,
"description": "This tool may delete or modify existing resources in its environment."
},
"idempotent": {
"value": false,
"description": "Running this operation multiple times with the same arguments may have additional effects or produce different results."
},
"openWorld": {
"value": false,
"description": "This tool's domain of interaction is closed and well-defined, limited to a specific set of entities."
},
"readOnly": {
"value": false,
"description": "This tool may modify its environment by creating, updating, or deleting data."
},
"secret": {
"value": false,
"description": "This tool does not handle sensitive or secret information."
},
"localRequired": {
"value": false,
"description": "This tool is available in both local and remote server modes."
}
},
"mappedToolList": [
"documentdb_collection_drop_collection",
"documentdb_collection_rename_collection",
"documentdb_database_drop_database",
"documentdb_index_create_index",
"documentdb_index_drop_index"
]
},
{
Expand Down
6 changes: 6 additions & 0 deletions tools/Azure.Mcp.Tools.DocumentDb/src/AssemblyInfo.cs
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")]
Loading
Loading