Skip to content

Commit 2ca4ae9

Browse files
authored
Add support for ACR (Azure Container Registry) and MCR (Microsoft Container Registry) (#754)
<!-- Provide a brief summary of your changes --> ## Motivation and Context Microsoft uses `mcr.microsoft.com` to host our public containers. These are syndicated to Docker Hub but image references use `mcr.microsoft.com` which is not currently supported by the Official MCP Registry. See #753. Microsoft teams want to use MCR-based images for Microsoft MCP servers. I believe we should be adding ACR support as well, so that our customers using Azure Container Registry can use the MCP Registry as well. In short, MCR is used for Microsoft managed containers. ACR is a solution for Azure customers to host their own containers. ## How Has This Been Tested? <!-- Have you tested this in a real application? Which scenarios were tested? --> Unit tests. Manual test: local push of a server.json with `mcr.microsoft.com/azure-sdk/azure-mcp:2.0.0-beta.1` and `azurearcjumpstart.azurecr.io/hello-arc:latest` in it. The error is now about missing annotation not unsupported OCI registry. ## Breaking Changes <!-- Will users need to update their code or configurations? --> No. ## Types of changes <!-- What types of changes does your code introduce? Put an `x` in all the boxes that apply: --> - [ ] Bug fix (non-breaking change which fixes an issue) - [x] New feature (non-breaking change which adds functionality) - [ ] Breaking change (fix or feature that would cause existing functionality to change) - [ ] Documentation update ## Checklist <!-- Go over all the following points, and put an `x` in all the boxes that apply. --> - [x] I have read the [MCP Documentation](https://modelcontextprotocol.io) - [x] My code follows the repository's style guidelines - [x] New and existing tests pass locally - [x] I have added appropriate error handling - [x] I have added or updated documentation as needed ## Additional context <!-- Add any other context, implementation notes, or design decisions -->
1 parent 32b37e7 commit 2ca4ae9

File tree

5 files changed

+28
-0
lines changed

5 files changed

+28
-0
lines changed

docs/guides/publishing/publish-server.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -317,6 +317,8 @@ The official MCP registry supports:
317317
- Docker Hub (`docker.io`)
318318
- GitHub Container Registry (`ghcr.io`)
319319
- Google Artifact Registry (any `*.pkg.dev` domain)
320+
- Azure Container Registry (`*.azurecr.io`)
321+
- Microsoft Container Registry (`mcr.microsoft.com`)
320322

321323
</details>
322324

docs/reference/faq.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,9 @@ This applies to both locally-run and remote servers.
6262
- NuGet.org (.NET packages)
6363
- GitHub Container Registry (GHCR)
6464
- Docker Hub
65+
- Google Artifact Registry (`*.pkg.dev` domains)
66+
- Azure Container Registry (`*.azurecr.io` domains)
67+
- Microsoft Container Registry (MCR)
6568

6669
More can be added as the community desires; feel free to open an issue if you are interested in building support for another registry.
6770

docs/reference/server-json/official-registry-requirements.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,8 @@ Only trusted public registries are supported. Private registries and alternative
4242
- Docker Hub (`docker.io`)
4343
- GitHub Container Registry (`ghcr.io`)
4444
- Google Artifact Registry (`*.pkg.dev`)
45+
- Azure Container Registry (`*.azurecr.io`)
46+
- Microsoft Container Registry (`mcr.microsoft.com`)
4547
- **MCPB**: `https://github.com` releases and `https://gitlab.com` releases only
4648

4749
## `_meta` Namespace Restrictions

internal/validators/registries/oci.go

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,10 @@ var allowedOCIRegistries = map[string]bool{
3333
"index.docker.io": true, // Docker Hub index
3434
// GitHub Container Registry
3535
"ghcr.io": true,
36+
// Microsoft Container Registry
37+
"mcr.microsoft.com": true,
3638
// Google Artifact Registry (*.pkg.dev pattern handled in isAllowedRegistry)
39+
// Azure Container Registry (*.azurecr.io pattern handled in isAllowedRegistry)
3740
}
3841

3942
// ValidateOCI validates that an OCI image contains the correct MCP server name annotation.
@@ -47,6 +50,7 @@ var allowedOCIRegistries = map[string]bool{
4750
// - Docker Hub (docker.io)
4851
// - GitHub Container Registry (ghcr.io)
4952
// - Google Artifact Registry (*.pkg.dev)
53+
// - Microsoft Container Registry (mcr.microsoft.com)
5054
func ValidateOCI(ctx context.Context, pkg model.Package, serverName string) error {
5155
if pkg.Identifier == "" {
5256
return ErrMissingIdentifierForOCI
@@ -149,5 +153,10 @@ func isAllowedRegistry(registry string) bool {
149153
return true
150154
}
151155

156+
// Azure Container Registry: *.azurecr.io
157+
if strings.HasSuffix(registry, ".azurecr.io") {
158+
return true
159+
}
160+
152161
return false
153162
}

internal/validators/registries/oci_test.go

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,18 @@ func TestValidateOCI_RegistryAllowlist(t *testing.T) {
5151
expectError: true,
5252
errorMsg: "missing required annotation",
5353
},
54+
{
55+
name: "MCR should be allowed",
56+
identifier: "mcr.microsoft.com/dotnet/aspire-dashboard:9.5.0",
57+
expectError: true,
58+
errorMsg: "missing required annotation",
59+
},
60+
{
61+
name: "ACR should be allowed",
62+
identifier: "azurearcjumpstart.azurecr.io/hello-arc:latest",
63+
expectError: true,
64+
errorMsg: "missing required annotation",
65+
},
5466

5567
// Disallowed registries
5668
{

0 commit comments

Comments
 (0)