You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
PR #2895 added Azure OpenAI endpoint validation to the cosmos_database_container_item_vector-search tool. The --openai-endpoint parameter now performs a strict allowlist check before any service call:
The endpoint must use HTTPS (HTTP is rejected with 400).
The endpoint hostname must be a trusted Azure first-party domain: *.openai.azure.com, *.cognitiveservices.azure.com, *.services.ai.azure.com, or their US Government / China sovereign cloud equivalents.
Any endpoint that does not match a trusted Azure cloud domain is rejected with a 400 Bad Request before the service is called.
Previously the parameter accepted any URI value; tests used `(aoai.example/redacted) as a placeholder, which would now be rejected.
Gaps Found
The azmcp-commands.md description for azmcp cosmos database container item vector-search says only "Provide --openai-endpoint and --embedding-deployment" with no mention of the trusted-domain or HTTPS requirements. Users who supply a non-Azure endpoint (e.g. an on-premises proxy or a custom URL) will receive a cryptic 400 error with no guidance from the docs.
The parameter placeholder --openai-endpoint (endpoint) gives no hint that the value is restricted; it should indicate a trusted Azure OpenAI or AI Foundry endpoint (e.g. --openai-endpoint (azure-openai-endpoint)), and the comment block should note the HTTPS + trusted-domain constraint.
Files to Update
servers/Azure.Mcp.Server/docs/azmcp-commands.md
Context
Current documentation comment block (line ~114453):
# Vector similarity search against a Cosmos DB container. Provide --search-text plus --openai-endpoint and# --embedding-deployment; the tool generates the query vector via Azure OpenAI and runs the search against the# configured vector index. Optionally, provide --embedding-dimensions to request a specific number for models that# support custom dimensions like "text-embedding-3-small" or "text-embedding-3-large". Optionally pass# --properties-to-select to project specific fields; when omitted the full document is returned with the vector# property stripped so the embedding doesn't bloat the response. Requires a vector index on the vector property.# ❌ Destructive | ✅ Idempotent | ❌ OpenWorld | ✅ ReadOnly | ❌ Secret | ❌ LocalRequired
azmcp cosmos database container item vector-search --subscription <subscription> \
--account <account> \
--database <database> \
--container <container> \
--vector-property <vector-property> \
--search-text "free-form text" \
--openai-endpoint <endpoint> \
--embedding-deployment <deployment> \
[--properties-to-select <p1,p2,...>] \
[--count 10] \
[--embedding-dimensions <n>]
Relevant diff showing the new validation logic added in the command:
+ private static void ValidateOpenAIEndpoint(string? endpoint, System.CommandLine.Parsing.CommandResult result)+ {+ if (string.IsNullOrWhiteSpace(endpoint))+ {+ result.AddError("--openai-endpoint is required.");+ return;+ }++ // Accept the endpoint if it is valid for any supported cloud.+ foreach (var cloud in s_openAIEndpointClouds)+ {+ foreach (var serviceType in s_openAIEndpointServiceTypes)+ {+ try+ {+ EndpointValidator.ValidateAzureServiceEndpoint(endpoint, serviceType, cloud);+ return;+ }+ catch (Exception ex) when (ex is SecurityException or ArgumentException) { }+ }+ }++ result.AddError(+ $"The provided Azure OpenAI endpoint is not a trusted Azure OpenAI, Cognitive Services, or AI Foundry endpoint for the configured Azure cloud. The value '{endpoint}' is not allowed.");+ }
📐 Implementation Guide
This section contains step-by-step instructions for a coding agent to implement the changes described above.
Step 1: Modify files
File:servers/Azure.Mcp.Server/docs/azmcp-commands.md Action: Edit the Cosmos vector-search command comment block to:
Update the --openai-endpoint placeholder from <endpoint> to <azure-openai-endpoint> to signal it is not a generic URL.
Add a note in the comment block stating that --openai-endpoint must be a trusted Azure first-party HTTPS endpoint.
Replace the current block:
# Vector similarity search against a Cosmos DB container. Provide --search-text plus --openai-endpoint and# --embedding-deployment; the tool generates the query vector via Azure OpenAI and runs the search against the# configured vector index. Optionally, provide --embedding-dimensions to request a specific number for models that# support custom dimensions like "text-embedding-3-small" or "text-embedding-3-large". Optionally pass# --properties-to-select to project specific fields; when omitted the full document is returned with the vector# property stripped so the embedding doesn't bloat the response. Requires a vector index on the vector property.# ❌ Destructive | ✅ Idempotent | ❌ OpenWorld | ✅ ReadOnly | ❌ Secret | ❌ LocalRequired
azmcp cosmos database container item vector-search --subscription <subscription> \
--account <account> \
--database <database> \
--container <container> \
--vector-property <vector-property> \
--search-text "free-form text" \
--openai-endpoint <endpoint> \
--embedding-deployment <deployment> \
[--properties-to-select <p1,p2,...>] \
[--count 10] \
[--embedding-dimensions <n>]
With:
# Vector similarity search against a Cosmos DB container. Provide --search-text plus --openai-endpoint and# --embedding-deployment; the tool generates the query vector via Azure OpenAI and runs the search against the# configured vector index. Optionally, provide --embedding-dimensions to request a specific number for models that# support custom dimensions like "text-embedding-3-small" or "text-embedding-3-large". Optionally pass# --properties-to-select to project specific fields; when omitted the full document is returned with the vector# property stripped so the embedding doesn't bloat the response. Requires a vector index on the vector property.# --openai-endpoint must be a trusted Azure first-party HTTPS endpoint on one of the following domains:# *.openai.azure.com, *.cognitiveservices.azure.com, *.services.ai.azure.com# (and their US Government / China sovereign cloud equivalents). HTTP endpoints and non-Azure domains are rejected.# ❌ Destructive | ✅ Idempotent | ❌ OpenWorld | ✅ ReadOnly | ❌ Secret | ❌ LocalRequired
azmcp cosmos database container item vector-search --subscription <subscription> \
--account <account> \
--database <database> \
--container <container> \
--vector-property <vector-property> \
--search-text "free-form text" \
--openai-endpoint <azure-openai-endpoint> \
--embedding-deployment <deployment> \
[--properties-to-select <p1,p2,...>] \
[--count 10] \
[--embedding-dimensions <n>]
Step 2: Verify documentation structure
Verify the updated servers/Azure.Mcp.Server/docs/azmcp-commands.md still follows the expected format — the Cosmos DB section should remain inside ## Azure Cosmos DB Operations with a single fenced bash code block containing all cosmos commands.
Step 3: Validate
Run these commands in order:
dotnet build servers/Azure.Mcp.Server/ — confirms the server project compiles cleanly
dotnet build tools/Azure.Mcp.Tools.Cosmos/src/ — confirms the affected toolset compiles
dotnet test tools/Azure.Mcp.Tools.Cosmos/tests/Azure.Mcp.Tools.Cosmos.Tests/ --filter "TestType!=Live" — runs unit tests for the Cosmos toolset
.\eng\common\spelling\Invoke-Cspell.ps1 — checks spelling in the modified documentation
Next Steps
Tip
Ready for automated implementation? Assign this issue to @copilot to have Copilot coding agent implement the changes described in the Implementation Guide above
Documentation Gap
Server:
Azure.Mcp.ServerTool directory:
tools/Azure.Mcp.Tools.CosmosTriggered by: commit bb0f8ab / PR #2895 by
@vcolin7Changed files:
tools/Azure.Mcp.Tools.Cosmos/src/Commands/Item/ItemVectorSearchCommand.cstools/Azure.Mcp.Tools.Cosmos/src/Services/CosmosService.csWhat Changed
PR #2895 added Azure OpenAI endpoint validation to the
cosmos_database_container_item_vector-searchtool. The--openai-endpointparameter now performs a strict allowlist check before any service call:*.openai.azure.com,*.cognitiveservices.azure.com,*.services.ai.azure.com, or their US Government / China sovereign cloud equivalents.400 Bad Requestbefore the service is called.Previously the parameter accepted any URI value; tests used `(aoai.example/redacted) as a placeholder, which would now be rejected.
Gaps Found
azmcp-commands.mddescription forazmcp cosmos database container item vector-searchsays only "Provide--openai-endpointand--embedding-deployment" with no mention of the trusted-domain or HTTPS requirements. Users who supply a non-Azure endpoint (e.g. an on-premises proxy or a custom URL) will receive a cryptic 400 error with no guidance from the docs.--openai-endpoint (endpoint)gives no hint that the value is restricted; it should indicate a trusted Azure OpenAI or AI Foundry endpoint (e.g.--openai-endpoint (azure-openai-endpoint)), and the comment block should note the HTTPS + trusted-domain constraint.Files to Update
servers/Azure.Mcp.Server/docs/azmcp-commands.mdContext
Current documentation comment block (line ~114453):
Relevant diff showing the new validation logic added in the command:
📐 Implementation Guide
This section contains step-by-step instructions for a coding agent to implement the changes described above.
Step 1: Modify files
File:
servers/Azure.Mcp.Server/docs/azmcp-commands.mdAction: Edit the Cosmos vector-search command comment block to:
--openai-endpointplaceholder from<endpoint>to<azure-openai-endpoint>to signal it is not a generic URL.--openai-endpointmust be a trusted Azure first-party HTTPS endpoint.Replace the current block:
With:
Step 2: Verify documentation structure
Verify the updated
servers/Azure.Mcp.Server/docs/azmcp-commands.mdstill follows the expected format — the Cosmos DB section should remain inside## Azure Cosmos DB Operationswith a single fenced bash code block containing all cosmos commands.Step 3: Validate
Run these commands in order:
dotnet build servers/Azure.Mcp.Server/— confirms the server project compiles cleanlydotnet build tools/Azure.Mcp.Tools.Cosmos/src/— confirms the affected toolset compilesdotnet test tools/Azure.Mcp.Tools.Cosmos/tests/Azure.Mcp.Tools.Cosmos.Tests/ --filter "TestType!=Live"— runs unit tests for the Cosmos toolset.\eng\common\spelling\Invoke-Cspell.ps1— checks spelling in the modified documentationNext Steps
Tip
Ready for automated implementation? Assign this issue to
@copilotto have Copilot coding agent implement the changes described in the Implementation Guide above