PDF Reader MCP server

Securely extracts text, metadata, and page information from PDF files within a project directory using pdfjs-dist for both local files and remote URLs.
Back to servers
Provider
shtse8
Release date
Apr 05, 2025
Language
TypeScript
Package
Stats
898 downloads
15 stars

The PDF Reader MCP Server by Sylphlab allows you to extract text, metadata, and page information from PDF files, providing a secure way for AI agents to access PDF content within your project context.

Installation Options

Using npm

Install the package in your project:

pnpm add @sylphlab/pdf-reader-mcp
# Or use npm install or yarn add

Configure your MCP host settings in mcp_settings.json:

{
  "mcpServers": {
    "pdf-reader-mcp": {
      "command": "npx",
      "args": ["@sylphlab/pdf-reader-mcp"],
      "name": "PDF Reader (npx)"
    }
  }
}

Using Docker

Pull the Docker image:

docker pull sylphlab/pdf-reader-mcp:latest

Configure your MCP host to use the Docker container:

{
  "mcpServers": {
    "pdf-reader-mcp": {
      "command": "docker",
      "args": [
        "run",
        "-i",
        "--rm",
        "-v",
        "/path/to/your/project:/app",
        "sylphlab/pdf-reader-mcp:latest"
      ],
      "name": "PDF Reader (Docker)"
    }
  }
}

Usage

Once the server is running and properly configured, you can send MCP requests to extract information from PDF files.

Reading PDF Content

Here's a basic example that retrieves metadata and text from page 2 of a PDF:

{
  "tool_name": "read_pdf",
  "arguments": {
    "sources": [
      {
        "path": "./documents/my_report.pdf",
        "pages": [2]
      }
    ],
    "include_metadata": true,
    "include_page_count": false,
    "include_full_text": false
  }
}

Response Format

The server will respond with structured JSON data:

{
  "results": [
    {
      "source": "./documents/my_report.pdf",
      "success": true,
      "data": {
        "page_texts": [
          { "page": 2, "text": "Text content from page 2..." }
        ],
        "info": { /* PDF information */ },
        "metadata": { /* PDF metadata */ }
      }
    }
  ]
}

Available Options

The PDF Reader supports these main configuration options:

  • sources: Array of PDF sources to process (local files or URLs)
    • path: Path to the PDF file (relative to project root) or URL
    • pages: Optional array of specific pages to extract
  • include_metadata: Whether to include PDF metadata
  • include_page_count: Whether to include total page count
  • include_full_text: Whether to extract all text from the document

Processing Multiple Files

You can process multiple PDFs in a single request:

{
  "tool_name": "read_pdf",
  "arguments": {
    "sources": [
      { "path": "./docs/report1.pdf" },
      { "path": "https://example.com/public-document.pdf", "pages": [1,2,3] }
    ],
    "include_metadata": true
  }
}

Key Features

  • Extracts text from entire PDFs or specific pages
  • Retrieves PDF metadata (author, title, creation date, etc.)
  • Gets total page count
  • Processes multiple PDFs in a single request
  • Handles both local files and remote URLs
  • Securely constrains file access to project directory
  • Returns structured JSON for easy parsing

How to add this MCP server to Cursor

There are two ways to add an MCP server to Cursor. The most common way is to add the server globally in the ~/.cursor/mcp.json file so that it is available in all of your projects.

If you only need the server in a single project, you can add it to the project instead by creating or adding it to the .cursor/mcp.json file.

Adding an MCP server to Cursor globally

To add a global MCP server go to Cursor Settings > MCP and click "Add new global MCP server".

When you click that button the ~/.cursor/mcp.json file will be opened and you can add your server like this:

{
    "mcpServers": {
        "cursor-rules-mcp": {
            "command": "npx",
            "args": [
                "-y",
                "cursor-rules-mcp"
            ]
        }
    }
}

Adding an MCP server to a project

To add an MCP server to a project you can create a new .cursor/mcp.json file or add it to the existing one. This will look exactly the same as the global MCP server example above.

How to use the MCP server

Once the server is installed, you might need to head back to Settings > MCP and click the refresh button.

The Cursor agent will then be able to see the available tools the added MCP server has available and will call them when it needs to.

You can also explictly ask the agent to use the tool by mentioning the tool name and describing what the function does.

Want to 10x your AI skills?

Get a free account and learn to code + market your apps using AI (with or without vibes!).

Nah, maybe later