Prerequisites
Before publishing:- PyPI Account: Create accounts on:
- API Tokens: Generate API tokens:
-
Token Storage: Save tokens securely in files (never commit these!):
Building Packages
Before publishing, build all packages:- Iterates through all server directories in
src/ - Reads version information from
pyproject.toml - Updates
__init__.pywith project name and version - Runs
uv buildto create distribution packages - Creates
.whland.tar.gzfiles in each server’sdist/directory
Building a Specific Server
To build only one server:What Gets Built
For each server, the build process creates:- Wheel file:
oracle.my_service_mcp_server-1.0.0-py3-none-any.whl - Source distribution:
oracle.my_service_mcp_server-1.0.0.tar.gz
dist/ directory.
Publishing to Test PyPI
Why Test PyPI?
Always test your packages on Test PyPI before publishing to production. This allows you to:- Verify package metadata
- Test installation process
- Catch errors without polluting the production registry
- Validate version numbers
Publish to Test PyPI
- Reads your Test PyPI token from the file
- Publishes all built packages to https://test.pypi.org/legacy/
- Validates packages against https://test.pypi.org/simple/
Publish a Specific Server to Test PyPI
Verifying Test Packages
After publishing to Test PyPI, verify the installation:- Download the package from Test PyPI
- Install it in a temporary environment
- Run the server to verify it works
Testing in an MCP Client
Configure your MCP client to use the Test PyPI version:Publishing to Production PyPI
Publish to PyPI
- Reads your PyPI token from the file
- Publishes all built packages to https://upload.pypi.org/legacy/
- Validates packages against https://pypi.org/simple/
The
UV_PUBLISH_TOKEN differs for Test PyPI and PyPI. Make sure you’re using the correct token file.Publish a Specific Server to PyPI
Makefile Publishing Targets
test-publish Target
publish Target
Version Management
Updating Version Numbers
Version numbers are defined in each server’spyproject.toml:
Semantic Versioning
Follow Semantic Versioning (MAJOR.MINOR.PATCH):- MAJOR: Incompatible API changes
- MINOR: Add functionality (backwards-compatible)
- PATCH: Bug fixes (backwards-compatible)
Pre-release Versions
For testing, use pre-release version numbers:1.0.0a1- Alpha release 11.0.0b1- Beta release 11.0.0rc1- Release candidate 1
Publishing Workflow
Complete Release Process
- Update version in
pyproject.toml - Update changelog (if you maintain one)
- Run tests:
make lint && make test - Build packages:
make build - Test locally: Install and test the built package
- Publish to Test PyPI:
UV_PUBLISH_TOKEN=$(cat ~/.testpypi-token) make test-publish - Verify on Test PyPI:
uv run --index=https://test.pypi.org/simple oracle.my-service-mcp-server - Get approval: Follow contribution guidelines
- Publish to PyPI:
UV_PUBLISH_TOKEN=$(cat ~/.pypi-token) make publish - Tag release:
git tag v1.0.0 && git push origin v1.0.0 - Announce: Update documentation and notify users
Troubleshooting
Package Already Exists
Error:File already exists
Solution: You cannot overwrite a published version. Increment the version number in pyproject.toml and rebuild.
Invalid Token
Error:Invalid or non-existent authentication information
Solution:
- Verify token is correct
- Check token hasn’t expired
- Ensure you’re using the right token (Test PyPI vs PyPI)
- Regenerate token if necessary
Build Files Not Found
Error:No files found to publish
Solution: Run make build before attempting to publish.
Incorrect Package Name
Error:Invalid package name
Solution: Verify the name field in pyproject.toml follows the correct format: oracle.service-name-mcp-server
Best Practices
- Always test first: Use Test PyPI before production
- Version carefully: Follow semantic versioning
- Document changes: Keep a changelog
- Test installations: Verify packages work after publishing
- Secure tokens: Never commit API tokens
- Review metadata: Check PyPI page after publishing
- Coordinate releases: Communicate with team members
- Tag releases: Use git tags for tracking versions
PyPI Package Pages
After publishing, your packages will be available at:- Test PyPI:
https://test.pypi.org/project/oracle.my-service-mcp-server/ - PyPI:
https://pypi.org/project/oracle.my-service-mcp-server/
- Description renders correctly
- Links work
- Classifiers are appropriate
- Version number is correct
- Author information is accurate
