MCP Agent Memory MCP Server

Local setup required. This server has to be cloned and prepared on your machine before you register it in Claude Code.
1

Set the server up locally

Run this once to clone and prepare the server before adding it to Claude Code.

Run in terminal
pip install mcp pydantic
python3 shared_memory_mcp.py
2

Register it in Claude Code

After the local setup is done, run this command to point Claude Code at the built server.

Run in terminal
claude mcp add mcp-agent-memory -- python3 "<FULL_PATH_TO_MCP_AGENT_MEMORY>/dist/index.js"

Replace <FULL_PATH_TO_MCP_AGENT_MEMORY>/dist/index.js with the actual folder you prepared in step 1.

README.md

Production-ready MCP server providing shared memory for multi-agent collaboration.

MCP Agent Memory - v2.0

Production-ready MCP server providing shared memory for multi-agent collaboration.


Overview

MCP Agent Memory is an enhanced Model Context Protocol (MCP) server that enables multiple AI agents (like Claude Code instances) to communicate asynchronously through a shared memory space. Think of it as a sophisticated shared notepad where AI agents can leave messages, search for information, and coordinate their work.

Key Features

  • ๐Ÿ”’ Concurrency Safe - File locking for shared environments
  • ๐Ÿ“ Full CRUD - Create, Read, Update, Delete operations
  • ๐Ÿ” Advanced Search - Full-text search across all fields
  • ๐Ÿท๏ธ Organization - Tags, priority levels, metadata
  • ๐Ÿ“Š Analytics - Comprehensive memory statistics
  • ๐Ÿ’พ Reliable - Automatic backups and corruption recovery
  • ๐Ÿ“‹ Structured Logging - Complete operation visibility
  • ๐Ÿ›ก๏ธ Health Monitoring - Built-in health check system

Quick Start

Installation

  1. Clone or download this repository
  2. Install dependencies:
    pip install mcp pydantic
    
  3. Run the server:
    python3 shared_memory_mcp.py
    

Basic Usage

# Add a memory entry
await add_memory(
    agent_name="claude-alpha",
    content="Analysis complete. Found 3 key insights.",
    tags=["analysis", "complete"],
    priority="high"
)

# Search for entries
results = await search_memory(query="analysis")

# Get statistics
stats = await get_memory_stats()

Configuration

Add to your Claude Code config (~/.claudeCode/config.json):

{
  "mcpServers": {
    "shared-memory": {
      "command": "python3",
      "args": ["/path/to/shared_memory_mcp.py"]
    }
  }
}

What's New in v2.0

New Tools (6 total)

  • โœ… update_memory - Modify existing entries
  • โœ… delete_memory - Remove specific entries
  • โœ… get_memory - Retrieve single entry by ID
  • โœ… search_memory - Full-text search
  • โœ… get_memory_stats - Memory analytics
  • โœ… health_check - System health monitoring

Enhanced Tools

  • โšก add_memory - Now supports tags, priority, metadata
  • โšก read_memory - Advanced filtering and sorting
  • โšก clear_memory - Auto-backup before clearing

Core Improvements

  • ๐Ÿ”’ Thread-safe file locking
  • ๐Ÿ’พ Automatic backups (keeps 10)
  • ๐Ÿ“ Structured logging
  • ๐Ÿ”„ Auto-rotation at 1000 entries
  • ๐Ÿ›ก๏ธ Corruption recovery
  • ๐Ÿ†” Unique entry IDs (UUID)

Zero breaking changes! All v1 code works without modification.


Architecture

MCP Agent Memory v2.0
โ”œโ”€โ”€ shared_memory_mcp.py      # Main server (9 MCP tools)
โ”œโ”€โ”€ utils/
โ”‚   โ”œโ”€โ”€ file_lock.py           # Concurrency safety
โ”‚   โ””โ”€โ”€ logger.py              # Structured logging
โ”œโ”€โ”€ tests/
โ”‚   โ”œโ”€โ”€ test_memory_operations.py
โ”‚   โ””โ”€โ”€ test_concurrency.py
โ””โ”€โ”€ docs/
    โ”œโ”€โ”€ API_REFERENCE_V2.md    # Complete API docs
    โ”œโ”€โ”€ CHANGELOG_V2.md        # Version history
    โ”œโ”€โ”€ UPGRADE_GUIDE.md       # v1โ†’v2 migration
    โ””โ”€โ”€ IMPLEMENTATION_SUMMARY.md

Storage

~/.shared_memory_mcp/
โ”œโ”€โ”€ memory.json              # Main storage
โ”œโ”€โ”€ mcp_memory.log          # Rotating logs
โ””โ”€โ”€ backups/                # Auto-backups (10 kept)
    โ””โ”€โ”€ memory_backup_*.json

Documentation

Getting Started

Reference

Developer


API Overview

Memory Operations

Tool Description Type
add_memory Create new entry with tags/priority Write
read_memory Read with advanced filtering Read
update_memory Modify existing entry Write
delete_memory Remove specific entry Write
get_memory Retrieve single entry by ID Read
search_memory Full-text search Read
get_memory_stats Memory analytics Read
clear_memory Clear all entries Write
health_check System health status Read

See API Reference for detailed documentation.


Testing

Run Basic Tests

python3 run_basic_tests.py

Run Full Test Suite (requires pytest)

pip install pytest pytest-cov
pytest tests/ -v --cov

Test Coverage

  • โœ… 70+ test

Tools (9)

add_memoryCreate new entry with tags, priority, and metadata.
read_memoryRead memory entries with advanced filtering and sorting.
update_memoryModify existing memory entries.
delete_memoryRemove specific memory entries.
get_memoryRetrieve a single memory entry by its ID.
search_memoryPerform full-text search across all memory fields.
get_memory_statsRetrieve memory analytics and statistics.
clear_memoryClear all memory entries with an automatic backup.
health_checkCheck the system health status.

Configuration

claude_desktop_config.json
{"mcpServers": {"shared-memory": {"command": "python3", "args": ["/path/to/shared_memory_mcp.py"]}}}

Try it

โ†’Add a memory entry noting that the project analysis is complete and found 3 key insights.
โ†’Search my shared memory for any entries related to 'analysis' to see what previous agents found.
โ†’Get the current memory statistics to see how many entries are stored.
โ†’Delete the memory entry with ID 123 as it is no longer relevant.

Frequently Asked Questions

What are the key features of MCP Agent Memory?

Concurrency-safe file locking for shared environments. Full CRUD operations for memory management. Full-text search across all stored fields. Automatic backups and corruption recovery. Built-in health monitoring and memory analytics.

What can I use MCP Agent Memory for?

Coordinating tasks between multiple Claude Code instances. Maintaining a persistent shared notepad for long-running AI projects. Storing project insights and analysis results for asynchronous agent collaboration. Tracking agent progress and status updates across different sessions.

How do I install MCP Agent Memory?

Install MCP Agent Memory by running: pip install mcp pydantic && python3 shared_memory_mcp.py

What MCP clients work with MCP Agent Memory?

MCP Agent Memory works with any MCP-compatible client including Claude Desktop, Claude Code, Cursor, and other editors with MCP support.

Turn this server into reusable context

Keep MCP Agent Memory docs, env vars, and workflow notes in Conare so your agent carries them across sessions.

Need the old visual installer? Open Conare IDE.
Open Conare