feat: add pip-installable MCP server support (#80) - #85
Merged
Conversation
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.
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
📊 Code Quality ReportLinting Issues |
Coverage reportClick to see where and how coverage changed
This report was generated by python-coverage-comment-action |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Codecov Report❌ Patch coverage is
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. 🚀 New features to boost your workflow:
|
- 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
📊 Code Quality ReportLinting Issues |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
devsync installpython -m,uvx, console_scripts)pip_packagefield through extraction pipeline, manifest format, and LLM prompts--skip-pipflag for users who want to manage dependencies manuallyChanges
Core
devsync/core/pip_utils.py— New module withvalidate_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+ compatibledevsync/core/practice.py— Addpip_package: Optional[str]field toMCPDeclarationwith validation in__post_init__,to_dict(),from_dict()devsync/core/component_detector.py— Addpip_packagetoDetectedMCPServer, auto-resolve from command/args during detectiondevsync/core/extractor.py— Threadpip_packagethrough both AI and no-AI extraction pathsCLI
devsync/cli/main.py— Add--skip-pipflag toinstallcommanddevsync/cli/install_v2.py— Add_install_pip_dependencies()with interactive prompts: already-installed detection, user confirmation, spinner during install, success/failure messagingLLM
devsync/llm/prompts.py— Addpip_packagetoEXTRACT_MCP_PROMPToutput specificationTests
tests/unit/core/test_pip_utils.py— 33 tests covering validation, detection, resolution, installation, and all error pathstests/unit/core/test_practice.py— 8 new tests forpip_packagefield roundtrip and validationtests/unit/core/test_extractor.py— 2 new tests for pip_package propagationtests/unit/cli/test_install_v2.py— 7 new tests for_install_pip_dependenciesbranchesDocs
CLAUDE.md— Documentpip_utils.pymodule and--skip-pipflagREADME.md— Add MCP server dependencies feature to features listIssue References
Closes #80
Test Plan
invoke test-unit(1554 passed)ruff checkcleanblack --checkcleanmypycleandevsync install ./test-packagewithpip_package: mcp-server-fetch>=0.1— verify prompt, install, error handling--skip-pipflag skips all pip installationsSecurity Considerations
validate_pip_spec()uses allowlist regex — rejects URLs, file paths, shell metacharacterssubprocesscalls use list form (shell=False) — no command injectionMCPDeclaration.__post_init__validation before reachinginstall_pip_package()Vision Alignment
Supports zero-friction distribution: pip-installable MCP servers are detected and offered for installation interactively. Users maintain full control via
--skip-pipflag. No new external dependencies added — uses only stdlib (subprocess,importlib.metadata).Generated with Claude Code