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

memreduct-mcp

v0.1.1

Published

MCP server that lets AI agents free RAM with the user's own Mem Reduct, without admin prompts.

Readme

memreduct-mcp

让 AI Agent(Claude Code、Codex、Cursor、Claude Desktop 等)在 Windows 上用你自己的 Mem Reduct 腾内存。模型、渲染、编译等任务马上要用内存时,Agent 可以自己清理,不弹管理员确认,也不留需要点掉的对话框。

为什么做这个

Windows 上的 AI Agent 经常自己跑长任务:编译、模型推理、渲染,同时开着好几个会话和 MCP 服务。跑着跑着内存就满了,Agent 自己却释放不了:闲置的会话一直占着物理内存,而清理别的程序的内存需要管理员权限,Agent 没有。Mem Reduct 能清,但要有人去点。

memreduct-mcp 补上了这一步。Agent 自己查看内存,任务快装不下时,让你已经在用的 Mem Reduct 清理一次,再读回实际腾出了多少。

原理

Mem Reduct 本来就以管理员身份常驻在托盘里。这个服务只是按下 Mem Reduct 的清理内存快捷键。即使 Agent 以普通权限运行,Windows 也会把注册过的全局快捷键送到管理员权限的 Mem Reduct,所以不需要 UAC、计划任务或任何提权服务。按完以后,服务会等 Mem Reduct 在配置文件里写下这次清理的时间(StatisticLastReduct),再对比清理前后的可用内存。

用快捷键清理时,Mem Reduct 既不弹确认框,也不弹模态对话框。命令行 memreduct.exe -clean 则一定会弹出必须点“确定”的对话框,所以这里不用命令行。

本项目不包含 Mem Reduct。Mem Reduct 是 Henry++ 以 GPL-3.0 发布的软件,本项目只负责按它的快捷键。

工具

| 工具 | 作用 | |---|---| | memory_status | 总内存、可用内存、提交量,以及占用最多的进程。只读。 | | clean_memory | 触发 Mem Reduct 清理,返回清理前后的可用内存和 freedMB;Mem Reduct 开了结果日志时,再附上它自己报告的清理量。传 needed_mb 时,内存已经够用就跳过清理。有冷却时间(默认 120 秒,环境变量 MEMREDUCT_MCP_COOLDOWN)。 | | memreduct_setup_check | 检查 Mem Reduct 是否安装、是否在运行、快捷键是否已开启;没准备好时告诉用户怎么改。 |

安装

  1. 安装并启动 Mem Reduct(第一次会请求管理员权限),让它常驻托盘。建议打开它的“开机启动”。
  2. 在 Mem Reduct 的 设置 > 快捷键 里启用 清理内存,挑一个不和别的软件冲突的组合。默认的 Ctrl+F1 和 Office 的“折叠功能区”冲突,推荐 Ctrl+Alt+Shift+F12。服务会自动读取你设置的组合。
  3. 建议:在 Mem Reduct 的 设置 > 高级 里勾选 Log cleaning results into a debug log。这样 clean_memory 还会返回 Mem Reduct 自己报告的清理量(memreductReported),不用只信本工具的测量。
  4. 可选:关掉清理结果的托盘提示。
  5. 需要 Node.js 18 或更高版本。

Claude Code(插件,附带一份告诉 Claude 何时该清理的 Skill)

/plugin marketplace add RepressedAlliance/memreduct-mcp
/plugin install memreduct@memreduct-mcp

Codex、Cursor 等 MCP 客户端

服务已发布到 npm,包名 memreduct-mcp:

codex mcp add memreduct -- npx -y memreduct-mcp

服务本身会告诉 Codex 什么时候该清理。想要 Claude Code 那份更详细的说明,可以再把 skills/memreduct/SKILL.md 复制到 %USERPROFILE%\.codex\skills\memreduct\SKILL.md(可选,新开的 Codex 会话会用上)。

用 JSON 配置的客户端(Cursor、Windsurf、Claude Desktop 等)加上:

{
  "mcpServers": {
    "memreduct": { "command": "npx", "args": ["-y", "memreduct-mcp"] }
  }
}

Claude Desktop 扩展

从 Releases 下载 memreduct-mcp.mcpb,双击打开,或拖到 Claude Desktop 的 设置 > 扩展 页面。冷却时间可以在扩展设置里改。

不用 npm

克隆仓库即可。dist/index.cjs 是打包好的单文件,不需要 npm install。命令填 node,参数填 C:\path\to\memreduct-mcp\dist\index.cjs。

清内存真的有用吗?

只在合适的时机有用。清理会削减所有程序的工作集、丢掉备用缓存,所以可用内存会马上变多,具体多出多少,取决于各程序占着多少暂时不用的内存。在一台 16 GB 的测试笔记本上,让一个进程占着 6 GB 不动,可用内存降到 3.6 GB;调用一次 clean_memory 后回到 10.9 GB(Mem Reduct 日志记录:“Cleanup (Hotkey),7.72 GB”)。如果刚清理过、又已经有 10 GB 空闲,同样的调用只能腾出不到 1 GB。

对闲置的 Agent 会话效果最稳定。让 8 个常驻的 Claude Code 会话(连同 MCP 服务共 40 个进程)干完活后闲着,清理一次,它们的工作集从 2.81 GB 降到 0.42 GB,5 分钟后是 1.02 GB。它们的提交量一直在 4 GB 左右:清理腾出的是物理内存,不会结束进程,也不会降低提交量。

但程序再用到那些页面时,还会从磁盘读回来,所以它不会让电脑整体变快。它真正有用的场景,是马上要开始一个内存吃紧、本来装不下的任务。工具的冷却时间和附带的 Skill,都是为了引导 Agent 只在这种时候清理,不要定时清理。

限制

  • 只支持 Windows,而且 Mem Reduct 必须在运行。
  • 当前台是管理员权限的窗口(比如任务管理器),或者电脑处于锁屏状态时,Windows 会拦下模拟按键。这时 clean_memory 会返回 cleaned: false 和提示。
  • 如果别的软件占用了同一个快捷键,清理不会发生,换一个组合即可。

开发

npm install
npm run build   # 把 src/ 打包成 dist/index.cjs
npm test        # 端到端测试:启动服务并真正清理一次内存
npm run pack:mcpb  # 生成给 Claude Desktop 用的 memreduct-mcp.mcpb

许可证

MIT