npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

@sylphlab/tools-pdf-mcp

v0.5.1

Published

MCP server providing PDF tools (text extraction, etc.)

Readme

@sylphlab/tools-pdf-mcp

NPM version

Extract text and metadata from PDF documents remotely via the Model Context Protocol (MCP).

This package provides a ready-to-run MCP server that exposes PDF processing functionalities, primarily text extraction, based on the tools defined in @sylphlab/tools-pdf.

Purpose

This server allows MCP clients (like AI agents, RAG systems, or document processing workflows) to remotely extract content and information from PDF files. It acts as a secure interface, taking the core PDF processing logic from @sylphlab/tools-pdf (which uses mupdf), adapting it using @sylphlab/tools-adaptor-mcp, and serving it over the MCP standard (stdio). This enables clients to work with PDF content without needing local PDF parsing libraries or direct file access.

Features

  • MCP Server: Implements the Model Context Protocol for tool execution.
  • Exposes PDF Tools: Provides tools (like getTextTool) for:
    • Extracting full text content.
    • Extracting text from specific pages or ranges.
    • Retrieving document metadata.
    • Getting the total page count.
  • Handles Local Files: Processes PDF files located within the server's working directory. (URL support might depend on the underlying @sylphlab/tools-pdf implementation).
  • Structured Output: Returns extracted data and metadata in a predictable JSON format.
  • Executable: Provides a binary (mcp-pdf) for easy execution.
  • Secure: Operates within the defined working directory context.

Installation

This package is intended to be used as a standalone server.

Using npm/pnpm/yarn (Recommended)

Install as a dependency or globally:

# Globally
npm install -g @sylphlab/tools-pdf-mcp
# Or in a project
pnpm add @sylphlab/tools-pdf-mcp

Configure your MCP host (e.g., mcp_settings.json) to use npx or the installed binary path:

// Using npx
{
  "mcpServers": {
    "pdf-mcp": {
      "command": "npx",
      "args": ["@sylphlab/tools-pdf-mcp"],
      "name": "PDF Tools (npx)"
      // "cwd": "/path/to/target/project" // Set CWD if PDFs are relative to a project
    }
  }
}

// Or using global install path
{
  "mcpServers": {
    "pdf-mcp": {
      "command": "mcp-pdf", // If in PATH
      "name": "PDF Tools (Global)"
      // "cwd": "/path/to/target/project" // Set CWD if PDFs are relative to a project
    }
  }
}

Note: Ensure the MCP host configuration specifies the correct cwd if PDF paths are relative to a specific project directory.

Using Docker (If Available)

(Requires a Docker image sylphlab/tools-pdf-mcp:latest to be published)

docker pull sylphlab/tools-pdf-mcp:latest

Configure your MCP host, mounting the target project directory containing PDFs to /app:

{
  "mcpServers": {
    "pdf-mcp": {
      "command": "docker",
      "args": [
        "run",
        "-i", // Essential for stdio communication
        "--rm",
        "-v",
        "/path/to/your/project:/app", // Mount the directory with PDFs
        "-w", "/app", // Set the working directory inside the container
        "sylphlab/tools-pdf-mcp:latest"
      ],
      "name": "PDF Tools (Docker)"
    }
  }
}

Local Build (For Development)

  1. Build: From the monorepo root: pnpm build --filter @sylphlab/tools-pdf-mcp
  2. Configure MCP Host:
    {
      "mcpServers": {
        "pdf-mcp": {
          "command": "node",
          // Adjust path as needed
          "args": ["./packages/tools-pdf-mcp/dist/index.js"],
          "name": "PDF Tools (Local Build)"
          // "cwd": "/path/to/target/project" // Set CWD if PDFs are relative to a project
        }
      }
    }

Usage

Once the server is running and configured in your MCP host, clients can send requests to extract information from PDF files within the server's working directory.

MCP Request Example (Get text from page 2 and metadata):

{
  "tool_name": "getTextTool", // Tool name from @sylphlab/tools-pdf
  "arguments": {
    "items": [
      {
        "filePath": "./reports/annual_report.pdf", // Path relative to server CWD
        "pages": [2]
      }
    ],
    "includeMetadata": true,
    "includePageCount": true
  }
}

Expected Response Snippet:

{
  "result": {
    "results": [
      {
        "source": "./reports/annual_report.pdf",
        "success": true,
        "data": {
          "page_texts": [
            { "page": 2, "text": "Text content from page 2..." }
          ],
          "metadata": { /* PDF metadata object */ },
          "num_pages": 50
        }
      }
    ]
  }
}

Dependencies

  • @modelcontextprotocol/sdk: For creating the MCP server instance.
  • @sylphlab/tools-adaptor-mcp: To adapt the core tool definitions to MCP format.
  • @sylphlab/tools-pdf: Contains the actual logic for PDF processing using mupdf.
  • @sylphlab/tools-core: Provides the base tool definition structure.

Developed by Sylph Lab.