Skip to main content
Glama

Status Python SQLite WAL License CI


πŸ€” The Problem with Agentic Memory

When dozens of autonomous agents operate in parallel, standard vector memory stores break down:

  • Race conditions: Simultaneous writes cause index corruption.

  • Data duplication: Agents save the same observations repeatedly, polluting context windows.

  • Context hallucination: Lexical keywords are ignored in favor of vague semantic matches.

Related MCP server: agent-memory

πŸ’‘ The MemMCP Solution

MemMCP is a lightweight, zero-latency, local memory daemon. It runs silently over STDIO via the Model Context Protocol, offering a robust engine that guarantees:

  • ACID-Compliant State: Backed by SQLite in Write-Ahead Log (WAL) mode.

  • Deduplication Gate: Uses Bloom-Filter idempotency tracking to drop duplicate records before vectorization.

  • Hybrid RRF Retrieval: Blends FAISS vector search with SQLite FTS5 lexical keyword matching under Reciprocal Rank Fusion (RRF).


⚑ Quick Start

Prerequisites

  • Python 3.11+

  • uv (recommended for package management) or standard pip

1. Clone & Install

git clone https://github.com/axtontc/MemMCP.git
cd MemMCP

# Sync virtual environment using uv (fastest)
uv sync

# Or using pip
python -m venv .venv
.venv/Scripts/activate  # On Windows
source .venv/bin/activate  # On Linux/macOS
pip install .

2. Verify with the Test Suite

Ensure everything is working correctly:

# Run unit tests
uv run python -m pytest tests/test_memmcp.py -v

# Run E2E STDIO integration tests
uv run python tests/e2e_test.py

πŸ”Œ MCP Integration (Cursor & Claude)

MemMCP integrates seamlessly into MCP-compatible editors and clients like Cursor or Claude Desktop.

1. Claude Desktop Config

Add the following to your claude_desktop_config.json (located at %APPDATA%\Claude\claude_desktop_config.json on Windows or ~/Library/Application Support/Claude/claude_desktop_config.json on macOS):

{
  "mcpServers": {
    "memmcp": {
      "command": "uv",
      "args": [
        "--directory",
        "C:/absolute/path/to/MemMCP",
        "run",
        "python",
        "src/server.py"
      ],
      "env": {
        "MEMMCP_DB_PATH": "C:/absolute/path/to/memmcp.db",
        "MEMMCP_LOG_PATH": "C:/absolute/path/to/memory_wal.log"
      }
    }
  }
}

2. Cursor IDE Config

  1. Navigate to Settings β†’ Features β†’ MCP.

  2. Click + Add New MCP Server.

  3. Fill out the dialog:

    • Name: memmcp

    • Type: command

    • Command: uv --directory "C:/path/to/MemMCP" run python src/server.py

  4. Click Save.


πŸ— Architecture

graph TD
    A[MCP Client / Agent] --> B{Bloom-Filter Idempotency}
    B -->|Duplicate Request| C[Fast Return / Drop]
    B -->|New Request| D[SentenceTransformer Vectorizer]
    D --> E[FAISS Vector Matching]
    D --> F[SQLite FTS5 Keyword Match]
    E & F --> G[Reciprocal Rank Fusion RRF]
    G --> H[SQLite WAL Transaction Ledger]
    H --> I[XML-Bounded RAG Output]
    I --> J[MCP Response]

    style A fill:#1a1a2e,stroke:#0969DA,color:#fff
    style B fill:#16213e,stroke:#0969DA,color:#fff
    style E fill:#0f3460,stroke:#2ea043,color:#fff
    style F fill:#0f3460,stroke:#2ea043,color:#fff
    style G fill:#1a1a2e,stroke:#F5A800,color:#fff
    style H fill:#1a1a2e,stroke:#F5A800,color:#fff

Key Subsystems

Module

File

Responsibility

MCP Server

src/server.py

Exposes standard stdio transport, handles incoming JSON-RPC tool calls.

Database Manager

src/database.py

Transaction safe SQLite WAL ledger with thread-safe write loop.

Hybrid Retriever

src/retrieval.py

FAISS CPU vector index synced with SQLite FTS5 full-text indexing.

Context Pruner

src/pruner.py

Trims redundant tokens from search context to optimize LLM input boundaries.


πŸ›  MCP Tool Reference

MemMCP automatically registers the following tools with the connected LLM:

store_memory

Saves a single string memory block.

  • Arguments:

    • content (string, required): The memory string to store.

    • idempotency_key (string, optional): A unique key to prevent duplicate writes.

  • Returns: A confirmation string containing the generated unique memory ID.

store_memories_batch

Stores multiple memories atomically in a single transaction, rebuilding the vector index only once at the end of the batch.

  • Arguments:

    • memories (array of strings, required): List of memory strings to insert.

  • Returns: A JSON array of generated memory IDs.

recall_memories

