
A security-focused Model Context Protocol (MCP) server that helps AI agents write safer Python code.
A security-focused Model Context Protocol (MCP) server that helps AI agents write safer Python code. Search packages, scan for vulnerabilities, audit dependencies, and ensure security across your entire Python project.
A security-focused Model Context Protocol (MCP) server that helps AI agents write safer Python code. Search packages, scan for vulnerabilities, audit dependencies, and ensure security across your entire Python project.
MCP-PyPI is a security-focused Model Context Protocol server that empowers AI assistants to write safer Python code. Beyond basic package information, it provides comprehensive vulnerability scanning, dependency auditing, and proactive security recommendations to ensure AI-generated code uses secure, up-to-date dependencies.
🛡️ Security First: Every tool is designed to encourage security best practices, from checking vulnerabilities before suggesting packages to scanning entire project dependency trees for hidden risks.
When AI assistants suggest Python packages, they might unknowingly recommend packages with known vulnerabilities. MCP-PyPI ensures that:
# Basic installation
pip install mcp-pypi
# With HTTP transport support
pip install "mcp-pypi[http]"
# With all features
pip install "mcp-pypi[all]"# Start with default stdio transport (for Claude Desktop)
mcp-pypi serve
# Alternative stdio command (for compatibility)
mcp-pypi stdio
# Start with HTTP transport
mcp-pypi serve --transport http
# With custom cache directory
mcp-pypi serve --cache-dir ~/.pypi-cacheAdd to your Claude Desktop configuration (claude.json):
{
"servers": {
"pypi": {
"command": "mcp-pypi",
"args": ["serve"],
"description": "Access Python package information from PyPI"
}
}
}
// Alternative using stdio command (equivalent to above)
{
"servers": {
"pypi": {
"command": "mcp-pypi",
"args": ["stdio"],
"description": "Access Python package information from PyPI"
}
}
}Add the MCP server to Claude Code:
# Add the server (using serve command)
claude mcp add mcp-pypi -- mcp-pypi serve
# Alternative using stdio command
claude mcp add mcp-pypi -- mcp-pypi stdio
# The server will be available in your next Claude Code sessionCursor IDE supports MCP servers through configuration files. You can configure mcp-pypi either globally (available in all projects) or per-project.
Cmd+, on Mac, Ctrl+, on Windows/Linux)Global Configuration (available in all projects):
| Platform | Location |
|---|---|
| macOS/Linux | ~/.cursor/mcp.json |
| Windows | C:\Users\YourUsername\.cursor\mcp.json |
Project Configuration (project-specific):
Create .cursor/mcp.json in your project root.
Add mcp-pypi to your mcp.json file:
{
"mcpServers": {
"mcp-pypi": {
"command": "mcp-pypi",
"args": ["serve"]
}
}
}With custom options:
{
"mcpServers": {
"mcp-pypi": {
"command": "mcp-pypi",
"args": ["serve", "--log-level", "DEBUG"],
"env": {
"PYPI_CACHE_DIR": "/path/to/cache"
}
}
}
}| Issue | Solution |
|---|---|
| Tools not appearing | Ensure Cursor is in Agent Mode, not Ask Mode |
| Server not starting | Check mcp-pypi is installed and in PATH |
| Configuration errors | Open Output panel (Cmd+Shift+U) and select "MCP Logs" |
| Server crashes | Toggle server off/on in Settings without removing config |
Once configured, you can ask Claude:
# Custom cache directory
export PYPI_CACHE_DIR=/path/to/cache
# Cache TTL (seconds)
export PYPI_CACHE_TTL=3600
# Vulnerability cache TTL (seconds) - default 1 hour
export PYPI_VULNERABILITY_CACHE_TTL=3600
# Custom user agent
export PYPI_USER_AGENT="MyApp/1.0"from mcp_pypi.server import PyPIMCPServer
from mcp_pypi.core.models import PyPIClientConfig
# Custom configuration
config = PyPIClientConfig(
cache_dir="/tmp/pypi-cache",
cache_ttl=7200,
cache_strategy="hybrid"
)
# Create and run server
server = PyPIMCPServer(config=config)
server.run(transport="http", host="0.0.0.0", port=8080)Vulnerability checks are cached to improve performance and reduce API load:
PYPI_VULNERABILITY_CACHE_TTL environment variable# Clear all caches
mcp-pypi cache clear
# View cache statistics
mcp-pypi cache stats
# Set shorter TTL for development (5 minutes)
export PYPI_VULNERABILITY_CACHE_TTL=300MCP-PyPI includes a full-featured command-line interface for direct package operations:
# Show version
mcp-pypi --version
# Display README documentation
mcp-pypi --readme
# Show changelog
mcp-pypi --changelog
# Get connection examples
mcp-pypi serve --help-connecting
mcp-pypi stdio --help-connecting# Search for packages
mcp-pypi search "web scraping"
# Get package info
mcp-pypi package info requests
# Check latest version
mcp-pypi package version django
# List all versions
mcp-pypi package releases numpy
# Get dependencies
mcp-pypi package dependencies flask
# Compare versions
mcp-pypi package compare pandas 2.0.0 2.1.0# Check requirements file
mcp-pypi check-requirements /path/to/requirements.txt
# View package statistics
mcp-pypi stats downloads requests# Clear cache
mcp-pypi cache clear
# View cache statistics
mcp-pypi cache statsConnection Issues with stdio
mcp-pypi in your configurationmcp-pypi stdio instead of mcp-pypi serve for better compatibility--log-level DEBUG for detailed error messagesToken Limit Errors
Cache Issues
mcp-pypi cache clear if you see stale data~/.cache/mcp-pypi/Import Errors
pip install "mcp-pypi[all]" for all dependenciesContributions are welcome! Please check out our Contributing Guide for details.
# Clone the repository
git clone https://github.com/kimasplund/mcp-pypi.git
cd mcp-pypi
# Install in development mode
pip install -e ".[dev]"
# Run tests
pytest
# Run with debug logging
mcp-pypi serve --log-level DEBUGThis project is dual-licensed:
Made with ❤️ for the Python and AI communities
Pick your client and paste the snippet. Each one is the same server, written the way that client expects it.
claude mcp add mcp-pypi -- mcp-pypi serve{
"mcpServers": {
"mcp-pypi": {
"args": [
"serve"
],
"command": "mcp-pypi"
}
}
}code --add-mcp '{"name":"mcp-pypi","args":["serve"],"command":"mcp-pypi"}'[mcp_servers.mcp-pypi]
command = "mcp-pypi"
args = ["serve"]Runs locally on your device. Your client starts the server itself, so nothing has to be hosted.
Paste this prompt into your agent. It reads this page and does the setup for you.
Read https://aiagentslisting.com/mcp/mcp-pypi to learn what the "Mcp Pypi" MCP server does and how to install it. Add it to my coding agent's MCP configuration as documented on that page, then confirm the server connects and list the tools it exposes.Agents can also browse this directory over MCP at https://aiagentslisting.com/api/mcp
claude mcp add mcp-pypi -- mcp-pypi serve
claude mcp add mcp-pypi -- mcp-pypi stdioThis server runs locally, so we can't read its tool list over the web yet.
Maintain this server? Claiming proves you own the listing and earns the last 4 points.
Claim this listingPaste this line near the top of your repository's README. The badge always renders the current score.
[](https://aiagentslisting.com/mcp/mcp-pypi)Nothing comparable is listed yet.
No tagged releases on record.
Connect to the AI Agents Listing MCP server at https://aiagentslisting.com/api/mcp using the HTTP transport and complete the sign-in when it asks. Then call the submit_review tool for the listing "mcp-pypi" with a rating from 1 to 5 and a short note on what worked and what did not.No reviews yet
Be the first to share your experience with this tool.
One email a week. New agents, MCP servers and skills, and what is actually getting traction.