thinking-memory-bank
v0.1.2
Published
MCP server integrating RooCode Memory Bank pattern with Sequential Thinking
Maintainers
Readme
Thinking Memory Bank MCP Server
A custom MCP server that combines the 'RooCode Memory Bank' pattern with the 'Sequential Thinking' methodology to provide structured context persistence with dynamic reasoning capabilities.
Overview
The Thinking Memory Bank MCP server is a specialized implementation that integrates two powerful paradigms:
RooCode Memory Bank: A structured approach to maintaining project context across sessions using specialized Markdown files organized in a consistent structure.
Sequential Thinking: A step-by-step reasoning methodology that breaks down complex problems into manageable thoughts that can be revised, branched, and extended dynamically.
By combining these approaches, the server provides AI assistants with:
- Persistent context storage organized in a structured format
- Reasoning capabilities that can leverage and update this context
- Specialized tools for initializing, updating, and querying memory
- Integration of sequential thinking with memory operations
Installation
For Users
Once published to npm, install via npx (no installation required):
npx thinking-memory-bankFor Development
# Clone the repository
git clone https://github.com/herdeybayor/thinking-memory-bank.git
cd thinking-memory-bank
# Install dependencies
npm install
# Build the project
npm run buildPublishing to npm
If you want to publish your own version, see PUBLISHING.md for a complete guide.
Usage
Starting the Server
The MCP server can be started using the following command:
npm startThis will launch the server on stdio, ready to receive MCP protocol messages.
MCP Tool Usage
The server provides the following MCP tools:
Initialize Memory Bank
Creates the memory bank structure for a new project:
{
"toolName": "initialize_memory_bank",
"params": {
"projectName": "My Project",
"projectDescription": "A description of my project",
"initialContext": "Additional context information"
}
}Update Memory
Updates a specific memory file with new information:
{
"toolName": "update_memory",
"params": {
"memoryType": "activeContext",
"content": "New information to add",
"operation": "append",
"reason": "Adding current session goals"
}
}Query Memory
Retrieves relevant information from memory:
{
"toolName": "query_memory",
"params": {
"query": "What are the project goals?",
"memoryTypes": ["productContext", "activeContext"]
}
}Sequential Thinking
Performs a step in a sequential thinking process with optional memory integration:
{
"toolName": "sequential_thinking",
"params": {
"thought": "First, we need to understand the requirements...",
"thoughtNumber": 1,
"totalThoughts": 5,
"nextThoughtNeeded": true,
"contextQuery": "What are the current requirements?",
"updateMemory": true
}
}Architecture
The Thinking Memory Bank combines several components:
┌─────────────────────────┐
│ MCP Server Interface │
└───────────┬─────────────┘
│
▼
┌─────────────────────────┐
│ Tool Handlers │
└───────┬───────────┬─────┘
│ │
▼ ▼
┌───────────┐ ┌───────────┐
│ Memory │ │ Thinking │
│ Manager │ │ Engine │
└───────────┘ └───────────┘Memory Bank Structure
The memory bank is organized with the following files:
- activeContext.md: Current session state and goals
- productContext.md: Overall project knowledge and context
- decisionLog.md: Record of decisions and their rationale
- progress.md: Documentation of completed work and future tasks
- systemPatterns.md: Recurring patterns and standards in the project
Memory Operations
Three operations are supported for memory updates:
- Append: Add new content to the end of a file
- Replace: Completely replace a file's content
- Merge: Intelligently update specific sections of a file
Development
Project Structure
src/
├── index.ts # Main entry point
├── memory/ # Memory management
│ ├── memory-manager.ts # Memory file operations
│ └── memory-manager.test.ts
├── thinking/ # Sequential thinking
│ └── thinking-engine.ts
├── tools/ # MCP tool definitions
│ ├── tool-definitions.ts
│ ├── tool-handlers.ts
│ └── tool-handlers.test.ts
├── types/ # Type definitions
│ └── memory.ts
└── mcp/ # MCP server implementation
└── mock-mcp-sdk.ts # Mock SDK implementationTesting
Run the test suite with:
npm testReferences
This project is based on the following:
- RooCode Memory Bank - The original Memory Bank implementation
- MCP Sequential Thinking Server - The reference implementation for Sequential Thinking
Using with Roo Code
The Thinking Memory Bank MCP server is designed to integrate smoothly with Roo Code. Here's how to set it up:
1. Configuration in VS Code
Add the following to your VS Code mcp.json configuration file:
Option A: Using Published npm Package (Recommended)
{
"servers": {
"thinking-memory-bank": {
"command": "npx",
"args": ["-y", "thinking-memory-bank"]
}
}
}Option B: Using Local Development Version
{
"servers": {
"thinking-memory-bank": {
"command": "node",
"args": ["/absolute/path/to/thinking-memory-bank/dist/index.js"]
}
}
}You can open this file through:
- Command Palette (Ctrl+Shift+P) → "MCP: Open User Configuration"
- Or add it to
.vscode/mcp.jsonin your workspace
2. Interacting with Memory Bank in Roo Code
Once configured, you can use the Memory Bank tools within your Roo Code conversations:
Initializing a Memory Bank
When starting a new project:
I'd like to initialize a memory bank for this project. It's a React application for managing inventory.Roo will use the initialize_memory_bank tool to create the memory structure.
Updating Memory
To explicitly update memory with specific information:
Please update our project context with this information: The application needs to support both desktop and mobile views, with responsive design principles.Retrieving Context
To have Roo utilize previously stored knowledge:
What were our design decisions regarding the state management approach?Roo will use the query_memory tool to retrieve this information.
Sequential Thinking with Memory
For complex problems requiring step-by-step analysis:
Let's work through how to implement the authentication flow, considering the security requirements we established earlier.Roo will combine sequential thinking with memory queries to provide context-aware reasoning.
3. Memory Bank Maintenance
You can explicitly manage the memory bank with commands like:
UMB (Update Memory Bank) - Used to manually trigger memory updates
Review memory - View the contents of specific memory files4. Best Practices
- Initialize the memory bank at the start of a project
- Periodically review memory contents to ensure accuracy
- Use explicit memory update requests for crucial information
- Let sequential thinking handle routine updates automatically
License
MIT
