Roo Code Memory Bank MCP Server
Roo 代码记忆库 MCP 服务器
该项目将Roo Code 记忆库系统的核心功能实现为模型上下文协议 (MCP) 服务器。它允许 AI 助手通过使用结构化 MCP 工具与基于文件的记忆库进行交互,从而跨会话维护项目上下文。
特征
该 MCP 服务器提供以下工具:
initialize_memory_bank:使用初始模板创建memory-bank/目录和标准.md文件(productContext.md、activeContext.md、progress.md、decisionLog.md、systemPatterns.md)。输入:(可选)
{ "project_brief_content": string }输出:
{ "status": "success" | "error", "messages"?: string[], "message"?: string }
check_memory_bank_status:检查memory-bank/目录是否存在并列出其中的.md文件。输入:
{}输出:
{ "exists": boolean, "files": string[] }
read_memory_bank_file:读取指定存储库文件的全部内容。输入:
{ "file_name": string }输出:
{ "content": string }或错误对象。
append_memory_bank_entry:将新的带时间戳的条目附加到指定文件,可选地附加到指定的 Markdown 标头下。如果文件不存在,则创建该文件。输入:
{ "file_name": string, "entry": string, "section_header"?: string }输出:
{ "status": "success" | "error", "message": string }
Related MCP server: engrams
先决条件
Node.js(建议使用 v18 或更高版本)
npm(通常包含在 Node.js 中)
MCP 客户端环境(如 Cline 使用的环境)能够管理和启动 MCP 服务器。
安装
克隆存储库:
git clone https://github.com/IncomeStreamSurfer/roo-code-memory-bank-mcp-server.git cd roo-code-memory-bank-mcp-server安装依赖项:
npm install构建项目:
npm run build这会将
dist/目录中的 TypeScript 代码编译为 JavaScript。
配置(适用于 Cline MCP 客户端)
为了使您的 AI 助手(如 Cline)可以使用此服务器,您需要将其配置添加到您的 MCP 设置文件(例如, cline_mcp_settings.json )中。
在您的设置文件中找到mcpServers对象并添加以下条目:
{
"mcpServers": {
// ... other server configurations ...
"roo-code-memory-bank-mcp": {
"autoApprove": [
"initialize_memory_bank",
"check_memory_bank_status",
"read_memory_bank_file",
"append_memory_bank_entry"
],
"disabled": false,
"timeout": 60,
"command": "node", // Or "cmd.exe" with "/c node ..." on Windows if needed
"args": [
// IMPORTANT: Replace this path with the actual absolute path
// to the compiled index.js file on your system
"/path/to/your/cloned/repo/roo-code-memory-bank-mcp-server/dist/index.js"
],
"env": {},
"transportType": "stdio"
}
// ... other server configurations ...
}
}**重要提示:**请将/path/to/your/cloned/repo/替换为您在计算机上克隆仓库的正确绝对路径。请确保路径分隔符与您的操作系统匹配(例如,在 Windows 上使用反斜杠\ )。
运行服务器
通常情况下,您无需手动运行服务器。MCP 客户端(例如 Cline)会在首次调用其工具时,使用配置文件中指定的command和args自动启动服务器。
如果您想手动测试,您可以从项目目录运行npm start 。
用法
AI助手使用定义的工具与服务器交互。典型的工作流程包括:
检查存储库状态(
check_memory_bank_status)。如果需要则初始化(
initialize_memory_bank)。读取相关文件(
read_memory_bank_file)以获取上下文。在做出决策或出现进展时附加条目(
append_memory_bank_entry)。
memory-bank/目录将在服务器进程启动的同一目录中创建(通过 MCP 客户端配置启动时,该目录应该是该项目目录的根目录)。
自定义指令
在 Roo 中设置这些指令
您必须在需要的地方使用 MCP
我有一个特定的 MCP 流程:
使用 context7 查找此过程所需的任何相关文档,确保将任何相关信息提供给任何相关子任务 - 如果您不确定某些内容,请始终使用 context7 研究重要文档 使用谷歌地图 mcp 搜索 + - 这将使我们能够找到完成任务所需的基本业务 使用勇敢搜索 mcp 查找要抓取的 URL 使用 fetch mcp 与 fetch_txt 和 fetch_markdown 在页面上查找文本和图像,以便转换为 JSON 文件并创建深入的内容 使用 openrouter 搜索来查找主题、评论等的一般情绪。
利用roo-code-memory-bank-mcp服务器来维护项目上下文:
在任务或重要子任务开始时,使用
check_memory_bank_status。如果内存库存在(
exists: true),则使用read_memory_bank_file获取相关文件(例如productContext.md、activeContext.md)来加载当前项目上下文。将这种重要的背景纳入到您的计划和执行中。
在做出重大决策、进度更新或架构变更时,使用
append_memory_bank_entry将信息记录在适当的文件(decisionLog.md、progress.md等)中,确保上下文持久性。如果存储库不存在,请考虑使用适合项目的
initialize_memory_bank。
Available Tools
4 toolsappend_memory_bank_entryC
Appends a new, timestamped entry to a specified file, optionally under a specific markdown header.
| Name | Required | Description | Default |
|---|---|---|---|
| entry | Yes | The content of the entry to append. | |
| file_name | Yes | The name of the memory bank file to append to. | |
| section_header | No | (Optional) The exact markdown header (e.g., '## Decision') to append under. |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
With no annotations provided, the description carries full burden but offers minimal behavioral insight. It states the tool appends with timestamping and optional header placement, but lacks details on permissions, file format constraints, error handling (e.g., if file doesn't exist), or mutation effects (e.g., overwriting). This is inadequate for a write operation with zero annotation coverage.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is a single, efficient sentence that front-loads the core action and key optional feature. Every word earns its place, with no redundancy or fluff, making it highly concise and well-structured.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
Given the tool's complexity (a write operation with 3 parameters), lack of annotations, and no output schema, the description is incomplete. It doesn't cover behavioral aspects like error cases, return values, or interaction with siblings, leaving significant gaps for an agent to use it correctly in context.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema description coverage is 100%, so the schema fully documents all parameters. The description adds marginal value by clarifying that 'section_header' is for markdown headers and 'entry' is content, but doesn't provide syntax examples or constraints beyond the schema. Baseline 3 is appropriate as the schema does the heavy lifting.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states the action ('Appends'), resource ('to a specified file'), and key details ('new, timestamped entry', 'optionally under a specific markdown header'), making the purpose unambiguous. However, it doesn't explicitly differentiate from sibling tools like 'initialize_memory_bank' (which likely creates files) or 'read_memory_bank_file' (which reads content), missing full sibling distinction.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description provides no guidance on when to use this tool versus alternatives. It doesn't mention prerequisites (e.g., file must exist), exclusions (e.g., not for creating new files), or comparisons to siblings like 'initialize_memory_bank' for setup or 'read_memory_bank_file' for retrieval, leaving usage context implied at best.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
check_memory_bank_statusA
Checks if the memory-bank directory exists and lists the .md files within it.
| Name | Required | Description | Default |
|---|---|---|---|
No parameters | |||
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
With no annotations provided, the description carries the full burden of behavioral disclosure. It describes the tool's actions (checking directory existence and listing .md files), which is helpful, but doesn't cover aspects like error handling (e.g., what happens if the directory doesn't exist), performance characteristics, or output format details. This leaves gaps in understanding how the tool behaves in edge cases.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is a single, clear sentence that efficiently conveys the tool's purpose without unnecessary words. It is front-loaded with the main action ('Checks if...') and includes all relevant details (directory existence and file listing) in a compact form, making it easy to understand at a glance.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
Given the tool's simplicity (0 parameters, no output schema, no annotations), the description is somewhat complete but could be improved. It explains what the tool does, but without an output schema, it doesn't detail the return format (e.g., whether it returns a boolean, list, or structured data). For a status-checking tool, more information on output behavior would enhance completeness.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
The input schema has 0 parameters with 100% coverage, so no parameter documentation is needed. The description appropriately doesn't discuss parameters, focusing instead on the tool's purpose. Since there are no parameters to explain, this meets expectations, but a perfect score is reserved for cases where the description adds value beyond an already complete schema, which isn't applicable here.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states the tool's purpose with specific verbs ('checks if... exists' and 'lists... files') and identifies the resource ('memory-bank directory' and '.md files'). It distinguishes from siblings by focusing on status checking rather than appending, initializing, or reading specific files. However, it doesn't explicitly contrast with sibling tools, keeping it from a perfect score.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description implies usage context by mentioning what the tool does (checking existence and listing files), which suggests it's for verifying the memory bank's state. However, it lacks explicit guidance on when to use this tool versus alternatives like 'initialize_memory_bank' or 'read_memory_bank_file', and doesn't specify any prerequisites or exclusions, leaving usage decisions somewhat ambiguous.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
initialize_memory_bankB
Creates the memory-bank directory and standard .md files with initial templates.
| Name | Required | Description | Default |
|---|---|---|---|
| project_brief_content | No | (Optional) Content from projectBrief.md to pre-fill productContext.md |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
No annotations are provided, so the description carries the full burden of behavioral disclosure. While it states the tool creates directories and files, it doesn't cover critical aspects such as whether this is idempotent (e.g., what happens if the memory bank already exists), permission requirements, error conditions, or side effects. This is a significant gap for a tool that performs file system operations.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is a single, efficient sentence that directly states the tool's action without unnecessary words. It's front-loaded with the core purpose and avoids redundancy, making it easy to parse quickly.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
Given the tool's complexity (file system creation with templates), lack of annotations, and no output schema, the description is minimally adequate. It covers the basic purpose but misses behavioral details like idempotency or error handling. With no structured fields to rely on, the agent would need more information for robust usage.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
The input schema has 100% description coverage, with one optional parameter clearly documented. The description doesn't add any parameter-specific information beyond the schema, but since schema coverage is high and there's only one parameter, the baseline is 3. The description's mention of 'initial templates' provides slight additional context about the tool's behavior, justifying a score of 4.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states the tool's purpose: 'Creates the memory-bank directory and standard .md files with initial templates.' This specifies the verb ('Creates') and resources ('memory-bank directory and standard .md files'), making it easy to understand what the tool does. However, it doesn't explicitly differentiate from sibling tools like 'check_memory_bank_status' or 'read_memory_bank_file', which would require a 5.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description provides no guidance on when to use this tool versus alternatives. It doesn't mention prerequisites (e.g., whether the memory bank must not already exist), exclusions, or comparisons to siblings like 'append_memory_bank_entry'. This leaves the agent with minimal context for decision-making.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
read_memory_bank_fileC
Reads the full content of a specified memory bank file.
| Name | Required | Description | Default |
|---|---|---|---|
| file_name | Yes | The name of the memory bank file (e.g., 'productContext.md') |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
With no annotations provided, the description carries the full burden of behavioral disclosure. It states the action ('Reads') but lacks details on permissions, error handling (e.g., what happens if the file doesn't exist), or output format (e.g., plain text, structured data). This leaves significant gaps for a tool with no annotation coverage.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is a single, efficient sentence that directly states the tool's purpose without any wasted words. It is appropriately sized and front-loaded, making it easy for an agent to parse quickly.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
Given the lack of annotations and output schema, the description is incomplete. It doesn't address behavioral aspects like error cases or output format, which are crucial for a read operation. The high schema coverage helps with parameters, but overall context is insufficient for reliable tool invocation.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
The input schema has 100% description coverage, with the parameter 'file_name' well-documented in the schema itself. The description adds no additional parameter semantics beyond what the schema provides, so it meets the baseline score of 3 for high schema coverage.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states the verb ('Reads') and resource ('full content of a specified memory bank file'), making the purpose evident. However, it doesn't explicitly differentiate from sibling tools like 'check_memory_bank_status' or 'append_memory_bank_entry', which might involve reading or checking content in different ways.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
No guidance is provided on when to use this tool versus alternatives. For example, it doesn't clarify if this should be used for retrieving entire files versus checking status or appending entries, leaving the agent to infer usage from tool names alone.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
4 tool updates
v1.0.0- First observed
append_memory_bank_entry - First observed
check_memory_bank_status - First observed
initialize_memory_bank - First observed
read_memory_bank_file
TDQS
Scored across 4 tools
Each tool has a clearly distinct purpose: append adds entries, check verifies directory status, initialize sets up the structure, and read retrieves content. There is no overlap in functionality, making it easy for an agent to select the correct tool without confusion.
All tool names follow a consistent verb_noun pattern (e.g., append_memory_bank_entry, check_memory_bank_status), with clear and descriptive verbs. There are no deviations in naming conventions, ensuring predictability and readability.
With 4 tools, the server is well-scoped for managing a memory bank system. Each tool serves a distinct and necessary function (setup, verification, reading, writing), and the count is neither too sparse nor excessive for the domain.
The tools cover core CRUD-like operations for a memory bank: initialize (create), check (status), read (retrieve), and append (update/add). A minor gap is the lack of a delete or modify tool for removing or editing entries, but agents can work around this with append for updates.
Maintenance
Related MCP Connectors
Portable AI memory shared across models and harnesses - plain markdown you own.
Shared project memory that keeps teammates and AI agents aligned across sessions.
Persistent memory for AI assistants: store, search, and connect knowledge across conversations.
Gives your AI assistant persistent memory and intelligence about your work patterns.
Related MCP Servers
- AlicenseBqualityDmaintenanceProvides a structured documentation system for context preservation in AI assistant environments, helping users create and manage memory banks for their projects.377MIT
- AlicenseNot gradedqualityCmaintenanceGives AI assistants persistent, queryable project memory for decisions, patterns, and rules, reducing the need to re-explain context in every prompt.11Apache 2.0
- AlicenseNot gradedqualityCmaintenanceEnables AI assistants to retain memory across sessions by storing conversations locally in Markdown files, allowing personalization and continuity without external servers.MIT
- AlicenseNot gradedqualityCmaintenanceProvides persistent, project-specific memory to AI assistants via the Model Context Protocol, enabling context-aware collaboration across sessions without cloud dependencies.21 PyPI1Apache 2.0