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 🙏

© 2025 – Pkg Stats / Ryan Hefner

thinkmem

v1.1.7

Published

ThinkMem: AI Memory Management MCP System for LLMs

Readme

🧠 THINK-MEM

AI Memory Management System for LLMs - 让LLM善用思考,善用记忆

TypeScript Node.js Node.js CI License

📋 项目简介

ThinkMem是一个为大型语言模型设计的记忆管理MCP服务器,提供多种存储类型和通信协议,帮助LLM更好地组织和利用信息。

✨ 核心特性

  • 🧠 多种内存类型: RawMemory(无结构文本)、ListMemory(数组/队列/栈)
  • 🔍 智能检索: 文本搜索和行级操作
  • 📝 摘要管理: 自动摘要生成和管理
  • 🔄 双重模式: MCP stdio模式 + StreamableHTTP模式
  • 💾 持久化存储: JSON文件存储,支持备份恢复
  • 🧪 完整测试: 单元测试 + 集成测试

基本使用

只推荐两种用法:

  1. 单机模式(stdio),但是为每一个AI助手显式指定存储位置(db参数)
  2. 多机模式(HTTP,支持StreamableHTTP),集中管理多个AI助手的记忆,使用默认存储位置

首先安装

npm install -g thinkmem

用法1:单机模式+显式指定存储位置

命令行用法(仅供调试):

npx -g thinkmem --db path/to/db.json # 强烈建议指定db,否则不同进程可能冲突

JSON:

{
  "mcpServers": {
    "ThinkMem": {
      "command": "npx",
      "args": ["-g", "thinkmem", "--db", "path/to/db.json"]
    }
  }
}

用法2:多机模式

你应该有一个位置能够一定范围内公开部署本项目,最好是公网服务器。当然身为技术人员的你一定知道我在说什么所以我就不多说了。配置SSL等可以通过反向代理。

一、启动服务器:

npm -g install thinkmem
npx -g thinkmem --mode http --port 13809 # --db 可有可无

二、给MCP Host添加AI助手:

JSON:

{
  "mcpServers": {
    "ThinkMem": {
      "type": "streamable-http",
      "url": "http://your.server:13809/mcp"
    }
  }
}

Claude Code:

claude mcp add --transport http ThinkMem --scope user http://your.server:13809/mcp

📖 详细文档


⚙️ 配置选项

命令行参数

| 参数 | 简写 | 完整参数 | 类型 | 默认值 | 说明 | |------|------|----------|------|--------|------| | 模式 | -m | --mode | string | stdio | 运行模式:stdiohttp | | 端口 | -p | --port | number | 13809 | HTTP服务器端口 | | 数据库 | -d | --db | string | ~/.thinkmem/current.db | 数据库文件路径 |


🏃‍♂️ 运行模式

下面开始是你clone了repo之后才能做的事,不是npx的用法

📡 Stdio模式

适用于: AI助手集成、本地开发、MCP生态系统

# 默认stdio模式
npm start

🌐 HTTP模式(StreamableHTTP)

适用于: Web应用、移动应用、多客户端、实时功能

# 基础HTTP模式
npm start -- --mode http

# 自定义端口
npm start -- --mode http --port 3000

📊 模式对比

| 功能 | Stdio模式 | HTTP模式 | |------|------------|----------| | 协议 | stdin/stdout | StreamableHTTP | | 客户端 | 单个 | 多个并发 | | 复杂度 | 简单 | 需要端口配置 | | 使用场景 | 测试环境使用 | 生产环境使用 |


🧠 内存类型和操作

RawMemory(无结构内存)

  • 用途: 存储文本文档、笔记、日志
  • 功能: 行级文本操作、摘要管理、智能搜索
  • 特性: 自动摘要优化、行号索引、内容搜索

主要操作:

  • 文本写入、追加、插入、删除、替换
  • 摘要管理和智能读取
  • 基于模式的内容搜索

ListMemory(列表内存)

  • 用途: 任务列表、工作流、临时数据
  • 功能: 有序集合管理,支持三种角色模式和名称唯一性

🆕 名称唯一性机制

  • 每个元素都有唯一的标识符名称
  • 支持按名称快速查找和删除元素
  • 自动维护名称映射表,提供O(1)查找性能
  • 防止重复名称,确保数据完整性
  • 支持嵌套元素的高效管理

支持的角色类型

  1. Array(数组): 基础列表操作

    • 添加、插入、删除元素
    • 按索引访问和修改
    • 支持按名称查找和删除
  2. Deque(双端队列): 先进先出/后进先出

    • 两端添加和移除元素
    • 队列和栈操作
    • 支持按名称管理元素
  3. Stack(栈): 后进先出

    • 压栈、弹栈、栈顶查看
    • LIFO数据管理
    • 支持按名称管理元素

🧪 开发和测试

开发命令

# 安装依赖
npm install

# 开发模式(stdio)
npm run dev

# 编译TypeScript
npm run build

# 运行生产版本
npm start

# 代码检查
npm run lint

# 运行测试
npm test

# 运行特定测试
npm test -- --testNamePattern="RawMemory"

📄 许可证

本项目采用 MIT 许可证 - 查看 LICENSE 文件了解详情。

🙏 致谢

📞 支持

如果您遇到问题或有建议,请:

  1. 查看设计文档了解系统架构
  2. 查看Claude集成指南了解AI助手使用
  3. 搜索Issues查看已知问题
  4. 创建新的Issue报告问题

🚀 让LLM更好地思考和记忆!