Skip to main content
Glama
NikhilBelwate

pdf-merger-mcp-server

PDF Merger MCP Server

An MCP (Model Context Protocol) server that exposes the PDF Merger App as a set of tools any MCP-compatible LLM client can use to upload, arrange, merge, and download PDFs.

Tools

Tool

Description

pdf_merger_upload_pdfs

Upload one or more PDF files from disk to the merger service

pdf_merger_remove_file

Remove a file from an upload session

pdf_merger_merge

Merge uploaded PDFs in a specified order

pdf_merger_get_download_url

Build a one-time download URL for the merged result

Related MCP server: PDF Manipulation MCP Server

Quick Start

# Install dependencies
npm install

# Build
npm run build

# Run (stdio transport — default)
PDF_MERGER_API_URL=http://localhost:3000 npm start

# Run (HTTP transport for remote access)
TRANSPORT=http PORT=4000 PDF_MERGER_API_URL=http://localhost:3000 npm start

Environment Variables

Variable

Default

Description

PDF_MERGER_API_URL

http://localhost:3000

Base URL of the PDF Merger App API

TRANSPORT

stdio

Transport mode: stdio or http

PORT

4000

HTTP server port (only when TRANSPORT=http)

Claude Desktop Configuration

Add to your claude_desktop_config.json:

{
  "mcpServers": {
    "pdf-merger": {
      "command": "node",
      "args": ["/path/to/pdf-merger-mcp-server/dist/index.js"],
      "env": {
        "PDF_MERGER_API_URL": "https://your-merger-app.vercel.app"
      }
    }
  }
}

Typical Workflow

  1. Upload PDFs → returns session_id + file IDs

  2. Remove unwanted files (optional)

  3. Merge with desired file order → returns one-time download token

  4. Download using the token URL

Architecture

LLM Client ──MCP──▶ pdf-merger-mcp-server ──HTTP──▶ PDF Merger App (Express)
                     (stdio or HTTP)                  (Vercel Blob + pdf-lib)

Development

npm run dev    # Auto-reload via tsx watch
npm run build  # Compile TypeScript → dist/
npm run clean  # Remove dist/

Available Tools

4 tools
pdf_merger_get_download_urlGet Download URLA
Read-onlyIdempotent

Build a one-time download URL for a merged PDF.

The token is returned by pdf_merger_merge. Each token can only be used once; after the first download the link expires and all associated cloud files are cleaned up.

Args:

  • token (string): One-time download token UUID from the merge response.

Returns (JSON): { "download_url": "https://your-api.example.com/download/" }

Notes:

  • Opening the URL in a browser triggers a file download of "merged.pdf".

  • After download, source blobs are automatically deleted from cloud storage.

ParametersJSON Schema
NameRequiredDescriptionDefault
tokenYesOne-time download token returned by the merge operation. Each token can only be used once.

TDQS

A4.7/5.0
Behavior5/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

Annotations already declare readOnly, idempotent, and non-destructive. The description adds critical behavioral context: tokens are one-time use, the link expires after first download, and associated cloud files are cleaned up. It also notes that opening the URL triggers a download of 'merged.pdf' and source blobs are deleted. This goes well beyond the annotations.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is efficiently organized with a summary, args, returns, and notes. Every sentence adds value, and the most important information is front-loaded. No redundancy.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness5/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a simple single-parameter tool, the description fully covers preconditions, behavior, return format, and side effects. Even without an output schema, it outlines the return JSON. Complete and self-sufficient.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 100% with a well-described token parameter. The description reinforces the source ('from the merge response') and one-time nature, adding context not present in the schema. Slight value beyond the schema.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description opens with a specific verb+resource: 'Build a one-time download URL for a merged PDF.' This clearly distinguishes it from sibling tools (merge, upload, remove) and states exactly what the tool does.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description explicitly states the prerequisite: 'The token is returned by pdf_merger_merge.' This tells the agent when to use the tool, though it does not explain exclusions or when not to use it. The context is clear enough for correct deployment.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

pdf_merger_mergeMerge PDFsA

Merge previously uploaded PDFs in a specified order into a single PDF.

