spire-pdf-mcp-server

eiceblue/spire-pdf-mcp-server

3.3

If you are the rightful owner of spire-pdf-mcp-server and would like to certify it and/or have it hosted online, please leave a comment on the right or send an email to henry@mcphub.com.

Spire.PDF MCP Server is a Model Context Protocol server for PDF document manipulation.

Tools
5
Resources
0
Prompts
0

What's Spire.PDF MCP Server ?

Spire.PDF MCP Server is a Model Context Protocol (MCP) server that allows you to create, read, edit, and convert PDF documents directly through your AI agent — without relying on Adobe Acrobat or other PDF software.

It provides a wide range of PDF manipulation capabilities, including merging, splitting, text replacement, form operations, watermarking, and format conversion.

Key Features

Quick Start

Prerequisites

  • Python 3.10 or higher

Installation

  1. Clone the repository:
git clone https://github.com/eiceblue/spire-pdf-mcp-server.git
cd spire-pdf-mcp-server
  1. Install using uv:
uv pip install -e .

Running the Server

Start the server (default port 8000):

uv run spire-pdf-mcp-server

Custom port (e.g., 8080):

# Bash/Linux/macOS
export FASTMCP_PORT=8080 && uv run spire-pdf-mcp-server

# Windows PowerShell
$env:FASTMCP_PORT = "8080"; uv run spire-pdf-mcp-server

Integration with AI Tools

Cursor IDE

  1. Add this configuration to Cursor:
{
  "mcpServers": {
    "pdf": {
      "url": "http://localhost:8000/sse",
      "env": {
        "PDF_FILES_PATH": "/path/to/pdf/files"
      }
    }
  }
}
  1. The PDF tools will be available through your AI assistant.

Remote Hosting & Protocols

This server uses Server-Sent Events (SSE) transport protocol. For other environments:

Environment Variables

VariableDescriptionDefault
FASTMCP_PORTServer port8000
PDF_FILES_PATHDirectory for PDF files./pdf_files

Available Tools

The server provides 15+ tools organized into 5 categories:

Document Operations (10 tools)

  • create_pdfducoment: Create new PDF documents
  • convert_pdfdocument: Convert PDF to other formats (Word, Excel, HTML, images, PDF/A, etc.)
  • extract_text: Extract text from PDF pages
  • merge_pdfs: Merge multiple PDFs into one
  • add_text_watermark: Insert text watermarks into PDF
  • compress_document: Reduce PDF file size
  • split_document: Split a PDF into multiple files
  • encrypt_document: Apply password protection to PDFs
  • decrypt_document: Remove password protection
  • replace_all_text: Replace all matching text in a PDF

Bookmarks Operations (2 tools)

  • delete_all_bookmarks: Remove all bookmarks from a PDF
  • expand_bookmarks: Expand bookmark tree

Forms Operations (2 tools)

  • flatten_formfield: Flatten form fields in PDF
  • get_forms_values: Extract values form PDF forms

Attachments Operations (1 tool)

  • delete_all_attachments: Remove all attachments from a PDF

Supported Conversion Formats

Development

Project Structure

spire-pdf-mcp-server/
ā”œā”€ā”€ src/spire_pdf_mcp/
│   ā”œā”€ā”€ api/                 # API layer (tools)
│   │   ā”œā”€ā”€ document_tools.py
│   │   ā”œā”€ā”€ bookmarks_tools.py
│   │   ā”œā”€ā”€ forms_tools.py
│   │   ā”œā”€ā”€ attachments_tools.py
│   ā”œā”€ā”€ core/                # Core business logic
│   │   ā”œā”€ā”€ document.py
│   │   ā”œā”€ā”€ bookmarks.py
│   │   ā”œā”€ā”€ forms.py
│   │   ā”œā”€ā”€ attachments.py
│   │   └── base.py
│   ā”œā”€ā”€ utils/               # Utilities and constants
│   │   ā”œā”€ā”€ exceptions.py
│   │   └── constants.py
│   ā”œā”€ā”€ server.py            # MCP server implementation
│   └── __main__.py          # Entry point
ā”œā”€ā”€ pyproject.toml           # Project configuration
ā”œā”€ā”€ README.md                # This file
└── TOOLS.md                 # Detailed tool documentation

Running Tests

uv run pytest

Code Quality

  • Fully typed with Python type hints
  • Comprehensive error handling
  • Modular architecture
  • Consistent code formatting
  • Detailed inline documentation

Documentation

  • : Complete tool documentation with usage examples
  • Error Handling: Common errors and troubleshooting

šŸ¤ Contributing

  1. Fork the repository
  2. Create a feature branch
  3. Commit your changes
  4. Add tests where applicable
  5. Submit a pull request

License

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

Version History

  • v1.0.0: Initial stable release with tools
  • Complete pdf document manipulation capabilities
  • Comprehensive error handling
  • Full format conversion support