Implement PyPI Account & Publishing Tools

Add comprehensive PyPI publishing and account management functionality:

Features:
- upload_package_to_pypi: Upload distributions to PyPI/TestPyPI with safety checks
- check_pypi_credentials: Validate API tokens and credentials
- get_pypi_upload_history: View upload history for packages with statistics
- delete_pypi_release: Safe release deletion with dry-run and confirmation
- manage_pypi_maintainers: Add/remove/list package maintainers
- get_pypi_account_info: View account details, quotas, and limits

Implementation:
- Created pypi_query_mcp/tools/publishing.py with all 6 functions
- Added PyPIPublishingClient for authenticated API operations
- Comprehensive error handling with custom exceptions
- Full async/await patterns following existing codebase conventions
- Safety checks for destructive operations (deletion requires confirmation)
- Support for both production PyPI and TestPyPI

Integration:
- Added publishing-specific exceptions to core/exceptions.py
- Updated tools/__init__.py with publishing function imports
- Added 6 MCP server endpoints to server.py with proper error handling
- Created comprehensive tests in tests/test_publishing.py

Production-ready code with proper authentication, validation, and safety measures.
This commit is contained in:
Ryan Malloy 2025-08-16 08:52:03 -06:00
parent e205176ace
commit 9f3fd459b3
5 changed files with 2170 additions and 0 deletions

View file

@ -21,6 +21,14 @@ from .package_query import (
query_package_info,
query_package_versions,
)
from .publishing import (
check_pypi_credentials,
delete_pypi_release,
get_pypi_account_info,
get_pypi_upload_history,
manage_pypi_maintainers,
upload_package_to_pypi,
)
from .search import (
find_alternatives,
get_trending_packages,
@ -44,4 +52,10 @@ __all__ = [
"search_by_category",
"find_alternatives",
"get_trending_packages",
"upload_package_to_pypi",
"check_pypi_credentials",
"get_pypi_upload_history",
"delete_pypi_release",
"manage_pypi_maintainers",
"get_pypi_account_info",
]