Get the FREE Ultimate OpenClaw Setup Guide →

pypi-query

A Model Context Protocol (MCP) server for Python package intelligence, providing structured queries for PyPI packages and GitHub repositories. Features include dependency analysis, version tracking, and package metadata retrieval for LLM interactions.

Installation
Run this command in your terminal to add the MCP server to Claude Code.
Run in terminal:
Command
claude mcp add --transport stdio loonghao-pypi-query-mcp-server uvx --from pypi-query-mcp-server pypi-query-mcp \
  --env PYPI_CACHE_TTL="3600" \
  --env PYPI_INDEX_URL="https://pypi.org/pypi" \
  --env PYPI_LOG_LEVEL="INFO" \
  --env PYPI_INDEX_URLS=""

How to use

The PyPI Query MCP Server provides a comprehensive tooling surface for interacting with PyPI data through the MCP framework. It can query package metadata, list versions, analyze dependencies, check Python compatibility, and perform advanced dependency analyses including recursive resolution. It also supports downloading packages with their dependencies, collecting download statistics and trends, and presenting results through MCP prompt templates for guided decision-making. Use the available MCP tools to inspect packages, compare versions, resolve dependency graphs, and generate structured prompts for analysis or migration planning. Typical workflows include querying a package's info, checking compatible Python versions, resolving dependencies for installation planning, and optionally downloading the package with its dependencies for local analysis or offline use.

How to install

Prerequisites:

  • Python (>= 3.8) or a runtime environment capable of running MCP servers
  • Node.js is not required for this server since uvx (Python) is the recommended runner
  • Access to install and run uvx or install via PyPI

Option A: Run with uvx (recommended)

  1. Install the MCP server via uvx:
uvx --from pypi-query-mcp-server pypi-query-mcp
  1. Run the server directly (if you have the package available in the environment):
uvx pypi-query-mcp-server
  1. Or specify the exact command as demonstrated in the configuration:
uvx --from pypi-query-mcp-server pypi-query-mcp

Option B: Install from PyPI and run with Python

  1. Install the package from PyPI:
pip install pypi-query-mcp-server
  1. Run the server:
python -m pypi_query_mcp.server

Option C: From source

  1. Clone the repository and install dependencies, then run with uvx as shown in the README:
git clone https://github.com/loonghao/pypi-query-mcp-server.git
cd pypi-query-mcp-server
uv sync
uv run pypi-query-mcp

Additional notes

Environment variables control indexing, caching, and security checks. Common options include:

  • PYPI_INDEX_URL: Primary PyPI index URL (default: https://pypi.org/pypi)
  • PYPI_CACHE_TTL: Cache duration in seconds (default: 3600)
  • PYPI_LOG_LEVEL: Logging level (default: INFO)
  • PYPI_INDEX_URLS: Additional mirror sources (comma-separated)
  • PYPI_PRIVATE_PYPI_URL / PYPI_PRIVATE_PYPI_USERNAME / PYPI_PRIVATE_PYPI_PASSWORD: Optional private PyPI configuration

Tips:

  • If you rely on private packages, configure PYPI_PRIVATE_PYPI_URL and credentials to enable private index access.
  • Adjust PYPI_DEPENDENCY_MAX_DEPTH and concurrency settings to tune performance for large dependency graphs.
  • Use the available MCP tools for automated prompt generation (e.g., analyze_package_quality, resolve_dependencies) to guide decisions.
  • Ensure network access to configured PyPI indices; behind proxies may require additional environment variables.

Related MCP Servers

Sponsor this space

Reach thousands of developers