chenxiaofie-memory-mcp 0.1.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,241 @@
1
+ Metadata-Version: 2.4
2
+ Name: chenxiaofie-memory-mcp
3
+ Version: 0.1.0
4
+ Summary: 情景+实体记忆 MCP 服务
5
+ Requires-Python: >=3.10
6
+ Description-Content-Type: text/markdown
7
+ License-File: LICENSE
8
+ Requires-Dist: mcp>=1.0.0
9
+ Requires-Dist: chromadb>=0.4.22
10
+ Requires-Dist: sentence-transformers>=2.3.0
11
+ Requires-Dist: pydantic>=2.0.0
12
+ Dynamic: license-file
13
+
14
+ # Memory MCP Service
15
+
16
+ [English](README.md) | [中文](README_zh.md)
17
+
18
+ A scenario + entity memory MCP service that provides persistent memory capabilities for Claude Code.
19
+
20
+ ## Features
21
+
22
+ - **Episodes**: Dialogue scenes divided by task/function
23
+ - **Entities**: Structured knowledge units (decisions, concepts, preferences, etc.)
24
+ - **Dual-layer storage**: User-level (cross-project) + Project-level (project isolated)
25
+ - **Real-time cache**: Messages are stored in real-time to prevent loss
26
+ - **Semantic retrieval**: Vector-based semantic search
27
+
28
+ ## Installation
29
+
30
+ ### Windows One-click Installation
31
+
32
+ Run the `install.bat` file in the project root directory:
33
+
34
+ ```bash
35
+ # Double-click to run or execute from command line
36
+ install.bat
37
+ ```
38
+
39
+ ### Mac/Linux One-click Installation
40
+
41
+ Run the `install.sh` file in the project root directory:
42
+
43
+ ```bash
44
+ # Execute from command line
45
+ chmod +x install.sh
46
+ ./install.sh
47
+ ```
48
+
49
+ ### Manual Installation
50
+
51
+ ```bash
52
+ cd .claude/memory-mcp
53
+
54
+ # Create virtual environment
55
+ python -m venv venv310
56
+
57
+ # Activate virtual environment
58
+ # Windows:
59
+ venv310\Scripts\activate
60
+ # Mac/Linux:
61
+ source venv310/bin/activate
62
+
63
+ # Install dependencies
64
+ pip install -e .
65
+ ```
66
+
67
+ ## Configure Claude Code
68
+
69
+ ### 1. MCP Service Configuration
70
+
71
+ #### Method 1: Add using command line (recommended)
72
+
73
+ ```bash
74
+ claude mcp add memory-mcp -- python -m src.server
75
+ ```
76
+
77
+ #### Method 2: Manual configuration in settings.json
78
+
79
+ Edit `~/.claude/settings.json` (global configuration):
80
+
81
+ ```json
82
+ {
83
+ "mcpServers": {
84
+ "memory-mcp": {
85
+ "command": "/path/to/your/venv/bin/python",
86
+ "args": ["-m", "src.server"],
87
+ "cwd": "/path/to/your/memory-mcp",
88
+ "env": {
89
+ "CLAUDE_PROJECT_ROOT": "/path/to/your/project"
90
+ }
91
+ }
92
+ },
93
+ "hooks": {
94
+ "SessionStart": [
95
+ {
96
+ "matcher": ".*",
97
+ "hooks": [
98
+ {
99
+ "type": "command",
100
+ "command": "/path/to/your/venv/bin/python",
101
+ "args": ["/path/to/your/memory-mcp/session_start.py"],
102
+ "env": {}
103
+ }
104
+ ]
105
+ }
106
+ ],
107
+ "UserPromptSubmit": [
108
+ {
109
+ "matcher": ".*",
110
+ "hooks": [
111
+ {
112
+ "type": "command",
113
+ "command": "/path/to/your/venv/bin/python",
114
+ "args": ["/path/to/your/memory-mcp/auto_save.py"],
115
+ "env": {}
116
+ }
117
+ ]
118
+ }
119
+ ],
120
+ "Stop": [
121
+ {
122
+ "matcher": ".*",
123
+ "hooks": [
124
+ {
125
+ "type": "command",
126
+ "command": "/path/to/your/venv/bin/python",
127
+ "args": ["/path/to/your/memory-mcp/save_response.py"],
128
+ "env": {}
129
+ }
130
+ ]
131
+ }
132
+ ],
133
+ "SessionEnd": [
134
+ {
135
+ "matcher": ".*",
136
+ "hooks": [
137
+ {
138
+ "type": "command",
139
+ "command": "/path/to/your/venv/bin/python",
140
+ "args": ["/path/to/your/memory-mcp/session_end.py"],
141
+ "env": {}
142
+ }
143
+ ]
144
+ }
145
+ ]
146
+ }
147
+ }
148
+ ```
149
+
150
+ ### 2. Hooks Functionality
151
+
152
+ The project provides 4 automated hooks to implement complete session lifecycle management:
153
+
154
+ | Hook Name | File | Function Description |
155
+ |-------------------|--------------------------|-------------------------------------------------------------------------------------|
156
+ | SessionStart | `session_start.py` | Automatically creates a scenario when a session starts and begins monitoring the terminal lifecycle |
157
+ | UserPromptSubmit | `auto_save.py` | Automatically saves user messages to the memory system when they submit a prompt |
158
+ | Stop | `save_response.py` | Saves assistant responses to the memory system when the session stops |
159
+ | 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 |
160
+
161
+ ### 3. Verify Configuration
162
+
163
+ ```bash
164
+ # Check MCP server status
165
+ claude mcp list
166
+
167
+ # Expected output
168
+ Checking MCP server health...
169
+ playwright: npx @playwright/mcp@latest - ✓ Connected
170
+ memory-mcp: /path/to/your/venv/bin/python -m src.server - ✓ Connected
171
+ ```
172
+
173
+ ## Tools List
174
+
175
+ ### Message Cache
176
+
177
+ - `memory_cache_message`: Cache messages
178
+
179
+ ### Episode Management
180
+
181
+ - `memory_start_episode`: Start a new episode
182
+ - `memory_close_episode`: Close an episode
183
+ - `memory_get_current_episode`: Get current episode
184
+
185
+ ### Entity Management
186
+
187
+ - `memory_add_entity`: Add entity
188
+ - `memory_confirm_entity`: Confirm candidate entity
189
+ - `memory_reject_candidate`: Reject candidate
190
+ - `memory_deprecate_entity`: Deprecate entity
191
+ - `memory_get_pending`: Get pending entities
192
+
193
+ ### Retrieval
194
+
195
+ - `memory_recall`: Comprehensive retrieval
196
+ - `memory_search_by_type`: Search by type
197
+ - `memory_get_episode_detail`: Get episode detail
198
+
199
+ ### Statistics
200
+
201
+ - `memory_stats`: Get statistics
202
+
203
+ ## Entity Types
204
+
205
+ ### User-level (cross-project shared)
206
+
207
+ - `Preference`: User preferences
208
+ - `Concept`: General concepts
209
+ - `Habit`: Work habits
210
+
211
+ ### Project-level (project isolated)
212
+
213
+ - `Decision`: Project decisions
214
+ - `Episode`: Development scenes
215
+ - `File`: File descriptions
216
+ - `Architecture`: Architecture designs
217
+
218
+ ## Storage Locations
219
+
220
+ - User-level: `~/.claude-memory/` (Windows: `%APPDATA%/claude-memory/`)
221
+ - Project-level: `{project}/.claude/memory/`
222
+
223
+ ## Example Usage
224
+
225
+ ```
226
+ # Start a new task
227
+ Claude call: memory_start_episode("Login Function Development", ["auth"])
228
+
229
+ # Record a decision
230
+ Claude call: memory_add_entity("Decision", "Adopt JWT + Redis solution", "Consider distributed deployment")
231
+
232
+ # Retrieve history
233
+ Claude call: memory_recall("Login scheme")
234
+
235
+ # Close task
236
+ Claude call: memory_close_episode("Completed JWT login function development")
237
+ ```
238
+
239
+ ## License
240
+
241
+ MIT License - see LICENSE file for details.
@@ -0,0 +1,228 @@
1
+ # Memory MCP Service
2
+
3
+ [English](README.md) | [中文](README_zh.md)
4
+
5
+ A scenario + entity memory MCP service that provides persistent memory capabilities for Claude Code.
6
+
7
+ ## Features
8
+
9
+ - **Episodes**: Dialogue scenes divided by task/function
10
+ - **Entities**: Structured knowledge units (decisions, concepts, preferences, etc.)
11
+ - **Dual-layer storage**: User-level (cross-project) + Project-level (project isolated)
12
+ - **Real-time cache**: Messages are stored in real-time to prevent loss
13
+ - **Semantic retrieval**: Vector-based semantic search
14
+
15
+ ## Installation
16
+
17
+ ### Windows One-click Installation
18
+
19
+ Run the `install.bat` file in the project root directory:
20
+
21
+ ```bash
22
+ # Double-click to run or execute from command line
23
+ install.bat
24
+ ```
25
+
26
+ ### Mac/Linux One-click Installation
27
+
28
+ Run the `install.sh` file in the project root directory:
29
+
30
+ ```bash
31
+ # Execute from command line
32
+ chmod +x install.sh
33
+ ./install.sh
34
+ ```
35
+
36
+ ### Manual Installation
37
+
38
+ ```bash
39
+ cd .claude/memory-mcp
40
+
41
+ # Create virtual environment
42
+ python -m venv venv310
43
+
44
+ # Activate virtual environment
45
+ # Windows:
46
+ venv310\Scripts\activate
47
+ # Mac/Linux:
48
+ source venv310/bin/activate
49
+
50
+ # Install dependencies
51
+ pip install -e .
52
+ ```
53
+
54
+ ## Configure Claude Code
55
+
56
+ ### 1. MCP Service Configuration
57
+
58
+ #### Method 1: Add using command line (recommended)
59
+
60
+ ```bash
61
+ claude mcp add memory-mcp -- python -m src.server
62
+ ```
63
+
64
+ #### Method 2: Manual configuration in settings.json
65
+
66
+ Edit `~/.claude/settings.json` (global configuration):
67
+
68
+ ```json
69
+ {
70
+ "mcpServers": {
71
+ "memory-mcp": {
72
+ "command": "/path/to/your/venv/bin/python",
73
+ "args": ["-m", "src.server"],
74
+ "cwd": "/path/to/your/memory-mcp",
75
+ "env": {
76
+ "CLAUDE_PROJECT_ROOT": "/path/to/your/project"
77
+ }
78
+ }
79
+ },
80
+ "hooks": {
81
+ "SessionStart": [
82
+ {
83
+ "matcher": ".*",
84
+ "hooks": [
85
+ {
86
+ "type": "command",
87
+ "command": "/path/to/your/venv/bin/python",
88
+ "args": ["/path/to/your/memory-mcp/session_start.py"],
89
+ "env": {}
90
+ }
91
+ ]
92
+ }
93
+ ],
94
+ "UserPromptSubmit": [
95
+ {
96
+ "matcher": ".*",
97
+ "hooks": [
98
+ {
99
+ "type": "command",
100
+ "command": "/path/to/your/venv/bin/python",
101
+ "args": ["/path/to/your/memory-mcp/auto_save.py"],
102
+ "env": {}
103
+ }
104
+ ]
105
+ }
106
+ ],
107
+ "Stop": [
108
+ {
109
+ "matcher": ".*",
110
+ "hooks": [
111
+ {
112
+ "type": "command",
113
+ "command": "/path/to/your/venv/bin/python",
114
+ "args": ["/path/to/your/memory-mcp/save_response.py"],
115
+ "env": {}
116
+ }
117
+ ]
118
+ }
119
+ ],
120
+ "SessionEnd": [
121
+ {
122
+ "matcher": ".*",
123
+ "hooks": [
124
+ {
125
+ "type": "command",
126
+ "command": "/path/to/your/venv/bin/python",
127
+ "args": ["/path/to/your/memory-mcp/session_end.py"],
128
+ "env": {}
129
+ }
130
+ ]
131
+ }
132
+ ]
133
+ }
134
+ }
135
+ ```
136
+
137
+ ### 2. Hooks Functionality
138
+
139
+ The project provides 4 automated hooks to implement complete session lifecycle management:
140
+
141
+ | Hook Name | File | Function Description |
142
+ |-------------------|--------------------------|-------------------------------------------------------------------------------------|
143
+ | SessionStart | `session_start.py` | Automatically creates a scenario when a session starts and begins monitoring the terminal lifecycle |
144
+ | UserPromptSubmit | `auto_save.py` | Automatically saves user messages to the memory system when they submit a prompt |
145
+ | Stop | `save_response.py` | Saves assistant responses to the memory system when the session stops |
146
+ | 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 |
147
+
148
+ ### 3. Verify Configuration
149
+
150
+ ```bash
151
+ # Check MCP server status
152
+ claude mcp list
153
+
154
+ # Expected output
155
+ Checking MCP server health...
156
+ playwright: npx @playwright/mcp@latest - ✓ Connected
157
+ memory-mcp: /path/to/your/venv/bin/python -m src.server - ✓ Connected
158
+ ```
159
+
160
+ ## Tools List
161
+
162
+ ### Message Cache
163
+
164
+ - `memory_cache_message`: Cache messages
165
+
166
+ ### Episode Management
167
+
168
+ - `memory_start_episode`: Start a new episode
169
+ - `memory_close_episode`: Close an episode
170
+ - `memory_get_current_episode`: Get current episode
171
+
172
+ ### Entity Management
173
+
174
+ - `memory_add_entity`: Add entity
175
+ - `memory_confirm_entity`: Confirm candidate entity
176
+ - `memory_reject_candidate`: Reject candidate
177
+ - `memory_deprecate_entity`: Deprecate entity
178
+ - `memory_get_pending`: Get pending entities
179
+
180
+ ### Retrieval
181
+
182
+ - `memory_recall`: Comprehensive retrieval
183
+ - `memory_search_by_type`: Search by type
184
+ - `memory_get_episode_detail`: Get episode detail
185
+
186
+ ### Statistics
187
+
188
+ - `memory_stats`: Get statistics
189
+
190
+ ## Entity Types
191
+
192
+ ### User-level (cross-project shared)
193
+
194
+ - `Preference`: User preferences
195
+ - `Concept`: General concepts
196
+ - `Habit`: Work habits
197
+
198
+ ### Project-level (project isolated)
199
+
200
+ - `Decision`: Project decisions
201
+ - `Episode`: Development scenes
202
+ - `File`: File descriptions
203
+ - `Architecture`: Architecture designs
204
+
205
+ ## Storage Locations
206
+
207
+ - User-level: `~/.claude-memory/` (Windows: `%APPDATA%/claude-memory/`)
208
+ - Project-level: `{project}/.claude/memory/`
209
+
210
+ ## Example Usage
211
+
212
+ ```
213
+ # Start a new task
214
+ Claude call: memory_start_episode("Login Function Development", ["auth"])
215
+
216
+ # Record a decision
217
+ Claude call: memory_add_entity("Decision", "Adopt JWT + Redis solution", "Consider distributed deployment")
218
+
219
+ # Retrieve history
220
+ Claude call: memory_recall("Login scheme")
221
+
222
+ # Close task
223
+ Claude call: memory_close_episode("Completed JWT login function development")
224
+ ```
225
+
226
+ ## License
227
+
228
+ MIT License - see LICENSE file for details.