Ryan Malloy 9f3fd459b3 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.
2025-08-16 08:52:03 -06:00

62 lines
1.6 KiB
Python

"""MCP tools for PyPI package queries.
This package contains the FastMCP tool implementations that provide
the user-facing interface for PyPI package operations.
"""
from .compatibility_check import (
check_python_compatibility,
get_compatible_python_versions,
suggest_python_version_for_packages,
)
from .dependency_resolver import resolve_package_dependencies
from .download_stats import (
get_package_download_stats,
get_package_download_trends,
get_top_packages_by_downloads,
)
from .package_downloader import download_package_with_dependencies
from .package_query import (
query_package_dependencies,
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,
search_by_category,
search_packages,
)
__all__ = [
"query_package_info",
"query_package_versions",
"query_package_dependencies",
"check_python_compatibility",
"get_compatible_python_versions",
"suggest_python_version_for_packages",
"resolve_package_dependencies",
"download_package_with_dependencies",
"get_package_download_stats",
"get_package_download_trends",
"get_top_packages_by_downloads",
"search_packages",
"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",
]