Skip to main content
Glama
publish.pyโ€ข2.56 kB
#!/usr/bin/env python3 """ Script to help publish the PDF Manipulation MCP Server to PyPI. This script automates the process of building and publishing the package. """ import subprocess import sys import os from pathlib import Path def run_command(cmd, description): """Run a command and handle errors.""" print(f"๐Ÿ”„ {description}...") try: result = subprocess.run(cmd, shell=True, check=True, capture_output=True, text=True) print(f"โœ… {description} completed successfully") return result except subprocess.CalledProcessError as e: print(f"โŒ {description} failed:") print(f"Error: {e.stderr}") return None def main(): """Main function to build and publish the package.""" print("๐Ÿš€ PDF Manipulation MCP Server - PyPI Publisher") print("=" * 50) # Check if we're in the right directory if not Path("pyproject.toml").exists(): print("โŒ Error: pyproject.toml not found. Please run this script from the project root.") sys.exit(1) # Check if build tools are installed print("๐Ÿ” Checking build tools...") build_tools = ["build", "twine"] for tool in build_tools: result = run_command(f"pip show {tool}", f"Checking {tool}") if result is None: print(f"๐Ÿ“ฆ Installing {tool}...") run_command(f"pip install {tool}", f"Installing {tool}") # Clean previous builds print("๐Ÿงน Cleaning previous builds...") run_command("rm -rf dist/ build/ *.egg-info/", "Cleaning build artifacts") # Build the package print("๐Ÿ”จ Building package...") result = run_command("python -m build", "Building package") if result is None: print("โŒ Build failed. Please check the errors above.") sys.exit(1) # Check the built package print("๐Ÿ” Checking built package...") result = run_command("twine check dist/*", "Checking package") if result is None: print("โŒ Package check failed. Please fix the issues above.") sys.exit(1) print("\n๐ŸŽ‰ Package built successfully!") print("\nNext steps:") print("1. Test the package locally:") print(" pip install dist/*.whl") print("2. Upload to PyPI:") print(" twine upload dist/*") print("3. Or upload to Test PyPI first:") print(" twine upload --repository testpypi dist/*") print("\n๐Ÿ“‹ Package files created:") for file in Path("dist").glob("*"): print(f" - {file}") if __name__ == "__main__": main()

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/andr3medeiros/pdf-manipulation-mcp-server'

If you have feedback or need assistance with the MCP directory API, please join our Discord server