情景+实体记忆 MCP 服务
Project description
mcp-name: io.github.chenxiaofie/memory-mcp
Memory MCP Service
A scenario + entity memory MCP service that provides persistent memory capabilities for Claude Code.
Features
- Episodes: Dialogue scenes divided by task/function
- Entities: Structured knowledge units (decisions, concepts, preferences, etc.)
- Dual-layer storage: User-level (cross-project) + Project-level (project isolated)
- Real-time cache: Messages are stored in real-time to prevent loss
- Semantic retrieval: Vector-based semantic search
Installation
Windows One-click Installation
Run the install.bat file in the project root directory:
# Double-click to run or execute from command line
install.bat
Mac/Linux One-click Installation
Run the install.sh file in the project root directory:
# Execute from command line
chmod +x install.sh
./install.sh
Manual Installation
cd .claude/memory-mcp
# Create virtual environment
python -m venv venv310
# Activate virtual environment
# Windows:
venv310\Scripts\activate
# Mac/Linux:
source venv310/bin/activate
# Install dependencies
pip install -e .
Configure Claude Code
1. MCP Service Configuration
Method 1: Add using command line (recommended)
claude mcp add memory-mcp -- python -m src.server
Method 2: Manual configuration in settings.json
Edit ~/.claude/settings.json (global configuration):
{
"mcpServers": {
"memory-mcp": {
"command": "/path/to/your/venv/bin/python",
"args": ["-m", "src.server"],
"cwd": "/path/to/your/memory-mcp",
"env": {
"CLAUDE_PROJECT_ROOT": "/path/to/your/project"
}
}
},
"hooks": {
"SessionStart": [
{
"matcher": ".*",
"hooks": [
{
"type": "command",
"command": "/path/to/your/venv/bin/python",
"args": ["/path/to/your/memory-mcp/session_start.py"],
"env": {}
}
]
}
],
"UserPromptSubmit": [
{
"matcher": ".*",
"hooks": [
{
"type": "command",
"command": "/path/to/your/venv/bin/python",
"args": ["/path/to/your/memory-mcp/auto_save.py"],
"env": {}
}
]
}
],
"Stop": [
{
"matcher": ".*",
"hooks": [
{
"type": "command",
"command": "/path/to/your/venv/bin/python",
"args": ["/path/to/your/memory-mcp/save_response.py"],
"env": {}
}
]
}
],
"SessionEnd": [
{
"matcher": ".*",
"hooks": [
{
"type": "command",
"command": "/path/to/your/venv/bin/python",
"args": ["/path/to/your/memory-mcp/session_end.py"],
"env": {}
}
]
}
]
}
}
2. Hooks Functionality
The project provides 4 automated hooks to implement complete session lifecycle management:
| Hook Name | File | Function Description |
|---|---|---|
| SessionStart | session_start.py |
Automatically creates a scenario when a session starts and begins monitoring the terminal lifecycle |
| UserPromptSubmit | auto_save.py |
Automatically saves user messages to the memory system when they submit a prompt |
| Stop | save_response.py |
Saves assistant responses to the memory system when the session stops |
| SessionEnd | session_end.py |
Sends a close signal to the monitoring process when the session ends, which is responsible for closing the scenario and generating a summary |
3. Verify Configuration
# Check MCP server status
claude mcp list
# Expected output
Checking MCP server health...
playwright: npx @playwright/mcp@latest - ✓ Connected
memory-mcp: /path/to/your/venv/bin/python -m src.server - ✓ Connected
Tools List
Message Cache
memory_cache_message: Cache messages
Episode Management
memory_start_episode: Start a new episodememory_close_episode: Close an episodememory_get_current_episode: Get current episode
Entity Management
memory_add_entity: Add entitymemory_confirm_entity: Confirm candidate entitymemory_reject_candidate: Reject candidatememory_deprecate_entity: Deprecate entitymemory_get_pending: Get pending entities
Retrieval
memory_recall: Comprehensive retrievalmemory_search_by_type: Search by typememory_get_episode_detail: Get episode detail
Statistics
memory_stats: Get statistics
Entity Types
User-level (cross-project shared)
Preference: User preferencesConcept: General conceptsHabit: Work habits
Project-level (project isolated)
Decision: Project decisionsEpisode: Development scenesFile: File descriptionsArchitecture: Architecture designs
Storage Locations
- User-level:
~/.claude-memory/(Windows:%APPDATA%/claude-memory/) - Project-level:
{project}/.claude/memory/
Example Usage
# Start a new task
Claude call: memory_start_episode("Login Function Development", ["auth"])
# Record a decision
Claude call: memory_add_entity("Decision", "Adopt JWT + Redis solution", "Consider distributed deployment")
# Retrieve history
Claude call: memory_recall("Login scheme")
# Close task
Claude call: memory_close_episode("Completed JWT login function development")
License
MIT License - see LICENSE file for details.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file chenxiaofie_memory_mcp-0.1.1.tar.gz.
File metadata
- Download URL: chenxiaofie_memory_mcp-0.1.1.tar.gz
- Upload date:
- Size: 21.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
97871d80ffd1be18e8e535b5b5e0d19e105720d57e1af61ab86c5d9820f88747
|
|
| MD5 |
a7b1338feecd8f930fc2edb0c0adbbcd
|
|
| BLAKE2b-256 |
6a3035e4b388c87a7f4a0c09ea15bc0a160982c20a9fbb8446829fe8bbb17745
|
File details
Details for the file chenxiaofie_memory_mcp-0.1.1-py3-none-any.whl.
File metadata
- Download URL: chenxiaofie_memory_mcp-0.1.1-py3-none-any.whl
- Upload date:
- Size: 24.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6f27a3fb6d398939fdbd4e09c91837e11bcd17834172c02b1fe1ab36671095a5
|
|
| MD5 |
cfb8cc1b9bcb8329e4cd9ada62a52a12
|
|
| BLAKE2b-256 |
b184db6ab0eb7d57d3ee18e130aaa856cd2697728957234b81339ee5228ae015
|