References: GitHub Repo · Official Docs
| Capability | Azure MCP Server | Cosmos DB MCP Toolkit |
|---|---|---|
| Vector / semantic search | Not supported | Native — uses Azure OpenAI embeddings |
| Focus | Broad Azure surface | Purpose-built for Cosmos DB |
| Deployment | Local / stdio only | Azure Container App with managed identity |
| Authentication | CLI credential passthrough | Managed identity + Entra ID SSO |
text-embedding-3-small)az login authenticated)git clone https://github.com/AzureCosmosDB/MCPToolKit.git| Resource | Type |
|---|---|
mcp-toolkit-app-identity | User-assigned Managed Identity |
mcp-toolkit-env | Container Apps Environment |
mcp-toolkit-app | Container App |
The ACR is not included — you'll connect yours in Step 4.
| Parameter | Description | Example |
|---|---|---|
cosmosEndpoint | Cosmos DB endpoint | https://<account>.documents.azure.com:443/ |
aifProjectEndpoint | Azure OpenAI endpoint | https://<resource>.openai.azure.com/ |
embeddingDeploymentName | Embedding model name | text-embedding-3-small |
embeddingDimensions | Dimension size (0 for ada-002) | 1536 |
managedIdentityPrincipalIdmanagedIdentityClientIdcontainerAppUrlImportant: The Container App has two identities — a user-assigned ( mcp-toolkit-app-identity) and a system-assigned one Azure creates automatically. Always assign roles to the user-assigned identity. SinceAZURE_CLIENT_IDpoints to the user-assigned identity,DefaultAzureCredentialignores the system-assigned one entirely — roles on it have no effect.
Cosmos DB Account Reader → mcp-toolkit-app-identityThe portal IAM blade is control-plane only. Without this step you'll get 403 readMetadata errors even if 3B is done. Data-plane roles are invisible in the portal — use the CLI.
Role propagation can take 1–2 minutes.
Cognitive Services User → mcp-toolkit-app-identitymcp-toolkit-app in the Azure Portal.| Field | Value |
|---|---|
| Image source | Azure Container Registry |
| Authentication | Secrets |
| Registry | <acr-name>.azurecr.io |
| Image | cosmos-mcp |
| Image tag | latest |
| Name | Value |
|---|---|
COSMOS_ENDPOINT | https://<cosmos-account>.documents.azure.com:443/ |
OPENAI_ENDPOINT | https://<openai-resource>.openai.azure.com/ |
OPENAI_EMBEDDING_DEPLOYMENT | Your embedding model name |
OPENAI_EMBEDDING_DIMENSIONS | 0 for ada-002, or model dimension (e.g. 1536) |
ASPNETCORE_ENVIRONMENT | Production |
ASPNETCORE_URLS | http://+:8080 |
AZURE_CLIENT_ID | Managed identity client ID ← see note below |
AzureAd__TenantId | Entra app registration tenant ID |
AzureAd__Audience | Entra app registration client ID |
AzureAd__ClientId | Entra app registration client ID |
AZURE_CLIENT_ID= the managed identity's client ID (fromaz identity show --query clientId).AzureAd__ClientId= the Entra app registration client ID.These are different objects — mixing them up causes auth failures.
https://<container-app-url>/ → Single-page applicationhttps://<container-app-url>/signin-oidc → Single-page applicationhttps://<apim-ejento-url>/auth-service/api/v2/mcp-sso/azure/callbackapi://<client-id>| Field | Value |
|---|---|
| Scope name | access_as_user |
| Who can consent | Admins only |
| Admin consent display name | Access Azure Cosmos DB MCP Toolkit API as user |
| Admin consent description | Allows the app to access the API on behalf of the signed-in user |
| State | Enabled |
| Field | Value |
|---|---|
| Display name | MCP Tool Executor |
| Allowed member types | Users/Groups |
| Value | Mcp.Tool.Executor |
| Description | Grants permission to execute MCP tools |
| Enable | ✅ |
The MCP server checks for the exact value Mcp.Tool.Executor— it must match exactly.
access_as_user → AddUser.Read| Name | Value |
|---|---|
AzureAd__TenantId | <tenant-id> |
AzureAd__ClientId | <app-registration-client-id> |
AzureAd__Audience | <client-id> or api://<client-id> |
MCP Tool Executor role.| Check | How |
|---|---|
| Health | GET https://<container-app-url>/health → should return healthy |
| Test UI | Open https://<container-app-url>/ in a browser |
| MCP endpoint | POST /mcp with a bearer token |
| # | Step | Notes |
|---|---|---|
| 1 | Deploy Bicep template | Creates identity, env, container app |
| 2 | Build & push image | To your ACR |
| 3a | Cosmos: Account Reader | Optional, portal IAM |
| 3b | Cosmos: Data-plane RBAC | Required — CLI only. Role 00000000-0000-0000-0000-000000000001, scope / |
| 3c | OpenAI: Cognitive Services User | Portal IAM |
| 4 | Container App config | Registry (Secrets auth) + env vars + new revision |
| 5 | Entra ID auth | Optional — SPA platform, redirect URIs, app role, permissions, user assignment |
| 6 | CORS | --allowed-origins "*" |
| 7 | Test | /health healthy, test UI loads, MCP endpoint accepts token |
AZURE_CLIENT_ID is wrong or missing. Retrieve it: az identity show --query clientId and set it in the Container App env vars, then create a new revision.