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

@buhuo/product-doc-mcp

v1.0.4

Published

MCP Server for quick access to product planning documents - search, read, and manage PRD files with ease

Readme

Product Doc MCP - 产品策划文档快速访问

一个 MCP Server,用于快速搜索和访问产品策划文档。支持本地目录配置,在项目目录下自动初始化目录结构。

功能特性

  • 🔍 智能搜索 - 根据文件名或关键词快速搜索策划文档
  • 📄 快速读取 - 一键读取文档内容
  • 搜索+读取 - search_and_read 一站式完成搜索和读取
  • 📁 多源管理 - 支持配置多个文档来源
  • 📊 相关度排序 - 智能匹配相关文档,优先显示最匹配的
  • 🛠️ 配置管理 - 运行时添加/移除文档来源
  • 自动初始化 - 一键创建项目目录结构

工具列表

1. search_docs - 搜索策划文档

根据关键词搜索策划文档,返回匹配文件列表。

参数: | 参数 | 类型 | 必需 | 默认值 | 说明 | |------|------|------|--------|------| | query | string | ✅ | - | 搜索关键词 | | limit | number | ❌ | 10 | 返回结果数量 |

示例:

搜索关键词: "用户增长"

2. read_doc - 读取策划文档

读取指定路径的策划文档内容。

参数: | 参数 | 类型 | 必需 | 默认值 | 说明 | |------|------|------|--------|------| | filePath | string | ✅ | - | 文档完整路径 | | maxLength | number | ❌ | 50000 | 最大读取字符数 |

示例:

文档路径: /Users/xxx/Documents/PRD/用户增长方案.md

3. search_and_read - 搜索并读取 ⭐(推荐)

搜索策划文档并直接读取第一个匹配结果,适合快速访问。

参数: | 参数 | 类型 | 必需 | 默认值 | 说明 | |------|------|------|--------|------| | query | string | ✅ | - | 搜索关键词 | | readContent | boolean | ❌ | true | 是否直接读取内容 |

示例:

搜索关键词: "用户增长"

4. list_docs - 列出所有文档

列出所有配置的文档目录中的策划文件。

参数: | 参数 | 类型 | 必需 | 默认值 | 说明 | |------|------|------|--------|------| | sourceName | string | ❌ | - | 按来源名称筛选 | | limit | number | ❌ | 20 | 返回文件数量 |

5. get_config - 查看配置

查看当前文档来源配置。

6. update_config - 更新配置

添加或移除文档来源。

参数: | 参数 | 类型 | 必需 | 说明 | |------|------|------|------| | action | string | ✅ | add / remove / list | | name | string | add/remove时必需 | 来源名称 | | path | string | add时必需 | 文档目录路径 | | type | string | ❌ | local / remote | | description | string | ❌ | 来源描述 |

安装

方式一:npm 安装(推荐)

# 全局安装
npm install -g @buhuo/product-doc-mcp

# 初始化项目(创建目录结构和 Qoder MCP 配置)
npx product-doc-init

这将自动创建:

your-project/
├── prd/
│   ├── planning/     # 产品策划目录
│   └── req/          # 产品需求目录
├── .product-doc-mcp/
│   └── config.yaml   # MCP 配置文件
└── mcp.json          # Qoder MCP 配置

方式二:手动配置(从源码)

1. 克隆项目

git clone https://gitlab.vmic.xyz/minigame/product-doc-mcp.git
cd product-doc-mcp
npm install

2. 初始化项目

npx tsx install.ts

3. 配置 Qoder MCP

安装完成后会自动生成 mcp.json 文件。如果需要手动配置,编辑 mcp.json

{
  "mcpServers": {
    "product-doc": {
      "type": "stdio",
      "command": "node",
      "args": ["/path/to/global/node_modules/@buhuo/product-doc-mcp/dist/index.js"]
    }
  }
}

4. 重启 Qoder


使用示例

场景1:快速查找并阅读策划文档

帮我查找"用户增长"相关的策划文档,并读取内容

场景2:列出所有策划文档

列出我配置的所有策划文档

场景3:添加新的文档来源

添加一个新的策划文档目录,路径是 /Users/xxx/新项目/策划,名称叫"新项目策划"

场景4:快速获取文档进行技术策划

查找"订单模块"的策划文档,我需要基于这个来做技术方案设计

配置说明

配置文件位置

  • 项目目录./.product-doc-mcp/config.yaml(推荐,便于版本控制)
  • 用户目录~/.product-doc-mcp/config.yaml(备选)

配置项说明

| 配置项 | 类型 | 说明 | |--------|------|------| | sources | array | 文档来源列表 | | sources[].path | string | 目录路径(本地或远程) | | sources[].type | string | localremote | | sources[].name | string | 来源名称(用于识别) | | sources[].description | string | 来源描述 | | fileExtensions | array | 支持的文件扩展名 | | searchDepth | number | 递归搜索深度 |

支持的文件格式

  • .md / .markdown - Markdown 格式
  • .txt - 纯文本
  • .doc / .docx - Word 文档
  • .pdf - PDF 文档

编程方式使用

直接运行

# 直接运行
npx tsx src/index.ts

# 或构建后运行
npm run build
npx tsx dist/index.js

作为模块导入

import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';

// 在其他 MCP 客户端中使用
const transport = new StdioServerTransport();
await server.connect(transport);

工作流程

用户输入
    ↓
[search_and_read]
    ↓
MCP Server
    ↓
┌─────────────────────┐
│  1. 加载配置文件     │
│  2. 搜索匹配文件     │
│  3. 计算相关度       │
│  4. 返回结果/内容    │
└─────────────────────┘
    ↓
返回文档内容
    ↓
用户可以基于内容生成技术策划等

项目结构

product-doc-mcp/
├── src/
│   └── index.ts        # MCP Server 主入口
├── install.ts          # 自动安装脚本
├── package.json
├── tsconfig.json
└── README.md

技术栈

  • TypeScript - 开发语言
  • @modelcontextprotocol/sdk - MCP SDK
  • js-yaml - YAML 配置解析
  • zod - 参数验证

开发

环境要求

  • Node.js >= 18.0.0
  • npm >= 9.0.0

安装

npm install

构建

npm run build

类型检查

npx tsc --noEmit

调试

# 方式一:直接运行
npm start

# 方式二:使用 inspector
npm run inspect

测试

手动测试

  1. 启动 MCP Server:
npm start
  1. 在 Qoder 中测试工具:
  • 使用 search_docs 搜索文档
  • 使用 read_doc 读取文档
  • 使用 search_and_read 一站式访问

测试场景

// 搜索文档
await server.tools.search_docs({
  query: "用户增长",
  limit: 5
});

// 读取文档
await server.tools.read_doc({
  filePath: "/path/to/document.md"
});

// 搜索并读取
await server.tools.search_and_read({
  query: "订单模块"
});

License

MIT