Skip to content

cpier/LocalMem-MCP

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

LocalMem MCP

An easy-to-install MCP memory server that runs entirely on your machine with zero runtime dependencies. Stores memories, tasks, and a knowledge graph as plain, human-readable markdown files across chats. Syncable via iCloud, Dropbox, Syncthing or similar services.


Tools (19 total)

Memory

Tool Description
save_memory Create a memory (title, content, category, tags, importance)
read_memory Read a memory - auto-increments access count
list_memories List memories sorted by score or creation date
search_memories Full-text search, results ranked by relevance score
update_memory Overwrite content, tags, or importance
delete_memory Delete a memory file
get_context Snapshot: top memories + active tasks + key entities

Tasks

Tool Description
create_task Create a task (title, description, priority, due, tags)
list_tasks List tasks, optionally filtered by status
update_task Update status, priority, due date, or content
delete_task Delete a task

Knowledge Graph

Tool Description
create_entity Create a named entity with type, observations, and importance
get_entity Retrieve an entity and all its relations
list_entities List entities sorted by importance, optionally filtered by type
add_observation Append an observation to an existing entity
delete_entity Delete an entity
create_relation Create a directed relation: source -[relation]-> target
list_relations List relations, optionally filtered by entity name
delete_relation Delete a relation by file path

Installation

Option A - Download pre-built binary (easiest)

Go to the Releases page and download the archive for your platform:

File Platform
localmem-macos-arm64.tar.gz macOS Apple Silicon (M-Series)
localmem-macos-amd64.tar.gz macOS Intel
localmem-windows-amd64.zip Windows
localmem-linux-amd64.tar.gz Linux

Extract it and place the binary anywhere on your machine. Note the full path, you will need it in the next step.

Option B - Build from source

1. Install Go

macOS (Homebrew):

brew install go

Windows (winget):

winget install GoLang.Go

Debian / Ubuntu:

sudo apt update && sudo apt install -y golang-go

2. Download LocalMem

Download the repository and open a terminal inside the folder.

3. Build the binary

go mod tidy
go build -o localmem .

This produces a single localmem binary in the current folder. No installer, no dependencies - just one file.

4. Connect to LM Studio

  1. Open LM Studio
  2. Go to Settings → MCP Servers
  3. Add a new server entry:
{
  "mcpServers": {
    "localmem": {
      "command": "/home/user/localmem",
      "args": []
    }
  }
}

Replace /home/user/localmem with the actual path to the binary you built in step 3.

Tip: To find the full path, run pwd in the terminal where you built it, then append /localmem.

5. (Optional) Choose a memory folder

By default, LocalMem stores files in a memory/ folder next to the binary. To use a custom location - for example a synced folder for cross-device access - add a MEMORY_DIR environment variable:

{
  "mcpServers": {
    "localmem": {
      "command": "/home/user/localmem",
      "args": [],
      "env": {
        "MEMORY_DIR": "/home/user/localmem-memory"
      }
    }
  }
}

6. Verify it's working

Restart LM Studio. In a chat, ask the model to call get_context - it should return an empty context snapshot without errors. You're ready to go.


Other MCP clients

LocalMem works with any MCP-compatible client. The configuration format varies by client but always needs the path to the localmem binary and optionally MEMORY_DIR.

Cursor (~/.cursor/mcp.json):

{
  "mcpServers": {
    "localmem": {
      "command": "/home/user/localmem",
      "args": []
    }
  }
}

Claude Desktop (~/.config/Claude/claude_desktop_config.json):

{
  "mcpServers": {
    "localmem": {
      "command": "/home/user/localmem",
      "args": []
    }
  }
}

OpenWebUI: Go to Settings → Tools and add a new tool server pointing to the localmem binary.


Memory layout

memory/
├── general/            ← default category for memories
│   └── my-note.md
├── projects/
│   └── acme.md
├── tasks/              ← tasks & todos
│   └── buy-milk.md
├── entities/           ← knowledge graph nodes
│   └── alice.md
└── relations/          ← knowledge graph edges
    └── alice-works-at-acme.md

Relevance scoring

Each memory is scored as:

score = importance × log₂(access_count + 2) / (1 + 0.01 × days_since_access)

Memories decay slowly over time but recover each time they are read. High-importance memories (e.g. importance: 1.0) decay much more slowly than default ones.

Permanent memories

Memories tagged with any of the following tags are immune to decay and always return their raw importance score:

Tag Intended use
permanent General-purpose pin
core Fundamental facts that should always be available
identity Information about the user's identity or profile
value Personal values or principles
principle Rules or guidelines the model should always follow

Example:

---
title: My name is Alex
tags: identity, permanent
importance: 1.0
---

The user's name is Alex. Always address them by name.

Cross-device sync

Set MEMORY_DIR to an iCloud Drive, Dropbox, or any synced folder to share memories across machines.


Credits

  • mcp-go by mark3labs - Go SDK for the Model Context Protocol, used as the server transport layer.
  • Model Context Protocol by Anthropic - the open protocol that lets language models communicate with external tools.
  • Beledarian's mcp-local-memory - referenced for feature inspiration (knowledge graph, importance scoring, decay, tasks).
  • MemPalace - inspiration for the fact-checking feature (similar name detection and relationship mismatch).
  • Go - the programming language used to build the binary.

About

A zero-dependency MCP memory server that is easy to set up and runs entirely on your machine. Stores memories, tasks, and a knowledge graph as plain, human-readable markdown files across chats.

Resources

Stars

Watchers

Forks

Languages