Skip to main content
Glama
NikhilBelwate

pdf-merger-mcp-server

README.md
# 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 |

## Quick Start

```bash
# 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`:

```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

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

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.