Skip to main content

An MCP server that converts text to PDF and provides various PDF manipulation tools - developed by ofbahar

Project description

ofbahar PDF Converter

An MCP (Model Context Protocol) server that provides various PDF manipulation tools. This project allows you to create, merge, encrypt PDFs and more through a simple interface - developed by ofbahar.

Features

  • Text to PDF Conversion

    • Convert text to PDF with formatting options
    • Custom font, size, and color support
    • Rich text formatting capabilities
  • PDF Manipulation

    • Merge multiple PDFs
    • Encrypt PDFs with password protection
    • Extract text from PDFs
    • Add images to PDFs
    • Compress PDFs
    • Update PDF metadata

Prerequisites

  • Python 3.12 or higher
  • uv package manager

Installation

  1. Clone the repository:
git clone https://github.com/ofbahar/pdf_converter.git
cd pdf_converter
  1. Create a virtual environment and install dependencies:
uv venv
uv pip install -e .

Configuration

Claude Desktop Configuration

Location

  • On MacOS: ~/Library/Application\ Support/Claude/claude_desktop_config.json
  • On Windows: %APPDATA%/Claude/claude_desktop_config.json
Development/Unpublished Servers Configuration
{
  "mcpServers": {
    "ofbahar_pdf_converter": {
      "command": "uv",
      "args": [
        "--directory",
        "C:\\Users\\OmerFarukBAHAR(ADEO)\\Desktop\\Proje\\CTICrawler\\MCPDevelopment\\pdf_converter",
        "run",
        "ofbahar_pdf_converter"
      ]
    }
  }
}
Published Servers Configuration
{
  "mcpServers": {
    "ofbahar_pdf_converter": {
      "command": "uvx",
      "args": [
        "ofbahar_pdf_converter"
      ]
    }
  }
}

Environment Variables

  • PDF_OUTPUT_DIR: Specify output directory for PDFs (optional)
  • Default output directory: output_pdfs in current working directory

Usage Examples

Example Operations

  1. Creating a PDF:
Create a PDF with the text "Hello World"
  1. Formatting Text:
Create a PDF with formatted text using Helvetica font, size 14, and red color
  1. Merging PDFs:
Merge file1.pdf and file2.pdf into merged.pdf
  1. Encrypting PDFs:
Encrypt document.pdf with password "secure123"
  1. Extracting Text:
Extract text from document.pdf
  1. Updating Metadata:
Update metadata of document.pdf with title "My Document" and author "ofbahar"

Development

Building and Publishing

  1. Sync dependencies and update lockfile:
uv sync
  1. Build package distributions:
uv build

This will create source and wheel distributions in the dist/ directory.

  1. Publish to PyPI:
uv publish

Note: You'll need to set PyPI credentials via environment variables or command flags:

  • Token: --token or UV_PUBLISH_TOKEN
  • Or username/password: --username/UV_PUBLISH_USERNAME and --password/UV_PUBLISH_PASSWORD

Debugging

Since MCP servers run over stdio, debugging can be challenging. For the best debugging experience, we strongly recommend using the MCP Inspector.

You can launch the MCP Inspector via npm with this command:

npx @modelcontextprotocol/inspector uv --directory C:\Users\OmerFarukBAHAR(ADEO)\Desktop\Proje\CTICrawler\MCPDevelopment\pdf_converter run ofbahar-pdf-converter

Upon launching, the Inspector will display a URL that you can access in your browser to begin debugging.

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

License

This project is licensed under the MIT License - see the LICENSE file for details.

Author

  • Ömer Faruk BAHAR - Initial work - ofbahar

Acknowledgments

  • Built with Python MCP Server SDK
  • Uses ReportLab and PyPDF2 for PDF operations

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ofbahar_pdf_converter-0.1.1.tar.gz (16.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

ofbahar_pdf_converter-0.1.1-py3-none-any.whl (6.4 kB view details)

Uploaded Python 3

File details

Details for the file ofbahar_pdf_converter-0.1.1.tar.gz.

File metadata

File hashes

Hashes for ofbahar_pdf_converter-0.1.1.tar.gz
Algorithm Hash digest
SHA256 bc887efd6704380f970048269c799c079afe052f6d4e0d4a5ca61995cbc5cd77
MD5 dbb7054b25e04508ea8c0f5f5b84da77
BLAKE2b-256 d8487d0287fc2f8dcb88857838c02a4be70cf318587772ed51112c596384aa99

See more details on using hashes here.

File details

Details for the file ofbahar_pdf_converter-0.1.1-py3-none-any.whl.

File metadata

File hashes

Hashes for ofbahar_pdf_converter-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 b14f0ee8beb0adc8b28b928f144b79dff46ea49c3f44b17e3d44c5a44eaf6dbe
MD5 fe44418c2163761fe0ee69bba423ff5f
BLAKE2b-256 2a30bc159666b4834413c91dd4ed2d5c90c81eca5a6dbc014ab178ade7fc331a

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page