This guide explains how to publish the iTop MCP Server to PyPI.
- PyPI Account: Create accounts on both PyPI and TestPyPI
- API Tokens: Generate API tokens for both services
- uv configured: Configure uv with your credentials
Create or update your ~/.pypirc file:
[distutils]
index-servers =
pypi
testpypi
[pypi]
repository = https://upload.pypi.org/legacy/
username = __token__
password = <your-pypi-api-token>
[testpypi]
repository = https://test.pypi.org/legacy/
username = __token__
password = <your-testpypi-api-token># For TestPyPI
export UV_PUBLISH_TOKEN="pypi-your-testpypi-token-here"
# For PyPI (production)
export UV_PUBLISH_TOKEN="pypi-your-pypi-token-here"[publish.testpypi]
url = "https://test.pypi.org/legacy/"
password = "pypi-your-testpypi-token-here"
[publish.pypi]
password = "pypi-your-pypi-token-here"📋 See PYPI_TOKEN_SETUP.md for detailed token setup instructions
make buildThis will:
- Clean previous builds
- Build both wheel and source distribution
- Show the created files
make publish-testThis will:
- Build the package
- Upload to TestPyPI for testing
- Provide a link to check the uploaded package
# Install from TestPyPI to test
pip install --index-url https://test.pypi.org/simple/ itop-mcp
# Test the installation
itop-mcp --helpmake publishThis will:
- Build the package
- Ask for confirmation (since it's production)
- Upload to PyPI
- Provide a link to the live package
-
Update version in
pyproject.toml:version = "1.0.1"
-
Update version in
__init__.py:__version__ = "1.0.1"
-
Commit the changes:
git add pyproject.toml __init__.py git commit -m "bump: version 1.0.1" git tag v1.0.1 -
Build and publish:
make publish
- Package Name:
itop-mcp - Import Name: Import the main module directly
- Entry Point:
itop-mcpcommand (from main:main) - Python Support: 3.10+
- License: MIT
- Add PyPI installation instructions to README
- Update version badges if using any
- Document new features in CHANGELOG
# Create and push tag
git tag v1.0.0
git push origin v1.0.0
# Create GitHub release with changelog- Update project documentation
- Announce in relevant communities
- Add to awesome lists if applicable
-
Authentication Errors:
- Check API token is correct
- Ensure token has correct permissions
- Verify ~/.pypirc format
-
Package Name Conflicts:
- Package name must be unique on PyPI
- Check availability: https://pypi.org/project/itop-mcp/
-
Build Errors:
- Check pyproject.toml syntax
- Ensure all required files are included
- Verify dependencies are available
-
Upload Errors:
- Cannot upload same version twice
- Increment version number for new uploads
- Check file size limits
- Never commit API tokens to version control
- Use environment variables or secure credential storage
- Regularly rotate API tokens
- Use TestPyPI for testing uploads