pypi-query-mcp-server

loonghao/pypi-query-mcp-server

3.4

If you are the rightful owner of pypi-query-mcp-server and would like to certify it and/or have it hosted online, please leave a comment on the right or send an email to henry@mcphub.com.

A Model Context Protocol (MCP) server for querying PyPI package information, dependencies, and compatibility checking.

Tools

Functions exposed to the LLM to take actions

get_package_info

Query comprehensive information about a PyPI package.

This tool retrieves detailed information about a Python package from PyPI, including metadata, description, author information, dependencies, and more.

Args: package_name: The name of the PyPI package to query (e.g., 'requests', 'django')

Returns: Dictionary containing comprehensive package information including: - Basic metadata (name, version, summary, description) - Author and maintainer information - License and project URLs - Python version requirements - Dependencies and classifiers - Version history summary

Raises: InvalidPackageNameError: If package name is empty or invalid PackageNotFoundError: If package is not found on PyPI NetworkError: For network-related errors

get_package_versions

Get version information for a PyPI package.

This tool retrieves comprehensive version information for a Python package, including all available versions, release details, and distribution formats.

Args: package_name: The name of the PyPI package to query (e.g., 'requests', 'numpy')

Returns: Dictionary containing version information including: - Latest version and total version count - List of all available versions (sorted) - Recent versions with release details - Distribution format information (wheel, source)

Raises: InvalidPackageNameError: If package name is empty or invalid PackageNotFoundError: If package is not found on PyPI NetworkError: For network-related errors

get_package_dependencies

Get dependency information for a PyPI package.

This tool retrieves comprehensive dependency information for a Python package, including runtime dependencies, development dependencies, and optional dependencies.

Args: package_name: The name of the PyPI package to query (e.g., 'django', 'flask') version: Specific version to query (optional, defaults to latest version)

Returns: Dictionary containing dependency information including: - Runtime dependencies and development dependencies - Optional dependency groups - Python version requirements - Dependency counts and summary statistics

Raises: InvalidPackageNameError: If package name is empty or invalid PackageNotFoundError: If package is not found on PyPI NetworkError: For network-related errors

check_package_python_compatibility

Check if a package is compatible with a specific Python version.

This tool analyzes a package's Python version requirements and determines if it's compatible with your target Python version.

Args: package_name: The name of the PyPI package to check (e.g., 'django', 'requests') target_python_version: Target Python version to check (e.g., '3.9', '3.10.5', '3.11') use_cache: Whether to use cached package data (default: True)

Returns: Dictionary containing detailed compatibility information including: - Compatibility status (True/False) - Source of compatibility information (requires_python or classifiers) - Detailed analysis and suggestions - Package version requirements

Raises: InvalidPackageNameError: If package name is empty or invalid PackageNotFoundError: If package is not found on PyPI NetworkError: For network-related errors

get_package_compatible_python_versions

Get all Python versions compatible with a package.

This tool analyzes a package and returns which Python versions are compatible with it, along with recommendations.

Args: package_name: The name of the PyPI package to analyze (e.g., 'numpy', 'pandas') python_versions: List of Python versions to check (optional, defaults to common versions) use_cache: Whether to use cached package data (default: True)

Returns: Dictionary containing compatibility information including: - List of compatible Python versions - List of incompatible versions with reasons - Compatibility rate and recommendations - Package version requirements

Raises: InvalidPackageNameError: If package name is empty or invalid PackageNotFoundError: If package is not found on PyPI NetworkError: For network-related errors

resolve_dependencies

Resolve all dependencies for a PyPI package recursively.

This tool performs comprehensive dependency resolution for a Python package, analyzing the complete dependency tree including transitive dependencies.

Args: package_name: The name of the PyPI package to analyze (e.g., 'pyside2', 'django') python_version: Target Python version for dependency filtering (e.g., '3.10', '3.11') include_extras: List of extra dependency groups to include (e.g., ['dev', 'test']) include_dev: Whether to include development dependencies (default: False) max_depth: Maximum recursion depth for dependency resolution (default: 5)

Returns: Dictionary containing comprehensive dependency analysis including: - Complete dependency tree with all transitive dependencies - Dependency categorization (runtime, development, extras) - Package metadata for each dependency - Summary statistics and analysis

