simple-memory-mcp 1.1.3

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.
Files changed (247) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +742 -0
  3. package/dist/cli/arg-parser.d.ts +9 -0
  4. package/dist/cli/arg-parser.d.ts.map +1 -0
  5. package/dist/cli/arg-parser.js +68 -0
  6. package/dist/cli/arg-parser.js.map +1 -0
  7. package/dist/cli/help-generator.d.ts +8 -0
  8. package/dist/cli/help-generator.d.ts.map +1 -0
  9. package/dist/cli/help-generator.js +89 -0
  10. package/dist/cli/help-generator.js.map +1 -0
  11. package/dist/cli/index.d.ts +27 -0
  12. package/dist/cli/index.d.ts.map +1 -0
  13. package/dist/cli/index.js +56 -0
  14. package/dist/cli/index.js.map +1 -0
  15. package/dist/cli/query-builder.d.ts +8 -0
  16. package/dist/cli/query-builder.d.ts.map +1 -0
  17. package/dist/cli/query-builder.js +63 -0
  18. package/dist/cli/query-builder.js.map +1 -0
  19. package/dist/cli/shortcuts-config.d.ts +26 -0
  20. package/dist/cli/shortcuts-config.d.ts.map +1 -0
  21. package/dist/cli/shortcuts-config.js +94 -0
  22. package/dist/cli/shortcuts-config.js.map +1 -0
  23. package/dist/graphql/resolvers.d.ts +101 -0
  24. package/dist/graphql/resolvers.d.ts.map +1 -0
  25. package/dist/graphql/resolvers.js +98 -0
  26. package/dist/graphql/resolvers.js.map +1 -0
  27. package/dist/graphql/schema.d.ts +13 -0
  28. package/dist/graphql/schema.d.ts.map +1 -0
  29. package/dist/graphql/schema.js +314 -0
  30. package/dist/graphql/schema.js.map +1 -0
  31. package/dist/index.d.ts +3 -0
  32. package/dist/index.d.ts.map +1 -0
  33. package/dist/index.js +573 -0
  34. package/dist/index.js.map +1 -0
  35. package/dist/services/backup-service.d.ts +57 -0
  36. package/dist/services/backup-service.d.ts.map +1 -0
  37. package/dist/services/backup-service.js +191 -0
  38. package/dist/services/backup-service.js.map +1 -0
  39. package/dist/services/database-optimizer.d.ts +15 -0
  40. package/dist/services/database-optimizer.d.ts.map +1 -0
  41. package/dist/services/database-optimizer.js +45 -0
  42. package/dist/services/database-optimizer.js.map +1 -0
  43. package/dist/services/memory-service.d.ts +126 -0
  44. package/dist/services/memory-service.d.ts.map +1 -0
  45. package/dist/services/memory-service.js +862 -0
  46. package/dist/services/memory-service.js.map +1 -0
  47. package/dist/services/migrations.d.ts +17 -0
  48. package/dist/services/migrations.d.ts.map +1 -0
  49. package/dist/services/migrations.js +273 -0
  50. package/dist/services/migrations.js.map +1 -0
  51. package/dist/tests/backup-export-test.d.ts +2 -0
  52. package/dist/tests/backup-export-test.d.ts.map +1 -0
  53. package/dist/tests/backup-export-test.js +162 -0
  54. package/dist/tests/backup-export-test.js.map +1 -0
  55. package/dist/tests/backup-test.d.ts +14 -0
  56. package/dist/tests/backup-test.d.ts.map +1 -0
  57. package/dist/tests/backup-test.js +209 -0
  58. package/dist/tests/backup-test.js.map +1 -0
  59. package/dist/tests/export-import-test.d.ts +15 -0
  60. package/dist/tests/export-import-test.d.ts.map +1 -0
  61. package/dist/tests/export-import-test.js +227 -0
  62. package/dist/tests/export-import-test.js.map +1 -0
  63. package/dist/tests/graphql-comprehensive-test.d.ts +6 -0
  64. package/dist/tests/graphql-comprehensive-test.d.ts.map +1 -0
  65. package/dist/tests/graphql-comprehensive-test.js +342 -0
  66. package/dist/tests/graphql-comprehensive-test.js.map +1 -0
  67. package/dist/tests/graphql-performance-test.d.ts +6 -0
  68. package/dist/tests/graphql-performance-test.d.ts.map +1 -0
  69. package/dist/tests/graphql-performance-test.js +141 -0
  70. package/dist/tests/graphql-performance-test.js.map +1 -0
  71. package/dist/tests/graphql-test.d.ts +5 -0
  72. package/dist/tests/graphql-test.d.ts.map +1 -0
  73. package/dist/tests/graphql-test.js +47 -0
  74. package/dist/tests/graphql-test.js.map +1 -0
  75. package/dist/tests/memory-server-tests.d.ts +7 -0
  76. package/dist/tests/memory-server-tests.d.ts.map +1 -0
  77. package/dist/tests/memory-server-tests.js +466 -0
  78. package/dist/tests/memory-server-tests.js.map +1 -0
  79. package/dist/tests/migration-test.d.ts +2 -0
  80. package/dist/tests/migration-test.d.ts.map +1 -0
  81. package/dist/tests/migration-test.js +270 -0
  82. package/dist/tests/migration-test.js.map +1 -0
  83. package/dist/tests/performance-benchmark.d.ts +7 -0
  84. package/dist/tests/performance-benchmark.d.ts.map +1 -0
  85. package/dist/tests/performance-benchmark.js +234 -0
  86. package/dist/tests/performance-benchmark.js.map +1 -0
  87. package/dist/tests/performance-test.d.ts +3 -0
  88. package/dist/tests/performance-test.d.ts.map +1 -0
  89. package/dist/tests/performance-test.js +61 -0
  90. package/dist/tests/performance-test.js.map +1 -0
  91. package/dist/tests/time-range-test.d.ts +7 -0
  92. package/dist/tests/time-range-test.d.ts.map +1 -0
  93. package/dist/tests/time-range-test.js +169 -0
  94. package/dist/tests/time-range-test.js.map +1 -0
  95. package/dist/tools/delete-memory/cli-parser.d.ts +2 -0
  96. package/dist/tools/delete-memory/cli-parser.d.ts.map +1 -0
  97. package/dist/tools/delete-memory/cli-parser.js +13 -0
  98. package/dist/tools/delete-memory/cli-parser.js.map +1 -0
  99. package/dist/tools/delete-memory/executor.d.ts +13 -0
  100. package/dist/tools/delete-memory/executor.d.ts.map +1 -0
  101. package/dist/tools/delete-memory/executor.js +40 -0
  102. package/dist/tools/delete-memory/executor.js.map +1 -0
  103. package/dist/tools/delete-memory/index.d.ts +3 -0
  104. package/dist/tools/delete-memory/index.d.ts.map +1 -0
  105. package/dist/tools/delete-memory/index.js +24 -0
  106. package/dist/tools/delete-memory/index.js.map +1 -0
  107. package/dist/tools/export-memory/cli-parser.d.ts +2 -0
  108. package/dist/tools/export-memory/cli-parser.d.ts.map +1 -0
  109. package/dist/tools/export-memory/cli-parser.js +34 -0
  110. package/dist/tools/export-memory/cli-parser.js.map +1 -0
  111. package/dist/tools/export-memory/executor.d.ts +10 -0
  112. package/dist/tools/export-memory/executor.d.ts.map +1 -0
  113. package/dist/tools/export-memory/executor.js +41 -0
  114. package/dist/tools/export-memory/executor.js.map +1 -0
  115. package/dist/tools/export-memory/index.d.ts +4 -0
  116. package/dist/tools/export-memory/index.d.ts.map +1 -0
  117. package/dist/tools/export-memory/index.js +99 -0
  118. package/dist/tools/export-memory/index.js.map +1 -0
  119. package/dist/tools/import-memory/cli-parser.d.ts +2 -0
  120. package/dist/tools/import-memory/cli-parser.d.ts.map +1 -0
  121. package/dist/tools/import-memory/cli-parser.js +25 -0
  122. package/dist/tools/import-memory/cli-parser.js.map +1 -0
  123. package/dist/tools/import-memory/executor.d.ts +8 -0
  124. package/dist/tools/import-memory/executor.d.ts.map +1 -0
  125. package/dist/tools/import-memory/executor.js +31 -0
  126. package/dist/tools/import-memory/executor.js.map +1 -0
  127. package/dist/tools/import-memory/index.d.ts +4 -0
  128. package/dist/tools/import-memory/index.d.ts.map +1 -0
  129. package/dist/tools/import-memory/index.js +70 -0
  130. package/dist/tools/import-memory/index.js.map +1 -0
  131. package/dist/tools/index.d.ts +14 -0
  132. package/dist/tools/index.d.ts.map +1 -0
  133. package/dist/tools/index.js +48 -0
  134. package/dist/tools/index.js.map +1 -0
  135. package/dist/tools/memory-graphql/cli-parser.d.ts +6 -0
  136. package/dist/tools/memory-graphql/cli-parser.d.ts.map +1 -0
  137. package/dist/tools/memory-graphql/cli-parser.js +24 -0
  138. package/dist/tools/memory-graphql/cli-parser.js.map +1 -0
  139. package/dist/tools/memory-graphql/executor.d.ts +18 -0
  140. package/dist/tools/memory-graphql/executor.d.ts.map +1 -0
  141. package/dist/tools/memory-graphql/executor.js +53 -0
  142. package/dist/tools/memory-graphql/executor.js.map +1 -0
  143. package/dist/tools/memory-graphql/index.d.ts +3 -0
  144. package/dist/tools/memory-graphql/index.d.ts.map +1 -0
  145. package/dist/tools/memory-graphql/index.js +73 -0
  146. package/dist/tools/memory-graphql/index.js.map +1 -0
  147. package/dist/tools/memory-stats/cli-parser.d.ts +2 -0
  148. package/dist/tools/memory-stats/cli-parser.d.ts.map +1 -0
  149. package/dist/tools/memory-stats/cli-parser.js +8 -0
  150. package/dist/tools/memory-stats/cli-parser.js.map +1 -0
  151. package/dist/tools/memory-stats/executor.d.ts +4 -0
  152. package/dist/tools/memory-stats/executor.d.ts.map +1 -0
  153. package/dist/tools/memory-stats/executor.js +4 -0
  154. package/dist/tools/memory-stats/executor.js.map +1 -0
  155. package/dist/tools/memory-stats/index.d.ts +3 -0
  156. package/dist/tools/memory-stats/index.d.ts.map +1 -0
  157. package/dist/tools/memory-stats/index.js +15 -0
  158. package/dist/tools/memory-stats/index.js.map +1 -0
  159. package/dist/tools/search-memory/cli-parser.d.ts +2 -0
  160. package/dist/tools/search-memory/cli-parser.d.ts.map +1 -0
  161. package/dist/tools/search-memory/cli-parser.js +56 -0
  162. package/dist/tools/search-memory/cli-parser.js.map +1 -0
  163. package/dist/tools/search-memory/executor.d.ts +36 -0
  164. package/dist/tools/search-memory/executor.d.ts.map +1 -0
  165. package/dist/tools/search-memory/executor.js +83 -0
  166. package/dist/tools/search-memory/executor.js.map +1 -0
  167. package/dist/tools/search-memory/index.d.ts +3 -0
  168. package/dist/tools/search-memory/index.d.ts.map +1 -0
  169. package/dist/tools/search-memory/index.js +89 -0
  170. package/dist/tools/search-memory/index.js.map +1 -0
  171. package/dist/tools/store-memory/cli-parser.d.ts +2 -0
  172. package/dist/tools/store-memory/cli-parser.d.ts.map +1 -0
  173. package/dist/tools/store-memory/cli-parser.js +21 -0
  174. package/dist/tools/store-memory/cli-parser.js.map +1 -0
  175. package/dist/tools/store-memory/executor.d.ts +16 -0
  176. package/dist/tools/store-memory/executor.d.ts.map +1 -0
  177. package/dist/tools/store-memory/executor.js +100 -0
  178. package/dist/tools/store-memory/executor.js.map +1 -0
  179. package/dist/tools/store-memory/index.d.ts +3 -0
  180. package/dist/tools/store-memory/index.d.ts.map +1 -0
  181. package/dist/tools/store-memory/index.js +68 -0
  182. package/dist/tools/store-memory/index.js.map +1 -0
  183. package/dist/tools/sync-memory/cli-parser.d.ts +1 -0
  184. package/dist/tools/sync-memory/cli-parser.d.ts.map +1 -0
  185. package/dist/tools/sync-memory/cli-parser.js +2 -0
  186. package/dist/tools/sync-memory/cli-parser.js.map +1 -0
  187. package/dist/tools/sync-memory/executor.d.ts +1 -0
  188. package/dist/tools/sync-memory/executor.d.ts.map +1 -0
  189. package/dist/tools/sync-memory/executor.js +2 -0
  190. package/dist/tools/sync-memory/executor.js.map +1 -0
  191. package/dist/tools/sync-memory/index.d.ts +1 -0
  192. package/dist/tools/sync-memory/index.d.ts.map +1 -0
  193. package/dist/tools/sync-memory/index.js +2 -0
  194. package/dist/tools/sync-memory/index.js.map +1 -0
  195. package/dist/tools/update-memory/cli-parser.d.ts +2 -0
  196. package/dist/tools/update-memory/cli-parser.d.ts.map +1 -0
  197. package/dist/tools/update-memory/cli-parser.js +17 -0
  198. package/dist/tools/update-memory/cli-parser.js.map +1 -0
  199. package/dist/tools/update-memory/executor.d.ts +16 -0
  200. package/dist/tools/update-memory/executor.d.ts.map +1 -0
  201. package/dist/tools/update-memory/executor.js +59 -0
  202. package/dist/tools/update-memory/executor.js.map +1 -0
  203. package/dist/tools/update-memory/index.d.ts +3 -0
  204. package/dist/tools/update-memory/index.d.ts.map +1 -0
  205. package/dist/tools/update-memory/index.js +30 -0
  206. package/dist/tools/update-memory/index.js.map +1 -0
  207. package/dist/transports/streamable-http.d.ts +38 -0
  208. package/dist/transports/streamable-http.d.ts.map +1 -0
  209. package/dist/transports/streamable-http.js +209 -0
  210. package/dist/transports/streamable-http.js.map +1 -0
  211. package/dist/types/tools.d.ts +79 -0
  212. package/dist/types/tools.d.ts.map +1 -0
  213. package/dist/types/tools.js +3 -0
  214. package/dist/types/tools.js.map +1 -0
  215. package/dist/utils/cli-parser.d.ts +12 -0
  216. package/dist/utils/cli-parser.d.ts.map +1 -0
  217. package/dist/utils/cli-parser.js +43 -0
  218. package/dist/utils/cli-parser.js.map +1 -0
  219. package/dist/utils/config.d.ts +95 -0
  220. package/dist/utils/config.d.ts.map +1 -0
  221. package/dist/utils/config.js +176 -0
  222. package/dist/utils/config.js.map +1 -0
  223. package/dist/utils/db-integrity-check.d.ts +22 -0
  224. package/dist/utils/db-integrity-check.d.ts.map +1 -0
  225. package/dist/utils/db-integrity-check.js +69 -0
  226. package/dist/utils/db-integrity-check.js.map +1 -0
  227. package/dist/utils/debug.d.ts +25 -0
  228. package/dist/utils/debug.d.ts.map +1 -0
  229. package/dist/utils/debug.js +67 -0
  230. package/dist/utils/debug.js.map +1 -0
  231. package/dist/utils/help-generator.d.ts +18 -0
  232. package/dist/utils/help-generator.d.ts.map +1 -0
  233. package/dist/utils/help-generator.js +81 -0
  234. package/dist/utils/help-generator.js.map +1 -0
  235. package/dist/utils/json-parser.d.ts +12 -0
  236. package/dist/utils/json-parser.d.ts.map +1 -0
  237. package/dist/utils/json-parser.js +52 -0
  238. package/dist/utils/json-parser.js.map +1 -0
  239. package/dist/utils/mcp-config.d.ts +12 -0
  240. package/dist/utils/mcp-config.d.ts.map +1 -0
  241. package/dist/utils/mcp-config.js +64 -0
  242. package/dist/utils/mcp-config.js.map +1 -0
  243. package/dist/web-server.d.ts +3 -0
  244. package/dist/web-server.d.ts.map +1 -0
  245. package/dist/web-server.js +265 -0
  246. package/dist/web-server.js.map +1 -0
  247. package/package.json +75 -0
