npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@leoyoge/pdf-mcp

v0.1.1

Published

PDF阅读MCP服务器,支持从本地文件和URL读取PDF内容

Readme

PDF MCP 服务器

这是一个基于 Model Context Protocol (MCP) 的PDF阅读工具,支持从本地文件和URL读取PDF内容。

功能特性

  • 📖 多源读取: 支持从本地文件和URL读取PDF内容
  • 📄 文本提取: 提取PDF中的文本内容供智能体分析
  • 📊 元数据获取: 获取PDF文件的基本信息(页数、作者、标题等)
  • 🎯 页面选择: 支持指定页面范围或特定页面进行提取
  • 🔧 智能体集成: 专为智能体设计的MCP协议接口

安装和设置

  1. 安装依赖:
npm install
  1. 构建项目:
npm run build
  1. 启动MCP服务器:
npm start

可用工具

read_pdf

读取PDF文件内容,支持本地文件和URL

参数:

  • sources (必需): PDF源数组,每个源包含:
    • path (可选): 本地PDF文件路径
    • url (可选): PDF文件的URL链接
    • pages (可选): 要提取的页面,支持:
      • 数组: [1, 3, 5] - 指定页面
      • 字符串: "1-3,5,7-" - 页面范围
  • include_full_text (可选): 是否包含完整文本,默认false
  • include_metadata (可选): 是否包含元数据,默认true
  • include_page_count (可选): 是否包含页数,默认true

示例:

{
  "name": "read_pdf",
  "arguments": {
    "sources": [
      {
        "url": "https://example.com/document.pdf",
        "pages": "1-5"
      }
    ],
    "include_full_text": true,
    "include_metadata": true
  }
}

智能体配置

在您的智能体配置中添加以下MCP服务器配置:

{
  "mcpServers": {
    "pdf-mcp": {
      "command": "node",
      "args": ["dist/index.js"],
      "cwd": "/path/to/pdf-mcp"
    }
  }
}

使用场景

  • 📚 学术论文阅读: 智能体可以读取学术PDF论文并进行分析
  • 📰 新闻文章处理: 处理在线PDF格式的新闻文章
  • 📋 文档分析: 分析各种PDF格式的文档内容
  • 🔍 内容搜索: 在PDF文档中搜索特定信息

技术特性

  • 基于MCP协议,与智能体无缝集成
  • 支持大文件处理(流式读取)
  • 自动处理各种PDF格式
  • 错误处理和超时保护
  • TypeScript实现,类型安全

注意事项

  • 确保PDF URL可公开访问
  • 大文件可能需要较长处理时间
  • 某些PDF可能包含图片或复杂格式,文本提取效果可能有限
  • 建议在使用前先用 get_pdf_info 检查文件信息

开发

# 开发模式
npm run dev

# 构建
npm run build

# 启动
npm start

许可证

MIT License