-
Notifications
You must be signed in to change notification settings - Fork 555
feat(oci): GHCR support + private auth; tests and docs #511
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(oci): GHCR support + private auth; tests and docs #511
Conversation
Add GHCR (ghcr.io) compatibility to OCI validator Implement robust auth resolution: Per-host token envs (e.g., MCP_REGISTRY_OCI_TOKEN_GHCR_IO) Mapping var MCP_REGISTRY_OCI_REGISTRY_AUTH GITHUB_TOKEN fallback for ghcr.io Optional MCP_REGISTRY_OCI_GHCR_USERNAME + PAT; exchange PAT→Bearer via ghcr.io/token (service=ghcr.io, scope=repository:<ns>/<repo>:pull), prefer Bearer over Basic Broaden Accept headers for manifests/config; propagate auth to follow-up requests Support multi-segment repository paths (e.g., owner/sub/repo) Allow skipping label check via MCP_REGISTRY_OCI_SKIP_LABEL_VALIDATION (test-only) Tests: Mocked HTTP: single-arch, multi-arch, missing label, auth header GHCR integration test gated by GHCR_TEST_IMAGE/TAG (+ server name or skip) Optional E2E docker test (OCI_E2E_RUN) that login/pull/run, execs into container (os-release, uname), and cleans up; controllable via OCI_E2E_RUN_ARGS and OCI_E2E_CMD Docs: README markdown lint fixes and GHCR/private auth env guidance Closes modelcontextprotocol#498
…/registry into feat/private-ghcr
…/registry into feat/private-ghcr
|
GHCR was added here: #439 Does that solve your need here? If not, could you please explain more about the intent behind this PR? |
|
GHCR was only added there for public GHCR registries, my PR apart of working for private registries, solves the mocked tests, cause it actually test e2e pulling the image from a private GHCR, run it and exec a command inside the running container to get the OS info @tadasant |
|
@claude Can you review this? |
|
@copilot review this too please |
|
@domdomegg sorry but I saw the number of contribution lines and I also needed to add you |
rdimitrov
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey, thanks a lot for identifying this gap 👍 I just had a quick look, so apologies if my feedback is a bit incomplete:
- To get started I’d recommend keeping things simple and generic so we can streamline the implementation to support bearer token authentication and have better chances this gets merged
- Right now the changes feel a bit all over the place and more like a rewrite whereas it might be better to align more closely with the existing design.
- The tests could use some improvements, i.e switching from
ifandfatalto proper assertions. - I also noticed a few unrelated lines being modified which might be worth revisiting
- Commit descriptions could use some love too
The overall goal looks great 👍 I’d just suggest spending a bit more time polishing the details and refining the design so it’s more solid 👍
|
Can we talk about the premise here a bit first please --
Do we need to support private GHCR registries? We've already decided we won't support private GitHub repos, so it's not clear to me what the use case is for private containers. |
|
After reviewing this more closely it became clear that the docs might not have fully explained what’s considered open vs. closed source and how that relates to public vs. private MCP servers (likely causing some confusion here on me too). We’ve clarified the reasoning and expanded the explanation in the FAQ: https://github.com/modelcontextprotocol/registry/blob/main/docs/reference/faq.md#can-i-publish-a-private-server That said we'll close the PR since private registries are out of scope for this project. Thank you! 🙏 |
|
Wooow amazing feedback @rdimitrov!!! Many thanks for the positive vibes, and sorry for my informal way, and there was a test that I know I've messed and moved into another file, and for sure will solve all 'fatal' to the correct assertions. Today in the afternoon I'll take some time to solve the issues so we can have a fresh iteration!! GoGo! DEVS |
|
@marcpradas-IAG - hey 👋 I think you might have missed my last comment but it won't be necessary to iterate on this since we clarified that supporting private registries is not in the scope of the registry project. |
|
Oh I haven't seen the next messages, sorry to hear that @tadasant and @rdimitrov don't want to disturb anymore but just to give a bit of context why we needed that: From IAG we are willing to be able to use MCP from a long time ago, but we assessed the security of the connectivity layer between some agentic tools and MCP servers and we found many possibilities of infection threat or data leakage. Example: Then we analyzed the different possibilities of installing MCP servers (uv, npm, docker, locally...), seeing the scenario and within our context and we thought that any server could be wrapped into a docker image (one that we control and where we can add observability and so) and we also knew how to store this images in GHCR, this brought us to the next point which is a private GHCR also will use the same authentication credentials than Github, so that will solve all our problems. |
|
@marcpradas-IAG - thanks for the context 🙏 Totally understand why you’d want to wrap MCP servers into Docker images you control and host them in GHCR 😃 It gives you the control, observability and security guarantees you need. This registry though is meant as a community-driven public good instance so for your case a private MCP registry you manage directly would be the better fit 👍 |




Follow-up PR: OCI Validator Enhancements (Issue #498)
This PR builds on the GHCR compatibility branch and delivers a more robust OCI image validation flow plus developer ergonomics for testing and CI.
Highlights
GHCR authentication flow
MCP_REGISTRY_OCI_GHCR_USERNAMEBasic exchange to obtain a repository-scoped Bearer tokenGITHUB_TOKENautomatically forghcr.iowhen availableHeader standardization
Multi-arch image handling
Label validation with test toggle
MCP_REGISTRY_OCI_SKIP_LABEL_VALIDATION=1Auth discovery and environment variables
MCP_REGISTRY_OCI_TOKEN_GHCR_IO,MCP_REGISTRY_OCI_TOKEN_DOCKER_IOMCP_REGISTRY_OCI_REGISTRY_AUTH="host=token,..."(e.g.ghcr.io=<token>,docker.io=<token>)docker.io(API host isregistry-1.docker.io)Test-only base URL override
MCP_REGISTRY_OCI_TEST_BASE_URLfor mocking registry endpoints in unit testsDeveloper diagnostics
MCP_REGISTRY_OCI_DEBUG=1prints non-sensitive debug traces: auth source selection, GHCR exchange path, header decisionsTests
Docs & Lint
Notes
MCP_REGISTRY_OCI_GHCR_USERNAMEenables exchange of PAT to Bearer; otherwise, token is used as Bearer directly