Kimi Code Memory MCP Server

Kimi Code Memory MCP Server

Provides persistent, Markdown-based memory for Kimi Code CLI, enabling cross-session context recovery and structured knowledge management.

Category
访问服务器

README

Kimi Code Memory MCP Server

中文

CI npm License: MIT

A local stdio MCP server that gives Kimi Code CLI cross-session memory.

All data is stored as plain Markdown files on disk. No vector database, no graph database, no external services.

Note for publishers: Replace Zehee in badge URLs and package.json with your actual GitHub username or organization before publishing.

Features

  • Markdown-first memories — human-readable, git-friendly, LLM-compatible.
  • Structured long-term memorymemory/decisions/, memory/knowledge/, memory/rules/, memory/reference/.
  • Workspace essence — condensed digest (≤15 KB) generated from memory/.
  • Cross-session context recovery — parses Kimi Code CLI's wire.jsonl directly.
  • Theme tracing — associate conversation turns and memories with themes, then trace their evolution.
  • Refined turn summaries — reusable turn-level atomic summaries shared across themes.
  • Rebuilding indexindex.json is a cache; .md files are the source of truth.

Why Markdown?

Most agent memory systems default to vector databases. That works for fuzzy retrieval, but it also makes memories opaque, hard to audit, and hard to version-control.

This project starts from the opposite assumption:

Memories should be judged, structured, and owned by the user before they are stored.

Markdown + YAML frontmatter gives you:

  • Full readability and editability
  • Native git diff support
  • Zero external dependencies
  • Compatibility with any LLM that can read text

See docs/ARCHITECTURE.md for the design rationale.

Install

npm install -g kimi-code-memory-mcp-server

Or run directly with npx:

npx kimi-code-memory-mcp-server

Configure Kimi Code CLI

Edit ~/.kimi-code/mcp.json:

{
  "mcpServers": {
    "memory": {
      "command": "npx",
      "args": ["kimi-code-memory-mcp-server"],
      "enabled": true
    }
  }
}

Restart Kimi Code CLI to load the server.

Optional: Install User-Level AGENTS.md Startup Hook

For automatic memory recovery and behavioral rules on every session start, copy the bundled AGENTS.md to your Kimi Code user directory:

cp AGENTS.md ~/.kimi-code/AGENTS.md

This installs a startup hook that tells Kimi Code CLI to call bootstrap_workspace at the beginning of every session, and to follow the memory classification and decision-guard rules. Because AGENTS.md is injected into every session, it is the right place for memory-related behavior protocols.

Note: Keep AGENTS.md focused on memory-related conventions only. Do not include tool preferences that belong to other MCP servers.

Optional: Install the Memory Skill

This repository also includes a lightweight Skill (skills/memory-manage/SKILL.md) that reminds Kimi Code CLI to call the memory tools when the user expresses a memory-related intent.

cp -r skills/memory-manage ~/.kimi-code/skills/memory-manage

The Skill does not enforce behavior on its own; it is a dispatcher. The actual protocols (when to remember, decision guard, etc.) live in AGENTS.md.

Quick Start

After the server is loaded, the agent can call memory tools naturally:

User: Let's use SQLite for the cache layer.
Agent: [calls remember] memory/decisions/use-sqlite-cache

User: Why did we choose SQLite?
Agent: [calls search] SQLite cache decision
       [calls recall] use-sqlite-cache
       → "We chose SQLite over Redis because..."

User: How has the cache design evolved?
Agent: [calls tag_theme] theme=cache-design
       [calls trace_theme] cache-design
       → shows related turns and decisions across sessions

Storage Layout

The server stores data under ~/.kimi-code-memory/<workspace-id>/:

~/.kimi-code-memory/workspace-a1b2c3d4/
├── index.json              # v3-kv metadata cache (rebuildable)
├── memory/
│   ├── decisions/          # architecture and product decisions
│   ├── knowledge/          # project-specific knowledge
│   ├── rules/              # conventions and guardrails
│   └── reference/          # external references
├── essence/
│   └── essence.md          # workspace digest (≤15 KB)
├── notes/                  # scratch notes
├── themes/
│   └── my-theme.json       # theme -> turn/memory refs
└── refined/
    └── <sessionId>.jsonl   # turn-level summaries

You can override the storage root with the MEMORY_STORE_ROOT environment variable.

Tools

Tool Purpose
remember Write a Markdown memory
recall Read a memory by key
recall_recent List recently updated memories
search Keyword search across memories
list List memories
list_tags List all tags
delete Delete a memory
move Move or rename a memory
organize_memories Distill memory/ into essence/essence.md
sync_workspace_index Rebuild index.json from disk
bootstrap_workspace Load context, essence, and memory tree
load_workspace_context Load recent conversation context
load_more_context Load older conversation rounds
search_context Search across all session wires
load_turn_context Load specific turn details
tag_theme Associate a turn or memory with a theme
trace_theme Trace a theme's evolution
list_themes List themes
refine_session_turns Generate refined turn summaries

Development

git clone https://github.com/Zehee/kimi-code-memory-mcp-server.git
cd kimi-code-memory-mcp-server
npm install
npm test
npm run lint

See docs/CONTRIBUTING.md for contribution guidelines.

Project Structure

src/
├── server.js              # MCP server entry
├── config.js              # defaults and paths
├── theme-manager.js       # theme storage
├── refined-manager.js     # refined turn storage
├── dao/
│   ├── index.js           # index.json DAO (v3-kv)
│   └── memory-store.js    # Markdown file operations
├── context/
│   └── wire-context.js    # wire.jsonl parsing
├── tools/
│   ├── index.js           # tool schemas & dispatch
│   ├── memory-tools.js    # memory CRUD
│   ├── context-tools.js   # context recovery
│   ├── theme-tools.js     # theme tracing
│   └── system-tools.js    # organize/sync/bootstrap
└── utils/
    ├── frontmatter.js
    ├── paths.js
    └── validation.js

Roadmap

  • [x] Modular source structure
  • [x] ESLint + Prettier
  • [x] Basic integration tests
  • [ ] Full test coverage for context/theme tools
  • [ ] Optional local embedding search
  • [ ] Optional LLM-based turn refinement
  • [ ] Pluggable wire format adapters
  • [ ] Memory usage benchmarks

Related Documents

License

MIT

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选