Returns a one-time download token. Use pdf_merger_get_download_url to build the download link. The session is consumed after merging — re-upload files to merge again.

Args:

  • session_id (string): UUID of the upload session.

  • file_order (string[]): Ordered array of file UUIDs. The first entry becomes the first pages of the merged output. Must contain at least 2 file IDs and at most 30.

Returns (JSON): { "token": "uuid", "page_count": 45, "size_formatted": "2.3 MB", "download_url": "https://..." }

Workflow:

  1. Upload PDFs using pdf_merger_upload_pdfs

  2. (Optional) Remove unwanted files using pdf_merger_remove_file

  3. Merge using this tool with desired file order

  4. Use the returned download_url to download the merged PDF

Error Handling:

  • Session not found → 404

  • File order contains unknown IDs → 400

  • Encrypted/corrupt PDF → 422

  • Less than 2 files → 400

ParametersJSON Schema
NameRequiredDescriptionDefault
file_orderYesOrdered array of file IDs specifying the merge sequence. The first ID becomes the first pages of the output.
session_idYesSession ID containing uploaded PDFs.

TDQS

A4.7/5.0
Behavior5/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

Beyond annotations, the description discloses that the session is consumed after merging, that the returned token is one-time, and includes specific HTTP error codes for failure modes. This is substantial behavioral context not present in the annotations.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is well structured with focused sections: overview, return value, workflow, and error handling. Each section adds necessary information, and the most important purpose statement is front-loaded.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness5/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Despite lacking an output schema, the description provides a concrete JSON return example, full workflow guidance, and error handling details. This gives the agent enough context to invoke the tool correctly and interpret results.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Input schema coverage is 100%, and the schema already describes both parameters, including min/max items and the ordering behavior. The description repeats this information without adding new parameter-level meaning, so baseline 3 applies.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description opens with a specific verb and resource: "Merge previously uploaded PDFs in a specified order into a single PDF." It clearly distinguishes this from sibling tools by naming the upload, remove, and download steps.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines5/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The Workflow section explicitly lists the sequence of operations (upload → remove optional → merge → download) and mentions the one-time session constraint, which tells the agent when to use this tool and when re-uploading is needed.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

pdf_merger_remove_fileRemove File from SessionA
DestructiveIdempotent

Remove a single PDF file from an upload session on the PDF Merger service.

The file is permanently deleted from cloud storage. This operation cannot be undone.

Args:

  • session_id (string): UUID of the session containing the file.

  • file_id (string): UUID of the file to remove.

Returns (JSON): { "success": true }

Error Handling:

  • Session not found → 404 error

  • File not found in session → 404 error

ParametersJSON Schema
NameRequiredDescriptionDefault
file_idYesID of the file to remove from the session.
session_idYesSession ID that contains the file.

TDQS

A4.3/5.0
Behavior5/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

Annotations mark the tool as destructive (destructiveHint: true), but the description strengthens this by stating the file is permanently deleted from cloud storage and cannot be undone. It also documents error handling (404 for missing session/file), providing additional behavioral detail beyond the annotations.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is well-structured with clear sections for purpose, consequence, arguments, return value, and errors. Each sentence provides necessary information without padding.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness5/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a simple destructive 2-parameter tool, the description covers the operation's effect (permanent deletion), the exact return JSON, and error conditions. No output schema is present, but the description compensates by explicitly specifying the return value.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Both parameters (session_id and file_id) have full schema descriptions, and the description's Args section essentially restates the schema. No additional syntax, precedence, or format details are provided, so the description adds no semantic value beyond the schema.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the action: remove a single PDF file from an upload session. The verb 'Remove' and resource 'PDF file from an upload session' are specific and distinct from sibling tools that upload, merge, or generate download links.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description implies the tool is for deleting a file from a session but does not explicitly state when to choose it over alternatives or when not to use it. No exclusion or alternative tool is mentioned, leaving usage context implicit rather than explicit.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

pdf_merger_upload_pdfsUpload PDFsA

Upload one or more PDF files to the PDF Merger service for later merging.

