RLM Memory MCP Server

RLM Memory MCP Server

Provides persistent memory and semantic file discovery for AI coding agents, enabling them to remember changes and find relevant files across sessions.

Category
访问服务器

README

RLM Memory MCP Server

Persistent memory + semantic file discovery for ANY AI coding agent.

Works with Claude Code, OpenAI Codex, Gemini CLI, Cursor, Windsurf — anything that speaks MCP.

What is this?

AI agents forget everything between sessions. This MCP server fixes that:

  • 🧠 Memory — after every task, the agent records what it changed and why. Next session, it remembers.
  • 🗺️ File map — a semantic index of your codebase ("this file is the login form", "this is the checkout API"), so the agent finds the right files without grepping the whole repo.
  • 🔄 Bi-directional — the agent asks the MCP ("user wants to fix the submit button — which files?") and the MCP answers with files, history, and suggestions.

The core idea (Recursive Large Model): the agent stays intentionally "blind" to the filesystem and uses the MCP as its eyes and memory — making it faster, cheaper, and more focused.

┌────────────────────────────────────────────────────────┐
│  AI Agent (Claude Code, Codex, Gemini CLI, Cursor...)  │
│                                                        │
│  "User wants to fix login" ──► rlm_query               │
│                            ◄── relevant files+history  │
│  [does the work]                                       │
│  "Here's what I changed"   ──► rlm_smart_memory        │
└────────────────────────────────────────────────────────┘
                          │ stdio (MCP)
┌────────────────────────────────────────────────────────┐
│  RLM Memory MCP Server                                 │
│  • JSON storage per project (projects/<name>/.rlm/)    │
│  • AI-powered matching via OpenRouter or Gemini        │
│  • Web UI for you at http://localhost:3848             │
└────────────────────────────────────────────────────────┘

Setup in 3 Steps

1. Install & build

git clone https://github.com/jumpino27/RLM-Memory-MCP-Server.git
cd RLM-Memory-MCP-Server
npm install
npm run build

2. Add an API key

Copy .env.example to .env and set one key:

# Option A (recommended): OpenRouter — one key, any model
# https://openrouter.ai/keys
OPENROUTER_API_KEY="sk-or-..."

# Option B: Google Gemini direct — https://aistudio.google.com/
# GEMINI_API_KEY="..."
  • With OpenRouter the server uses google/gemini-3.5-flash by default — fast, cheap, near-Pro quality.
  • With Gemini direct it uses gemini-3.5-flash.
  • No key at all? Everything still works using keyword matching (just less smart).

Want a different model? Set LLM_MODEL (e.g. anthropic/claude-haiku-4.5 or openai/gpt-4o-mini on OpenRouter). See .env.example for all options.

3. Connect your AI agent

Replace C:\\path\\to with where you cloned the repo.

Claude Code (one command):

claude mcp add rlm-memory -- node C:\\path\\to\\RLM-Memory-MCP-Server\\dist\\index.js

OpenAI Codex CLI — add to ~/.codex/config.toml:

[mcp_servers.rlm-memory]
command = "node"
args = ["C:\\path\\to\\RLM-Memory-MCP-Server\\dist\\index.js"]

Gemini CLI — add to ~/.gemini/settings.json:

{
  "mcpServers": {
    "rlm-memory": {
      "command": "node",
      "args": ["C:\\path\\to\\RLM-Memory-MCP-Server\\dist\\index.js"]
    }
  }
}

Any other MCP client: launch node dist/index.js over stdio.

💡 Tell your agent how to use it: copy the rules from example_agents.md into your agent's instructions file (CLAUDE.md, AGENTS.md, .cursorrules, …).


The Workflow

First time on a project — index it once:

rlm_init → rlm_index_codebase → rlm_verify_index

Every task after that — three steps:

1. rlm_query          "User wants X — which files?"   → files + history + tips
2. (agent does the actual work)
3. rlm_smart_memory   "Here's what I changed"         → remembered forever

That's it. The more the agent works, the smarter the memory gets.


The Tools

Daily drivers

Tool What it does
rlm_query Start every task here. Ask about the user's request → get relevant files, past memories, and suggestions
rlm_smart_memory End every task here. Record changes with rich metadata (component types, feature areas, edit history)

Project setup

Tool What it does
rlm_init Register a project for memory tracking
rlm_index_codebase Scan a codebase and build the semantic file map
rlm_verify_index Post-index check: "Is this everything?" — shows breakdown + gaps

