memory-journal-mcp 3.0.0

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 (107) hide show
  1. package/.dockerignore +88 -0
  2. package/.github/ISSUE_TEMPLATE/bug_report.md +76 -0
  3. package/.github/ISSUE_TEMPLATE/config.yml +11 -0
  4. package/.github/ISSUE_TEMPLATE/feature_request.md +89 -0
  5. package/.github/ISSUE_TEMPLATE/question.md +63 -0
  6. package/.github/dependabot.yml +110 -0
  7. package/.github/pull_request_template.md +110 -0
  8. package/.github/workflows/DOCKER_DEPLOYMENT_SETUP.md +346 -0
  9. package/.github/workflows/codeql.yml +45 -0
  10. package/.github/workflows/dependabot-auto-merge.yml +42 -0
  11. package/.github/workflows/docker-publish.yml +277 -0
  12. package/.github/workflows/lint-and-test.yml +58 -0
  13. package/.github/workflows/publish-npm.yml +75 -0
  14. package/.github/workflows/secrets-scanning.yml +32 -0
  15. package/.github/workflows/security-update.yml +99 -0
  16. package/.memory-journal-team.db +0 -0
  17. package/.trivyignore +18 -0
  18. package/CHANGELOG.md +19 -0
  19. package/CODE_OF_CONDUCT.md +128 -0
  20. package/CONTRIBUTING.md +209 -0
  21. package/DOCKER_README.md +377 -0
  22. package/Dockerfile +64 -0
  23. package/LICENSE +21 -0
  24. package/README.md +461 -0
  25. package/SECURITY.md +200 -0
  26. package/VERSION +1 -0
  27. package/dist/cli.d.ts +5 -0
  28. package/dist/cli.d.ts.map +1 -0
  29. package/dist/cli.js +42 -0
  30. package/dist/cli.js.map +1 -0
  31. package/dist/constants/ServerInstructions.d.ts +8 -0
  32. package/dist/constants/ServerInstructions.d.ts.map +1 -0
  33. package/dist/constants/ServerInstructions.js +26 -0
  34. package/dist/constants/ServerInstructions.js.map +1 -0
  35. package/dist/database/SqliteAdapter.d.ts +198 -0
  36. package/dist/database/SqliteAdapter.d.ts.map +1 -0
  37. package/dist/database/SqliteAdapter.js +736 -0
  38. package/dist/database/SqliteAdapter.js.map +1 -0
  39. package/dist/filtering/ToolFilter.d.ts +63 -0
  40. package/dist/filtering/ToolFilter.d.ts.map +1 -0
  41. package/dist/filtering/ToolFilter.js +242 -0
  42. package/dist/filtering/ToolFilter.js.map +1 -0
  43. package/dist/github/GitHubIntegration.d.ts +91 -0
  44. package/dist/github/GitHubIntegration.d.ts.map +1 -0
  45. package/dist/github/GitHubIntegration.js +317 -0
  46. package/dist/github/GitHubIntegration.js.map +1 -0
  47. package/dist/handlers/prompts/index.d.ts +28 -0
  48. package/dist/handlers/prompts/index.d.ts.map +1 -0
  49. package/dist/handlers/prompts/index.js +366 -0
  50. package/dist/handlers/prompts/index.js.map +1 -0
  51. package/dist/handlers/resources/index.d.ts +27 -0
  52. package/dist/handlers/resources/index.d.ts.map +1 -0
  53. package/dist/handlers/resources/index.js +453 -0
  54. package/dist/handlers/resources/index.js.map +1 -0
  55. package/dist/handlers/tools/index.d.ts +26 -0
  56. package/dist/handlers/tools/index.d.ts.map +1 -0
  57. package/dist/handlers/tools/index.js +982 -0
  58. package/dist/handlers/tools/index.js.map +1 -0
  59. package/dist/index.d.ts +11 -0
  60. package/dist/index.d.ts.map +1 -0
  61. package/dist/index.js +13 -0
  62. package/dist/index.js.map +1 -0
  63. package/dist/server/McpServer.d.ts +18 -0
  64. package/dist/server/McpServer.d.ts.map +1 -0
  65. package/dist/server/McpServer.js +171 -0
  66. package/dist/server/McpServer.js.map +1 -0
  67. package/dist/types/index.d.ts +300 -0
  68. package/dist/types/index.d.ts.map +1 -0
  69. package/dist/types/index.js +15 -0
  70. package/dist/types/index.js.map +1 -0
  71. package/dist/utils/McpLogger.d.ts +61 -0
  72. package/dist/utils/McpLogger.d.ts.map +1 -0
  73. package/dist/utils/McpLogger.js +113 -0
  74. package/dist/utils/McpLogger.js.map +1 -0
  75. package/dist/utils/logger.d.ts +30 -0
  76. package/dist/utils/logger.d.ts.map +1 -0
  77. package/dist/utils/logger.js +70 -0
  78. package/dist/utils/logger.js.map +1 -0
  79. package/dist/vector/VectorSearchManager.d.ts +63 -0
  80. package/dist/vector/VectorSearchManager.d.ts.map +1 -0
  81. package/dist/vector/VectorSearchManager.js +235 -0
  82. package/dist/vector/VectorSearchManager.js.map +1 -0
  83. package/docker-compose.yml +37 -0
  84. package/eslint.config.js +86 -0
  85. package/mcp-config-example.json +21 -0
  86. package/package.json +71 -0
  87. package/releases/release-notes-v2.2.0.md +165 -0
  88. package/releases/release-notes.md +214 -0
  89. package/releases/v3.0.0.md +236 -0
  90. package/server.json +42 -0
  91. package/src/cli.ts +52 -0
  92. package/src/constants/ServerInstructions.ts +25 -0
  93. package/src/database/SqliteAdapter.ts +952 -0
  94. package/src/filtering/ToolFilter.ts +271 -0
  95. package/src/github/GitHubIntegration.ts +409 -0
  96. package/src/handlers/prompts/index.ts +420 -0
  97. package/src/handlers/resources/index.ts +529 -0
  98. package/src/handlers/tools/index.ts +1081 -0
  99. package/src/index.ts +53 -0
  100. package/src/server/McpServer.ts +230 -0
  101. package/src/types/index.ts +435 -0
  102. package/src/types/sql.js.d.ts +34 -0
  103. package/src/utils/McpLogger.ts +155 -0
  104. package/src/utils/logger.ts +98 -0
  105. package/src/vector/VectorSearchManager.ts +277 -0
  106. package/tools.json +300 -0
  107. package/tsconfig.json +51 -0