Each file must be a valid PDF (≤100 MB). Up to 30 files can be uploaded per session. If session_id is provided, files are appended to that existing session; otherwise a new session is created.

Args:

  • file_paths (string[]): Absolute paths to PDF files on disk.

  • session_id (string, optional): UUID of existing session to append to.

Returns (JSON): { "session_id": "uuid", "files": [ { "id": "uuid", "name": "doc.pdf", "size": 102400, "sizeFormatted": "100.0 KB" } ] }

Examples:

  • Upload two files to a new session: file_paths=["/tmp/report.pdf", "/tmp/appendix.pdf"]

  • Append to existing session: file_paths=["/tmp/extra.pdf"], session_id="550e8400-..."

Error Handling:

  • File not found on disk → clear message with the missing path

  • Non-PDF file → 415 error from API

  • File >100 MB → 413 error from API

  • 30 files in session → 400 error from API

ParametersJSON Schema
NameRequiredDescriptionDefault
file_pathsYesAbsolute file paths to PDF files on the local filesystem (e.g., ["/home/user/doc1.pdf", "/home/user/doc2.pdf"])
session_idNoOptional existing session ID to append files to. Omit to create a new session.

TDQS

A4.6/5.0
Behavior5/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

Beyond the annotations (which indicate non-read-only, non-idempotent, non-destructive), the description adds substantial behavioral context: file size limit, file count limit, error handling for missing files/non-PDF/oversized/exceeding limits, and session creation/appending behavior. This is far beyond what annotations provide.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is well-structured with sections for description, args, return value, examples, and error handling. Every sentence adds necessary information without redundancy or fluff. It is appropriately sized for the tool's complexity.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

The description is highly complete given the lack of an output schema: it specifies the return JSON structure, examples, and error cases. Minor gaps exist, such as not specifying behavior for an invalid session_id, but overall it is sufficient for an agent to use the tool correctly.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The input schema already covers both parameters with descriptions (100% coverage), but the tool description adds value by including concrete examples, clarifying the session_id append-vs-new behavior, and explaining the expected file_paths format. This lifts it above the baseline of 3.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool uploads one or more PDF files to the PDF Merger service for later merging, using a specific verb and resource. It distinguishes itself from sibling tools (remove, merge, download URL) by focusing solely on the upload action.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides clear context for when to use the tool (starting a session or appending to an existing one) and explains the session_id behavior. However, it does not explicitly contrast with alternative tools, so a 4 rather than 5 is appropriate.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

  1. 4 tool updatesv2.0.0
    • First observedpdf_merger_get_download_url
    • First observedpdf_merger_merge
    • First observedpdf_merger_remove_file
    • First observedpdf_merger_upload_pdfs

TDQS

A4.6/5.0

Scored across 4 tools

Disambiguation5/5

Each tool has a clearly distinct purpose: upload, remove, merge, and get download URL. There is no overlap in functionality, and the descriptions reinforce the boundaries between them.

Naming Consistency5/5

All tool names follow a consistent prefix+verb_noun pattern (pdf_merger_remove_file, pdf_merger_upload_pdfs, pdf_merger_get_download_url). The single exception, pdf_merger_merge, is still a clear verb and fits the overall style.

Tool Count5/5

Four tools is a well-scoped size for a PDF merging service. Each tool covers a necessary step in the workflow without redundancy or bloat.

Completeness4/5

The core workflow (upload, remove, merge, download) is covered. However, there is no tool to list the current files in a session, which would be needed if an agent needs to reference file IDs without having just uploaded them. This is a minor but notable gap.

Related MCP Connectors

Related MCP Servers

  • -
    license
    Not graded
    quality
    Not graded
    maintenance
    Enables comprehensive PDF analysis and manipulation including page size analysis, chapter extraction, splitting, compression, merging, and conversion to images. Provides both MCP server interface for AI assistants and Streamlit web interface for direct user interaction.
    -
  • F
    license
    Not graded
    quality
    B
    maintenance
    Enables AI agents to perform 13 PDF operations (merge, split, compress, watermark, encrypt, and more) on local files via MCP.
    2
    -