使用说明
PDF阅读器MCP服务器
An MCP server for reading PDF files and extracting text content.(MCP服务器读取PDF文件并提取文本)
Installation(安装方法)
cd /path/to/pdfreaderMCP
pip install -r requirements.txt
MCP配置(MCP设置)
将以下内容添加到您的 ~/.cursor/mcp.json 或 /root/.cursor/mcp.json:
(~/.cursor/mcp.json 或者 /root/.cursor/mcp.json请在中添加以下内容)
{
"mcpServers": {
"pdf-reader": {
"command": "python3",
"args": [
"/absolute/path/to/server.py"
]
}
}
}
注: 替换 /absolute/path/to/server.py 与您的实际路径 server.py 文件。
(实际路径 server.py 请更改文件位置)
可用工具(Available Tools)
1.read_pdf
Reads a PDF file and extracts text content.(读取PDF文件并提取文本内容)
Parameters(参数):
file_path(必需/必需):Path to the PDF file to read(要读取的PDF文件的路径)page_range(optional/选择):Page range to read(阅读页面范围)"all":All pages(default)(所有页面,默认值)"1-5":Pages 1 to 5(第1页至第5页)"1,3,5":Pages 1、3和5 only(仅限第1、3和5页)"1-3,7,10-12":Mixed range(复合范围)
Example(示例):
# Read all pages (모든 페이지 읽기)
read_pdf(file_path="/path/to/document.pdf")
# Read specific pages (특정 페이지만 읽기)
read_pdf(file_path="/path/to/document.pdf", page_range="1-10")
2.get_pdf_info
Retrieves PDF metadata information.(获取PDF文件的元数据信息)
Parameters(参数):
file_path(required/必需):Path to the PDF file(获取信息的PDF文件的路径)
Example(示例):
get_pdf_info(file_path="/path/to/document.pdf")
Features(功能)
- PDF text extraction(PDF文本提取)
- 页面范围规格(页面范围规格)
- PDF metadata retrieval(title,author,dates,etc.)(元数据查询:标题、作者、创建日期等)
- Unicode support(Korean,Chinese,Japanese,etc.)(Unicode支持:韩文、中文、日文等)
Dependencies(依赖性)
mcp>=1.0.0:Model Context Protocol server library(MCP服务器库)pymupdf>=1.24.0:PDF processing library(PyMuPDF)(PDF处理库)
Troubleshooting(故障排除)
ImportError:找不到mcp包
pip install mcp
ImportError:找不到fitz(PyMuPDF)
pip install pymupdf
Restart Cursor(重新启动Cursor)
配置更改后,重新启动Cursor以激活新的MCP服务器。
(更改设置后重新启动Cursor将激活新的MCP服务器)
许可证
MIT License - Free to use, modify, and distribute.(可自由使用、修改和分发)
请参阅 许可证 file for details.(有关详细信息,请参阅LICENSE文件)