Maintenance & extras

Tool What it does
rlm_manage_sitemap Keep the file map in sync when files are deleted/moved/renamed
rlm_status Project statistics
rlm_list_projects All tracked projects
rlm_recall_memory Simple keyword memory search (legacy — prefer rlm_query)
rlm_find_files_by_intent Semantic file search (legacy — prefer rlm_query)
rlm_create_memory Basic memory creation (legacy — prefer rlm_smart_memory)

Example: rlm_query

{
  "project_name": "my-app",
  "user_request": "The user wants to fix the submit button color on the login form"
}

Returns:

{
  "relevant_files": [
    { "path": "src/components/LoginForm.tsx", "description": "Login form with submit button",
      "component_type": "form", "feature_area": "auth",
      "recent_changes": ["Added hover state to submit button"] }
  ],
  "relevant_memories": [
    { "summary": "Changed submit button to theme primary color", "date": "..." }
  ],
  "ai_analysis": "The submit button lives in LoginForm.tsx and uses theme.ts colors...",
  "suggestions": ["Check theme.ts for the color tokens"]
}

Example: rlm_smart_memory

{
  "project_name": "my-app",
  "user_prompt": "Fix the submit button color",
  "changes_context": "Changed the submit button in LoginForm to use the primary theme color instead of hardcoded blue. Added hover state.",
  "files_modified": [
    { "path": "src/components/LoginForm.tsx", "change_type": "modified",
      "change_summary": "Button color now uses theme.primary, added hover state" }
  ],
  "affected_areas": ["auth", "ui"]
}

The Web UI (for you, the human)

npm start   # → http://localhost:3848
  • Browse all projects, memories, and the semantic file map
  • Test every MCP tool from the browser
  • Delete stale memories / file entries
  • See live AI provider status (e.g. openrouter · google/gemini-3.5-flash)

Configuration Reference

All settings live in .env (see .env.example):

Variable Default Description
OPENROUTER_API_KEY OpenRouter key (recommended) — get one
GEMINI_API_KEY Google Gemini key — get one
LLM_PROVIDER auto auto / openrouter / gemini. Auto prefers OpenRouter
LLM_MODEL google/gemini-3.5-flash (OpenRouter) / gemini-3.5-flash (direct) Any model your provider offers
LLM_REASONING_EFFORT low minimal / low / medium / high — thinking depth for helper calls
LLM_MAX_TOKENS 4096 Max output tokens per call
LLM_TIMEOUT_MS 60000 Per-request timeout
UI_PORT 3848 Web UI port
RLM_DATA_DIR <install dir>/projects Where project memories are stored (set it to keep data outside the install tree)

Scripts: npm start (web UI) · npm run mcp (MCP server directly) · npm run build · npm test (end-to-end smoke test) · npm run dev (UI with auto-reload) · npm run typecheck


How data is stored

Everything is plain JSON — no database needed:

RLM-Memory-MCP-Server/
└── projects/
    └── my-app/.rlm/
        ├── config.json       # project info
        ├── memory_log.json   # every recorded task
        └── file_map.json     # the semantic file index

Back up by copying projects/. Inspect with any text editor or the web UI.


FAQ

Does this work without an API key? Yes — all tools fall back to weighted keyword matching. AI matching is just smarter.

Why store data centrally instead of in each repo? One place to back up, browsable across projects in the UI, no .rlm clutter in your repos, survives repo deletion.

Which agent works best? Any MCP-capable agent. The tool descriptions teach the agent how to use them, and example_agents.md has drop-in instructions.

rlm_query vs rlm_recall_memory? rlm_query searches files + memories + edit history and adds AI analysis. rlm_recall_memory only searches memories by keyword. Use rlm_query.

How much does the AI cost? Helper calls are small and run at low reasoning effort. With google/gemini-3.5-flash ($1.50/M input, $9/M output) typical queries cost fractions of a cent.


Project structure (for contributors)

src/
├── index.ts            # MCP server entry (stdio) — registers all tools
├── ui/server.ts        # Web UI (Express) at localhost:3848
├── services/
│   ├── llm.ts          # Multi-provider AI layer (OpenRouter / Gemini + fallbacks)
│   └── database.ts     # JSON file storage
├── tools/              # MCP tool implementations
├── schemas/index.ts    # Zod input validation
├── types.ts            # Shared types
└── constants.ts        # Paths, models, limits

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 模型以安全和受控的方式获取实时的网络信息。

官方
精选