mcp-server-pdf
A Model Context Protocol (MCP) server that exposes PDF operations — text extraction and metadata retrieval — to MCP-compatible clients such as Claude Desktop.
Features
- Extract text from a PDF (all pages or a specific page)
- Get metadata from a PDF (title, author, page count, creation date, etc.)
Requirements
- Go 1.25.1+
- (Optional) Nix with flakes enabled for a reproducible dev environment
Installation
go install
go install github.com/tkuramot/mcp-server-pdf@latest
Build from source
git clone https://github.com/tkuramot/mcp-server-pdf.git
cd mcp-server-pdf
go build -o mcp-server-pdf .
Using Nix
git clone https://github.com/tkuramot/mcp-server-pdf.git
cd mcp-server-pdf
nix develop
go build -o mcp-server-pdf .
Usage
The server communicates over stdio following the MCP specification. It is not intended to be run directly in a terminal; instead, register it with your MCP client.
Claude Desktop
Add the following to your claude_desktop_config.json:
{
"mcpServers": {
"pdf": {
"command": "/path/to/mcp-server-pdf"
}
}
}
Replace /path/to/mcp-server-pdf with the absolute path to the binary.
Extracts plain text content from a PDF file.
| Parameter |
Type |
Required |
Description |
file_path |
string |
yes |
Absolute or relative path to the PDF file |
page |
number |
no |
Page number to extract (1-based). Omit or set to 0 for all pages. |
Example response (all pages):
--- Page 1 ---
Lorem ipsum dolor sit amet...
--- Page 2 ---
Consectetur adipiscing elit...
Returns metadata embedded in a PDF file as JSON.
| Parameter |
Type |
Required |
Description |
file_path |
string |
yes |
Absolute or relative path to the PDF file |
Example response:
{
"title": "Annual Report 2024",
"author": "Jane Doe",
"subject": "Finance",
"keywords": ["finance", "annual"],
"creator": "Microsoft Word",
"producer": "Adobe PDF Library",
"creation_date": "2024-01-15T09:00:00Z",
"modification_date": "2024-03-01T12:00:00Z",
"page_count": 42
}
Development
# Run tests
go test ./...
# Lint
go vet ./...
With Nix:
nix develop
Dependencies
License
MIT