Skip to main content
Glama

MCP Persistent Memory Server

by dirkenglund

MCP Persistent Memory Server

A Model Context Protocol (MCP) server that provides persistent graph memory with automatic disk storage. Perfect for building knowledge graphs, storing entity relationships, and maintaining context across sessions.

Features

  • Persistent Storage: Automatically saves graph data to disk
  • Multiple Deployment Options: Run locally or deploy to cloud
  • MCP Compatible: Works with Claude Desktop, Cursor, and other MCP clients
  • Timestamped Backups: Automatic backup rotation
  • Fast Indexed Lookups: Map-based indices for quick searches
  • Multiple Export Formats: JSON, CSV for entities and relations
  • Remote Access: HTTP/WebSocket server for cloud deployment
  • RESTful API: Direct HTTP endpoints for convenience

Quick Start

Local Installation

# Clone the repository git clone https://github.com/dirkenglund/mcp-persistent-memory.git cd mcp-persistent-memory # Install dependencies npm install # Run in stdio mode (for MCP clients) npm start # Or run HTTP server npm run start:http

Add to Cursor

Edit ~/.cursor/mcp.json:

{ "mcpServers": { "persistent-memory": { "command": "node", "args": [ "/path/to/mcp-persistent-memory/src/index.mjs" ], "env": { "MEMORY_STORAGE_DIR": "~/.cursor/persistent-memory" } } } }

Usage

Creating Entities

// Via MCP tool call create_entities({ entities: [ { name: "Cursor", entityType: "Software", observations: [ "An AI-powered code editor", "Supports MCP protocol", "Built on VSCode" ] } ] })

Creating Relations

create_relations({ relations: [ { from: "Cursor", to: "VSCode", relationType: "based_on" } ] })

Searching Nodes

search_nodes({ query: "AI editor" })

Getting Statistics

get_stats() // Returns: { entities: 10, relations: 15, storage: '2.5 MB' }

REST API

When running in HTTP mode:

# Create entities curl -X POST http://localhost:8080/api/entities \ -H "Content-Type: application/json" \ -d '{"entities": [{"name": "Test", "entityType": "Example", "observations": ["A test entity"]}]}' # Search curl http://localhost:8080/api/search?q=test # Get full graph curl http://localhost:8080/api/graph # Export as CSV curl http://localhost:8080/api/export?format=csv-entities > entities.csv

Cloud Deployment

Deploy to Google Cloud

# Make deploy script executable chmod +x deploy/gcp-deploy.sh # Deploy (requires gcloud CLI) ./deploy/gcp-deploy.sh my-mcp-server us-central1-a

Docker Deployment

# Build image docker build -t mcp-persistent-memory . # Run container docker run -d \ -p 8080:8080 \ -v $(pwd)/data:/data \ --name mcp-memory \ mcp-persistent-memory

Using Remote Server

Add to Cursor config:

{ "persistent-memory-remote": { "url": "http://YOUR-SERVER-IP:8080/mcp", "transport": "websocket" } }

Storage Structure

data/memory/ ├── graph.json # Main graph data ├── backups/ # Timestamped backups │ ├── graph-2025-07-06T10-30-00.json │ ├── graph-2025-07-06T11-00-00.json │ └── ... └── exports/ # Manual exports

Environment Variables

  • MEMORY_STORAGE_DIR: Directory for storing graph data (default: ./data/memory)
  • MAX_BACKUPS: Maximum number of backup files to keep (default: 10)
  • PORT: HTTP server port (default: 8080)
  • HOST: HTTP server host (default: 0.0.0.0)

Development

# Run with auto-reload npm run dev # Run tests npm test # Build Docker image npm run docker:build

API Reference

MCP Tools

  • create_entities: Create new entities in the graph
  • create_relations: Create relations between entities
  • search_nodes: Search entities by query
  • read_graph: Read the entire graph
  • open_nodes: Get specific nodes by name
  • add_observations: Add observations to existing entities
  • delete_entities: Delete entities and their relations
  • delete_relations: Delete specific relations
  • get_stats: Get graph statistics
  • export_graph: Export in various formats
  • clear_graph: Clear all data

HTTP Endpoints

  • GET /health: Health check
  • GET /info: Server information and stats
  • POST /api/entities: Create entities
  • POST /api/relations: Create relations
  • GET /api/search?q=query: Search nodes
  • GET /api/graph: Get full graph
  • GET /api/stats: Get statistics
  • GET /api/export?format=json|csv-entities|csv-relations: Export data

License

MIT

Contributing

  1. Fork the repository
  2. Create your feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

Support

  • Issues: https://github.com/dirkenglund/mcp-persistent-memory/issues
  • Documentation: https://github.com/dirkenglund/mcp-persistent-memory/wiki

Built with ❤️ for the MCP ecosystem

-
security - not tested
F
license - not found
-
quality - not tested

Provides persistent graph memory with automatic disk storage for building knowledge graphs, storing entity relationships, and maintaining context across sessions.

  1. Features
    1. Quick Start
      1. Local Installation
      2. Add to Cursor
    2. Usage
      1. Creating Entities
      2. Creating Relations
      3. Searching Nodes
      4. Getting Statistics
    3. REST API
      1. Cloud Deployment
        1. Deploy to Google Cloud
        2. Docker Deployment
        3. Using Remote Server
      2. Storage Structure
        1. Environment Variables
          1. Development
            1. API Reference
              1. MCP Tools
              2. HTTP Endpoints
            2. License
              1. Contributing
                1. Support

                  Related MCP Servers

                  • -
                    security
                    A
                    license
                    -
                    quality
                    A basic implementation of persistent memory using a local knowledge graph. This lets Claude remember information about the user across chats.
                    Last updated -
                    9
                    26,187
                    58,172
                    TypeScript
                    MIT License
                    • Apple
                    • Linux
                  • -
                    security
                    A
                    license
                    -
                    quality
                    Provides knowledge graph functionality for managing entities, relations, and observations in memory with strict validation rules to maintain data consistency.
                    Last updated -
                    6
                    Python
                    MIT License
                  • -
                    security
                    A
                    license
                    -
                    quality
                    A persistent memory implementation using a local knowledge graph that lets Claude remember information about users across conversations.
                    Last updated -
                    4
                    Python
                    MIT License
                  • -
                    security
                    F
                    license
                    -
                    quality
                    Enables storage and retrieval of knowledge in a graph database format, allowing users to create, update, search, and delete entities and relationships in a Neo4j-powered knowledge graph through natural language.
                    Last updated -
                    Python
                    • Linux

                  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/dirkenglund/mcp-persistent-memory'

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