Pdflens MCP
An MCP server for reading PDFs, coded by human, designed for AI
Ask AI about Pdflens MCP
Powered by Claude · Grounded in docs
I know everything about Pdflens MCP. Ask me about installation, configuration, usage, or troubleshooting.
0/500
Reviews
Documentation
pdflens-mcp
An MCP server for reading PDFs, coded by human, designed for AI.

Provided tools
get_pdf_num_pagesread_pdf_as_textread_pdf_page_as_image‡
‡ Not all MCP clients support images.
Usage
-
Install Rust compiler: https://rustup.rs/
-
Download and build pdflens-mcp from crates.io
cargo install --git https://codeberg.org/m13253/pdflens-mcp.git pdflens-mcpUsually, the program is installed to
$HOME/.cargo/bin/pdflens-mcp. You can usecargo install --root /another/path pdflens-mcpto set a custom installation path. -
Add this MCP server to your MCP client of choice.
(Note: We use
shto expand~to your actual home directory. If you are using Microsoft Windows, please instead put the full path topdflens-mcp.exeto"command"and leave"args"empty.)-
If your MCP client supports
mcp.json:{ "mcpServers": { "pdflens": { "command": "sh", "args": ["-c", "exec ~/.cargo/bin/pdflens-mcp"] } } } -
Visual Studio Code:
code --add-mcp "{\"name\": \"pdflens\", \"command\": \"sh\", \"args\": [\"-c\", \"exec ~/.cargo/bin/pdflens-mcp\"]}" -
Codex
[mcp_servers.pdflens] command = "sh" args = ["-c", "exec ~/.cargo/bin/pdflens-mcp"] -
Continue.dev
mcpServers: - name: pdflens command: sh args: - -c - exec ~/.cargo/bin/pdflens-mcp -
Kilo Code
{ "mcpServers": { "pdflens": { "command": "sh", "args": ["-c", "exec ~/.cargo/bin/pdflens-mcp"], "alwaysAllow": [ "get_pdf_num_pages", "read_pdf_as_text" ], "disabledTools": ["read_pdf_page_as_image"] } } } -
Roo Code
{ "mcpServers": { "pdflens": { "command": "sh", "args": ["-c", "exec ~/.cargo/bin/pdflens-mcp"], "alwaysAllow": [ "get_pdf_num_pages", "read_pdf_as_text", "read_pdf_page_as_image" ] } } } -
Zed
{ "agent": { "tool_permissions": { "tools": { "mcp:pdflens:get_pdf_num_pages": {"default": "allow"}, "mcp:pdflens:read_pdf_as_text": {"default": "allow"}, "mcp:pdflens:read_pdf_page_as_image": {"default": "deny"} } } }, "context_servers": { "pdflens": { "command": "sh", "args": ["-c", "exec ~/.cargo/bin/pdflens-mcp"], "enabled": true, } } }
-
Path sandboxing
Pdflens is designed to only read PDFs located within the user’s workspace directories, also called MCP root directories.
Each time before reading the PDFs, it checks the file path after resolving any symbolic links. If the PDF exists but is outside any user’s workspace directories, pdflens will return an error, asking the user to check the root path settings.
If your MCP client doesn’t specify a root path, pdflens will fallback to the current directory it is started in.
{
"mcpServers": {
"pdflens": {
"command": "sh",
"args": ["-c", "exec ~/.cargo/bin/pdflens-mcp"],
"cwd": "/path/to/workspace/if/root/path/is/unsupported"
}
}
}
Known issue
- pdflens uses pdf-extract to extract text from PDFs. It is not perfect and may crash with some PDFs. I am waiting for pdf-extract#142 to land on its master branch.
Not-vibe-coded declaration
This project is developed mainly with human effort. I have throughoutly read and checked every piece of code in this repository to ensure its quality.
