agentic-memory
This server does not currently have a deployable release on Glama. Follow the repository's setup instructions to install and configure it for your MCP client, including any required credentials and local dependencies.
Claude Code Agentic Semantic Memory System (MCP)
A sophisticated Model Context Protocol (MCP) server that provides Claude Code with persistent semantic memory capabilities, enabling long-term information storage and retrieval across sessions. This system allows Claude to remember context, preferences, and important information between conversations.
š Key Features
š§ Persistent Memory: Information survives across Claude Code sessions
š Semantic Search: Retrieve memories based on meaning, not just keywords
š Project Namespaces: Organize memories into separate contexts/projects
š Local Embeddings: Works offline without external API dependencies
š Memory Relations: Create knowledge graphs with connected memories
š Intent-Based Activation: Natural language triggers automatic tool invocation
š Full CRUD Operations: Create, read, update, and delete memories
š Privacy-First: All data stored in your own PostgreSQL database
Related MCP server: MemoVault
šļø Architecture
Core Components
agentic-memory/
āāā src/
ā āāā index.ts # MCP server entry point
ā āāā db/
ā ā āāā client.ts # Database connection (Neon PostgreSQL)
ā ā āāā schema.ts # Drizzle ORM schema (memories, relations)
ā āāā tools/
ā āāā createMemory.ts # Store new memories
ā āāā searchMemory.ts # Semantic search
ā āāā listMemories.ts # List and filter memories
ā āāā deleteMemory.ts # Remove memories
ā āāā updateMemory.ts # Modify existing memories
ā āāā manageProjects.ts # Project namespace management
ā āāā simpleEmbedding.ts # Local embedding generation
āāā run-server.sh # Server startup script
āāā .env # Environment configurationHow It Works
Claude Code sends requests to the MCP server via stdio
MCP Server processes tool requests (create, search, delete memories)
Embeddings are generated locally using mathematical algorithms
PostgreSQL (Neon) stores memories with pgvector for semantic search
Drizzle ORM manages database operations and migrations
š Quick Start
Prerequisites
Node.js 18+
PostgreSQL database with pgvector extension (Neon recommended)
Claude Code CLI installed
Installation
Clone or copy this MCP server to your project:
cp -r /path/to/agentic-memory /your/project/.claude/mcp-servers/Install dependencies:
cd /your/project/.claude/mcp-servers/agentic-memory
npm installConfigure environment variables:
cp .env.example .env
# Edit .env with your database URLRun database migrations:
npm run db:migrateAdd to Claude Code:
claude mcp add agentic-memory ./run-server.shVerify connection:
claude mcp list
# Should show: agentic-memory - ā Connectedš Usage
Available MCP Tools
Tool | Description | Example Use |
| Store new information | "Remember that the user prefers TypeScript" |
| Find relevant memories | "What do we know about the user's preferences?" |
| View all memories | "Show all memories in current project" |
| Remove specific memory | "Delete memory with ID xyz" |
| Modify existing memory | "Update the location information" |
| Change memory namespace | "Switch to project 'work'" |
| Show all projects | "What projects exist?" |
| Remove entire project | "Delete the 'test' project" |
Using with CLAUDE.md Orchestration
The CLAUDE.md file acts as a quasi-orchestrator, providing:
Context Instructions: High-level rules for memory usage
Specialist Agents: Memory agents that Claude Code can invoke
Immutability Principles: Memories should be append-only
Quality Guidelines: Only store high-signal, reusable information
Example CLAUDE.md pattern:
# Project Context: [Your Project Name]
This project uses an advanced semantic memory system to learn and improve over time.
## Key Capabilities
- **Semantic Memory**: Long-term memory storage and retrieval
- **Specialist Agents**: Dedicated agents for memory operations
## Core Principles
- **Immutable Memories**: Once created, memories should not be altered
- **High-Signal Only**: Store only reusable, non-obvious information
- **No Secrets**: Never store API keys, passwords, or PIIš§ Configuration
Environment Variables
Create .env file:
# PostgreSQL connection (required)
DATABASE_URL=postgresql://user:pass@host/db?sslmode=require
# Optional: Embedding configuration
EMBEDDING_MODEL=simple # or 'llama' for advanced
EMBEDDING_DIMENSIONS=1536
# Optional: Default project
DEFAULT_PROJECT=defaultDatabase Schema
The system uses two main tables:
memories: Stores content, embeddings, metadata, and timestampsmemory_relations: Links related memories (parent-child relationships)
š§ Embedding Systems
Simple Embeddings (Default)
Pros: No external dependencies, works offline, fast
Cons: Less semantic accuracy
Use Case: Development, restricted networks, testing
Llama CPP Embeddings (Advanced)
Pros: Higher semantic accuracy
Cons: Requires model download, more resources
Use Case: Production environments with good connectivity
š Agent Architecture
Current Agents
ā Memory CRUD Agents: Create, read, update, delete operations ā Project Management Agents: Namespace organization ā Search Agent: Semantic similarity search
Recommended Additional Agents
Memory Relations Agent
Create parent-child relationships
Build knowledge graphs
Track memory evolution
Memory Analytics Agent
Usage statistics
Memory patterns
Optimization recommendations
Export/Import Agent
Backup memories
Transfer between projects
Migration tools
Deduplication Agent
Detect similar memories
Merge duplicates
Maintain consistency
šØ Common Issues & Solutions
Issue: "Failed to connect" in MCP list
Solution: Check .env file exists and DATABASE_URL is correct
Issue: Embedding dimension mismatch
Solution: Ensure EMBEDDING_DIMENSIONS matches your database vector size
Issue: Memories not persisting across sessions
Solution: Verify database connection and that migrations have run
š Development
Running TypeScript directly:
npm run devBuilding for production:
npm run buildRunning tests:
npm testš Replication Guide
To replicate this setup in another codebase:
Copy the MCP server directory
Set up a PostgreSQL database with pgvector
Configure environment variables
Run migrations
Add to Claude Code configuration
Create a CLAUDE.md file with memory instructions
Test with simple memory operations
š Production Considerations
Database Scaling: Consider connection pooling for heavy usage
Embedding Cache: Implement caching for frequently accessed memories
Backup Strategy: Regular database backups are essential
Security: Never store sensitive information in memories
Monitoring: Track memory usage and search performance
š¤ Contributing
This is a custom MCP implementation. To contribute:
Improve embedding algorithms
Add new memory management tools
Enhance search capabilities
Optimize database queries
š¤ Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
Areas for Contribution
Improve embedding algorithms
Add new memory management tools
Enhance search capabilities
Create visualization tools
Optimize database queries
Add support for more embedding models
š License
This project is licensed under the MIT License - see the LICENSE file for details.
š Acknowledgments
Anthropic for Claude and the MCP protocol
Neon for serverless PostgreSQL
Drizzle ORM for database management
The Claude Code community for feedback and suggestions
š§ Contact
Tristan McInnis
GitHub: @tristan-mcinnis
Built for Claude Code - Enabling persistent, semantic memory across AI coding sessions.
ā If you find this project useful, please consider giving it a star on GitHub!
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelogā¦
This server cannot be deployed
Maintenance
Related MCP Connectors
Persistent memory for Claude Code and Cursor. Stop re-explaining your project every session.
Persistent cross-session memory shared by Codex, Claude Code, ChatGPT, and other AI agents.
Shared work memory for Claude Code, Codex, Cursor and chat, scoped to each repository.
Private persistent memory for Claude, ChatGPT & Gemini via MCP - semantic search, zero-code setup.
Related MCP Servers
- AlicenseBqualityDmaintenanceA persistent memory layer for Claude Code that maintains project information, technology stack, tasks, decisions, and session history between coding sessions, eliminating the need to re-explain project context.9MIT
- AlicenseAqualityDmaintenanceA personal memory system that provides AI assistants with long-term memory capabilities through semantic search and vector storage. It enables Claude Code to store, retrieve, and manage personal context and project preferences using flexible LLM backends.8MIT
- AlicenseNot gradedqualityDmaintenanceEnables Claude Code with persistent memory that learns from past sessions, capturing coding episodes and surfacing relevant memories to improve over time.6Apache 2.0
- AlicenseNot gradedqualityBmaintenanceProvides persistent long-term memory for Claude Code by enabling semantic save, search, and context retrieval across sessions.1MIT