Raises: InvalidPackageNameError: If package name is empty or invalid PackageNotFoundError: If package is not found on PyPI NetworkError: For network-related errors

download_package

Download a PyPI package and all its dependencies to local directory.

This tool downloads a Python package and all its dependencies, providing comprehensive package collection for offline installation or analysis.

Args: package_name: The name of the PyPI package to download (e.g., 'pyside2', 'requests') download_dir: Local directory to download packages to (default: './downloads') python_version: Target Python version for compatibility (e.g., '3.10', '3.11') include_extras: List of extra dependency groups to include (e.g., ['dev', 'test']) include_dev: Whether to include development dependencies (default: False) prefer_wheel: Whether to prefer wheel files over source distributions (default: True) verify_checksums: Whether to verify downloaded file checksums (default: True) max_depth: Maximum dependency resolution depth (default: 5)

Returns: Dictionary containing download results including: - Download statistics and file information - Dependency resolution results - File verification results - Success/failure summary for each package

Raises: InvalidPackageNameError: If package name is empty or invalid PackageNotFoundError: If package is not found on PyPI NetworkError: For network-related errors

get_download_statistics

Get download statistics for a PyPI package.

This tool retrieves comprehensive download statistics for a Python package, including recent download counts, trends, and analysis.

Args: package_name: The name of the PyPI package to analyze (e.g., 'requests', 'numpy') period: Time period for recent downloads ('day', 'week', 'month', default: 'month') use_cache: Whether to use cached data for faster responses (default: True)

Returns: Dictionary containing download statistics including: - Recent download counts (last day/week/month) - Package metadata and repository information - Download trends and growth analysis - Data source and timestamp information

Raises: InvalidPackageNameError: If package name is empty or invalid PackageNotFoundError: If package is not found on PyPI NetworkError: For network-related errors

get_download_trends

Get download trends and time series for a PyPI package.

This tool retrieves detailed download trends and time series data for a Python package, providing insights into download patterns over the last 180 days.

Args: package_name: The name of the PyPI package to analyze (e.g., 'django', 'flask') include_mirrors: Whether to include mirror downloads in analysis (default: False) use_cache: Whether to use cached data for faster responses (default: True)

Returns: Dictionary containing download trends including: - Time series data for the last 180 days - Trend analysis (increasing/decreasing/stable) - Peak download periods and statistics - Average daily downloads and growth indicators

Raises: InvalidPackageNameError: If package name is empty or invalid PackageNotFoundError: If package is not found on PyPI NetworkError: For network-related errors

get_top_downloaded_packages

Get the most downloaded PyPI packages.

This tool retrieves a list of the most popular Python packages by download count, helping you discover trending and widely-used packages in the Python ecosystem.

Args: period: Time period for download ranking ('day', 'week', 'month', default: 'month') limit: Maximum number of packages to return (default: 20, max: 50)

Returns: Dictionary containing top packages information including: - Ranked list of packages with download counts - Package metadata and repository links - Period and ranking information - Data source and limitations

Note: Due to API limitations, this tool provides results based on known popular packages. For comprehensive data analysis, consider using Google BigQuery with PyPI datasets.

Prompts

Interactive templates invoked by user choice

analyze_package_quality_prompt

Generate a comprehensive quality analysis prompt for a PyPI package.

compare_packages_prompt

Generate a detailed comparison prompt for multiple PyPI packages.

suggest_alternatives_prompt

Generate a prompt for finding package alternatives.

resolve_dependency_conflicts_prompt

Generate a prompt for resolving dependency conflicts.

plan_version_upgrade_prompt

Generate a prompt for planning package version upgrades.

audit_security_risks_prompt

Generate a prompt for security risk auditing of packages.

plan_package_migration_prompt

Generate a comprehensive package migration plan prompt.

generate_migration_checklist_prompt

Generate a detailed migration checklist prompt.

analyze_environment_dependencies_prompt

Generate a prompt for analyzing environment dependencies.

check_outdated_packages_prompt

Generate a prompt for checking outdated packages.

generate_update_plan_prompt

Generate a prompt for creating package update plans.

analyze_daily_trends_prompt

Generate a prompt for analyzing daily PyPI trends.

find_trending_packages_prompt

Generate a prompt for finding trending packages.

track_package_updates_prompt

Generate a prompt for tracking recent package updates.

Resources

Contextual data attached and managed by the client

No resources