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

document-mcp-server-1

v1.0.1

Published

MCP server for fetching recent documents from Google Sheets

Readme

Document MCP Server

MCP 服务器,用于从 Google Sheets 获取最近新增的文档信息,以 Markdown 格式输出。

npm version License: MIT

功能特性

  • 读取文档:从 Google Sheets 读取文档数据
  • 筛选文档:筛选最近 N 天的文档(默认 7 天)
  • 添加文档:通过 MCP 工具或 Slack 命令添加文档到 Google Sheets
  • 配置管理:支持设置默认提交人,查看当前配置
  • 自动识别字段:自动识别所有字段
  • Markdown 格式:以 Markdown 格式输出,按日期分组
  • 自定义列名:支持自定义列名

输出示例

## 最近7天文档 (2026-01-22 - 2026-01-28)

### 2026-01-28
- **技术文档A** by 张三 | [查看](https://example.com/doc1)
  类型: 技术 | 状态: 已完成

### 2026-01-27
- **产品需求B** by 李四 | [查看](https://example.com/doc2)

共 2 条记录

快速开始

方式一:通过 npm 安装(推荐)

# 全局安装
npm install -g document-mcp-server-1

方式二:从源码安装

# 克隆仓库
git clone https://github.com/eliauk1/document-mcp.git
cd document-mcp

# 安装依赖
npm install

# 构建
npm run build

配置步骤

1. 配置 Google Sheets API

⚠️ 注意:Google Sheets API 是完全免费的,不需要绑定信用卡,适合个人和小团队使用。

方法一:Service Account(推荐用于服务器)

  1. 访问 Google Cloud Console
  2. 创建新项目或选择现有项目
  3. 启用 Google Sheets API
  4. 创建服务账号:
    • 导航到 "IAM & Admin" > "Service Accounts"
    • 点击 "Create Service Account"
    • 填写名称和描述
    • 点击 "Create and Continue"
    • 跳过权限设置,点击 "Done"
  5. 创建密钥:
    • 点击创建的服务账号
    • 转到 "Keys" 标签
    • 点击 "Add Key" > "Create new key"
    • 选择 JSON 格式
    • 下载的 JSON 文件重命名为 credentials.json,放在项目根目录
  6. 共享 Google Sheet:
    • 打开目标 Google Sheet
    • 点击右上角 "Share"
    • 将服务账号的邮箱地址(如 [email protected])添加为编辑者

方法二:OAuth 2.0(推荐用于个人使用)

  1. 在 Google Cloud Console 中创建 OAuth 2.0 凭据
  2. 下载凭据文件为 credentials.json
  3. 首次运行时会提示授权

2. 配置 MCP 客户端

选项 A:在 Claude Code 中使用(推荐)

使用命令行配置:

Windows:

claude mcp add --transport stdio document-mcp -- cmd /c npx document-mcp-server-1

macOS/Linux:

claude mcp add --transport stdio document-mcp -- npx document-mcp-server-1

验证配置:

# 查看所有 MCP 服务器
claude mcp list

# 或在 Claude Code 中输入
/mcp

配置说明:

  • 自动创建配置文件:~/.claude.json(local 范围)
  • 团队共享:使用 --scope project 创建 .mcp.json 文件
  • 重启 Claude Code 使配置生效

生成的配置文件示例:

~/.claude.json (Windows) 或 .mcp.json (项目目录):

{
  "mcpServers": {
    "document-mcp": {
      "command": "cmd",
      "args": ["/c", "npx", "document-mcp-server-1"],
      "env": {}
    }
  }
}

macOS/Linux 版本:

{
  "mcpServers": {
    "document-mcp": {
      "command": "npx",
      "args": ["document-mcp-server-1"],
      "env": {}
    }
  }
}

手动配置(可选):

如果命令行方式不工作,也可以手动创建/编辑配置文件:

  • Windows: C:\Users\你的用户名\.claude.json
  • macOS/Linux: ~/.claude.json
  • 项目范围: 在项目根目录创建 .mcp.json

选项 B:在 Claude Desktop 中使用

如果通过 npm 全局安装:

先安装包:

npm install -g document-mcp-server-1

然后编辑配置文件:

  • Windows: %APPDATA%\Claude\claude_desktop_config.json
  • macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
{
  "mcpServers": {
    "document-mcp": {
      "command": "document-mcp-server"
    }
  }
}

注意:命令名是 document-mcp-server(不带 -1 后缀)。

如果从源码安装:

{
  "mcpServers": {
    "document-mcp": {
      "command": "node",
      "args": ["D:\\CODE\\project\\Document-mcp\\dist\\index.js"]
    }
  }
}

重启 Claude Desktop 使配置生效。

3. 放置认证文件

credentials.json 放在您的工作目录或项目根目录。

使用方法

基本使用

1. 获取文档列表

在 Claude Code 或 Claude Desktop 中输入:

查询最近7天的文档

或指定天数:

获取最近3天的文档

2. 添加新文档

添加文档,标题是"技术方案设计",URL是https://example.com/doc

带备注:

添加文档:标题"产品需求PRD",链接https://example.com/prd.pdf,备注"Q1产品规划"

3. 设置默认提交人

设置默认提交人为"张三"

4. 查看当前配置

显示当前的配置信息

在 Claude Code 中测试

配置完成后,在 Claude Code 中测试:

# 查看可用的 MCP 工具
/mcp

# 直接使用
查询最近7天的文档

工具说明

get_recent_documents

获取最近 N 天新增的文档信息。

参数:

  • days (可选): 获取最近多少天的文档,默认 7
  • sheetUrl (可选): Google Sheets URL,默认使用预配置的 Sheet
  • dateColumn (可选): 日期列名,默认 "提交日期"
  • titleColumn (可选): 标题列名,默认 "文档主题"
  • submitterColumn (可选): 提交人列名,默认 "提交人"
  • urlColumn (可选): URL列名,默认 "URL"

add_document

添加新文档到 Google Sheets。

参数:

  • title (必需): 文档主题
  • submitter (可选): 提交人(不提供时使用默认配置)
  • url (可选): 文档 URL
  • note (可选): 备注
  • sheetUrl (可选): Google Sheets URL,默认使用预配置的 Sheet

示例:

// 仅标题(使用默认提交人)
{
  "title": "技术方案设计"
}

// 完整信息
{
  "title": "产品需求PRD",
  "submitter": "张三",
  "url": "https://example.com/doc.pdf",
  "note": "Q1产品规划"
}

set_default_submitter

设置默认提交人。当添加文档时未指定提交人时,将使用此默认值。

参数:

  • submitter (必需): 默认提交人名称

get_config

查看当前配置信息(默认提交人、Sheet URL、列名等)。

参数:

开发

# 开发模式运行
npm run dev

# 构建
npm run build

# 生产模式运行
npm start

故障排除

权限错误

确保:

  1. Service Account 邮箱已添加到 Google Sheet 的共享列表
  2. credentials.json 文件在工作目录或项目根目录
  3. Google Sheets API 已启用

找不到日期列

检查:

  1. Sheet 第一行是否为表头
  2. 日期列名是否为"提交日期"(或通过参数指定正确的列名)

日期格式问题

支持的日期格式:

  • 2026-01-28 (ISO)
  • 2026/01/28
  • 01/28/2026

MCP Server 连接问题

Claude Code:

# 检查服务器状态
claude mcp list

# 查看具体配置
claude mcp get document-mcp

# 重新添加服务器
claude mcp remove document-mcp
claude mcp add --transport stdio document-mcp -- cmd /c npx document-mcp-server-1

Claude Desktop:

  • 检查配置文件格式是否正确
  • 确认命令路径是否正确
  • 重启 Claude Desktop

npx 下载问题

如果 npx 下载慢,可以先手动安装:

npm install -g document-mcp-server-1

然后修改配置使用直接命令:

claude mcp add --transport stdio document-mcp -- document-mcp-server-1

费用说明

  • Google Sheets API:完全免费,无需信用卡
  • npm 包:开源免费
  • 无隐藏费用

Google Sheets API 免费配额(足够个人和小团队使用):

  • 每分钟 60 次读取/写入请求(每用户)
  • 每分钟 100 次请求(每项目)

Google Sheets 权限设置

⚠️ 重要:确保 Service Account 有 Google Sheet 的编辑权限(不只是查看权限)

  1. 打开目标 Google Sheet
  2. 点击右上角 "Share"
  3. 将服务账号邮箱(如 [email protected])添加为编辑者(Editor)

License

MIT