whimsicality-mcp
Officialwhimsicality-mcp
一个 MCP(模型上下文协议) 服务器,为 AI 代理提供持久化记忆——跨会话和进程存活的上下文存储、事实、计划、RAG 搜索、代码片段和对话压缩。
适用于任何兼容 MCP 的代理:Devin CLI、Claude Desktop、Cursor 等。
快速开始
# Install globally
npm install -g whimsicality-mcp
# Or run without installing
npx whimsicality-mcp然后将其添加到代理的 MCP 配置中:
{
"mcpServers": {
"whimsicality": {
"command": "npx",
"args": ["whimsicality-mcp"]
}
}
}就这样。服务器开箱即用,支持基于磁盘的持久化——无需原生依赖。数据存储在 ~/.whimsicality/kernel-storage/ 中。
Related MCP server: Memory MCP
工具
服务器公开了 14 个工具,全部以 whim_ 为前缀:
工具 | 用途 |
| 持久化文本上下文槽位 |
| 键值事实(用户偏好、项目决策) |
| 用于长期任务的计划文档 |
| 文档索引和语义搜索 |
| 可复用的代码片段 |
| 将对话历史压缩为摘要 |
代理应如何使用
在会话开始时 — 恢复之前代理的状态:
1. whim_plan_get({}) → read the current plan
2. whim_facts_list({}) → list all facts
3. whim_facts_get({name: "..."}) → read relevant facts
4. whim_context_list({}) → list all context slots
5. whim_context_get({key: "..."}) → read relevant slots在工作过程中 — 为下一个代理保存状态:
whim_plan_save({plan: "updated plan with progress and next steps"})
whim_facts_save({name: "new_fact", value: "..."})
whim_context_set({key: "what_i_learned", text: "..."})后端
服务器支持四种查找内核的方式,按顺序尝试:
1. 磁盘回退(默认,零配置)
开箱即用。数据持久化到 ~/.whimsicality/kernel-storage/whim-mcp-store.json 的 JSON 文件中。RAG/片段的词重叠搜索。无需原生依赖。
2. 预构建的内核二进制文件(最简单的升级方式)
npm install @whimsicalitylabs/kernel-prebuilt通过 npm optionalDependencies 分发的平台特定预构建二进制文件。服务器会自动发现 node_modules 中的二进制文件。
注意: 预构建二进制文件尚不适用于所有平台。请参阅 kernel-prebuilt 了解状态。
3. 指向现有二进制文件
{
"mcpServers": {
"whimsicality": {
"command": "npx",
"args": ["whimsicality-mcp"],
"env": {
"WHIMSICALITY_KERNEL_BIN": "/path/to/whimsicality-kernel"
}
}
}
}4. 从源码构建
克隆 Rust 工作区 并构建:
git clone https://github.com/WhimsicalityLabs/whimsicality-kernel.git
cd whimsicality-kernel
cargo build --release然后将 WHIMSICALITY_KERNEL_BIN 设置为 target/release/whimsicality-kernel。
内核提供了什么
Rust 内核提供:
分层存储:热(RAM)→ 温(mmap)→ 冷(磁盘上的 zstd),支持自动提升/降级
内容寻址去重:通过 blake3 哈希共享相同值的存储
无锁热路径:使用 DashMap 进行并发读取
仅追加的会话日志:支持分支/分叉的 bincode 条目
结构化上下文组装:命名变量,而非扁平标记流
当内核可用时,服务器会同时双写到内核和磁盘。这为您提供了内核的快速会话内访问以及跨会话可靠性的磁盘持久化(内核的热层仅存在于 RAM 中,进程退出时会丢失)。
配置
所有配置均通过环境变量进行:
变量 | 默认值 | 描述 |
|
| 所有存储数据的根目录 |
| (自动发现) | Rust 内核二进制文件的路径 |
|
| 热层 RAM 预算(MB)(仅内核) |
开发
git clone https://github.com/WhimsicalityLabs/Whimsicality-MCP.git
cd whimsicality-mcp
npm install
npm run build
node bin/whimsicality-mcp.js许可证
MIT
Available Tools
14 toolswhim_compactA
Truncate conversation history to fit a token budget. Keeps first and last messages intact, truncates the middle. This is truncation, not summarization.
Inputs: messages (required), maxTokens.
whim_context_deleteB
Delete a context slot.
Inputs: key (required), namespace.
whim_context_getB
Retrieve text from a named context slot.
Inputs: key (required), namespace.
whim_context_listB
List all context slot keys.
Inputs: namespace.
whim_context_setA
Store text in a named context slot. Use for persistent memory that survives across agent sessions.
Inputs: key (required), text (required), namespace.
whim_facts_getC
Retrieve a named fact.
Inputs: name (required).
whim_facts_listC
List all saved fact names.
Inputs: no named parameters.
whim_facts_saveB
Save a named fact. Facts are key-value pairs that persist across sessions.
Inputs: name (required), value (required).
whim_plan_getC
Retrieve a saved plan.
Inputs: name.
whim_plan_saveA
Save a plan document. The plan persists across sessions and can be retrieved later by another agent.
Inputs: plan (required), name.
whim_rag_indexB
Index a document for keyword search retrieval.
Inputs: id (required), text (required).
whim_rag_searchB
Search indexed documents by keyword overlap. Returns relevant chunks ranked by word-boundary match score.
Inputs: query (required), topK.
whim_snippet_saveB
Save a reusable code snippet.
Inputs: code (required), name (required), language (required), description.
whim_snippet_searchB
Search saved snippets by keyword overlap.
Inputs: query (required), topK.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 14 tools
Most tools have distinct purposes: facts, context slots, RAG search, plans, snippets, and compaction each serve different needs. However, facts and context both act as persistent key-value stores, which could cause some confusion, though the descriptions clarify context as memory and facts as factual data.
The naming follows a consistent pattern of 'whim_<resource>_<action>' for most tools (e.g., whim_facts_get, whim_context_set, whim_rag_search). Minor exceptions include whim_compact, which lacks a resource category, and slight verb placement variations, but overall the pattern is predictable.
14 tools is a reasonable count for a multi-purpose memory and utility server. Each tool covers a distinct functional area, though some areas like facts and context could potentially be merged, but the count is within the well-scoped range and does not feel excessive.
The server covers core operations for facts, context, and RAG, but has notable gaps: no delete for facts, plans, or snippets; no list for plans or snippets; and no way to retrieve a snippet by name (only search). These missing operations may force agents to work around or leave orphaned data.
Maintenance
Related MCP Connectors
Persistent memory for AI agents. Search, store, and recall across sessions.
Persistent memory for AI agents. Search and store durable facts, preferences and decisions.
Universal persistent memory and knowledge retrieval layer for AI agents and LLMs.
Persistent memory for AI agents: save, search and connect context across tools and sessions.
Related MCP Servers
- FlicenseNot gradedqualityDmaintenanceProvides AI agents with persistent, searchable memory that survives across conversations using semantic search, temporal versioning, and smart organization. Enables long-term context retention and cross-session continuity for AI assistants.14-
- FlicenseNot gradedqualityDmaintenanceProvides persistent AI agent memory using a local vector database for long-term semantic storage and short-term session scratchpads. It enables low-latency memory operations including search, storage, and bulk management without external cloud dependencies.-
- AlicenseNot gradedqualityDmaintenanceProvides persistent memory storage for AI agents with full-text search, tagging, and importance levels, enabling agents to store and retrieve memories efficiently.MIT
- AlicenseAqualityCmaintenanceProvides persistent, searchable memory for AI agents, enabling them to retain, recall, and reflect on information across conversations.191MIT