PDF Reader MCP Server is a tool that enables AI agents to securely extract text, metadata, and page count information from PDF files within your project context. It provides a structured interface for reading PDFs through the Model Context Protocol (MCP).
Install the package in your MCP host environment:
pnpm add @sylphlab/pdf-reader-mcp
# Or npm install / yarn add
Configure your MCP host settings (e.g., in mcp_settings.json
):
{
"mcpServers": {
"pdf-reader-mcp": {
"command": "npx",
"args": ["@sylphlab/pdf-reader-mcp"],
"name": "PDF Reader (npx)"
}
}
}
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)"
}
}
}
Once you've configured the server in your MCP host, you can send requests to it for processing PDF files.
To retrieve metadata and text from a specific page:
{
"tool_name": "read_pdf",
"arguments": {
"sources": [
{
"path": "./documents/my_report.pdf",
"pages": [2]
}
],
"include_metadata": true,
"include_page_count": false,
"include_full_text": false
}
}
The server will respond with structured JSON:
{
"results": [
{
"source": "./documents/my_report.pdf",
"success": true,
"data": {
"page_texts": [
{ "page": 2, "text": "Text content from page 2..." }
],
"info": { ... },
"metadata": { ... }
}
}
]
}
You can process multiple PDF files in a single request:
{
"tool_name": "read_pdf",
"arguments": {
"sources": [
{
"path": "./documents/first.pdf"
},
{
"path": "./documents/second.pdf",
"pages": [1, 2, 3]
}
],
"include_metadata": true
}
}
The server can also process PDFs from URLs:
{
"tool_name": "read_pdf",
"arguments": {
"sources": [
{
"path": "https://example.com/sample.pdf"
}
]
}
}
The PDF Reader MCP Server offers several capabilities:
When making requests, you can customize behavior with these parameters:
path
: Path to the PDF file (relative to project root) or URLpages
: Optional array of page numbers to extract (1-based indexing)include_metadata
: Include document metadata (default: false)include_page_count
: Include total page count (default: true)include_full_text
: Extract all text if no pages specified (default: true)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.
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"
]
}
}
}
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.
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.