- Home
- MCP servers
- PyPI Query
PyPI Query
- python
14
GitHub Stars
python
Language
6 months ago
First Indexed
2 months ago
Catalog Refreshed
Documentation & install
Readme and setup notes from the catalogue, plus a client-ready config you can copy for your MCP host.
Installation
Add the following to your MCP client configuration file.
Configuration
View docs{
"mcpServers": {
"loonghao-pypi-query-mcp-server": {
"command": "uvx",
"args": [
"--from",
"pypi-query-mcp-server",
"pypi-query-mcp"
],
"env": {
"PYPI_CACHE_TTL": "3600",
"PYPI_INDEX_URL": "https://pypi.org/pypi",
"PYPI_LOG_LEVEL": "INFO",
"PYPI_INDEX_URLS": "https://mirrors.aliyun.com/pypi/simple/,https://pypi.tuna.tsinghua.edu.cn/simple/",
"PYPI_EXTRA_INDEX_URLS": "https://test.pypi.org/simple/",
"PYPI_PRIVATE_PYPI_URL": "https://private.pypi.company.com",
"PYPI_DEPENDENCY_MAX_DEPTH": "5",
"PYPI_PRIVATE_PYPI_PASSWORD": "your_password",
"PYPI_PRIVATE_PYPI_USERNAME": "your_username",
"PYPI_ENABLE_SECURITY_ANALYSIS": "false",
"PYPI_DEPENDENCY_MAX_CONCURRENT": "10"
}
}
}
}You run a PyPI-focused MCP server that lets you query package information, analyze dependencies, check Python compatibility, download packages, and explore download trends. This server is designed to work with MCP clients to provide fast, asynchronous queries and rich analysis of Python packages from PyPI and private mirrors.
How to use
You connect to the PyPI Query MCP Server using an MCP client such as Claude Desktop, Cline, Cursor, or Windsurf. Once connected, you can ask for comprehensive package details, versions, and dependencies, verify Python compatibility, perform recursive dependency analysis, download packages with their dependencies, and fetch download statistics and trends. Use the available prompts and tools to compare packages, plan upgrades, audit security risks, and generate migration or update plans.
How to install
Prerequisites: you need Python and/or Node tooling depending on your chosen run method.
# Option 1: Run directly with uvx (recommended)
uvx pypi-query-mcp-server
# Or install and run with specific script
uvx --from pypi-query-mcp-server pypi-query-mcp
Option 2: Install from PyPI and run with Python (internal MCP server entry point)
pip install pypi-query-mcp-server
# Run the server
python -m pypi_query_mcp.server
Option 3: Build from source and run (if you prefer cloning)
git clone https://github.com/loonghao/pypi-query-mcp-server.git
cd pypi-query-mcp-server
uvx sync
uvx run pypi-query-mcp
Additional configuration and usage notes
Configure how you connect from clients by supplying MCP connection details and environment variables. The following are examples you can adapt for Claude Desktop, Cline, Cursor, or Windsurf. They set the index URLs, cache behavior, and credentials for private PyPI repositories when needed.
Configuration snippets for MCP clients
{
"mcpServers": {
"pypi-query": {
"command": "uvx",
"args": ["--from", "pypi-query-mcp-server", "pypi-query-mcp"],
"env": {
"PYPI_INDEX_URL": "https://pypi.org/pypi",
"PYPI_INDEX_URLS": "https://mirrors.aliyun.com/pypi/simple/,https://pypi.tuna.tsinghua.edu.cn/simple/",
"PYPI_CACHE_TTL": "3600",
"PYPI_LOG_LEVEL": "INFO"
}
}
}
}
Environment variables
Basic configuration covers how the server locates PyPI and how long it caches results. You can also enable private PyPI repositories, control dependency analysis depth, and adjust concurrency. The common variables below appear in setup instructions and examples.
Troubleshooting and notes
If you encounter network or authentication issues, verify that PYPI_INDEX_URL and any private credentials are set correctly. Ensure the runtime (uvx or Python) has access to the configured URLs and that any private repository credentials are valid. For slow dependencies or 429 responses, increase cache TTL or adjust index mirrors in your environment variables.
Examples of common tasks
- Get comprehensive package information for a package and all its versions.
- Analyze the full dependency tree for a package and resolve transitive requirements.
- Download a package with all dependencies to a local folder.
- Retrieve download statistics and identify trending packages over the last 180 days.
Security and prompts
The server provides templates to prompt analysis and decision-making, including quality analysis, compatibility checks, and migration planning. Use these templates to guide your investigations and ensure thorough coverage of dependency and security considerations.
Development status and licensing
Core functionality is implemented and ready for use, with ongoing improvements for private repository support and performance optimizations. The project is licensed under the MIT License.
Tools and capabilities overview
The server exposes a rich set of MCP tools to query package data, analyze dependencies, verify Python compatibility, download packages, and explore download statistics and trends. You can also use prompt templates to plan upgrades, audit security risks, and generate migration plans.
Available tools
get_package_info
Get comprehensive package information including name, version, description, and metadata.
get_package_versions
List all available versions for a given package.
get_package_dependencies
Analyze and return the dependency graph for a package.
check_package_python_compatibility
Check whether a package is compatible with a specified Python version.
get_package_compatible_python_versions
Return all Python versions a package supports.
resolve_dependencies
Recursively resolve all dependencies with detailed analysis.
download_package
Download a package and its dependencies to a local directory.
get_download_statistics
Provide download statistics for a package over a period.
get_download_trends
Analyze download trends over a specified time range.
get_top_downloaded_packages
List the most downloaded packages over a period.
analyze_package_quality
Generate prompts for assessing package quality.
compare_packages
Create prompts for comparing multiple packages.
suggest_alternatives
Generate prompts to find alternative packages.
resolve_dependency_conflicts
Generate prompts to resolve dependency conflicts.
plan_version_upgrade
Generate prompts for planning version upgrades.
audit_security_risks
Generate prompts for security risk auditing.
plan_package_migration
Generate migration plan prompts for package changes.
generate_migration_checklist
Create a migration checklist prompt.
analyze_environment_dependencies
Generate prompts to analyze environment dependencies.
check_outdated_packages
Generate prompts to check for outdated packages.
generate_update_plan
Create prompts for comprehensive update plans.
analyze_daily_trends
Generate prompts for analyzing daily PyPI download trends.
find_trending_packages
Generate prompts for discovering trending packages.
track_package_updates
Generate prompts for tracking recent package updates.