Skip to content

Conversation

@juan-abia
Copy link

@juan-abia juan-abia commented Dec 20, 2025

Add support for custom package index URLs to allow installing dependencies from private registries. The --index-url CLI option can be repeated multiple times to specify multiple indexes, which are tried in order before PyPI.

Changes:

  • Add --index-url CLI argument with action='append' for multiple indexes
  • Add index_urls parameter to run_mcp_server(), prepare_deno_env(), async_prepare_deno_env(), and code_sandbox()
  • Pass index_urls through Deno/TypeScript layer to micropip.install()
  • Update README with usage examples

Usage:
uvx mcp-run-python --index-url https://private.repo.com/simple --deps pkg stdio

Python API:
async with code_sandbox( dependencies=['pkg'], index_urls=['https://private.repo.com/simple'] ) as sandbox: await sandbox.eval('import pkg')

@juan-abia juan-abia force-pushed the feat/index-url-support branch from 79f12ac to 2e51c0b Compare December 20, 2025 21:29
@juan-abia juan-abia force-pushed the feat/index-url-support branch 3 times, most recently from d33a672 to 22eb651 Compare December 20, 2025 21:50
@DouweM DouweM self-assigned this Jan 12, 2026
@DouweM DouweM added the enhancement New feature or request label Jan 12, 2026
@juan-abia juan-abia force-pushed the feat/index-url-support branch 2 times, most recently from 1f09b30 to 553272c Compare January 13, 2026 14:07
Add support for custom package index URLs to allow installing dependencies
from private registries. The --index-url CLI option can be repeated multiple
times to specify multiple indexes, which are tried in order before PyPI.

Changes:
- Add --index-url CLI argument with action='append' for multiple indexes
- Add index_urls parameter to run_mcp_server(), prepare_deno_env(),
  async_prepare_deno_env(), and code_sandbox()
- Pass index_urls through Deno/TypeScript layer to micropip.install()
- Update README with usage examples

Usage:
  uvx mcp-run-python --index-url https://private.repo.com/simple --deps pkg stdio

Python API:
  async with code_sandbox(
      dependencies=['pkg'],
      index_urls=['https://private.repo.com/simple']
  ) as sandbox:
      await sandbox.eval('import pkg')
@juan-abia juan-abia force-pushed the feat/index-url-support branch from 553272c to 81e9179 Compare January 13, 2026 14:31
- Always pass indexUrls to prepare_env (even if empty), matching how dependencies are handled
- Add repeatable --dep flag alongside existing --deps for CLI consistency with --index-url
- Mark --deps as deprecated but keep it working for backwards compatibility
micropip treats empty list [] differently from None - with [] it doesn't
fall back to PyPI. Using 'index_urls or None' ensures empty lists are
converted to None so PyPI fallback works correctly.
--return-mode <xml/json> Return mode for output data (default: xml)`,
--port <port> Port to run the HTTP server on (default: 3001)
--deps <deps> Comma separated list of dependencies to install
--index-urls <urls> Comma separated list of package index URLs (tried in order before PyPI)
Copy link
Contributor

Choose a reason for hiding this comment

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

Slightly surprising they're not repeatable singular args here. I guess its not that important for these to be consistent, but see if you can make it so without too much effort

Copy link
Author

@juan-abia juan-abia Jan 14, 2026

Choose a reason for hiding this comment

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

This commit is my attempt at making it consistent!

- Update README.md examples to use --dep (repeatable) instead of --deps
- Hide --deps from CLI help (argparse.SUPPRESS)
- Add DeprecationWarning when --deps is used
- Keep --deps working for backwards compatibility
- Add --dep and --index-url as repeatable args in Deno CLI (using collect)
- Update Python main.py to pass --dep= and --index-url= instead of comma-separated
- Add deprecation warnings when --deps or --index-urls are used
- Update Deno help text to show new args
- Keep backwards compatibility for old comma-separated format
- Add test for repeatable --dep flag
- test_cli_dep_multiple: test multiple --dep flags (--dep numpy --dep pydantic)
- test_cli_dep_and_deps_combined: test combining --dep and --deps
- test_cli_deps_deprecation_warning: verify deprecation warning is emitted
console.warn('Warning: --deps is deprecated, use --dep instead (can be repeated)')
}
if (flags['index-urls']) {
console.warn('Warning: --index-urls is deprecated, use --index-url instead (can be repeated)')
Copy link
Contributor

Choose a reason for hiding this comment

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

We don't need this do we? 😄

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants