Skip to main content
Glama

Memory MCP

by JamesANZ
MIT License

Memory MCP

A Model Context Protocol (MCP) server for logging and retrieving memories from LLM conversations.

Features

  • Save Memories: Store memories from LLM conversations with timestamps and LLM identification
  • Retrieve Memories: Get all stored memories with detailed metadata
  • Add Memories: Append new memories without overwriting existing ones
  • Clear Memories: Remove all stored memories
  • MongoDB Storage: Persistent storage using MongoDB database

Installation

  1. Install dependencies:
npm install
  1. Build the project:
npm run build

Configuration

Set the MongoDB connection string via environment variable:

export MONGODB_URI="mongodb://localhost:27017"

Default: mongodb://localhost:27017

Usage

Available Tools

  1. save-memories: Save all memories to the database, overwriting existing ones
    • memories: Array of memory strings to save
    • llm: Name of the LLM (e.g., 'chatgpt', 'claude')
    • userId: Optional user identifier
  2. get-memories: Retrieve all memories from the database
    • No parameters required
  3. add-memories: Add new memories to the database without overwriting existing ones
    • memories: Array of memory strings to add
    • llm: Name of the LLM (e.g., 'chatgpt', 'claude')
    • userId: Optional user identifier
  4. clear-memories: Clear all memories from the database
    • No parameters required

Example Usage in LLM

  1. Save all memories (overwrites existing):
    User: "Save all my memories from this conversation to the MCP server" LLM: [Uses save-memories tool with current conversation memories]
  2. Retrieve all memories:
    User: "Get all my memories from the MCP server" LLM: [Uses get-memories tool to retrieve stored memories]
  3. Add new memories (preserves existing):
    User: "Add these new memories to my existing ones" LLM: [Uses add-memories tool to append new memories]

Database Schema

Memories are stored in MongoDB with the following structure:

{ _id: ObjectId, memories: string[], // Array of memory strings timestamp: Date, // When memories were saved llm: string, // LLM identifier (e.g., 'chatgpt', 'claude') userId?: string // Optional user identifier }

Development

To run in development mode:

npm run build node build/index.js
-
security - not tested
A
license - permissive license
-
quality - not tested

A Model Context Protocol server that allows saving, retrieving, adding, and clearing memories from LLM conversations with MongoDB persistence.

  1. Features
    1. Installation
      1. Configuration
        1. Usage
          1. Available Tools
          2. Example Usage in LLM
        2. Database Schema
          1. Development

            Related MCP Servers

            • A
              security
              A
              license
              A
              quality
              A Model Context Protocol server that provides access to MongoDB databases. This server enables LLMs to inspect collection schemas and execute read-only queries.
              Last updated -
              8
              344
              254
              TypeScript
              MIT License
              • Apple
            • -
              security
              A
              license
              -
              quality
              A Model Context Protocol server that enables LLMs to interact directly with MongoDB databases, allowing users to query collections, inspect schemas, and manage data through natural language.
              Last updated -
              1,783
              1
              TypeScript
              MIT License
              • Apple
            • -
              security
              A
              license
              -
              quality
              A Model Context Protocol server that enables LLMs to interact directly with MongoDB databases, allowing users to query collections, inspect schemas, and manage data through natural language.
              Last updated -
              1,783
              MIT License
              • Apple
            • -
              security
              A
              license
              -
              quality
              A Model Context Protocol (MCP) server that enables LLMs to interact directly with MongoDB databases, allowing them to query collections, inspect schemas, and manage data seamlessly through natural language.
              Last updated -
              1,783
              MIT License
              • Apple

            View all related MCP servers

            MCP directory API

            We provide all the information about MCP servers via our MCP API.

            curl -X GET 'https://glama.ai/api/mcp/v1/servers/JamesANZ/memory-mcp'

            If you have feedback or need assistance with the MCP directory API, please join our Discord server