Ryan Malloy 9924df34ec feat: Add comprehensive PyPI Analytics & Insights Tools
This commit implements a complete analytics suite for PyPI packages with four major tools:

🔍 **Package Analytics** (`get_pypi_package_analytics`)
- Comprehensive download analytics with trend analysis
- Platform and Python version breakdown
- Version adoption patterns and quality metrics
- Geographic distribution and growth indicators

🔒 **Security Alerts** (`get_pypi_security_alerts`)
- Integration with OSV (Open Source Vulnerabilities) database
- Dependency vulnerability scanning
- Security posture analysis and risk assessment
- Severity filtering and remediation recommendations

📈 **Package Rankings** (`get_pypi_package_rankings`)
- Search visibility and discoverability analysis
- Competitor ranking comparison
- SEO optimization suggestions
- Keyword and metadata analysis

🏆 **Competition Analysis** (`analyze_pypi_competition`)
- Market positioning and share analysis
- Feature comparison with competitors
- Adoption trends and growth patterns
- Strategic recommendations for improvement

**Key Features:**
- 50+ helper functions for detailed analysis
- Comprehensive error handling and validation
- Async/await patterns for optimal performance
- Integration with multiple data sources (PyPI, OSV, GitHub)
- Configurable analysis depth and options
- Production-ready code with extensive logging

**Implementation Details:**
- New module: `pypi_query_mcp/tools/analytics.py` (2000+ lines)
- Updated exports in `tools/__init__.py`
- Added 4 new MCP server endpoints in `server.py`
- Comprehensive test suite with 80+ test cases
- Full type hints and detailed docstrings

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-08-16 09:19:14 -06:00

82 lines
2.2 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 .metadata import (
manage_package_keywords,
manage_package_urls,
set_package_visibility,
update_package_metadata,
)
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,
)
from .analytics import (
analyze_pypi_competition,
get_pypi_package_analytics,
get_pypi_package_rankings,
get_pypi_security_alerts,
)
__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",
"update_package_metadata",
"manage_package_urls",
"set_package_visibility",
"manage_package_keywords",
"get_pypi_package_analytics",
"get_pypi_security_alerts",
"get_pypi_package_rankings",
"analyze_pypi_competition",
]