Skip to main content
Glama
pdfdotco

PDF.co MCP Server

Official
by pdfdotco

pdf_merge

Merge multiple files including PDFs, documents, spreadsheets, and images into a single PDF document using the PDF.co MCP Server tool.

Instructions

Merge PDF from two or more PDF, DOC, XLS, images, even ZIP with documents and images into a new PDF. Ref: https://developer.pdf.co/api-reference/merge/various-files.md

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
urlYesURLs to the source files as a comma-separated list. Supports PDF, DOC, DOCX, RTF, TXT, XLS, XLSX, CSV, images, and more. Supports publicly accessible links including Google Drive, Dropbox, PDF.co Built-In Files Storage. Use 'upload_file' tool to upload local files.
httpusernameNoHTTP auth user name if required to access source url. (Optional)
httppasswordNoHTTP auth password if required to access source url. (Optional)
nameNoFile name for the generated output. (Optional)
api_keyNoPDF.co API key. If not provided, will use X_API_KEY environment variable. (Optional)

Implementation Reference

  • The pdf_merge tool handler, registered with @mcp.tool(), defines the input schema using Pydantic Field descriptions, and implements the core logic by constructing ConversionParams and delegating to the merge_pdf helper.
    @mcp.tool() async def pdf_merge( url: str = Field( description="URLs to the source files as a comma-separated list. Supports PDF, DOC, DOCX, RTF, TXT, XLS, XLSX, CSV, images, and more. Supports publicly accessible links including Google Drive, Dropbox, PDF.co Built-In Files Storage. Use 'upload_file' tool to upload local files." ), httpusername: str = Field( description="HTTP auth user name if required to access source url. (Optional)", default="", ), httppassword: str = Field( description="HTTP auth password if required to access source url. (Optional)", default="", ), name: str = Field( description="File name for the generated output. (Optional)", default="" ), api_key: str = Field( description="PDF.co API key. If not provided, will use X_API_KEY environment variable. (Optional)", default="", ), ) -> BaseResponse: """ Merge PDF from two or more PDF, DOC, XLS, images, even ZIP with documents and images into a new PDF. Ref: https://developer.pdf.co/api-reference/merge/various-files.md """ return await merge_pdf( ConversionParams( url=url, httpusername=httpusername, httppassword=httppassword, name=name ), api_key=api_key, )
  • Supporting helper function that makes the API request to PDF.co's pdf/merge2 endpoint for merging PDFs.
    async def merge_pdf(params: ConversionParams, api_key: str | None = None) -> BaseResponse: return await request("pdf/merge2", params, api_key=api_key)
  • The @mcp.tool() decorator registers the pdf_merge function as an MCP tool.
    @mcp.tool()
  • Pydantic Field definitions providing the input schema, descriptions, and defaults for the pdf_merge tool.
    url: str = Field( description="URLs to the source files as a comma-separated list. Supports PDF, DOC, DOCX, RTF, TXT, XLS, XLSX, CSV, images, and more. Supports publicly accessible links including Google Drive, Dropbox, PDF.co Built-In Files Storage. Use 'upload_file' tool to upload local files." ), httpusername: str = Field( description="HTTP auth user name if required to access source url. (Optional)", default="", ), httppassword: str = Field( description="HTTP auth password if required to access source url. (Optional)", default="", ), name: str = Field( description="File name for the generated output. (Optional)", default="" ), api_key: str = Field( description="PDF.co API key. If not provided, will use X_API_KEY environment variable. (Optional)", default="", ), ) -> BaseResponse:

Latest Blog Posts

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/pdfdotco/pdfco-mcp'

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