Skip to content

feat: add pip-installable MCP server support (#80) - #85

Merged
troylar merged 4 commits into
mainfrom
issue-80-pip-mcp-servers
Feb 22, 2026
Merged

feat: add pip-installable MCP server support (#80)#85
troylar merged 4 commits into
mainfrom
issue-80-pip-mcp-servers

Conversation

@troylar

@troylar troylar commented Feb 22, 2026

Copy link
Copy Markdown
Owner

Summary

  • Add pip package detection, validation, and installation for MCP server dependencies during devsync install
  • Auto-detect pip packages from MCP server commands (python -m, uvx, console_scripts)
  • Thread pip_package field through extraction pipeline, manifest format, and LLM prompts
  • Add --skip-pip flag for users who want to manage dependencies manually

Changes

Core

  • devsync/core/pip_utils.py — New module with validate_pip_spec(), is_pip_installed(), get_installed_version(), resolve_pip_package_for_command(), find_pip_executable(), install_pip_package(). Allowlist-based validation, comprehensive error handling for every pip failure mode, Python 3.10+ compatible
  • devsync/core/practice.py — Add pip_package: Optional[str] field to MCPDeclaration with validation in __post_init__, to_dict(), from_dict()
  • devsync/core/component_detector.py — Add pip_package to DetectedMCPServer, auto-resolve from command/args during detection
  • devsync/core/extractor.py — Thread pip_package through both AI and no-AI extraction paths

CLI

  • devsync/cli/main.py — Add --skip-pip flag to install command
  • devsync/cli/install_v2.py — Add _install_pip_dependencies() with interactive prompts: already-installed detection, user confirmation, spinner during install, success/failure messaging

LLM

  • devsync/llm/prompts.py — Add pip_package to EXTRACT_MCP_PROMPT output specification

Tests

  • tests/unit/core/test_pip_utils.py — 33 tests covering validation, detection, resolution, installation, and all error paths
  • tests/unit/core/test_practice.py — 8 new tests for pip_package field roundtrip and validation
  • tests/unit/core/test_extractor.py — 2 new tests for pip_package propagation
  • tests/unit/cli/test_install_v2.py — 7 new tests for _install_pip_dependencies branches

Docs

  • CLAUDE.md — Document pip_utils.py module and --skip-pip flag
  • README.md — Add MCP server dependencies feature to features list

Issue References

Closes #80

Test Plan

  • Unit tests pass: invoke test-unit (1554 passed)
  • Lint passes: ruff check clean
  • Format passes: black --check clean
  • Type check passes: mypy clean
  • Manual: devsync install ./test-package with pip_package: mcp-server-fetch>=0.1 — verify prompt, install, error handling
  • Manual: --skip-pip flag skips all pip installations
  • Manual: Already-installed packages are detected and skipped
  • Manual: Invalid pip specs are rejected gracefully

Security Considerations

  • validate_pip_spec() uses allowlist regex — rejects URLs, file paths, shell metacharacters
  • All subprocess calls use list form (shell=False) — no command injection
  • pip specs flow through MCPDeclaration.__post_init__ validation before reaching install_pip_package()
  • No credentials stored in manifests or installation records

Vision Alignment

Supports zero-friction distribution: pip-installable MCP servers are detected and offered for installation interactively. Users maintain full control via --skip-pip flag. No new external dependencies added — uses only stdlib (subprocess, importlib.metadata).


Generated with Claude Code

Add pip_utils module for validating, detecting, and installing pip
packages required by MCP servers. Thread pip_package field through
MCPDeclaration, component detection, extraction pipeline, and LLM
prompts. Add --skip-pip flag to install command and pip dependency
installation step with user prompting and error handling.
@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

@github-actions

Copy link
Copy Markdown

📊 Code Quality Report

Linting Issues

All checks passed!

@github-actions

github-actions Bot commented Feb 22, 2026

Copy link
Copy Markdown

Coverage report

Click to see where and how coverage changed

FileStatementsMissingCoverageCoverage
(new stmts)
Lines missing
  devsync/cli
  install_v2.py 82, 86, 138, 150-156, 217, 276-291, 343
  main.py 163-173
  devsync/core
  component_detector.py 468, 486
  extractor.py
  pip_utils.py 128-130, 192-194, 202, 217-221, 226-230, 287
  practice.py 146
  devsync/llm
  prompts.py
Project Total  

This report was generated by python-coverage-comment-action

@codecov

codecov Bot commented Feb 22, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 88.15166% with 25 lines in your changes missing coverage. Please review.
✅ Project coverage is 84.63%. Comparing base (33379e5) to head (a4ddbe9).
⚠️ Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
devsync/core/pip_utils.py 89.65% 15 Missing ⚠️
devsync/cli/install_v2.py 82.00% 9 Missing ⚠️
devsync/core/component_detector.py 87.50% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main      #85      +/-   ##
==========================================
+ Coverage   84.44%   84.63%   +0.19%     
==========================================
  Files          75       76       +1     
  Lines        6202     6403     +201     
==========================================
+ Hits         5237     5419     +182     
- Misses        965      984      +19     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

- Add installed_version_satisfies() for proper version constraint checking
- Add uvx validation via validate_pip_spec()
- Track failed pip installs and skip their credential prompting
- Move imports to module level (pip_utils, practice, tests)
- Fix _find_distribution_for_script to continue on missing dist
- Add typed parameters (list[str], list[MCPDeclaration])
- Add tests for installed_version_satisfies and return values
@github-actions

Copy link
Copy Markdown

📊 Code Quality Report

Linting Issues

All checks passed!

@troylar
troylar merged commit 78b9bf0 into main Feb 22, 2026
22 of 24 checks passed
@troylar
troylar deleted the issue-80-pip-mcp-servers branch February 22, 2026 14:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add pip-installable MCP server support to packages

1 participant