Retrieves memories matching a search query using Reciprocal Rank Fusion.

  • Arguments:

    • query (string, required): The search text.

    • limit (integer, optional): Maximum number of memories to return (default: 5).

  • Returns: A JSON array of matching records containing ID, content, and scores.


πŸ“– API & Core Functions Reference

src/database.py

These functions manage SQLite connection states, memory inserts, and migrations:

Function / Routine

Parameters

Description

init_db(db_path)

str / Path

Initializes the SQLite database, executes migration scripts, and enables WAL mode.

add_memory(content, id_key)

str, str

Inserts a raw memory record into the table and updates the FTS5 search index.

delete_memory(memory_id)

str

Deletes a memory record by its primary key.

src/retrieval.py

These functions run queries against the semantic and keyword indices:

Function / Routine

Parameters

Description

search_memories(query, limit)

str, int

Runs semantic and lexical search, blends results via Reciprocal Rank Fusion, and returns top nodes.

rebuild_index()

None

Reads all table records, recomputes vector embeddings, and serializes the FAISS index.


πŸ“Š Comparison

Metric / Capability

Pinecone / Cloud Vector

FAISS-only

MemMCP

Offline First (Zero-Network)

❌

βœ…

βœ…

Deduplication Handling

❌ (Manual)

❌ (Manual)

βœ… (Bloom Gate)

ACID Transaction Safety

⚠️ Eventual

❌ None

βœ… (SQLite WAL)

Hybrid Keyword Search

⚠️ Partial

❌ (Vector only)

βœ… (RRF + FTS5)

MCP Out-of-the-box

❌

❌

βœ…

Average Query Latency

>120ms

<10ms

<35ms


🧰 Tech Stack

  • Language: Python 3.11+

  • Vector Search: FAISS CPU

  • Embeddings: sentence-transformers (all-MiniLM-L6-v2)

  • Database: SQLite 3 (WAL mode + FTS5 full-text extension)

  • Dev tools: pytest, pytest-asyncio, Ruff, mypy


πŸ—ΊοΈ Roadmap

  • SentencesTransformer semantic vector indexing

  • Full-Text-Search FTS5 keyword matching

  • Deduplication gate with Bloom filters

  • Reciprocal Rank Fusion (RRF) blending algorithm

  • Distributed Replication β€” Sync memory states across swarm nodes using Raft consensus

  • Multi-tenant Spaces β€” Provide isolated user space environments and custom credentials keys

  • Timeline Visualizer Dashboard β€” Open-source local dashboard showing memories timeline maps


🀝 Contributing & Security

Contributions are welcome! Please read our Contributing Guide and Code of Conduct before submitting pull requests.

For reporting security vulnerabilities, please refer to SECURITY.md.


MemMCP belongs to a suite of interconnected AI agent utilities:

Project

Description

AUI

Zero-latency cross-process UI automation for Windows and Web

The-Nexus

Monolithic API gateway and orchestrator for local LLMs

The-Skillbrary

MCP-compatible low-latency registry for 6,000+ agent skills

Fractal-Swarm-v2

Mathematically optimal state-machine agent swarm orchestration

AntiMem

Memory daemon and compactor for Antigravity swarms

OmniMem

PostgreSQL hybrid memory system for large enterprise swarms


πŸ“œ License

This project is licensed under the Apache License, Version 2.0. See the LICENSE file for details. Copyright (c) 2026 Axton Carroll.


Available Tools

3 tools
recall_memoriesA

Recall relevant memories using hybrid search (semantic similarity + keyword search).

ParametersJSON Schema
NameRequiredDescriptionDefault
limitNoThe maximum number of memories to return.
queryYesThe search query to match against memories.

TDQS

A4/5.0
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations, the description carries the full burden. It adds value by revealing the hybrid search method (semantic + keyword), which is not obvious from the name alone. However, it does not disclose potential behaviors such as result ordering, handling of the limit parameter, or any side effects. For a read-only search tool this is acceptable but not comprehensive.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, concise sentence that immediately states the core function and search method. It is front-loaded and free of unnecessary words or repetition.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a simple search tool with two well-described parameters, the description adequately explains what the tool does and how it works. It does not describe the return format or ordering, but the absence of an output schema and the simplicity of the operation make this a minor gap. The description is sufficient for basic use.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 100%, with clear descriptions for both 'query' and 'limit'. The tool description does not add any extra meaning beyond the schema, but it does not need to since the schema already documents each parameter effectively. Baseline 3 applies.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool's function: 'Recall relevant memories using hybrid search (semantic similarity + keyword search).' The verb 'recall' and resource 'memories' are specific, and the hybrid search method is explicitly mentioned. This distinguishes it from sibling tools (store_memory and store_memories_batch) which are clearly for writing, not reading.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides clear context for when to use the tool: it is for retrieving relevant memories. While it does not explicitly exclude alternatives, the sibling tools are all storage operations, making the recall tool's purpose obvious. No conflicts or competing search tools are present, so the implied usage is sufficient.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

