MCP PDF Server is a specialized server that allows you to extract text and images from PDF files through a simple API interface. It supports standard text extraction, OCR recognition for scanned documents, and image extraction with a convenient web debugger for testing your requests without writing code.
To install the MCP PDF Server, you'll need Python 3.9 or newer. Install the required dependencies using pip:
pip install pymupdf mcp
Note: If you plan to use OCR features, you may need additional OCR libraries or a special MuPDF build with OCR support.
Once you've installed the dependencies, you can launch the server with:
python txt_server.py
The server will start, and you should see a message indicating it's running:
Serving on http://127.0.0.1:6231
The MCP PDF Server includes a built-in web debugger that makes it easy to test functionality:
http://127.0.0.1:6231
This interface allows you to quickly test the server's capabilities without writing any code.
Extracts normal text from PDF documents, page by page.
Parameters:
file_path
: Path to the PDF filestart_page
: First page to extract (starting from 1)end_page
: Last page to extractExample:
mcp run read_pdf_text --args '{"file_path": "pdf_resources/example.pdf", "start_page": 1, "end_page": 5}'
Uses Optical Character Recognition to extract text from scanned or image-based PDFs.
Parameters:
file_path
: Path to the PDF filestart_page
: First page to processend_page
: Last page to processlanguage
: OCR language code (e.g., "eng" for English)dpi
: Resolution for OCR processingExample:
mcp run read_by_ocr --args '{"file_path": "pdf_resources/example.pdf", "start_page": 1, "end_page": 1, "language": "eng"}'
Extracts all images from a specified page in the PDF.
Parameters:
file_path
: Path to the PDF filepage_number
: The page to extract images fromExample:
mcp run read_pdf_images --args '{"file_path": "pdf_resources/example.pdf", "page_number": 3}'
pdf_resources/
directory, or you can provide an absolute file pathTo add this MCP server to Claude Code, run this command in your terminal:
claude mcp add-json "pdf-reader" '{"command":"python","args":["txt_server.py"]}'
See the official Claude Code MCP documentation for more details.
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 > Tools & Integrations and click "New MCP Server".
When you click that button the ~/.cursor/mcp.json
file will be opened and you can add your server like this:
{
"mcpServers": {
"pdf-reader": {
"command": "python",
"args": [
"txt_server.py"
]
}
}
}
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 explicitly ask the agent to use the tool by mentioning the tool name and describing what the function does.
To add this MCP server to Claude Desktop:
1. Find your configuration file:
~/Library/Application Support/Claude/claude_desktop_config.json
%APPDATA%\Claude\claude_desktop_config.json
~/.config/Claude/claude_desktop_config.json
2. Add this to your configuration file:
{
"mcpServers": {
"pdf-reader": {
"command": "python",
"args": [
"txt_server.py"
]
}
}
}
3. Restart Claude Desktop for the changes to take effect