Skip to content

[Onboard][Part Three] Mcp Server for Azure DocumentDB (Collection)#2050

Open
xingfan-git wants to merge 30 commits intomainfrom
users/xingfan/onboardingvcoremcp_collection
Open

[Onboard][Part Three] Mcp Server for Azure DocumentDB (Collection)#2050
xingfan-git wants to merge 30 commits intomainfrom
users/xingfan/onboardingvcoremcp_collection

Conversation

@xingfan-git
Copy link

@xingfan-git xingfan-git commented Mar 15, 2026

What does this PR do?

This PR added MCP tools for managing Azure DocumentDB (with MongoDB compatibility) database. It implements:

  • Drop collection
  • Rename collection
  • Sample documents from collection
  • Current operation (moved from previous index commands)
  • Get statistics (merging database, collection and index statistics into one command)

[Any additional context, screenshots, or information that helps reviewers]

Documentation:

Azure DocumentDB (with MongoDB compatibility) documentation

GitHub issue number?

[MCP Server Request] DocumentDB previously known as Azure Cosmos DB for MongoDB (vCore)

Pre-merge Checklist

  • Required for All PRs
    • Read contribution guidelines
    • PR title clearly describes the change
    • Commit history is clean with descriptive messages (cleanup guide)
    • Added comprehensive tests for new/modified functionality
    • Updated servers/Azure.Mcp.Server/CHANGELOG.md and/or servers/Fabric.Mcp.Server/CHANGELOG.md for product changes (features, bug fixes, UI/UX, updated dependencies)
  • For MCP tool changes:
    • One tool per PR: This PR adds or modifies only one MCP tool for faster review cycles
    • Updated servers/Azure.Mcp.Server/README.md and/or servers/Fabric.Mcp.Server/README.md documentation
    • Validate README.md changes using script at eng/scripts/Process-PackageReadMe.ps1. See Package README
    • Updated command list in /servers/Azure.Mcp.Server/docs/azmcp-commands.md and/or /docs/fabric-commands.md
    • Run .\eng\scripts\Update-AzCommandsMetadata.ps1 to update tool metadata in azmcp-commands.md (required for CI)
    • For new or modified tool descriptions, ran ToolDescriptionEvaluator and obtained a score of 0.4 or more and a top 3 ranking for all related test prompts
    • For tools with new names, including new tools or renamed tools, update consolidated-tools.json
    • For renamed tools, follow the Tool Rename Checklist and tag the PR with the breaking-change label
    • For new tools associated with Azure services or publicly available tools/APIs/products, add URL to documentation in the PR description
  • Extra steps for Azure MCP Server tool changes:
    • Updated test prompts in /servers/Azure.Mcp.Server/docs/e2eTestPrompts.md
    • 👉 For Community (non-Microsoft team member) PRs:
      • Security review: Reviewed code for security vulnerabilities, malicious code, or suspicious activities before running tests (crypto mining, spam, data exfiltration, etc.)
      • Manual tests run: added comment /azp run mcp - pullrequest - live to run Live Test Pipeline

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adds a new Azure MCP tool area for Azure DocumentDB (MongoDB compatibility), wiring it into the Azure MCP Server along with docs, packaging tweaks, and new unit/live test scaffolding.

Changes:

  • Introduces Azure.Mcp.Tools.DocumentDb with commands for index management, database management, collection operations, and diagnostics (get_stats, current_ops).
  • Adds DocumentDB unit tests, live tests, and test resource deployment scripts (bicep + post-deploy).
  • Updates Azure MCP Server registration/docs (command list, README, e2e prompts), consolidated tool mapping, and build info generation to disable trimming when MongoDB.Driver is present.

Reviewed changes

Copilot reviewed 60 out of 60 changed files in this pull request and generated 10 comments.

