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

clipboard-history-mcp

v1.0.0

Published

MCP服务器,用于记录MacBook剪贴板历史

Readme

MacBook 剪贴板历史记录 MCP 服务

这是一个基于 Node.js 的 MCP(Model Context Protocol)服务器,用于记录和管理 MacBook 上的剪贴板历史记录。

功能特性

  • 🔄 实时监控剪贴板变化
  • 📝 自动记录复制内容
  • 🔍 搜索历史记录
  • 📅 按日期存储历史文件
  • 🌐 Web 界面查看和管理
  • 🔌 WebSocket 实时通信
  • 📋 一键复制历史内容

安装和运行

1. 安装依赖

npm install

2. 启动服务

npm start

服务将在 http://localhost:3000 启动。

3. 访问 Web 界面

打开浏览器访问 http://localhost:3000 查看剪贴板历史记录。

MCP 工具和资源

可用工具

  1. getClipboardHistory

    • 描述: 获取剪贴板历史记录
    • 参数: limit (数字, 可选) - 要获取的历史记录数量,默认 10 条
  2. clearHistory

    • 描述: 清除所有剪贴板历史记录
    • 参数: 无
  3. searchHistory

    • 描述: 搜索剪贴板历史记录
    • 参数: query (字符串, 必需) - 搜索关键词

可用资源

  1. clipboard/latest

    • 描述: 获取最新的剪贴板内容
  2. clipboard/stats

    • 描述: 获取剪贴板历史统计信息

文件结构

clipboard-history-mcp/
├── index.js              # 主服务器文件
├── package.json          # 项目配置
├── README.md             # 说明文档
├── public/               # Web界面文件
│   ├── index.html        # 主页面
│   ├── style.css         # 样式文件
│   └── script.js         # 前端JavaScript
└── clipboard_history/    # 历史记录存储目录(自动创建)
    ├── 20241201.json     # 按日期存储的历史文件
    └── ...

使用说明

Web 界面功能

  1. 查看历史: 页面会实时显示剪贴板历史记录
  2. 搜索: 在搜索框中输入关键词搜索历史内容
  3. 查看详情: 点击任意历史记录查看完整内容
  4. 复制内容: 在详情页面可以一键复制内容到剪贴板
  5. 清除历史: 点击"清除历史"按钮删除所有记录

MCP 客户端集成

如果你想在其他应用中使用这个 MCP 服务,可以通过 WebSocket 连接:

const ws = new WebSocket("ws://localhost:3000");

// 使用工具
const request = {
  id: Date.now(),
  type: "mcp_request",
  action: "use_tool",
  tool: "getClipboardHistory",
  args: { limit: 5 },
};

ws.send(JSON.stringify(request));

配置选项

index.js 中可以修改以下配置:

  • maxHistorySize: 内存中保存的最大历史记录数量(默认 100)
  • PORT: 服务器端口(默认 3000)
  • 剪贴板检查间隔(默认 1 秒)

注意事项

  1. 权限要求: 在 macOS 上,应用可能需要辅助功能权限才能访问剪贴板
  2. 隐私: 所有剪贴板内容都存储在本地,不会上传到任何服务器
  3. 性能: 服务会定期检查剪贴板,对系统性能影响很小
  4. 存储: 历史记录按日期存储在 clipboard_history 目录中

故障排除

无法读取剪贴板

  • 确保应用有访问剪贴板的权限
  • 在 macOS 系统偏好设置 > 安全性与隐私 > 辅助功能中添加终端或 Node.js

WebSocket 连接失败

  • 检查端口 3000 是否被占用
  • 确保防火墙没有阻止连接

历史记录不显示

  • 检查 clipboard_history 目录是否有写入权限
  • 查看控制台是否有错误信息

开发和扩展

这个项目使用标准的 Node.js 技术栈:

  • Express.js 用于 Web 服务
  • WebSocket 用于实时通信
  • node-clipboard 用于剪贴板访问
  • moment.js 用于时间处理

你可以根据需要扩展功能,比如:

  • 添加更多搜索选项
  • 支持图片和文件复制
  • 添加导出功能
  • 集成云同步

许可证

MIT License