package/README.md ADDED
@@ -0,0 +1,742 @@
1
+ # 🧠 Simple Memory MCP Server
2
+
3
+ [![npm version](https://img.shields.io/npm/v/simple-memory-mcp.svg)](https://www.npmjs.com/package/simple-memory-mcp)
4
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
5
+ [![TypeScript](https://img.shields.io/badge/TypeScript-5.3-blue.svg)](https://www.typescriptlang.org/)
6
+
7
+ A blazingly fast Model Context Protocol (MCP) server for persistent memory storage with intelligent tagging and full-text search.
8
+
9
+ Perfect for AI assistants that need to remember context across conversations, store project notes, or build a personal knowledge base.
10
+
11
+ > 📚 **New to Simple Memory?** Read the [Design Philosophy](docs/DESIGN_PHILOSOPHY.md) to understand why it's built this way, the trade-offs made, and when this approach makes sense for your needs.
12
+
13
+ ---
14
+
15
+ ## ✨ Features
16
+
17
+ - 🧠 **Auto-Capture** - LLM proactively stores important information during conversations
18
+ - 🚀 **Sub-millisecond Performance** - 2,000-10,000 operations/second
19
+ - 🔍 **Full-Text Search** - SQLite FTS5 with 0.14ms average query time
20
+ - 🏷️ **Smart Tagging** - Organize and filter memories with tags
21
+ - 🔗 **Auto-Relationships** - Automatically link related memories
22
+ - 💾 **Automatic Backups** - Optional lazy backups to cloud storage
23
+ - 🔄 **Safe Migrations** - Automatic schema upgrades without data loss
24
+ - 📦 **Zero Config** - Works out of the box with sensible defaults
25
+
26
+ ---
27
+
28
+ ## 📊 Performance Highlights
29
+
30
+ | Operation | Average Time | Throughput |
31
+ |-----------|--------------|------------|
32
+ | Store Memory (1KB) | 0.05ms | ~20,000 ops/sec |
33
+ | Full-Text Search | 0.08ms | ~13,000 ops/sec |
34
+ | Tag Search | 0.22ms | ~4,500 ops/sec |
35
+ | Bulk Relationships (10) | 0.29ms | ~3,500 ops/sec |
36
+
37
+ **All operations complete in sub-millisecond timeframes** with optimized indexes and prepared statements.
38
+
39
+ > 📏 **Reproduce these numbers:** Run `npm run benchmark` after setup. Results vary by hardware - tested on NVMe SSD with Node.js 20+.
40
+
41
+
42
+ ---
43
+
44
+ ## 🚀 Quick Start
45
+
46
+ > 💡 **Best Experience**: Simple Memory works best with **Claude Sonnet in Agent Mode**. The agent's autonomous decision-making and proactive behavior enables optimal memory capture and retrieval without explicit instructions.
47
+
48
+ ### 1️⃣ One-Command Setup
49
+
50
+ **From Source:**
51
+ ```bash
52
+ git clone https://github.com/chrisribe/simple-memory-mcp.git
53
+ cd simple-memory-mcp
54
+ npm run setup
55
+ ```
56
+
57
+ **Or from npm (when published):**
58
+ ```bash
59
+ npm install -g simple-memory-mcp
60
+ ```
61
+
62
+ That's it! The `setup` command automatically:
63
+ - ✅ Installs dependencies
64
+ - ✅ Builds TypeScript → JavaScript
65
+ - ✅ Links globally (makes `simple-memory` command available)
66
+ - ✅ Configures VS Code (both stable and Insiders)
67
+
68
+ > 💡 VS Code users: The setup automatically adds the MCP server to your `mcp.json` file. Just restart VS Code after setup!
69
+ >
70
+ > 💡 Need to customize? Run `npm run setup` again to see the config file path (Ctrl+click to open)
71
+
72
+ ### 2️⃣ For Other MCP Clients (Optional)
73
+
74
+ If you're using Claude Desktop or other MCP clients, add this to their config:
75
+
76
+ **Claude Desktop** (`claude_desktop_config.json`):
77
+ ```json
78
+ {
79
+ "mcpServers": {
80
+ "simple-memory-mcp": {
81
+ "command": "simple-memory"
82
+ }
83
+ }
84
+ }
85
+ ```
86
+
87
+ > 💡 **Windows**: `%APPDATA%\Claude\claude_desktop_config.json`
88
+ > 💡 **macOS**: `~/Library/Application Support/Claude/claude_desktop_config.json`
89
+
90
+ ### 3️⃣ Start Using
91
+
92
+ Restart your MCP client and the `simple-memory-mcp` server will be available. The AI assistant can now:
93
+ - 🧠 Remember information across conversations
94
+ - 🔍 Search your stored memories
95
+ - 🏷️ Organize with tags
96
+ - 🔗 Link related memories automatically
97
+
98
+ **All transparent - no UI, no manual steps. Just works!**
99
+
100
+ ---
101
+
102
+ ## 📖 Table of Contents
103
+
104
+ - [Usage](#-usage)
105
+ - [MCP Server](#as-mcp-server)
106
+ - [CLI Commands](#command-line-interface)
107
+ - [Available Tools](#-available-tools)
108
+ - [Configuration](#-configuration)
109
+ - [Database](#-database)
110
+ - [Development](#-development)
111
+ - [Examples](#-examples)
112
+
113
+ ---
114
+
115
+ ## 💻 Usage
116
+
117
+ ### As MCP Server
118
+
119
+ The server exposes tools that your AI assistant can use directly. Once configured, your assistant will:
120
+
121
+ **🧠 Auto-Capture Mode** - Proactively store important information:
122
+ - Preferences you mention ("I prefer dark mode")
123
+ - Decisions you make ("Let's use PostgreSQL")
124
+ - Facts about people, projects, or tools
125
+ - Learnings and insights you discover
126
+
127
+ **📝 Manual Storage** - You can also explicitly ask:
128
+ - "Remember that I prefer dark mode"
129
+ - "Store this meeting summary with tags project and planning"
130
+ - "Search my memories for Python tips"
131
+ - "Show me all memories tagged with 'important'"
132
+
133
+ The assistant stores memories silently and retrieves them when relevant, creating a seamless conversation experience.
134
+
135
+ ### Command Line Interface
136
+
137
+ #### Quick Commands
138
+
139
+ For common operations, use simple shortcuts:
140
+
141
+ ```bash
142
+ # Search memories
143
+ simple-memory search --query "typescript" --limit 5
144
+ simple-memory search --tags "project,work" --limit 20
145
+ simple-memory search --query "bug" --daysAgo 7
146
+ simple-memory search --query "api" --verbose # Shows generated GraphQL
147
+
148
+ # Store a memory
149
+ simple-memory store --content "Remember this note"
150
+ simple-memory store --content "API key: xyz" --tags "credentials,api"
151
+
152
+ # Update a memory
153
+ simple-memory update --hash "abc123..." --content "Updated content"
154
+
155
+ # Get specific memory
156
+ simple-memory get --hash "abc123..."
157
+
158
+ # Find related memories
159
+ simple-memory related --hash "abc123..." --limit 10
160
+
161
+ # Delete memories
162
+ simple-memory delete --hash "abc123..."
163
+ simple-memory delete --tag "temporary"
164
+
165
+ # Get database stats
166
+ simple-memory stats
167
+
168
+ # Export/import
169
+ simple-memory export-memory --output backup.json
170
+ simple-memory import-memory --input backup.json
171
+ ```
172
+
173
+ Run `simple-memory <command> --help` for command-specific options.
174
+
175
+ > 💡 **Learning GraphQL?** Use `--verbose` with any shortcut command to see the generated GraphQL query. Great for learning the syntax!
176
+
177
+ #### Advanced: Raw GraphQL
178
+
179
+ Power users can execute raw GraphQL queries:
180
+
181
+ ```bash
182
+ # Raw GraphQL query
183
+ simple-memory graphql --query '{ memories(query: "search term") { hash title tags } }'
184
+
185
+ # GraphQL mutation
186
+ simple-memory graphql --query 'mutation { store(content: "Your content") { hash } }'
187
+
188
+ # Batch multiple operations in one call
189
+ simple-memory graphql --query '{
190
+ recent: memories(limit: 5) { hash title }
191
+ tagged: memories(tags: ["important"]) { hash title }
192
+ stats { totalMemories }
193
+ }'
194
+ ```
195
+
196
+ ---
197
+
198
+ ## 🛠️ Available Tools
199
+
200
+ Simple Memory exposes **3 MCP tools** - a unified GraphQL interface plus import/export:
201
+
202
+ ### `memory-graphql`
203
+ **The primary tool** - handles all memory operations via GraphQL queries and mutations.
204
+
205
+ **🧠 Auto-Capture:** This tool includes behavioral guidance that encourages your AI assistant to:
206
+ - Proactively search memories at conversation start
207
+ - Store important information silently (preferences, decisions, facts)
208
+ - Use descriptive tags for easy retrieval
209
+ - Return only needed fields for efficiency
210
+
211
+ **Parameters:**
212
+ - `query` (string, required) - GraphQL query or mutation
213
+ - `variables` (object, optional) - Variables for parameterized queries
214
+
215
+ **Schema Overview:**
216
+ ```graphql
217
+ type Query {
218
+ memories(query: String, tags: [String], limit: Int, summaryOnly: Boolean): [Memory!]!
219
+ memory(hash: String!): Memory # Get full content by hash
220
+ related(hash: String!, limit: Int): [Memory!]!
221
+ stats: Stats!
222
+ }
223
+
224
+ type Mutation {
225
+ store(content: String!, tags: [String]): StoreResult!
226
+ update(hash: String!, content: String!, tags: [String]): UpdateResult!
227
+ delete(hash: String, tag: String): DeleteResult!
228
+ }
229
+
230
+ type Memory {
231
+ hash: String!
232
+ content: String!
233
+ title: String # First 100 chars
234
+ preview: String # First 200 chars
235
+ tags: [String!]!
236
+ createdAt: String!
237
+ relevance: Float # BM25 score (search only)
238
+ }
239
+ ```
240
+
241
+ **Example Queries:**
242
+ ```graphql
243
+ # Efficient search (summaries only)
244
+ { memories(query: "typescript", summaryOnly: true) { hash title tags } }
245
+
246
+ # Then get full content for specific memory
247
+ { memory(hash: "abc123...") { content tags createdAt } }
248
+
249
+ # Store with auto-generated hash
250
+ mutation { store(content: "Remember this", tags: ["note"]) { success hash } }
251
+
252
+ # Batch multiple operations
253
+ {
254
+ search: memories(query: "mcp", limit: 3) { hash title }
255
+ recent: memories(limit: 5) { hash createdAt }
256
+ stats { totalMemories }
257
+ }
258
+ ```
259
+
260
+ ### `export-memory`
261
+ Export memories to JSON file for backup or sharing.
262
+
263
+ **Parameters:**
264
+ - `output` (string, required) - Output file path
265
+ - `tags` (array, optional) - Filter by tags
266
+ - `daysAgo` (number, optional) - Export memories from last N days
267
+ - `startDate` / `endDate` (string, optional) - Date range filter
268
+ - `limit` (number, optional) - Maximum memories to export
269
+
270
+ ### `import-memory`
271
+ Import memories from JSON file.
272
+
273
+ **Parameters:**
274
+ - `input` (string, required) - Input file path
275
+ - `skipDuplicates` (boolean, optional) - Skip existing memories
276
+ - `preserveTimestamps` (boolean, optional) - Keep original dates
277
+ - `dryRun` (boolean, optional) - Preview without importing
278
+
279
+ ---
280
+
281
+ ## ⚙️ Configuration
282
+
283
+ ### Zero Config Default
284
+
285
+ Simple Memory works **out of the box** with no configuration needed:
286
+
287
+ ```
288
+ ~/.simple-memory/memory.db
289
+ ```
290
+
291
+ - **Windows**: `C:\Users\{username}\.simple-memory\memory.db`
292
+ - **macOS/Linux**: `/home/{username}/.simple-memory/memory.db`
293
+
294
+ Just add to your MCP config and start using it:
295
+
296
+ ```json
297
+ {
298
+ "mcpServers": {
299
+ "simple-memory": {
300
+ "command": "simple-memory"
301
+ }
302
+ }
303
+ }
304
+ ```
305
+
306
+ ### Environment Variables
307
+
308
+ | Variable | Description | Default | Example |
309
+ |----------|-------------|---------|---------|
310
+ | `MEMORY_DB` | Database file path | `~/.simple-memory/memory.db` | `/home/user/memories.db` |
311
+ | `MEMORY_BACKUP_PATH` | Backup directory (creates JSON exports) | None (disabled) | `/home/user/backups` |
312
+ | `MEMORY_BACKUP_INTERVAL` | Minutes between backups (0=every write) | `0` | `180` |
313
+ | `MEMORY_BACKUP_KEEP` | Number of JSON backups to keep | `10` | `24` |
314
+ | `MEMORY_BACKUP_SOURCE` | Source identifier in backups (optional) | hostname | `work` or `personal` |
315
+ | `MEMORY_CLOUD_SAFE` | Cloud storage safe mode | `false` | `true` |
316
+ | `MEMORY_DEBUG` | Enable debug logging in CLI mode | `false` | `true` |
317
+ | `DEBUG` | Enable debug logging (MCP server) | `false` | `true` |
318
+
319
+ ### Custom Database Location
320
+
321
+ For power users who want to control where the database is stored:
322
+
323
+ ```json
324
+ {
325
+ "mcpServers": {
326
+ "simple-memory": {
327
+ "command": "simple-memory",
328
+ "env": {
329
+ "MEMORY_DB": "/path/to/your/memory.db"
330
+ }
331
+ }
332
+ }
333
+ }
334
+ ```
335
+
336
+ ### With Automatic Backups
337
+
338
+ ```json
339
+ {
340
+ "mcpServers": {
341
+ "simple-memory": {
342
+ "command": "simple-memory",
343
+ "env": {
344
+ "MEMORY_DB": "/home/user/memory.db",
345
+ "MEMORY_BACKUP_PATH": "/home/user/OneDrive/MCP-Backups",
346
+ "MEMORY_BACKUP_INTERVAL": "180",
347
+ "MEMORY_BACKUP_KEEP": "24",
348
+ "MEMORY_BACKUP_SOURCE": "work"
349
+ }
350
+ }
351
+ }
352
+ }
353
+ ```
354
+
355
+ **💡 Backup Strategy:**
356
+ - **JSON export format** - Human-readable, portable backups
357
+ - **Lazy backups** - Only backs up after write operations
358
+ - **Throttled** - Won't backup again until interval passes
359
+ - **Automatic cleanup** - Keeps last N backups, deletes old ones
360
+ - **Efficient** - No wasted backups when idle
361
+
362
+ **Backup Files:** `smem_auto_2026-01-31_20-13-19.json` (includes all memories + metadata)
363
+
364
+ **To restore from backup:** Use `simple-memory import-memory --input backup.json`
365
+
366
+ **⚠️ Cloud Storage Best Practices:**
367
+ - ✅ **Recommended**: Store database locally, backup to cloud (as shown above)
368
+ - ⚠️ **Not Recommended**: Store database directly in OneDrive/Dropbox
369
+ - WAL mode creates 3 files that sync at different times → corruption risk
370
+ - File locking conflicts cause "database locked" errors
371
+ - 2-10x slower performance
372
+
373
+ **If you must store directly in cloud storage**, enable safe mode:
374
+ ```json
375
+ {
376
+ "env": {
377
+ "MEMORY_DB": "/path/to/OneDrive/memory.db",
378
+ "MEMORY_CLOUD_SAFE": "true"
379
+ }
380
+ }
381
+ ```
382
+ This uses DELETE journal mode instead of WAL (30-50% slower but safer).
383
+
384
+ ### Multiple Database Instances
385
+
386
+ Run multiple instances for different contexts:
387
+
388
+ ```json
389
+ {
390
+ "mcpServers": {
391
+ "memory-work": {
392
+ "command": "simple-memory",
393
+ "env": {
394
+ "MEMORY_DB": "/path/to/work-memory.db"
395
+ }
396
+ },
397
+ "memory-personal": {
398
+ "command": "simple-memory",
399
+ "env": {
400
+ "MEMORY_DB": "/path/to/personal-memory.db"
401
+ }
402
+ }
403
+ }
404
+ }
405
+ ```
406
+
407
+ ### HTTP Transport (Advanced)
408
+
409
+ For Docker deployments, remote servers, or avoiding local Node.js path issues, you can run Simple Memory as an HTTP server:
410
+
411
+ **1. Start the HTTP server:**
412
+ ```bash
413
+ # With default database (~/.simple-memory/memory.db)
414
+ simple-memory --http
415
+
416
+ # With custom database and port
417
+ MEMORY_DB=/path/to/memory.db MCP_PORT=3001 simple-memory --http
418
+ ```
419
+
420
+ **2. Configure your MCP client to use HTTP:**
421
+ ```json
422
+ {
423
+ "mcpServers": {
424
+ "simple-memory": {
425
+ "url": "http://localhost:3000/mcp"
426
+ }
427
+ }
428
+ }
429
+ ```
430
+
431
+ **When to use HTTP transport:**
432
+ - 🐳 Running in Docker or remote server
433
+ - 🖥️ Multiple MCP clients sharing one database
434
+ - 🔧 Avoiding Node.js path configuration issues
435
+ - 🌐 Exposing memory server to network (use with caution!)
436
+
437
+ **Note:** HTTP transport requires manually starting the server before using MCP clients. For most local setups, the default stdio transport is simpler.
438
+
439
+ ---
440
+
441
+ ## 🗄️ Database
442
+
443
+ ### Technology
444
+
445
+ - **SQLite** with WAL mode for better concurrency
446
+ - **FTS5** for lightning-fast full-text search
447
+ - **Normalized tags** with proper indexing (50-200x faster than LIKE queries)
448
+ - **Automatic relationships** between related memories
449
+
450
+ ### Schema Features
451
+
452
+ - ✅ Automatic migrations with data integrity guarantees
453
+ - ✅ Optimized indexes on all hot paths
454
+ - ✅ Prepared statements for all queries
455
+ - ✅ 64MB cache with memory-based temp storage
456
+ - ✅ Transaction-based bulk operations
457
+
458
+ ### Size Limits
459
+
460
+ - Maximum content size: 5MB per memory
461
+ - No limit on number of memories
462
+ - No limit on number of tags
463
+
464
+ ---
465
+
466
+ ## 🔧 Development
467
+
468
+ ### Setup
469
+
470
+ ```bash
471
+ # Clone the repository
472
+ git clone https://github.com/chrisribe/simple-memory-mcp.git
473
+ cd simple-memory-mcp
474
+
475
+ # Install dependencies
476
+ npm install
477
+
478
+ # Build
479
+ npm run build
480
+ ```
481
+
482
+ ### Commands
483
+
484
+ ```bash
485
+ # Development mode with hot reload
486
+ npm run dev
487
+
488
+ # Build TypeScript
489
+ npm run build
490
+
491
+ # Build with version bump (for releases)
492
+ npm run build:release
493
+
494
+ # Run tests
495
+ npm test # GraphQL tests (11 tests)
496
+ npm run test:perf # Performance tests (6 tests)
497
+ npm run test:migration # Migration tests (13 tests)
498
+
499
+ # Performance benchmarks
500
+ npm run benchmark
501
+
502
+ # Link/unlink globally for testing
503
+ npm run link # Build and link globally (makes 'simple-memory' command available)
504
+ npm run unlink # Remove global link
505
+
506
+ # Or manually
507
+ npm link # Link current directory globally
508
+ npm unlink -g # Unlink from global
509
+ simple-memory memory-graphql --query '{ stats { totalMemories } }' # Test the global command
510
+ ```
511
+
512
+ ### Versioning
513
+
514
+ The project uses automated version bumping:
515
+
516
+ - **Development builds**: Use `npm run build` (no version change)
517
+ - **Release builds**: Use `npm run build:release` (bumps patch version)
518
+ - **Manual version bumps**: Use `npm run version:patch|minor|major`
519
+ - **Automatic**: All commits/merges to `main` automatically bump the patch version via GitHub Actions
520
+
521
+ The workflow skips version bumps for:
522
+ - Documentation-only changes (`.md` files)
523
+ - Changes to `docs/` directory
524
+ - Commits containing `[skip-version]` in the message
525
+
526
+ ### Testing
527
+
528
+ The project has comprehensive test coverage:
529
+
530
+ - ✅ **GraphQL Tests** (11) - Full CRUD, batching, error handling via GraphQL API
531
+ - ✅ **Performance Tests** (6) - Large content, size limits, throughput
532
+ - ✅ **Migration Tests** (13) - Schema upgrades, rollback safety, data integrity
533
+ - ✅ **Benchmarks** - Detailed performance metrics with reproduction steps
534
+
535
+ ```bash
536
+ npm test # GraphQL comprehensive tests
537
+ npm run test:perf # Performance tests
538
+ npm run test:migration # Migration tests
539
+ npm run benchmark # Full benchmark suite (reproduce README numbers)
540
+ ```
541
+
542
+ All tests pass with 100% backward compatibility.
543
+
544
+ ---
545
+
546
+ ## 📝 Examples
547
+
548
+ ### Real-World Usage with AI Assistants
549
+
550
+ Simple Memory shines when used with AI assistants through MCP. Here are real conversation flows:
551
+
552
+ #### 🎯 Example 1: Building Project Context Over Time
553
+
554
+ **Day 1:**
555
+ > **You:** "I'm starting a new project. It's a React app with TypeScript, using Vite for bundling. We'll deploy to Vercel."
556
+ >
557
+ > **Assistant:** *Stores this with tags: `project`, `react`, `typescript`, `vite`, `vercel`*
558
+
559
+ **Day 3:**
560
+ > **You:** "What stack am I using for my project again?"
561
+ >
562
+ > **Assistant:** *Searches memories and finds: "You're using React with TypeScript, Vite for bundling, and deploying to Vercel."*
563
+
564
+ **Week 2:**
565
+ > **You:** "We decided to add Prisma ORM with PostgreSQL for the database."
566
+ >
567
+ > **Assistant:** *Stores this and auto-links to previous project memories*
568
+
569
+ **Week 4:**
570
+ > **You:** "Give me a summary of all my tech stack decisions."
571
+ >
572
+ > **Assistant:** *Retrieves all related memories and provides complete context*
573
+
574
+ #### 💡 Example 2: Personal Knowledge Base
575
+
576
+ **Learning Session:**
577
+ > **You:** "Remember this: TypeScript generics allow type-safe reusable components. The syntax is `function name<T>(arg: T): T`"
578
+ >
579
+ > **Assistant:** *Stores with tags: `typescript`, `generics`, `learning`*
580
+
581
+ > **You:** "Also note: Array.reduce() is perfect for transforming arrays into single values. Use it instead of forEach when accumulating."
582
+ >
583
+ > **Assistant:** *Stores with tags: `javascript`, `arrays`, `patterns`*
584
+
585
+ **Later that week:**
586
+ > **You:** "What did I learn about TypeScript generics?"
587
+ >
588
+ > **Assistant:** *Retrieves your note with the exact syntax example*
589
+
590
+ > **You:** "Show me all my JavaScript tips"
591
+ >
592
+ > **Assistant:** *Searches tag `javascript` and finds all related notes*
593
+
594
+ #### 🔐 Example 3: Secure Information Storage
595
+
596
+ **Storing Credentials:**
597
+ > **You:** "Store this API key for the payment gateway: sk_live_abc123xyz"
598
+ >
599
+ > **Assistant:** *Stores securely with tags: `api-key`, `payment`, `credentials`*
600
+
601
+ > **You:** "The database connection string is postgresql://user:pass@host:5432/db"
602
+ >
603
+ > **Assistant:** *Stores with tags: `credentials`, `database`, `connection-string`*
604
+
605
+ **Retrieval:**
606
+ > **You:** "What's my payment gateway API key?"
607
+ >
608
+ > **Assistant:** *Searches memories: "Your payment gateway API key is sk_live_abc123xyz"*
609
+
610
+ > **You:** "Show me all my stored credentials"
611
+ >
612
+ > **Assistant:** *Lists all memories tagged with `credentials`*
613
+
614
+ #### 📋 Example 4: Meeting Notes & Decisions
615
+
616
+ **After Team Meeting:**
617
+ > **You:** "Meeting notes: Team agreed on 2-week sprints starting Monday. Sprint planning on Mondays at 10am. Retrospectives on Fridays."
618
+ >
619
+ > **Assistant:** *Stores with tags: `meeting`, `agile`, `team`, `schedule`*
620
+
621
+ > **You:** "Important decision: We're going with PostgreSQL instead of MongoDB for better transaction support."
622
+ >
623
+ > **Assistant:** *Stores with tags: `decision`, `database`, `architecture`*
624
+
625
+ **Later:**
626
+ > **You:** "When are our sprint meetings?"
627
+ >
628
+ > **Assistant:** *Retrieves schedule from meeting notes*
629
+
630
+ > **You:** "Why did we choose PostgreSQL?"
631
+ >
632
+ > **Assistant:** *Finds decision and reasoning: "For better transaction support"*
633
+
634
+ #### 🚀 Example 5: Continuous Context Building
635
+
636
+ The real power comes from **persistent memory across all conversations**:
637
+
638
+ ```
639
+ Session 1: Store project setup info
640
+
641
+ Session 2: Assistant remembers and builds on it
642
+
643
+ Session 5: Store API decisions
644
+
645
+ Session 10: Assistant recalls everything - full context maintained
646
+
647
+ Session 20: Complete project knowledge base available instantly
648
+ ```
649
+
650
+ **This is impossible with standard chat sessions that lose context!**
651
+
652
+ ---
653
+
654
+ ### 🔧 CLI Usage (For Testing & Direct Access)
655
+
656
+ You can also use the CLI directly for testing or scripting:
657
+
658
+ ```bash
659
+ # Store a memory
660
+ simple-memory memory-graphql --query 'mutation {
661
+ store(content: "PostgreSQL connection: postgresql://localhost:5432/mydb", tags: ["database", "credentials"])
662
+ { hash }
663
+ }'
664
+
665
+ # Search by content
666
+ simple-memory memory-graphql --query '{ memories(query: "PostgreSQL") { hash title tags } }'
667
+
668
+ # Search by tags
669
+ simple-memory memory-graphql --query '{ memories(tags: ["credentials"]) { hash content } }'
670
+
671
+ # View statistics
672
+ simple-memory memory-graphql --query '{ stats { totalMemories totalRelationships dbSize } }'
673
+
674
+ # Delete memories by tag
675
+ simple-memory memory-graphql --query 'mutation { delete(tag: "temporary") { deletedCount } }'
676
+ ```
677
+
678
+ **When to use CLI:**
679
+ - ✅ Testing the MCP server works
680
+ - ✅ Bulk operations or scripting
681
+ - ✅ Debugging or inspecting the database
682
+ - ✅ Manual backup before major changes
683
+
684
+ **Primary use case:** Let your AI assistant handle everything through natural conversation!
685
+
686
+ ---
687
+
688
+ ## 🤝 Contributing
689
+
690
+ Contributions are welcome! Please feel free to submit a Pull Request.
691
+
692
+ 1. Fork the repository
693
+ 2. Create your feature branch (`git checkout -b feature/amazing-feature`)
694
+ 3. Commit your changes (`git commit -m 'Add amazing feature'`)
695
+ 4. Push to the branch (`git push origin feature/amazing-feature`)
696
+ 5. Open a Pull Request
697
+
698
+ ---
699
+
700
+ ## 📄 License
701
+
702
+ This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
703
+
704
+ ---
705
+
706
+ ## 🙏 Acknowledgments
707
+
708
+ - Built with the [Model Context Protocol SDK](https://github.com/modelcontextprotocol/typescript-sdk)
709
+ - Powered by [SQLite](https://www.sqlite.org/) and [better-sqlite3](https://github.com/WiseLibs/better-sqlite3)
710
+
711
+ ---
712
+
713
+ ## 📚 Additional Resources
714
+
715
+ ### For Users
716
+ - 🏗️ [Design Philosophy](docs/DESIGN_PHILOSOPHY.md) - Why Simple Memory is built this way, trade-offs, and honest limitations
717
+ - 🚀 [Performance Benchmarks](docs/PERFORMANCE.md) - Detailed performance analysis and optimization insights
718
+ - 📝 [Changelog](CHANGELOG.md) - Version history and changes
719
+
720
+ ### For Package Maintainers
721
+ - 📦 [NPM Publishing Guide](docs/NPM_PUBLISHING.md) - Publishing steps, automation options, and maintenance tips
722
+
723
+ ---
724
+
725
+ ## 🐛 Issues & Support
726
+
727
+ Found a bug or have a feature request?
728
+
729
+ - 🐛 [Report Issues](https://github.com/chrisribe/simple-memory-mcp/issues)
730
+ - 💬 [Start a Discussion](https://github.com/chrisribe/simple-memory-mcp/discussions)
731
+ - 📧 Check the [documentation](https://github.com/chrisribe/simple-memory-mcp)
732
+
733
+ ---
734
+
735
+ <div align="center">
736
+
737
+ **[⬆ back to top](#-simple-memory-mcp-server)**
738
+
739
+ Made with ❤️ by [chrisribe](https://github.com/chrisribe)
740
+
741
+ </div>
742
+