Sponsored by Deepsite.site

Memory Bank MCP Server

Created By
TerLand0berver8 months ago
Content

Memory Bank MCP Server

This is a Model Context Protocol (MCP) server designed to manage project-specific "memory bank" data. It utilizes an SQLite database to store and retrieve contextual information related to a project, such as product background, decision logs, progress updates, etc.

Features

  • Project-Based: Maintains a separate memory bank for each specified project path.
  • SQLite Storage: Stores data in a memory-bank/memory.db file within the project directory, providing structured and efficient access.
  • Modular: Encapsulates memory bank management logic into an independent MCP service.
  • Standardized Interface: Provides a set of MCP tools for interacting with the memory bank.

This server is published to npm and can be run directly using npx without manual cloning, installation, or building.

Running the Server

The primary way to run this server is using npx, which executes the package directly from the npm registry:

npx @telagod/memory-bank-mcp-server

Node.js Version Requirement:

  • You need Node.js version 18.0.0 or higher (>=18.0.0) installed.

Platform-Specific Considerations:

  • Windows: If you have Node.js v18+ installed correctly and it's added to your system's PATH environment variable, the npx command should work directly in Command Prompt, PowerShell, or Windows Terminal.

  • macOS / Linux / WSL (Windows Subsystem for Linux):

    • Check your Node.js version: Run node -v.
    • Potential Issue: The default Node.js version provided by system package managers (like apt on Ubuntu/Debian) might be outdated (e.g., v12.x). Running npx with an old Node.js version will likely fail.
    • Recommended Solution: Use a Node Version Manager like NVM (Node Version Manager) or NodeSource to install and manage Node.js versions. System repositories often lag behind the latest Node.js releases.
    • Using NVM (Example):
      1. Install NVM (check the official NVM repository for the latest command):
        curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.7/install.sh | bash
        
      2. Restart your terminal or run the commands indicated by the NVM installer.
      3. Install a Node.js v18+ version: nvm install 18 (or a specific version like nvm install 18.17.0)
      4. Use the installed version: nvm use 18
      5. Now, the npx @telagod/memory-bank-mcp-server command should work correctly.

This server is typically started automatically by an MCP host application (like Roo Code) based on its configuration (e.g., mcp_settings.json), but the npx command is the underlying method used.

Integration Guide (Using npx)

You can integrate this Memory Bank MCP Server into MCP-enabled applications (like RooCode). Using npx to run the server is recommended.

RooCode Configuration Example

  1. Open RooCode's mcp_settings.json configuration file.

  2. Add a new server configuration entry to the servers object as shown below. The key (e.g., "memory-bank-server") is the unique identifier you'll use to refer to this server:

    {
      "servers": {
        "memory-bank-server": {
          "name": "Memory Bank Server (npx)",
          "command": "npx",
          "args": [
            "-y",
            "@telagod/memory-bank-mcp-server"
          ],
          "type": "stdio",
          "alwaysAllow": [
            "initialize_memory_bank",
            "get_memory_bank_status",
            "read_memory_bank_section",
            "update_memory_bank_entry"
          ],
          "disabled": false
        }
      }
    }
    
  3. Important: Ensure the package name @telagod/memory-bank-mcp-server is correct. If you are using a fork or a different version, update the name accordingly.

  4. Optional Arguments: If the server supports additional command-line arguments (like a configuration file path), you can add them as separate strings within the args array after the package name.

  5. Save the mcp_settings.json file.

  6. Restart RooCode to load the new MCP server.

Other MCP Clients

For other MCP-enabled clients, refer to their documentation on how to configure stdio or SSE type MCP servers launched via the command line. Typically, you will need to provide the npx command and corresponding arguments as shown in the example above.

MCP Tools

The server provides the following MCP tools:

  1. initialize_memory_bank

    • Description: Initializes the memory bank storage for the specified project path. Creates the memory-bank/ directory and memory.db file if they do not exist.
    • Input:
      • project_path (string, required): The absolute path to the project.
    • Output: An object containing a status message and the database path.
  2. get_memory_bank_status

    • Description: Checks the status of the memory bank for the specified project path (whether the database file exists).
    • Input:
      • project_path (string, required): The absolute path to the project.
    • Output: An object containing exists (boolean), db_path (string), and message (string).
  3. read_memory_bank_section

    • Description: Reads entries from a specific section of the memory bank.
    • Input:
      • project_path (string, required): The absolute path to the project.
      • section (string, required): The section to read from (e.g., product_context, decisions, progress, focus, system_patterns).
      • limit (number, optional, default: 10): Maximum number of entries to return.
      • offset (number, optional, default: 0): Offset for pagination.
    • Output: An array of objects representing the records from that section.
  4. update_memory_bank_entry

    • Description: Adds a new entry to a specific section of the memory bank.
    • Input:
      • project_path (string, required): The absolute path to the project.
      • section (string, required): The section to update (as above).
      • entry_data (object, required): Data for the new entry. Keys should match the column names of the section's database table (excluding id and timestamp).
        • product_context: { "content": "..." }
        • decisions: { "reason": "...", "outcome": "..." }
        • progress: { "update_summary": "...", "status": "..." }
        • focus: { "area": "...", "details": "..." }
        • system_patterns: { "pattern_name": "...", "description": "..." }
    • Output: An object containing a status message and the ID of the newly inserted entry.

How It Works

The following diagram illustrates the basic workflow of the Memory Bank MCP Server:

