claude_memory_mcp

MatheusKindrazki/claude_memory_mcp

3.2

If you are the rightful owner of claude_memory_mcp and would like to certify it and/or have it hosted online, please leave a comment on the right or send an email to dayong@mcphub.com.

Claude Memory MCP is a Model Context Protocol server that enables Claude Code to access and utilize its conversation history effectively.

Tools
5
Resources
0
Prompts
0

Claude Memory MCP

A Model Context Protocol (MCP) server that provides Claude Code with access to its own conversation history. Search past sessions, find code snippets, and retrieve context from previous conversations.

Features

  • Search conversations: Full-text search across all past conversations
  • Project summaries: Get insights about technologies used, files edited, and tools invoked
  • Session history: Browse recent sessions with summaries and metadata
  • Code retrieval: Find code snippets by content or programming language
  • Cross-project: Works across all your Claude Code projects

Installation

Prerequisites

  • Python 3.11 or higher
  • Claude Code CLI installed

Setup

# Clone the repository
git clone https://github.com/yourusername/claude-memory-mcp.git
cd claude-memory-mcp

# Create virtual environment
python3.11 -m venv .venv
source .venv/bin/activate  # On Windows: .venv\Scripts\activate

# Install the package
pip install -e .

Configuration

Add the MCP server to your Claude Code settings at ~/.claude/settings.json:

{
  "mcpServers": {
    "claude-memory": {
      "command": "/absolute/path/to/claude-memory-mcp/.venv/bin/python",
      "args": ["-m", "claude_memory_mcp.server"]
    }
  }
}

Replace /absolute/path/to/claude-memory-mcp with the actual path where you cloned the repository.

Available Tools

memory_list_projects

Lists all projects that have Claude Code conversation history.

Output: Project name, path, session count, message count, last activity time.


memory_search

Full-text search across all conversations.

ParameterTypeRequiredDefaultDescription
querystringYes-Search term
projectstringNo-Filter by project name
limitintNo10Maximum results
include_contextboolNotrueInclude surrounding messages

Output: Matches with project, session, timestamp, matched text with highlighting, and context.


memory_get_project_summary

Returns a summary of a project based on conversation history.

ParameterTypeRequiredDescription
projectstringYesProject name or path

Output: Technologies detected, frequently edited files, tool usage statistics, date range.


memory_get_recent_sessions

Lists recent sessions for a project.

ParameterTypeRequiredDefaultDescription
projectstringYes-Project name or path
limitintNo5Number of sessions

Output: Session list with timestamp, duration, message count, summary, and files touched.


memory_get_session_detail

Get detailed information about a specific session.

ParameterTypeRequiredDefaultDescription
session_idstringYes-Session ID (partial match supported)
formatstringNo"summary"Output format: full, summary, or code_only

Output: Session content in the requested format.


memory_find_code_snippets

Search for code that was discussed or generated in conversations.

ParameterTypeRequiredDefaultDescription
querystringYes-Search term (function name, pattern, etc.)
languagestringNo-Filter by language (python, typescript, etc.)
projectstringNo-Filter by project
limitintNo10Maximum results

Output: Code snippets with language, context, and source session.

Usage Examples

Once configured, you can ask Claude Code natural language questions:

"What did we discuss about authentication in this project?"
"Show me the last sessions for the backend project"
"Find that validation code we wrote last week"
"What was the decision about the database architecture?"
"Search for FastAPI implementations across all projects"

Or use the tools directly:

memory_list_projects
memory_search "error handling" --project myapp
memory_get_project_summary backend-api
memory_find_code_snippets "async def" --language python

How It Works

Claude Code stores conversation history as JSONL files in ~/.claude/projects/. Each project has a subdirectory containing session files.

This MCP server:

  1. Parses the JSONL files using streaming for memory efficiency
  2. Extracts messages, tool calls, and code blocks
  3. Provides search and summarization capabilities
  4. Returns formatted results to Claude Code

Project Structure

claude-memory-mcp/
├── pyproject.toml
├── README.md
└── src/
    └── claude_memory_mcp/
        ├── __init__.py
        ├── server.py      # FastMCP server with tool definitions
        ├── parser.py      # JSONL file parser with streaming
        ├── indexer.py     # Search and indexing logic
        ├── models.py      # Pydantic data models
        └── utils.py       # Formatting utilities

Requirements

  • Python >= 3.11
  • mcp >= 1.0.0
  • pydantic >= 2.0.0

Limitations

  • Search is currently text-based (no semantic/embedding search yet)
  • Large sessions may take a moment to parse on first access
  • Path encoding in Claude Code means some hyphens in paths are not preserved in display

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

License

MIT License - see LICENSE file for details.

Acknowledgments

Built with FastMCP for the Model Context Protocol implementation.