pdf-merger-mcp-server
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@pdf-merger-mcp-serverMerge report.pdf and appendix.pdf into one PDF"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
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 |
| Upload one or more PDF files from disk to the merger service |
| Remove a file from an upload session |
| Merge uploaded PDFs in a specified order |
| 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 startEnvironment Variables
Variable | Default | Description |
|
| Base URL of the PDF Merger App API |
|
| Transport mode: |
|
| HTTP server port (only when |
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
Upload PDFs → returns
session_id+ file IDsRemove unwanted files (optional)
Merge with desired file order → returns one-time download
tokenDownload 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 toolspdf_merger_get_download_urlGet Download URLARead-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.
| Name | Required | Description | Default |
|---|---|---|---|
| token | Yes | One-time download token returned by the merge operation. Each token can only be used once. |
TDQS
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.
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.
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.
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.
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.
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:
Upload PDFs using pdf_merger_upload_pdfs
(Optional) Remove unwanted files using pdf_merger_remove_file
Merge using this tool with desired file order
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
| Name | Required | Description | Default |
|---|---|---|---|
| file_order | Yes | Ordered array of file IDs specifying the merge sequence. The first ID becomes the first pages of the output. | |
| session_id | Yes | Session ID containing uploaded PDFs. |
TDQS
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.
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.
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.
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.
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.
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 SessionADestructiveIdempotent
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
| Name | Required | Description | Default |
|---|---|---|---|
| file_id | Yes | ID of the file to remove from the session. | |
| session_id | Yes | Session ID that contains the file. |
TDQS
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.
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.
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.
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.
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.
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
| Name | Required | Description | Default |
|---|---|---|---|
| file_paths | Yes | Absolute file paths to PDF files on the local filesystem (e.g., ["/home/user/doc1.pdf", "/home/user/doc2.pdf"]) | |
| session_id | No | Optional existing session ID to append files to. Omit to create a new session. |
TDQS
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.
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.
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.
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.
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.
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.
4 tool updates
v2.0.0- First observed
pdf_merger_get_download_url - First observed
pdf_merger_merge - First observed
pdf_merger_remove_file - First observed
pdf_merger_upload_pdfs
TDQS
Scored across 4 tools
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.
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.
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.
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
Document processing over MCP: merge, split and compress PDFs, run OCR, extract document text.
MCP server for the PDFGate API. Generate PDFs, manage documents and handle e-signatures.
PDF tools for Claude: merge, split, compress, convert, OCR & more. Requires a PDFHaul API key.
Generate PDFs from templates via AI chat. Works with Claude, ChatGPT, Cursor, and any MCP client.
Related MCP Servers
- -licenseNot gradedqualityNot gradedmaintenanceEnables 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.-
- AlicenseBqualityDmaintenanceEnables PDF manipulation including text, images, annotations, form fields, page operations, and metadata through natural language.16MIT
- FlicenseNot gradedqualityBmaintenanceEnables AI agents to perform 13 PDF operations (merge, split, compress, watermark, encrypt, and more) on local files via MCP.2-
- FlicenseNot gradedqualityCmaintenanceIndexes PDF documents into Qdrant and exposes semantic search as MCP tools, enabling RAG-based interactions with your documents.-