Skip to content

Add support for pypi packages in the registry#392

Merged
cmrigney merged 10 commits intomainfrom
pypi-support
Feb 26, 2026
Merged

Add support for pypi packages in the registry#392
cmrigney merged 10 commits intomainfrom
pypi-support

Conversation

@cmrigney
Copy link
Contributor

@cmrigney cmrigney commented Feb 9, 2026

What I did

Adds basic support for pypi packages in the community registry.

  • It works by mapping the pypi type into a containerized server type snapshot, like oci images
  • Uses the ghcr.io/astral-sh/uv:python{version}-bookworm-slim image to run uvx.
  • Dependencies are cached in a named volume -> docker-mcp-uv-cache:/root/.cache/uv docker-mcp-uv-cache-<server_name>:/root/.cache/uv

You can try it with this example:

docker mcp profile create --name test --server https://registry.modelcontextprotocol.io/v0/servers/io.github.jztan%2Fpdf-mcp/versions/1.1.1

Related issue

(not mandatory) A picture of a cute animal, if possible in relation to what you did

@cmrigney cmrigney requested a review from a team as a code owner February 9, 2026 22:43
Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: a9700af87f

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Copy link
Collaborator

@slimslenderslacks slimslenderslacks left a comment

Choose a reason for hiding this comment

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

I have one question about this but I'll put it in Slack

)

const (
defaultPythonVersion = "3.14"
Copy link
Collaborator

Choose a reason for hiding this comment

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

bleeding edge, but that's probably the right posture.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This will probably get slightly annoying because we'll have to keep it up to date, but hard-coding it is a quick way to have it in lieu of a better mechanism.

allMatches := re.FindAllStringSubmatch(requiresPython, -1)

// If any >= or > constraint exists, the package supports newer versions — use latest
for _, m := range allMatches {
Copy link
Collaborator

Choose a reason for hiding this comment

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

do we need to test ~ versions

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yep, this is handled on line 105.

command = append(command, pkg.Identifier)

// Add uv cache volume
volumes = []string{"docker-mcp-uv-cache:/root/.cache/uv"}
Copy link
Collaborator

Choose a reason for hiding this comment

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

Just confirming here but this is always correct because the container we use here is always running as root.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Would you be able to verify that the second run will always be fast and will not need access to pypi? I'm just thinking about creating a profile, and then needing it to run at least once before going offline (for packages that don't otherwise need networks)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Confirmed!
CleanShot 2026-02-13 at 10 32 47@2x

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Also, just to confirm, online and already cached takes the same amount of time as offline and already cached.

jchangx
jchangx previously approved these changes Feb 18, 2026
}

// Match all operator-version pairs in the specifier
re := regexp.MustCompile(`(~=|==|!=|<=|>=|<|>)\s*(\d+)(?:\.(\d+))?`)
Copy link
Contributor

Choose a reason for hiding this comment

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

Probably don't need to compile this on every parse

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good point. Updated this.

@cmrigney cmrigney dismissed stale reviews from jchangx and slimslenderslacks via ba15d28 February 20, 2026 14:57
@cmrigney
Copy link
Contributor Author

cmrigney commented Feb 20, 2026

I made a few updates:

  1. Each pypi server gets its own volume: docker-mcp-uv-cache-<server_name>:/root/.cache/uv
  2. Added longLived to the pypi servers to avoid the uvx bootstrapping for every tool call.
  3. Added a hidden --include-pypi flag for when a catalog is created via --from-community-registry.

@cmrigney
Copy link
Contributor Author

@codex

Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 291d114d85

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@cmrigney cmrigney merged commit bf9a6e8 into main Feb 26, 2026
8 checks passed
@cmrigney cmrigney deleted the pypi-support branch February 26, 2026 15:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants