package-query
Query the latest package versions from PyPI, npm, crates.io, Docker Hub, and GitHub Actions — directly from Python or as an MCP server for AI agents.
Installation
# Core library only
uv pip install package-query
# With MCP server support
uv pip install "package-query[mcp]"
Python Usage
from asyncio import run
from package_query import PackageQuery, PackageInfo
async def main():
pq = PackageQuery()
# Single query — format_pinned() returns the registry-native pinning format
info: PackageInfo = await pq.query("pypi", "requests")
print(info.format_pinned()) # [pypi] requests==2.32.3
info = await pq.query("npm", "express")
print(info.format_pinned()) # [npm] express@5.2.1
info = await pq.query("github-actions", "actions/checkout")
print(info.format_pinned()) # [github-actions] actions/checkout@v4
# Batch query — all resolved concurrently
packages = [
{"registry": "pypi", "package": "flask"},
{"registry": "npm", "package": "typescript"},
{"registry": "crates", "package": "tokio"},
{"registry": "docker", "package": "nginx"},
{"registry": "github-actions", "package": "actions/setup-python"},
]
results = await pq.query_batch(packages)
print(pq.format_batch(packages, results))
# [pypi] flask==3.1.1
# [npm] typescript@5.8.3
# [crates] tokio = "=1.45.0"
# [docker] nginx:stable-alpine3.23
# [github-actions] actions/setup-python@v5
run(main())
Output Format
Each registry uses its ecosystem-standard version-pinning format, prefixed with [registry]:
| Registry | Format | Example |
|---|---|---|
pypi |
[pypi] name==version |
[pypi] requests==2.32.3 |
npm |
[npm] name@version |
[npm] express@5.2.1 |
crates |
[crates] name = "=version" |
[crates] serde = "=1.0.228" |
docker |
[docker] name:tag |
[docker] nginx:stable-alpine3.23 |
github-actions |
[github-actions] owner/repo@tag |
[github-actions] actions/checkout@v4 |
Supported Registries
| Registry | Example Package |
|---|---|
pypi |
requests |
npm |
express |
crates |
serde |
docker |
nginx |
github-actions |
actions/checkout |
MCP Server
The MCP server allows AI agents (Claude, Copilot, Cursor, etc.) to query package versions without web search.
Running the Server
# If installed with [mcp] extra
package-query-mcp
# Or from source
uv run --extra mcp package-query-mcp
IDE Configuration
VS Code / Cursor
Add to your settings.json:
{
"mcp": {
"servers": {
"package-query": {
"command": "uvx",
"args": ["--from", "package-query[mcp]", "package-query-mcp"]
}
}
}
}
Or if installed globally:
{
"mcp": {
"servers": {
"package-query": {
"command": "package-query-mcp"
}
}
}
}
Claude Desktop
Add to ~/.config/Claude/claude_desktop_config.json (Linux) or equivalent:
{
"mcpServers": {
"package-query": {
"command": "uvx",
"args": ["--from", "package-query[mcp]", "package-query-mcp"]
}
}
}
Antigravity IDE
Add to ~/.gemini/antigravity/mcp_config.json:
{
"mcpServers": {
"package-query": {
"command": "uvx",
"args": ["--from", "package-query[mcp]", "package-query-mcp"]
}
}
}
Available Tools
| Tool | Description |
|---|---|
get_package_version |
Get the latest version of a single package |
get_package_versions |
Get versions for multiple packages in one call (recommended) |
get_package_version
registry(string): One ofpypi,npm,crates,docker,github-actionspackage(string): Package name (e.g."requests","actions/checkout")include_prerelease(bool, optional): Include pre-release versions
Returns a single line like [pypi] requests==2.32.3.
get_package_versions (batch — preferred)
packages(list): Array of objects with"registry"and"package"keysinclude_prerelease(bool, optional): Apply to all queries
All queries run concurrently. Returns one line per package:
[pypi] requests==2.32.3
[npm] express@5.2.1
[crates] serde = "=1.0.228"
[docker] nginx:stable-alpine3.23
[github-actions] actions/checkout@v4
[pypi] nonexistent: error: Package 'nonexistent' not found on PyPI
Development
# Clone and install all dependencies
git clone https://github.com/henrique-coder/package-query.git
cd package-query
uv sync --upgrade --all-groups --all-extras
just lint
just format
License
This project is licensed under the MIT License - see the LICENSE file for details.
Metadata
Release files for package-query 0.1.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| package_query-0.1.2.tar.gz | 9.8 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| package_query-0.1.2-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 25.0 kB
Release files / package_query-0.1.2.tar.gz
| Download URL | package_query-0.1.2.tar.gz |
|---|---|
| Size | 9.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
269e49c228d886f2e356bffabcd9be52de5f1e93cb276c65efbf8dd1444408f3
|
|
BLAKE2b-256 checksum How to use checksums |
44dbd614ade751f6b134ee123ba66380b128d570f0a3e63dac812401a30fffb3
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.11.14 {"installer":{"name":"uv","version":"0.11.14","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Release files / package_query-0.1.2-py3-none-any.whl
| Download URL | package_query-0.1.2-py3-none-any.whl |
|---|---|
| Size | 15.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
1c07bfcfe93e03283d258a34f90403ae9a859a7064a3144da67137f76ca0508d
|
|
BLAKE2b-256 checksum How to use checksums |
b1d7ec12ade42b79373956d305d3d083b08d11755378c7ecb1815bcd54c7219a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.11.14 {"installer":{"name":"uv","version":"0.11.14","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|