Claude Code Memory Server

Claude Code Memory Server

Provides persistent memory capabilities for Claude Code using Neo4j graph database to track development tasks, code patterns, solutions, and their relationships across sessions and projects, enabling contextual assistance and pattern recognition.

Category
访问服务器

README

Claude Code Memory Server

A Neo4j-based Model Context Protocol (MCP) server that provides intelligent memory capabilities for Claude Code, enabling persistent knowledge tracking, relationship mapping, and contextual development assistance.

Overview

This MCP server creates a sophisticated memory system that tracks Claude Code's activities, decisions, and learned patterns to provide contextual memory across sessions and projects. It uses Neo4j as a graph database to capture and analyze complex relationships between development concepts, solutions, and workflows.

Features

Core Memory Operations

  • Persistent Memory Storage - Store development tasks, solutions, and patterns
  • Intelligent Search - Find relevant memories by context, content, or relationships
  • Relationship Mapping - Track how different concepts, files, and solutions relate
  • Context Awareness - Project-specific and technology-specific memory retrieval

Advanced Intelligence

  • Pattern Recognition - Automatically identify reusable development patterns
  • Solution Effectiveness - Track and learn from successful approaches
  • Workflow Memory - Remember and suggest optimal development sequences
  • Error Prevention - Learn from past mistakes to prevent similar issues

Development Integration

  • Task Execution Tracking - Monitor what Claude Code does and how
  • Code Pattern Analysis - Identify and store successful code patterns
  • Project Context Memory - Understand codebase conventions and dependencies
  • Collaborative Learning - Share knowledge across development sessions

Architecture

Memory Types

  • Task - Development tasks and their execution patterns
  • CodePattern - Reusable code solutions and architectural decisions
  • Problem - Issues encountered and their context
  • Solution - How problems were resolved and their effectiveness
  • Project - Codebase context and project-specific knowledge
  • Technology - Framework, language, and tool-specific knowledge

Relationship Types

The system tracks seven categories of relationships:

  1. Causal - CAUSES, TRIGGERS, LEADS_TO, PREVENTS, BREAKS
  2. Solution - SOLVES, ADDRESSES, ALTERNATIVE_TO, IMPROVES, REPLACES
  3. Context - OCCURS_IN, APPLIES_TO, WORKS_WITH, REQUIRES, USED_IN
  4. Learning - BUILDS_ON, CONTRADICTS, CONFIRMS, GENERALIZES, SPECIALIZES
  5. Similarity - SIMILAR_TO, VARIANT_OF, RELATED_TO, ANALOGY_TO, OPPOSITE_OF
  6. Workflow - FOLLOWS, DEPENDS_ON, ENABLES, BLOCKS, PARALLEL_TO
  7. Quality - EFFECTIVE_FOR, INEFFECTIVE_FOR, PREFERRED_OVER, DEPRECATED_BY, VALIDATED_BY

Installation

Prerequisites

  • Python 3.10 or higher
  • Neo4j database (local or cloud)
  • Claude Code with MCP support

Setup

  1. Clone the repository:
git clone https://github.com/viralvoodoo/claude-code-memory.git
cd claude-code-memory
  1. Install dependencies:
pip install -e .
  1. Set up Neo4j connection:
cp .env.example .env
# Edit .env with your Neo4j credentials
  1. Initialize the database schema:
python -m claude_memory.setup

Configuration

Environment Variables

  • NEO4J_URI - Neo4j database URI (default: bolt://localhost:7687)
  • NEO4J_USER - Database username (default: neo4j)
  • NEO4J_PASSWORD - Database password
  • MEMORY_LOG_LEVEL - Logging level (default: INFO)

Claude Code Integration

Add to your Claude Code MCP configuration:

{
  "mcpServers": {
    "claude-memory": {
      "command": "python",
      "args": ["-m", "claude_memory.server"],
      "env": {
        "NEO4J_URI": "bolt://localhost:7687",
        "NEO4J_USER": "neo4j",
        "NEO4J_PASSWORD": "your-password"
      }
    }
  }
}

Usage

Available MCP Tools

Core Memory Operations

  • store_memory - Store new development memories with context
  • get_memory - Retrieve specific memory by ID with relationships
  • search_memories - Find memories by content, context, or relationships
  • update_memory - Modify existing memory content
  • delete_memory - Remove memory and cleanup relationships

Relationship Management

  • create_relationship - Link memories with specific relationship types
  • get_related_memories - Find memories connected to a specific memory
  • analyze_relationships - Discover relationship patterns in memory graph

Development Intelligence

  • analyze_codebase - Scan project and create contextual memory graph
  • track_task_execution - Record development workflow and patterns
  • suggest_similar_solutions - Find analogous past solutions
  • predict_solution_effectiveness - Estimate success probability of approaches

Advanced Analytics

  • get_memory_graph - Visualize knowledge network and relationships
  • find_memory_paths - Discover connection chains between concepts
  • memory_effectiveness - Track and analyze solution success rates

Development

Project Structure

claude-code-memory/
├── src/claude_memory/          # Main source code
│   ├── __init__.py
│   ├── server.py              # MCP server implementation
│   ├── models.py              # Data models and schemas
│   ├── database.py            # Neo4j database operations
│   ├── memory_store.py        # Core memory logic
│   ├── relationships.py       # Relationship management
│   ├── search.py              # Search and retrieval
│   └── intelligence.py        # Pattern recognition and analytics
├── tests/                     # Test suite
├── docs/                      # Documentation
├── scripts/                   # Utility scripts
└── pyproject.toml            # Project configuration

Development Setup

# Install development dependencies
pip install -e ".[dev]"

# Install pre-commit hooks
pre-commit install

# Run tests
pytest

# Format code
black src/ tests/
ruff --fix src/ tests/

# Type checking
mypy src/

Contributing

We welcome contributions! Please see our Contributing Guide for details.

Development Workflow

  1. Check existing GitHub Issues
  2. Fork the repository and create a feature branch
  3. Make changes following our coding standards
  4. Add tests for new functionality
  5. Submit a pull request with a clear description

License

This project is licensed under the MIT License - see the LICENSE file for details.

Roadmap

Phase 1: Foundation (Current)

  • ✅ Project setup and basic MCP server
  • 🔄 Core memory operations (CRUD)
  • ⏳ Basic relationship management

Phase 2: Intelligence

  • ⏳ Advanced relationship system
  • ⏳ Pattern recognition
  • ⏳ Context awareness

Phase 3: Integration

  • ⏳ Claude Code workflow integration
  • ⏳ Automatic memory capture
  • ⏳ Proactive suggestions

Phase 4: Analytics

  • ⏳ Memory effectiveness tracking
  • ⏳ Knowledge graph visualization
  • ⏳ Performance optimization

Support

Acknowledgments

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选