Show a summary per file
File Description
tools/Azure.Mcp.Tools.DocumentDb/tests/test-resources.bicep Deploys DocumentDB (Mongo vCore) test resources and outputs connection details.
tools/Azure.Mcp.Tools.DocumentDb/tests/test-resources-post.ps1 Post-deployment script to write test settings and optionally seed DB via mongosh.
tools/Azure.Mcp.Tools.DocumentDb/tests/Azure.Mcp.Tools.DocumentDb.UnitTests/Others/GetStatsCommandTests.cs Unit tests for get_stats command behavior and validation.
tools/Azure.Mcp.Tools.DocumentDb/tests/Azure.Mcp.Tools.DocumentDb.UnitTests/Others/CurrentOpsCommandTests.cs Unit tests for current_ops command.
tools/Azure.Mcp.Tools.DocumentDb/tests/Azure.Mcp.Tools.DocumentDb.UnitTests/Index/ListIndexesCommandTests.cs Unit tests for listing indexes.
tools/Azure.Mcp.Tools.DocumentDb/tests/Azure.Mcp.Tools.DocumentDb.UnitTests/Index/DropIndexCommandTests.cs Unit tests for dropping indexes.
tools/Azure.Mcp.Tools.DocumentDb/tests/Azure.Mcp.Tools.DocumentDb.UnitTests/Index/CreateIndexCommandTests.cs Unit tests for creating indexes.
tools/Azure.Mcp.Tools.DocumentDb/tests/Azure.Mcp.Tools.DocumentDb.UnitTests/Database/ListDatabasesCommandTests.cs Unit tests for listing/inspecting databases.
tools/Azure.Mcp.Tools.DocumentDb/tests/Azure.Mcp.Tools.DocumentDb.UnitTests/Database/DropDatabaseCommandTests.cs Unit tests for dropping databases.
tools/Azure.Mcp.Tools.DocumentDb/tests/Azure.Mcp.Tools.DocumentDb.UnitTests/Collection/SampleDocumentsCommandTests.cs Unit tests for sampling documents.
tools/Azure.Mcp.Tools.DocumentDb/tests/Azure.Mcp.Tools.DocumentDb.UnitTests/Collection/RenameCollectionCommandTests.cs Unit tests for renaming collections.
tools/Azure.Mcp.Tools.DocumentDb/tests/Azure.Mcp.Tools.DocumentDb.UnitTests/Collection/DropCollectionCommandTests.cs Unit tests for dropping collections.
tools/Azure.Mcp.Tools.DocumentDb/tests/Azure.Mcp.Tools.DocumentDb.UnitTests/Azure.Mcp.Tools.DocumentDb.UnitTests.csproj Adds the DocumentDB unit test project.
tools/Azure.Mcp.Tools.DocumentDb/tests/Azure.Mcp.Tools.DocumentDb.LiveTests/assets.json Adds assets metadata for live/recorded test infrastructure.
tools/Azure.Mcp.Tools.DocumentDb/tests/Azure.Mcp.Tools.DocumentDb.LiveTests/DocumentDbCommandTests.cs Adds end-to-end live tests for DocumentDB tools.
tools/Azure.Mcp.Tools.DocumentDb/tests/Azure.Mcp.Tools.DocumentDb.LiveTests/Azure.Mcp.Tools.DocumentDb.LiveTests.csproj Adds the DocumentDB live test project.
tools/Azure.Mcp.Tools.DocumentDb/src/Services/IDocumentDbService.cs Defines service surface for DocumentDB operations.
tools/Azure.Mcp.Tools.DocumentDb/src/Services/DocumentDbService.cs Implements MongoDB.Driver-based operations and response shaping.
tools/Azure.Mcp.Tools.DocumentDb/src/Options/SampleDocumentsOptions.cs Options model for sampling documents.
tools/Azure.Mcp.Tools.DocumentDb/src/Options/RenameCollectionOptions.cs Options model for renaming collections.
tools/Azure.Mcp.Tools.DocumentDb/src/Options/ListIndexesOptions.cs Options model for listing indexes.
tools/Azure.Mcp.Tools.DocumentDb/src/Options/ListDatabasesOptions.cs Options model for listing databases.
tools/Azure.Mcp.Tools.DocumentDb/src/Options/GetStatsOptions.cs Options model for stats retrieval.
tools/Azure.Mcp.Tools.DocumentDb/src/Options/DropIndexOptions.cs Options model for dropping an index.
tools/Azure.Mcp.Tools.DocumentDb/src/Options/DropDatabaseOptions.cs Options model for dropping a DB.
tools/Azure.Mcp.Tools.DocumentDb/src/Options/DropCollectionOptions.cs Options model for dropping a collection.
tools/Azure.Mcp.Tools.DocumentDb/src/Options/CurrentOpsOptions.cs Options model for current operations filter.
tools/Azure.Mcp.Tools.DocumentDb/src/Options/CreateIndexOptions.cs Options model for index creation.
tools/Azure.Mcp.Tools.DocumentDb/src/Options/BaseDocumentDbOptions.cs Base options including required connection string.
tools/Azure.Mcp.Tools.DocumentDb/src/Models/DocumentDbResponse.cs Unified service response DTO.
tools/Azure.Mcp.Tools.DocumentDb/src/GlobalUsings.cs Adds global System.CommandLine using.
tools/Azure.Mcp.Tools.DocumentDb/src/DocumentDbSetup.cs Registers services/commands and command groups for the new area.
tools/Azure.Mcp.Tools.DocumentDb/src/Commands/Others/GetStatsCommand.cs Implements get_stats tool, routing by --resource-type.
tools/Azure.Mcp.Tools.DocumentDb/src/Commands/Others/CurrentOpsCommand.cs Implements current_ops tool.
tools/Azure.Mcp.Tools.DocumentDb/src/Commands/Index/ListIndexesCommand.cs Implements list_indexes.
tools/Azure.Mcp.Tools.DocumentDb/src/Commands/Index/DropIndexCommand.cs Implements drop_index.
tools/Azure.Mcp.Tools.DocumentDb/src/Commands/Index/CreateIndexCommand.cs Implements create_index.
tools/Azure.Mcp.Tools.DocumentDb/src/Commands/DocumentDbOptionDefinitions.cs Centralizes System.CommandLine option definitions.
tools/Azure.Mcp.Tools.DocumentDb/src/Commands/DocumentDbJsonContext.cs Adds STJ source-gen context + response serialization helper.
tools/Azure.Mcp.Tools.DocumentDb/src/Commands/DocumentDbHelpers.cs BSON/JSON parsing helpers.
tools/Azure.Mcp.Tools.DocumentDb/src/Commands/Database/ListDatabasesCommand.cs Implements list_databases.
tools/Azure.Mcp.Tools.DocumentDb/src/Commands/Database/DropDatabaseCommand.cs Implements drop_database.
tools/Azure.Mcp.Tools.DocumentDb/src/Commands/Collection/SampleDocumentsCommand.cs Implements sample_documents.
tools/Azure.Mcp.Tools.DocumentDb/src/Commands/Collection/RenameCollectionCommand.cs Implements rename_collection.
tools/Azure.Mcp.Tools.DocumentDb/src/Commands/Collection/DropCollectionCommand.cs Implements drop_collection.
tools/Azure.Mcp.Tools.DocumentDb/src/Commands/BaseDocumentDbCommand.cs Base command wiring required connection-string option.
tools/Azure.Mcp.Tools.DocumentDb/src/Azure.Mcp.Tools.DocumentDb.csproj Adds new tool project + MongoDB.Driver dependency; disables trim analyzer.
tools/Azure.Mcp.Tools.DocumentDb/src/AssemblyInfo.cs Enables InternalsVisibleTo for unit tests.
servers/Azure.Mcp.Server/src/Resources/consolidated-tools.json Adds consolidated tool groupings for DocumentDB operations.
servers/Azure.Mcp.Server/src/Program.cs Registers the new DocumentDB area setup.
servers/Azure.Mcp.Server/docs/e2eTestPrompts.md Adds e2e test prompts for DocumentDB tools.
servers/Azure.Mcp.Server/docs/azmcp-commands.md Adds CLI command documentation for DocumentDB tools.
servers/Azure.Mcp.Server/changelog-entries/1773584979801.yaml Changelog entry for collection tool additions.
servers/Azure.Mcp.Server/changelog-entries/1773579786664.yaml Changelog entry for database tool additions.
servers/Azure.Mcp.Server/changelog-entries/1773124572664.yaml Changelog entry for index tool additions.
servers/Azure.Mcp.Server/README.md Adds DocumentDB example prompts to the server README.
servers/Azure.Mcp.Server/Azure.Mcp.Server.slnx Includes new DocumentDB projects in solution structure.
eng/scripts/New-BuildInfo.ps1 Detects MongoDB.Driver usage and disables trimming for affected server builds.
Directory.Packages.props Adds central version for MongoDB.Driver.
.github/CODEOWNERS Adds code owners/labels for the DocumentDB tool area.

@alzimmermsft alzimmermsft added the Do Not Merge Do Not Merge / WIP PRs label Mar 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Do Not Merge Do Not Merge / WIP PRs

Projects

Status: Untriaged

Development

Successfully merging this pull request may close these issues.

3 participants