package/README.md ADDED
@@ -0,0 +1,461 @@
1
+ # Memory Journal MCP Server
2
+
3
+ Last Updated December 28, 2025 - v3.0.0
4
+
5
+ <!-- mcp-name: io.github.neverinfamous/memory-journal-mcp -->
6
+
7
+ [![GitHub](https://img.shields.io/badge/GitHub-neverinfamous/memory--journal--mcp-blue?logo=github)](https://github.com/neverinfamous/memory-journal-mcp)
8
+ [![npm](https://img.shields.io/npm/v/memory-journal-mcp)](https://www.npmjs.com/package/memory-journal-mcp)
9
+ [![Docker Pulls](https://img.shields.io/docker/pulls/writenotenow/memory-journal-mcp)](https://hub.docker.com/r/writenotenow/memory-journal-mcp)
10
+ [![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](https://opensource.org/licenses/MIT)
11
+ ![Version](https://img.shields.io/badge/version-v3.0.0-green)
12
+ ![Status](https://img.shields.io/badge/status-Production%2FStable-brightgreen)
13
+ [![MCP Registry](https://img.shields.io/badge/MCP_Registry-Published-green)](https://registry.modelcontextprotocol.io/v0/servers?search=io.github.neverinfamous/memory-journal-mcp)
14
+ [![Security](https://img.shields.io/badge/Security-Enhanced-green.svg)](SECURITY.md)
15
+ [![TypeScript](https://img.shields.io/badge/TypeScript-Strict-blue.svg)](https://github.com/neverinfamous/memory-journal-mcp)
16
+
17
+ *Project context management for AI-assisted development - Bridge the gap between fragmented AI threads with persistent knowledge graphs and intelligent context recall*
18
+
19
+ **🎯 Solve the AI Context Problem:** When working with AI across multiple threads and sessions, context is lost. Memory Journal maintains a persistent, searchable record of your project work, decisions, and progress - making every AI conversation informed by your complete project history.
20
+
21
+ **[GitHub](https://github.com/neverinfamous/memory-journal-mcp)** • **[Wiki](https://github.com/neverinfamous/memory-journal-mcp/wiki)** • **[Changelog](https://github.com/neverinfamous/memory-journal-mcp/wiki/CHANGELOG)** • **[Release Article](https://adamic.tech/articles/memory-journal-mcp-server)**
22
+
23
+ **🚀 Quick Deploy:**
24
+ - **[npm Package](https://www.npmjs.com/package/memory-journal-mcp)** - `npm install -g memory-journal-mcp`
25
+ - **[Docker Hub](https://hub.docker.com/r/writenotenow/memory-journal-mcp)** - Alpine-based with full semantic search
26
+
27
+ ---
28
+
29
+ ## ✨ What's New in v3.0.0 (December 28, 2025)
30
+
31
+ ### 🚀 **Complete TypeScript Rewrite**
32
+
33
+ Memory Journal v3.0 is a ground-up rewrite in TypeScript, delivering:
34
+
35
+ - **Pure JS Stack** - No native compilation required (`sql.js` + `vectra` + `@xenova/transformers`)
36
+ - **Cross-Platform Portability** - Works on Windows, macOS, Linux without binary dependencies
37
+ - **Strict Type Safety** - Zero TypeScript errors, 100% strict mode compliance
38
+ - **Faster Startup** - Lazy ML loading with instant cold starts
39
+ - **MCP 2025-11-25 Compliance** - Full spec compliance with behavioral annotations
40
+
41
+ ### 🗄️ **New: Backup & Restore Tools**
42
+
43
+ Never lose your journal data again:
44
+
45
+ | Tool | Description |
46
+ |------|-------------|
47
+ | `backup_journal` | Create timestamped database backups |
48
+ | `list_backups` | List all available backup files |
49
+ | `restore_backup` | Restore from any backup (with auto-backup before restore) |
50
+
51
+ ```javascript
52
+ // Create a backup before major changes
53
+ backup_journal({ name: "before_migration" })
54
+ // → { success: true, filename: "before_migration.db", sizeBytes: 524288 }
55
+
56
+ // List available backups
57
+ list_backups()
58
+ // → { backups: [...], total: 3, backupsDirectory: "~/.memory-journal/backups" }
59
+
60
+ // Restore from backup (requires confirmation)
61
+ restore_backup({ filename: "before_migration.db", confirm: true })
62
+ // → { success: true, previousEntryCount: 50, newEntryCount: 42 }
63
+ ```
64
+
65
+ ### 📊 **New: Server Health Resource**
66
+
67
+ Get comprehensive server diagnostics via `memory://health`:
68
+
69
+ ```json
70
+ {
71
+ "database": {
72
+ "path": "~/.memory-journal/memory_journal.db",
73
+ "sizeBytes": 524288,
74
+ "entryCount": 150,
75
+ "deletedEntryCount": 5,
76
+ "relationshipCount": 42,
77
+ "tagCount": 28
78
+ },
79
+ "backups": {
80
+ "directory": "~/.memory-journal/backups",
81
+ "count": 3,
82
+ "lastBackup": { "filename": "...", "createdAt": "...", "sizeBytes": 524288 }
83
+ },
84
+ "vectorIndex": {
85
+ "available": true,
86
+ "indexedEntries": 150,
87
+ "modelName": "all-MiniLM-L6-v2"
88
+ },
89
+ "toolFilter": {
90
+ "active": false,
91
+ "enabledCount": 27,
92
+ "totalCount": 27
93
+ },
94
+ "timestamp": "2025-12-28T05:47:00Z"
95
+ }
96
+ ```
97
+
98
+ ### 📈 **Current Capabilities**
99
+
100
+ - **27 MCP tools** - Complete development workflow + backup/restore
101
+ - **14 workflow prompts** - Standups, retrospectives, PR workflows, CI/CD failure analysis
102
+ - **14 MCP resources** - Including new `memory://health` diagnostics
103
+ - **GitHub Integration** - Projects, Issues, Pull Requests, Actions with auto-linking
104
+ - **8 tool groups** - `core`, `search`, `analytics`, `relationships`, `export`, `admin`, `github`, `backup`
105
+ - **Knowledge graphs** - 5 relationship types, Mermaid visualization
106
+ - **Semantic search** - AI-powered conceptual search via `@xenova/transformers`
107
+
108
+ ---
109
+
110
+ ## 🎯 Why Memory Journal?
111
+
112
+ ### **The Fragmented AI Context Problem**
113
+
114
+ When managing large projects with AI assistance, you face a critical challenge:
115
+
116
+ - **Thread Amnesia** - Each new AI conversation starts from zero, unaware of previous work
117
+ - **Lost Context** - Decisions, implementations, and learnings scattered across disconnected threads
118
+ - **Repeated Work** - AI suggests solutions you've already tried or abandoned
119
+ - **Context Overload** - Manually copying project history into every new conversation
120
+
121
+ ### **The Solution: Persistent Project Memory**
122
+
123
+ Memory Journal acts as your project's **long-term memory**, bridging the gap between fragmented AI threads:
124
+
125
+ **For Developers:**
126
+ - 📝 **Automatic Context Capture** - Git commits, branches, GitHub issues, PRs, and project state captured with every entry
127
+ - 🔗 **Knowledge Graph** - Link related work (specs → implementations → tests → PRs) to build a connected history
128
+ - 🔍 **Intelligent Search** - Find past decisions, solutions, and context across your entire project timeline
129
+ - 📊 **Project Analytics** - Track progress from issues through PRs, generate reports for standups/retrospectives
130
+
131
+ **For AI-Assisted Work:**
132
+ - 💡 AI can query your **complete project history** in any conversation
133
+ - 🧠 **Semantic search** finds conceptually related work, even without exact keywords
134
+ - 📖 **Context bundles** provide AI with comprehensive project state instantly
135
+ - 🔗 **Relationship visualization** shows how different pieces of work connect
136
+
137
+ ---
138
+
139
+ ## 🚀 Quick Start
140
+
141
+ ### Option 1: npm (Recommended)
142
+
143
+ **Step 1: Install the package**
144
+
145
+ ```bash
146
+ npm install -g memory-journal-mcp
147
+ ```
148
+
149
+ **Step 2: Add to ~/.cursor/mcp.json**
150
+
151
+ ```json
152
+ {
153
+ "mcpServers": {
154
+ "memory-journal-mcp": {
155
+ "command": "memory-journal-mcp"
156
+ }
157
+ }
158
+ }
159
+ ```
160
+
161
+ **Step 3: Restart Cursor**
162
+
163
+ Restart Cursor or your MCP client, then start journaling!
164
+
165
+ ### Option 2: npx (No Installation)
166
+
167
+ ```json
168
+ {
169
+ "mcpServers": {
170
+ "memory-journal-mcp": {
171
+ "command": "npx",
172
+ "args": ["-y", "memory-journal-mcp"]
173
+ }
174
+ }
175
+ }
176
+ ```
177
+
178
+ ### Option 3: From Source
179
+
180
+ ```bash
181
+ git clone https://github.com/neverinfamous/memory-journal-mcp.git
182
+ cd memory-journal-mcp
183
+ npm install
184
+ npm run build
185
+ ```
186
+
187
+ ```json
188
+ {
189
+ "mcpServers": {
190
+ "memory-journal-mcp": {
191
+ "command": "node",
192
+ "args": ["dist/cli.js"]
193
+ }
194
+ }
195
+ }
196
+ ```
197
+
198
+ ### GitHub Integration Configuration
199
+
200
+ The GitHub tools (`get_github_issues`, `get_github_prs`, etc.) can auto-detect the repository from your git context. However, MCP clients may run the server from a different directory than your project.
201
+
202
+ **To enable GitHub auto-detection**, add `GITHUB_REPO_PATH` to your config:
203
+
204
+ ```json
205
+ {
206
+ "mcpServers": {
207
+ "memory-journal-mcp": {
208
+ "command": "memory-journal-mcp",
209
+ "env": {
210
+ "GITHUB_TOKEN": "ghp_your_token_here",
211
+ "GITHUB_REPO_PATH": "/path/to/your/git/repo"
212
+ }
213
+ }
214
+ }
215
+ }
216
+ ```
217
+
218
+ | Environment Variable | Description |
219
+ |---------------------|-------------|
220
+ | `GITHUB_TOKEN` | GitHub personal access token for API access |
221
+ | `GITHUB_REPO_PATH` | Path to the git repository for auto-detecting owner/repo |
222
+
223
+ **Without `GITHUB_REPO_PATH`**: You'll need to explicitly provide `owner` and `repo` parameters when calling GitHub tools.
224
+
225
+ ### Cursor Known Issues
226
+
227
+ **Listing MCP Resources**: If the agent has trouble listing resources, instruct it to call `list_mcp_resources()` without specifying a server parameter. Using `server="memory-journal-mcp"` may return nothing (Cursor bug).
228
+
229
+ ---
230
+
231
+ ## 📋 Core Capabilities
232
+
233
+ ### 🛠️ **27 MCP Tools** (8 Groups)
234
+
235
+ | Group | Tools | Description |
236
+ |-------|-------|-------------|
237
+ | `core` | 6 | Entry CRUD, tags, test |
238
+ | `search` | 4 | Text search, date range, semantic, vector stats |
239
+ | `analytics` | 2 | Statistics, cross-project insights |
240
+ | `relationships` | 2 | Link entries, visualize graphs |
241
+ | `export` | 1 | JSON/Markdown export |
242
+ | `admin` | 4 | Update, delete, rebuild/add to vector index |
243
+ | `github` | 5 | Issues, PRs, context integration |
244
+ | `backup` | 3 | **NEW** Backup, list, restore |
245
+
246
+ **[Complete tools reference →](https://github.com/neverinfamous/memory-journal-mcp/wiki/Tools)**
247
+
248
+ ### 🎯 **14 Workflow Prompts**
249
+
250
+ - `find-related` - Discover connected entries via semantic similarity
251
+ - `prepare-standup` - Daily standup summaries
252
+ - `prepare-retro` - Sprint retrospectives
253
+ - `weekly-digest` - Day-by-day weekly summaries
254
+ - `analyze-period` - Deep period analysis with insights
255
+ - `goal-tracker` - Milestone and achievement tracking
256
+ - `get-context-bundle` - Project context with Git/GitHub
257
+ - `pr-summary` - Pull request journal activity summary
258
+ - `code-review-prep` - Comprehensive PR review preparation
259
+ - `pr-retrospective` - Completed PR analysis with learnings
260
+ - `actions-failure-digest` - CI/CD failure analysis
261
+
262
+ **[Complete prompts guide →](https://github.com/neverinfamous/memory-journal-mcp/wiki/Prompts)**
263
+
264
+ ### 📡 **14 Resources**
265
+
266
+ - `memory://recent` - 10 most recent entries
267
+ - `memory://significant` - Significant milestones and breakthroughs
268
+ - `memory://graph/recent` - Live Mermaid diagram of recent relationships
269
+ - `memory://team/recent` - Recent team-shared entries
270
+ - `memory://health` - **NEW** Server health & diagnostics
271
+ - `memory://projects/{number}/timeline` - Project activity timeline
272
+ - `memory://issues/{issue_number}/entries` - Entries linked to issue
273
+ - `memory://prs/{pr_number}/entries` - Entries linked to PR
274
+ - `memory://prs/{pr_number}/timeline` - Combined PR + journal timeline
275
+ - `memory://graph/actions` - CI/CD narrative graph
276
+ - `memory://actions/recent` - Recent workflow runs
277
+ - `memory://tags` - All tags with usage counts
278
+ - `memory://statistics` - Journal statistics
279
+
280
+ ---
281
+
282
+ ## 🔧 Configuration
283
+
284
+ ### GitHub Integration (Optional)
285
+
286
+ ```bash
287
+ export GITHUB_TOKEN="your_token" # For Projects/Issues/PRs
288
+ export GITHUB_ORG_TOKEN="your_org_token" # Optional: org projects
289
+ export DEFAULT_ORG="your-org-name" # Optional: default org
290
+ ```
291
+
292
+ **Scopes:** `repo`, `project`, `read:org` (org only)
293
+
294
+ ### Tool Filtering (Optional)
295
+
296
+ Control which tools are exposed using `MEMORY_JOURNAL_MCP_TOOL_FILTER`:
297
+
298
+ ```bash
299
+ export MEMORY_JOURNAL_MCP_TOOL_FILTER="-analytics,-github"
300
+ ```
301
+
302
+ **Filter Syntax:**
303
+ - `-group` - Disable all tools in a group
304
+ - `-tool` - Disable a specific tool
305
+ - `+tool` - Re-enable after group disable
306
+ - Meta-groups: `starter`, `essential`, `full`, `readonly`
307
+
308
+ **Example Configurations:**
309
+
310
+ ```json
311
+ {
312
+ "mcpServers": {
313
+ "memory-journal-mcp": {
314
+ "command": "memory-journal-mcp",
315
+ "env": {
316
+ "MEMORY_JOURNAL_MCP_TOOL_FILTER": "starter",
317
+ "GITHUB_TOKEN": "your_token"
318
+ }
319
+ }
320
+ }
321
+ }
322
+ ```
323
+
324
+ | Configuration | Filter String | Tools |
325
+ |---------------|---------------|-------|
326
+ | Starter | `starter` | ~10 |
327
+ | Essential | `essential` | ~6 |
328
+ | Full (default) | `full` | 27 |
329
+ | Read-only | `readonly` | ~20 |
330
+
331
+ **[Complete tool filtering guide →](https://github.com/neverinfamous/memory-journal-mcp/wiki/Tool-Filtering)**
332
+
333
+ ---
334
+
335
+ ## 📖 Usage Examples
336
+
337
+ ### Create an Entry with GitHub Context
338
+
339
+ ```javascript
340
+ create_entry({
341
+ content: "Completed Phase 1 of GitHub Projects integration!",
342
+ entry_type: "technical_achievement",
343
+ tags: ["github-projects", "milestone"],
344
+ project_number: 1,
345
+ significance_type: "technical_breakthrough"
346
+ })
347
+ ```
348
+
349
+ ### Create and Manage Backups
350
+
351
+ ```javascript
352
+ // Before major refactoring
353
+ backup_journal({ name: "pre_refactor" })
354
+
355
+ // Check available backups
356
+ list_backups()
357
+
358
+ // Restore if needed (creates auto-backup first)
359
+ restore_backup({ filename: "pre_refactor.db", confirm: true })
360
+ ```
361
+
362
+ ### Check Server Health
363
+
364
+ ```javascript
365
+ // Fetch the health resource
366
+ // Returns: database stats, backup info, vector index status, tool filter config
367
+ ```
368
+
369
+ ### Search and Analyze
370
+
371
+ ```javascript
372
+ // Full-text search
373
+ search_entries({ query: "performance optimization", limit: 5 })
374
+
375
+ // Semantic search for concepts
376
+ semantic_search({ query: "startup time improvements", limit: 3 })
377
+
378
+ // Get analytics
379
+ get_statistics({ group_by: "week" })
380
+ ```
381
+
382
+ ### Generate Visual Maps
383
+
384
+ ```javascript
385
+ // Visualize entry relationships
386
+ visualize_relationships({
387
+ entry_id: 55,
388
+ depth: 2
389
+ })
390
+ ```
391
+
392
+ ---
393
+
394
+ ## 🏗️ Architecture
395
+
396
+ ```
397
+ ┌─────────────────────────────────────────────────────────────┐
398
+ │ MCP Server Layer (TypeScript) │
399
+ │ ┌─────────────────┐ ┌─────────────────┐ ┌─────────────┐ │
400
+ │ │ Tools (27) │ │ Resources (14) │ │ Prompts (14)│ │
401
+ │ │ with Annotations│ │ with Annotations│ │ │ │
402
+ │ └─────────────────┘ └─────────────────┘ └─────────────┘ │
403
+ ├─────────────────────────────────────────────────────────────┤
404
+ │ Pure JS Stack (No Native Dependencies) │
405
+ │ ┌─────────────────┐ ┌─────────────────┐ ┌─────────────┐ │
406
+ │ │ sql.js │ │ vectra │ │ transformers│ │
407
+ │ │ (SQLite) │ │ (Vector Index) │ │ (Embeddings)│ │
408
+ │ └─────────────────┘ └─────────────────┘ └─────────────┘ │
409
+ ├─────────────────────────────────────────────────────────────┤
410
+ │ SQLite Database with Hybrid Search │
411
+ │ ┌─────────────────────────────────────────────────────────┐│
412
+ │ │ entries + tags + relationships + embeddings + backups ││
413
+ │ └─────────────────────────────────────────────────────────┘│
414
+ └─────────────────────────────────────────────────────────────┘
415
+ ```
416
+
417
+ ---
418
+
419
+ ## 🔧 Technical Highlights
420
+
421
+ ### Performance & Portability
422
+ - **TypeScript + Pure JS Stack** - No native compilation, works everywhere
423
+ - **sql.js** - SQLite in pure JavaScript with disk sync
424
+ - **vectra** - Vector similarity search without native dependencies
425
+ - **@xenova/transformers** - ML embeddings in JavaScript
426
+ - **Lazy loading** - ML models load on first use, not startup
427
+
428
+ ### Security
429
+ - **Local-first** - All data stored locally, no external API calls (except optional GitHub)
430
+ - **Input validation** - Zod schemas, content size limits, SQL injection prevention
431
+ - **Path traversal protection** - Backup filenames validated
432
+ - **MCP 2025-11-25 annotations** - Behavioral hints (`readOnlyHint`, `destructiveHint`, etc.)
433
+
434
+ ### Data & Privacy
435
+ - **Single SQLite file** - You own your data
436
+ - **Portable** - Move your `.db` file anywhere
437
+ - **Soft delete** - Entries can be recovered
438
+ - **Auto-backup on restore** - Never lose data accidentally
439
+
440
+ ---
441
+
442
+ ## 📚 Documentation & Resources
443
+
444
+ - **[GitHub Wiki](https://github.com/neverinfamous/memory-journal-mcp/wiki)** - Complete documentation
445
+ - **[Docker Hub](https://hub.docker.com/r/writenotenow/memory-journal-mcp)** - Container images
446
+ - **[npm Package](https://www.npmjs.com/package/memory-journal-mcp)** - Node.js distribution
447
+ - **[Issues](https://github.com/neverinfamous/memory-journal-mcp/issues)** - Bug reports & feature requests
448
+
449
+ ---
450
+
451
+ ## 📄 License
452
+
453
+ MIT License - See [LICENSE](LICENSE) file for details.
454
+
455
+ ## 🤝 Contributing
456
+
457
+ Built by developers, for developers. PRs welcome! See [CONTRIBUTING.md](CONTRIBUTING.md) for guidelines.
458
+
459
+ ---
460
+
461
+ *Migrating from v2.x?* Your existing database is fully compatible. The TypeScript version uses the same schema and data format.
package/SECURITY.md ADDED
@@ -0,0 +1,200 @@
1
+ # 🔒 Security Guide
2
+
3
+ The Memory Journal MCP server implements comprehensive security measures to protect your personal journal data.
4
+
5
+ ## 🛡️ **Database Security**
6
+
7
+ ### **WAL Mode Enabled**
8
+ - ✅ **Write-Ahead Logging (WAL)** enabled for better concurrency and crash recovery
9
+ - ✅ **Atomic transactions** ensure data consistency
10
+ - ✅ **Better performance** with concurrent read/write operations
11
+
12
+ ### **Optimized PRAGMA Settings**
13
+ ```sql
14
+ PRAGMA foreign_keys = ON -- Enforce referential integrity
15
+ PRAGMA journal_mode = WAL -- Enable WAL mode
16
+ PRAGMA synchronous = NORMAL -- Balance safety and performance
17
+ PRAGMA cache_size = -64000 -- 64MB cache for better performance
18
+ PRAGMA mmap_size = 268435456 -- 256MB memory-mapped I/O
19
+ PRAGMA temp_store = MEMORY -- Store temp tables in memory
20
+ PRAGMA busy_timeout = 30000 -- 30-second timeout for busy database
21
+ ```
22
+
23
+ ### **File Permissions**
24
+ - ✅ **Database files**: `600` (read/write for owner only)
25
+ - ✅ **Data directory**: `700` (full access for owner only)
26
+ - ✅ **Automatic permission setting** on database creation
27
+
28
+ ## 🔐 **Input Validation**
29
+
30
+ ### **Content Limits**
31
+ - **Journal entries**: 50,000 characters maximum
32
+ - **Tags**: 100 characters maximum
33
+ - **Entry types**: 50 characters maximum
34
+ - **Significance types**: 50 characters maximum
35
+
36
+ ### **Character Filtering**
37
+ Dangerous characters are blocked in tags:
38
+ - `<` `>` `"` `'` `&` `\x00`
39
+
40
+ ### **SQL Injection Prevention**
41
+ - ✅ **Parameterized queries** used throughout
42
+ - ✅ **Input validation** before database operations
43
+ - ✅ **Warning system** for potentially dangerous content patterns
44
+
45
+ ## 🐳 **Docker Security**
46
+
47
+ ### **Non-Root User**
48
+ - ✅ **Dedicated user**: `appuser` with minimal privileges
49
+ - ✅ **No shell access**: `/bin/false` shell for security
50
+ - ✅ **Restricted home directory**: `/app/user`
51
+
52
+ ### **File System Security**
53
+ - ✅ **Minimal base image**: `python:3.11-slim`
54
+ - ✅ **Restricted data directory**: `700` permissions
55
+ - ✅ **Volume mounting**: Data persists outside container
56
+
57
+ ### **Container Isolation**
58
+ - ✅ **Process isolation** from host system
59
+ - ✅ **Network isolation** (no external network access needed)
60
+ - ✅ **Resource limits** can be applied via Docker
61
+
62
+ ## 🔍 **Data Privacy**
63
+
64
+ ### **Local-First Architecture**
65
+ - ✅ **No external services**: All processing happens locally
66
+ - ✅ **No telemetry**: No data sent to external servers
67
+ - ✅ **Full data ownership**: SQLite database stays on your machine
68
+
69
+ ### **Context Bundle Security**
70
+ - ✅ **Git context**: Only reads local repository information
71
+ - ✅ **No sensitive data**: Doesn't access private keys or credentials
72
+ - ✅ **Optional GitHub integration**: Only if explicitly configured
73
+
74
+ ## 🚨 **Security Best Practices**
75
+
76
+ ### **For Users**
77
+ 1. **Keep Docker updated**: Regularly update Docker and base images
78
+ 2. **Secure host system**: Ensure your host machine is secure
79
+ 3. **Regular backups**: Back up your `data/` directory
80
+ 4. **Monitor logs**: Check container logs for any unusual activity
81
+ 5. **Limit access**: Don't expose the container to external networks
82
+
83
+ ### **For Developers**
84
+ 1. **Regular updates**: Keep Python and dependencies updated
85
+ 2. **Security scanning**: Regularly scan Docker images for vulnerabilities
86
+ 3. **Code review**: All database operations use parameterized queries
87
+ 4. **Input validation**: All user inputs are validated before processing
88
+
89
+ ## 🔧 **Security Configuration**
90
+
91
+ ### **Environment Variables**
92
+ ```bash
93
+ # Database location (should be on secure volume)
94
+ DB_PATH=/app/data/memory_journal.db
95
+
96
+ # Python path for module resolution
97
+ PYTHONPATH=/app
98
+ ```
99
+
100
+ ### **Volume Mounting Security**
101
+ ```bash
102
+ # Secure volume mounting
103
+ docker run -v ./data:/app/data:rw,noexec,nosuid,nodev memory-journal-mcp
104
+ ```
105
+
106
+ ### **Resource Limits**
107
+ ```bash
108
+ # Apply resource limits
109
+ docker run --memory=1g --cpus=1 memory-journal-mcp
110
+ ```
111
+
112
+ ## 📋 **Security Checklist**
113
+
114
+ - [x] WAL mode enabled for database consistency
115
+ - [x] Proper file permissions (600/700)
116
+ - [x] Input validation and length limits
117
+ - [x] Parameterized SQL queries
118
+ - [x] Non-root Docker user
119
+ - [x] Minimal container attack surface
120
+ - [x] Local-first data architecture
121
+ - [x] No external network dependencies
122
+ - [x] Comprehensive error handling
123
+ - [x] Security documentation
124
+
125
+ ## 🚨 **Reporting Security Issues**
126
+
127
+ If you discover a security vulnerability, please:
128
+
129
+ 1. **Do not** open a public GitHub issue
130
+ 2. **Contact** the maintainers privately
131
+ 3. **Provide** detailed information about the vulnerability
132
+ 4. **Allow** time for the issue to be addressed before public disclosure
133
+
134
+ ## 🔄 **Security Updates**
135
+
136
+ - **Database maintenance**: Run `ANALYZE` and `PRAGMA optimize` regularly
137
+ - **Container updates**: Rebuild Docker images when base images are updated
138
+ - **Dependency updates**: Keep Python packages updated
139
+ - **Security patches**: Apply host system security updates
140
+
141
+ ### **Recent Security Fixes**
142
+
143
+ #### **CodeQL #110, #111: URL Substring Sanitization Vulnerability** (Fixed: October 26, 2025)
144
+ - **Issue**: Incomplete URL substring sanitization in GitHub remote URL parsing
145
+ - **Severity**: MEDIUM
146
+ - **Affected Code**: `_extract_repo_owner_from_remote()` function in server.py
147
+ - **Vulnerability Details**:
148
+ - Used unsafe substring checks: `'github.com' in remote_url` and `'github.com/' in remote_url`
149
+ - Could allow malicious URLs to bypass hostname validation
150
+ - Example bypasses: `http://evil.com/github.com/fake/repo` or `http://github.com.evil.com/fake/repo`
151
+ - **Mitigation**:
152
+ - ✅ **Proper URL Parsing**: Implemented `urllib.parse.urlparse()` for HTTPS/HTTP URLs
153
+ - ✅ **Exact Hostname Matching**: Validates `parsed.hostname == 'github.com'` (not substring or endswith)
154
+ - ✅ **SSH URL Validation**: Explicit `startswith('git@github.com:')` check for SSH format
155
+ - ✅ **Defense in Depth**: Returns `None` for any non-GitHub URLs instead of attempting to parse
156
+ - **Technical Details**:
157
+ - Vulnerability: CWE-20 (Improper Input Validation)
158
+ - CodeQL Rule: `py/incomplete-url-substring-sanitization`
159
+ - Context: Limited impact as this only parses Git remote URLs from local repositories
160
+ - However, could be exploited if an attacker could manipulate Git config files
161
+ - **Verification**: Review `_extract_repo_owner_from_remote()` function for proper urlparse usage
162
+ - **Impact**: Prevents URL spoofing attacks in repository owner detection
163
+ - **Reference**: [OWASP: SSRF](https://owasp.org/www-community/attacks/Server_Side_Request_Forgery) | [CWE-20](https://cwe.mitre.org/data/definitions/20.html)
164
+
165
+ #### **CVE-2025-58050: PCRE2 Heap Buffer Overflow** (Fixed: October 26, 2025)
166
+ - **Issue**: PCRE2 heap-buffer-overflow read in match_ref due to missing boundary restoration
167
+ - **Severity**: CRITICAL
168
+ - **Affected Package**: pcre2 <10.46-r0
169
+ - **Mitigation**:
170
+ - ✅ **Alpine Package**: Explicitly upgraded to pcre2=10.46-r0 in Dockerfile
171
+ - ✅ **Early Installation**: Upgraded in first layer to ensure all subsequent packages use patched version
172
+ - ✅ **Docker Base Image**: Using Python 3.14-alpine with latest security patches
173
+ - **Technical Details**:
174
+ - Vulnerability could allow heap buffer overflow attacks during regex pattern matching
175
+ - Fixed version restores boundaries correctly in match_ref function
176
+ - PCRE2 is a system dependency used by various tools including git and grep
177
+ - **Verification**: Run `apk info pcre2` in Alpine container to confirm version ≥10.46-r0
178
+ - **Impact**: Prevents potential remote code execution via malformed regex patterns
179
+ - **Reference**: [CVE-2025-58050](https://avd.aquasec.com/nvd/cve-2025-58050)
180
+
181
+ #### **CVE-2025-8869: pip Symbolic Link Vulnerability** (Fixed: October 20, 2025)
182
+ - **Issue**: pip missing checks on symbolic link extraction in fallback tar implementation (when Python doesn't implement PEP 706)
183
+ - **Severity**: MEDIUM
184
+ - **Affected Package**: pip <25.0 (with Python versions without PEP 706 support)
185
+ - **Comprehensive Mitigations**:
186
+ - ✅ **Python Version**: Minimum requirement bumped to 3.10.12+ (all versions ≥3.10.12 implement PEP 706)
187
+ - ✅ **pip Upgrade**: Explicitly upgrading to pip>=25.0 in all build processes (CI, Docker, local)
188
+ - ✅ **Docker Base Image**: Using Python 3.14-alpine which fully implements PEP 706
189
+ - ✅ **CI/CD Pipelines**: Updated to test against minimum Python 3.10.12
190
+ - ✅ **pyproject.toml**: Enforced minimum Python version requirement
191
+ - **Technical Details**:
192
+ - PEP 706 provides secure tar extraction with symlink validation
193
+ - When Python implements PEP 706, pip uses the secure implementation
194
+ - Otherwise, pip falls back to its own implementation which had the vulnerability
195
+ - Our fix addresses both the pip version and underlying Python version
196
+ - **Verification**: Run `pip --version` to confirm pip>=25.0
197
+ - **Impact**: Prevents potential exploitation during package installation via tar extraction
198
+ - **Reference**: [CVE-2025-8869](https://nvd.nist.gov/vuln/detail/CVE-2025-8869) | [PEP 706](https://peps.python.org/pep-0706/)
199
+
200
+ The Memory Journal MCP server is designed with **security-first principles** to protect your personal journal data while maintaining excellent performance and usability.
package/VERSION ADDED
@@ -0,0 +1 @@
1
+ 3.0.0
package/dist/cli.d.ts ADDED
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Memory Journal MCP Server - CLI Entry Point
3
+ */
4
+ export {};
5
+ //# sourceMappingURL=cli.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":"AAAA;;GAEG"}