graph TD
    Client["Client"] -- "Tool Call\n(e.g., update_entry, section='decisions')" --> MCPServer["Memory Bank MCP Server"]
    MCPServer -- "Parse Request" --> Router{"Router/Logic"}

    subgraph "Database Interaction"
        direction LR
        Router -- "section='product_context'?" --> Table_PC["product_context Table"]
        Router -- "section='decisions'?" --> Table_DEC["decisions Table"]
        Router -- "section='progress'?" --> Table_PROG["progress Table"]
        Router -- "section='focus'?" --> Table_FOC["focus Table"]
        Router -- "section='system_patterns'?" --> Table_SP["system_patterns Table"]

        Table_PC -- "Read/Write Ops" --> SQLiteDB["SQLite DB"]
        Table_DEC -- "Read/Write Ops" --> SQLiteDB
        Table_PROG -- "Read/Write Ops" --> SQLiteDB
        Table_FOC -- "Read/Write Ops" --> SQLiteDB
        Table_SP -- "Read/Write Ops" --> SQLiteDB
    end

    SQLiteDB -- "Operation Result" --> MCPServer
    MCPServer -- "Format & Send Response" --> Client
  1. Client Request: The client (e.g., RooCode) initiates a tool call request to the Memory Bank MCP Server, typically including a section parameter (e.g., update_memory_bank_entry with section='decisions').
  2. Server Parsing: The server core receives and parses the request.
  3. Routing Logic: The server's internal routing logic determines the target database table based on the section parameter in the request.
  4. Table Interaction: The request is routed to the appropriate table handling logic (product_context, decisions, progress, focus, or system_patterns).
  5. Database Operation: Read or write operations are performed on the selected table within the SQLite database (memory-bank/memory.db).
  6. Return Results (DB): The SQLite database returns the result of the operation (e.g., queried data or confirmation of successful insertion).
  7. Process & Format: The server core processes the results returned from the database and formats them into an MCP response.
  8. Send Response: The server sends the final response back to the client.

Database Structure

The core of the memory bank consists of the following SQLite tables, which collectively store key project information:

  • product_context: Stores high-level background information about the product or project, goals, scope, etc. This helps understand the "why" of the project.
  • decisions: Records important technical choices, architectural decisions, product direction adjustments, etc. Includes the reasons for decisions, options considered, and the final outcome, providing a basis for future review.
  • progress: Tracks key progress during development, status updates, completed tasks, or milestones. This helps understand "how things are going" with the project.
  • focus: Defines the current or near-term development focus, key issues to be resolved, or areas requiring special attention. This helps the team stay aligned.
  • system_patterns: Records reusable patterns, common solutions, or important design principles identified in the codebase or system architecture. This aids knowledge retention and code consistency.

These tables work together to form a dynamic project "memory bank," capturing the project's evolution and key knowledge points.

Acknowledgements

Parts of the design and inspiration for this project come from the RooFlow project. Thanks for the ideas provided for the MCP ecosystem and AI-assisted development workflows.

Recommend Servers
TraeBuild with Free GPT-4.1 & Claude 3.7. Fully MCP-Ready.
MCP AdvisorMCP Advisor & Installation - Use the right MCP server for your needs
EdgeOne Pages MCPAn MCP service designed for deploying HTML content to EdgeOne Pages and obtaining an accessible public URL.
WindsurfThe new purpose-built IDE to harness magic
Amap Maps高德地图官方 MCP Server
Tavily Mcp
Howtocook Mcp基于Anduin2017 / HowToCook (程序员在家做饭指南)的mcp server,帮你推荐菜谱、规划膳食,解决“今天吃什么“的世纪难题; Based on Anduin2017/HowToCook (Programmer's Guide to Cooking at Home), MCP Server helps you recommend recipes, plan meals, and solve the century old problem of "what to eat today"
BlenderBlenderMCP connects Blender to Claude AI through the Model Context Protocol (MCP), allowing Claude to directly interact with and control Blender. This integration enables prompt assisted 3D modeling, scene creation, and manipulation.
Jina AI MCP ToolsA Model Context Protocol (MCP) server that integrates with Jina AI Search Foundation APIs.
ChatWiseThe second fastest AI chatbot™
DeepChatYour AI Partner on Desktop
Visual Studio Code - Open Source ("Code - OSS")Visual Studio Code
Serper MCP ServerA Serper MCP Server
MiniMax MCPOfficial MiniMax Model Context Protocol (MCP) server that enables interaction with powerful Text to Speech, image generation and video generation APIs.
CursorThe AI Code Editor
Playwright McpPlaywright MCP server
Baidu Map百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Zhipu Web SearchZhipu Web Search MCP Server is a search engine specifically designed for large models. It integrates four search engines, allowing users to flexibly compare and switch between them. Building upon the web crawling and ranking capabilities of traditional search engines, it enhances intent recognition capabilities, returning results more suitable for large model processing (such as webpage titles, URLs, summaries, site names, site icons, etc.). This helps AI applications achieve "dynamic knowledge acquisition" and "precise scenario adaptation" capabilities.
TimeA Model Context Protocol server that provides time and timezone conversion capabilities. This server enables LLMs to get current time information and perform timezone conversions using IANA timezone names, with automatic system timezone detection.
AiimagemultistyleA Model Context Protocol (MCP) server for image generation and manipulation using fal.ai's Stable Diffusion model.
Context7Context7 MCP Server -- Up-to-date code documentation for LLMs and AI code editors