store_memories_batchA

Store multiple memories atomically in a single transaction, then rebuild the index once.

ParametersJSON Schema
NameRequiredDescriptionDefault
memoriesYesA list of memories, each containing 'content', and optional 'idempotency_key' and 'metadata'.

TDQS

A4.2/5.0
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations, the description carries the burden and discloses meaningful behaviors: atomic transaction (all-or-nothing) and index rebuild once. It does not cover error handling or permissions, but the atomicity and performance details are valuable beyond the basic store action.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

A single sentence conveys the action, the atomic behavior, and the index-rebuild side effect. No wasted words; it is front-loaded and easy to parse.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a simple batch storage tool with one parameter and no output schema, the description covers the core purpose and key behavioral traits. It does not explain return values, but that is not required given the absence of an output schema and the straightforward nature of the operation.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, with the 'memories' parameter fully detailed as an array of objects with content, metadata, and idempotency_key. The description adds no extra parameter semantics, so it relies on the schema, which is adequate.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the action ('Store multiple memories'), the resource ('memories'), and the batch nature ('multiple'). It distinguishes from sibling tools by emphasizing atomicity and the batch scope, unlike store_memory (single) and recall_memories (retrieval).

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description gives clear context: use when storing multiple memories and when atomicity matters. It does not explicitly name alternatives or exclusions, but the batch-focused phrasing implies when it should be used over store_memory.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

store_memoryA

Store a single memory, automatically generating unique keys and updating indices.

ParametersJSON Schema
NameRequiredDescriptionDefault
contentYesThe text content of the memory to store.
metadataNoOptional structured metadata dictionary.
idempotency_keyNoOptional unique key to prevent duplicate storage.

TDQS

A3.7/5.0
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries the burden. It discloses useful behaviors ('automatically generating unique keys and updating indices') but does not explain idempotency handling, return values, or potential side effects like overwrites. This is partial transparency, not comprehensive.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single sentence that conveys the core action, scope, and key behaviors without unnecessary filler. Every phrase contributes value, making it highly concise and well-structured.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

There is no output schema, and the description does not mention return values or error conditions. It covers key generation and index updates but omits details about idempotency key usage and batch alternative. For a simple tool this is adequate but has gaps, so a mid-range score is warranted.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The input schema has 100% coverage for all three parameters with descriptions. The description adds minimal extra meaning; it mentions auto key generation but does not directly connect it to the idempotency_key parameter. Baseline 3 is appropriate as the schema handles parameter semantics.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description 'Store a single memory' uses a specific verb and resource, clearly indicating a single-item write operation. It also distinguishes this tool from siblings like recall_memories (retrieval) and store_memories_batch (batch storage) by explicitly stating 'single memory'.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description implies usage for a single memory but does not explicitly contrast it with the batch sibling or mention when not to use it. It lacks explicit alternatives or exclusions, so guidance is only implied rather than clearly stated.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

TDQS

A4.2/5.0
Disambiguation5/5

The three tools are clearly distinct: recall_memories retrieves, store_memory stores a single item, and store_memories_batch stores multiple items atomically. The batch variant is clearly differentiated from the single-store tool by its transactional and batched nature.

Naming Consistency5/5

All tool names follow a consistent verb_noun pattern: recall_memories, store_memory, store_memories_batch. The verbs are clear and the nouns are consistent, with the batch variant appropriately qualified.

Tool Count5/5

With only 3 tools, the set is tightly scoped for a memory server. Each tool serves a distinct core operation (recall, store single, store batch) without unnecessary bloat, making the count appropriate for its stated purpose.

Completeness4/5

The server covers the essential store and recall operations, including an efficient batch store. However, it lacks explicit delete or update capabilities, which could be considered a minor gap for a complete memory lifecycle, though not critical for basic use.

Maintenance

ActivitySlowing
ResponsivenessSyncing

Resources

Unclaimed servers have limited discoverability.

Looking for Admin?

If you are the server author, to access and configure the admin panel.

Related MCP Connectors

Related MCP Servers

  • A
    license
    A
    quality
    C
    maintenance
    A local, fully-offline MCP memory server that enables persistent storage and retrieval of information using SQLite with both keyword and semantic vector search capabilities.
    10
    23
    12
    MIT
  • A
    license
    Not graded
    quality
    D
    maintenance
    MCP server providing persistent memory management for AI agents using SQLite and FTS5, enabling storage, full-text search, and recall of memories with namespace isolation.
    1
    MIT
  • A
    license
    Not graded
    quality
    D
    maintenance
    A SQLite-backed MCP memory server providing persistent memory storage with full-text search and knowledge graph capabilities for AI assistants.
    60
    MIT
  • A
    license
    Not graded
    quality
    D
    maintenance
    A local-first MCP server for persistent memory with vector search, metadata filtering, fact tracking, and graceful degradation when dependencies fail.
    31
    MIT

Latest Blog Posts

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/axtontc/MemMCP'

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