memory-journal-mcp 4.3.0 → 4.4.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.
- package/.dockerignore +131 -122
- package/.gitattributes +29 -0
- package/.github/workflows/docker-publish.yml +1 -1
- package/.github/workflows/lint-and-test.yml +1 -2
- package/.github/workflows/secrets-scanning.yml +0 -1
- package/.github/workflows/security-update.yml +6 -6
- package/.vscode/settings.json +17 -15
- package/CHANGELOG.md +1065 -11
- package/DOCKER_README.md +51 -33
- package/Dockerfile +14 -12
- package/README.md +68 -33
- package/SECURITY.md +225 -220
- package/dist/cli.js +7 -0
- package/dist/cli.js.map +1 -1
- package/dist/constants/ServerInstructions.d.ts +1 -1
- package/dist/constants/ServerInstructions.d.ts.map +1 -1
- package/dist/constants/ServerInstructions.js +70 -26
- package/dist/constants/ServerInstructions.js.map +1 -1
- package/dist/constants/icons.d.ts +2 -0
- package/dist/constants/icons.d.ts.map +1 -1
- package/dist/constants/icons.js +6 -0
- package/dist/constants/icons.js.map +1 -1
- package/dist/database/SqliteAdapter.d.ts +51 -10
- package/dist/database/SqliteAdapter.d.ts.map +1 -1
- package/dist/database/SqliteAdapter.js +143 -43
- package/dist/database/SqliteAdapter.js.map +1 -1
- package/dist/filtering/ToolFilter.d.ts +1 -1
- package/dist/filtering/ToolFilter.d.ts.map +1 -1
- package/dist/filtering/ToolFilter.js +7 -1
- package/dist/filtering/ToolFilter.js.map +1 -1
- package/dist/github/GitHubIntegration.d.ts +74 -2
- package/dist/github/GitHubIntegration.d.ts.map +1 -1
- package/dist/github/GitHubIntegration.js +508 -7
- package/dist/github/GitHubIntegration.js.map +1 -1
- package/dist/handlers/prompts/index.js +1 -0
- package/dist/handlers/prompts/index.js.map +1 -1
- package/dist/handlers/resources/index.d.ts.map +1 -1
- package/dist/handlers/resources/index.js +257 -13
- package/dist/handlers/resources/index.js.map +1 -1
- package/dist/handlers/tools/index.d.ts.map +1 -1
- package/dist/handlers/tools/index.js +595 -8
- package/dist/handlers/tools/index.js.map +1 -1
- package/dist/server/McpServer.d.ts +2 -0
- package/dist/server/McpServer.d.ts.map +1 -1
- package/dist/server/McpServer.js +69 -26
- package/dist/server/McpServer.js.map +1 -1
- package/dist/types/index.d.ts +97 -0
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/index.js.map +1 -1
- package/dist/utils/logger.d.ts +1 -0
- package/dist/utils/logger.d.ts.map +1 -1
- package/dist/utils/logger.js +8 -1
- package/dist/utils/logger.js.map +1 -1
- package/dist/utils/progress-utils.d.ts +18 -3
- package/dist/utils/progress-utils.d.ts.map +1 -1
- package/dist/utils/progress-utils.js.map +1 -1
- package/dist/utils/security-utils.d.ts +91 -0
- package/dist/utils/security-utils.d.ts.map +1 -0
- package/dist/utils/security-utils.js +184 -0
- package/dist/utils/security-utils.js.map +1 -0
- package/dist/vector/VectorSearchManager.d.ts +2 -1
- package/dist/vector/VectorSearchManager.d.ts.map +1 -1
- package/dist/vector/VectorSearchManager.js +100 -34
- package/dist/vector/VectorSearchManager.js.map +1 -1
- package/docker-compose.yml +46 -37
- package/mcp-config-example.json +0 -2
- package/package.json +21 -14
- package/releases/v4.3.1.md +69 -0
- package/releases/v4.4.0.md +120 -0
- package/server.json +3 -3
- package/src/cli.ts +11 -0
- package/src/constants/ServerInstructions.ts +70 -26
- package/src/constants/icons.ts +7 -0
- package/src/database/SqliteAdapter.ts +165 -44
- package/src/filtering/ToolFilter.ts +7 -1
- package/src/github/GitHubIntegration.ts +588 -8
- package/src/handlers/prompts/index.ts +1 -0
- package/src/handlers/resources/index.ts +318 -12
- package/src/handlers/tools/index.ts +686 -13
- package/src/server/McpServer.ts +79 -37
- package/src/types/index.ts +98 -0
- package/src/utils/logger.ts +10 -1
- package/src/utils/progress-utils.ts +17 -6
- package/src/utils/security-utils.ts +205 -0
- package/src/vector/VectorSearchManager.ts +110 -39
- package/tests/constants/icons.test.ts +102 -0
- package/tests/constants/server-instructions.test.ts +549 -0
- package/tests/database/sqlite-adapter.bench.ts +63 -0
- package/tests/database/sqlite-adapter.test.ts +555 -0
- package/tests/filtering/tool-filter.test.ts +266 -0
- package/tests/github/github-integration.test.ts +1024 -0
- package/tests/handlers/github-resource-handlers.test.ts +473 -0
- package/tests/handlers/github-tool-handlers.test.ts +556 -0
- package/tests/handlers/prompt-handlers.test.ts +91 -0
- package/tests/handlers/resource-handlers.test.ts +339 -0
- package/tests/handlers/tool-handlers.test.ts +497 -0
- package/tests/handlers/vector-tool-handlers.test.ts +238 -0
- package/tests/security/sql-injection.test.ts +347 -0
- package/tests/server/mcp-server.bench.ts +55 -0
- package/tests/server/mcp-server.test.ts +675 -0
- package/tests/utils/logger.test.ts +180 -0
- package/tests/utils/mcp-logger.test.ts +212 -0
- package/tests/utils/progress-utils.test.ts +156 -0
- package/tests/utils/security-utils.test.ts +82 -0
- package/tests/vector/vector-search-manager.test.ts +335 -0
- package/tests/vector/vector-search.bench.ts +53 -0
- package/vitest.config.ts +15 -0
- package/.github/workflows/DOCKER_DEPLOYMENT_SETUP.md +0 -387
- package/.github/workflows/dependabot-auto-merge.yml +0 -42
package/SECURITY.md
CHANGED
|
@@ -1,220 +1,225 @@
|
|
|
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
|
-
|
|
9
|
-
- ✅ **Write-Ahead Logging (WAL)** enabled for better concurrency and crash recovery
|
|
10
|
-
- ✅ **Atomic transactions** ensure data consistency
|
|
11
|
-
- ✅ **Better performance** with concurrent read/write operations
|
|
12
|
-
|
|
13
|
-
### **Optimized PRAGMA Settings**
|
|
14
|
-
|
|
15
|
-
```sql
|
|
16
|
-
PRAGMA foreign_keys = ON -- Enforce referential integrity
|
|
17
|
-
PRAGMA journal_mode = WAL -- Enable WAL mode
|
|
18
|
-
PRAGMA synchronous = NORMAL -- Balance safety and performance
|
|
19
|
-
PRAGMA cache_size = -64000 -- 64MB cache for better performance
|
|
20
|
-
PRAGMA mmap_size = 268435456 -- 256MB memory-mapped I/O
|
|
21
|
-
PRAGMA temp_store = MEMORY -- Store temp tables in memory
|
|
22
|
-
PRAGMA busy_timeout = 30000 -- 30-second timeout for busy database
|
|
23
|
-
```
|
|
24
|
-
|
|
25
|
-
### **File Permissions**
|
|
26
|
-
|
|
27
|
-
- ✅ **Database files**: `600` (read/write for owner only)
|
|
28
|
-
- ✅ **Data directory**: `700` (full access for owner only)
|
|
29
|
-
- ✅ **Automatic permission setting** on database creation
|
|
30
|
-
|
|
31
|
-
## 🔐 **Input Validation**
|
|
32
|
-
|
|
33
|
-
### **Content Limits**
|
|
34
|
-
|
|
35
|
-
- **Journal entries**: 50,000 characters maximum
|
|
36
|
-
- **Tags**: 100 characters maximum
|
|
37
|
-
- **Entry types**: 50 characters maximum
|
|
38
|
-
- **Significance types**: 50 characters maximum
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
- ✅ **
|
|
50
|
-
- ✅ **
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
- ✅ **
|
|
58
|
-
- ✅ **
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
### **
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
#
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
- **
|
|
154
|
-
- **
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
- **
|
|
165
|
-
- **
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
-
|
|
197
|
-
-
|
|
198
|
-
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
-
|
|
203
|
-
-
|
|
204
|
-
-
|
|
205
|
-
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
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
|
+
|
|
9
|
+
- ✅ **Write-Ahead Logging (WAL)** enabled for better concurrency and crash recovery
|
|
10
|
+
- ✅ **Atomic transactions** ensure data consistency
|
|
11
|
+
- ✅ **Better performance** with concurrent read/write operations
|
|
12
|
+
|
|
13
|
+
### **Optimized PRAGMA Settings**
|
|
14
|
+
|
|
15
|
+
```sql
|
|
16
|
+
PRAGMA foreign_keys = ON -- Enforce referential integrity
|
|
17
|
+
PRAGMA journal_mode = WAL -- Enable WAL mode
|
|
18
|
+
PRAGMA synchronous = NORMAL -- Balance safety and performance
|
|
19
|
+
PRAGMA cache_size = -64000 -- 64MB cache for better performance
|
|
20
|
+
PRAGMA mmap_size = 268435456 -- 256MB memory-mapped I/O
|
|
21
|
+
PRAGMA temp_store = MEMORY -- Store temp tables in memory
|
|
22
|
+
PRAGMA busy_timeout = 30000 -- 30-second timeout for busy database
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
### **File Permissions**
|
|
26
|
+
|
|
27
|
+
- ✅ **Database files**: `600` (read/write for owner only)
|
|
28
|
+
- ✅ **Data directory**: `700` (full access for owner only)
|
|
29
|
+
- ✅ **Automatic permission setting** on database creation
|
|
30
|
+
|
|
31
|
+
## 🔐 **Input Validation**
|
|
32
|
+
|
|
33
|
+
### **Content Limits**
|
|
34
|
+
|
|
35
|
+
- **Journal entries**: 50,000 characters maximum
|
|
36
|
+
- **Tags**: 100 characters maximum
|
|
37
|
+
- **Entry types**: 50 characters maximum
|
|
38
|
+
- **Significance types**: 50 characters maximum
|
|
39
|
+
- **HTTP request body**: 1MB maximum (prevents memory exhaustion)
|
|
40
|
+
|
|
41
|
+
### **Character Filtering**
|
|
42
|
+
|
|
43
|
+
Dangerous characters are blocked in tags:
|
|
44
|
+
|
|
45
|
+
- `<` `>` `"` `'` `&` `\x00`
|
|
46
|
+
|
|
47
|
+
### **SQL Injection Prevention**
|
|
48
|
+
|
|
49
|
+
- ✅ **Parameterized queries** used throughout
|
|
50
|
+
- ✅ **Input validation** via Zod schemas before database operations
|
|
51
|
+
- ✅ **Warning system** for potentially dangerous content patterns
|
|
52
|
+
- ✅ **LIKE pattern sanitization** (escapes `%`, `_`, `\` wildcards)
|
|
53
|
+
- ✅ **Date format whitelisting** (prevents strftime injection)
|
|
54
|
+
|
|
55
|
+
### **Path Traversal Protection**
|
|
56
|
+
|
|
57
|
+
- ✅ **Backup filenames validated** - rejects `/`, `\`, `..` in paths
|
|
58
|
+
- ✅ **Typed security errors** with consistent error codes
|
|
59
|
+
|
|
60
|
+
## 🌐 **HTTP Transport Security**
|
|
61
|
+
|
|
62
|
+
When running in HTTP mode (`--transport http`), the following security measures apply:
|
|
63
|
+
|
|
64
|
+
### **CORS Configuration**
|
|
65
|
+
|
|
66
|
+
- ✅ **Configurable origin** via `--cors-origin` flag or `MCP_CORS_ORIGIN` environment variable
|
|
67
|
+
- ⚠️ **Default: `*`** (allow all origins) for backward compatibility
|
|
68
|
+
- 🔒 **Recommended**: Set a specific origin for production deployments
|
|
69
|
+
|
|
70
|
+
```bash
|
|
71
|
+
# Restrict CORS to specific origin
|
|
72
|
+
memory-journal-mcp --transport http --cors-origin "http://localhost:3000"
|
|
73
|
+
|
|
74
|
+
# Or via environment variable
|
|
75
|
+
export MCP_CORS_ORIGIN="http://localhost:3000"
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
### **Security Headers**
|
|
79
|
+
|
|
80
|
+
- ✅ **X-Content-Type-Options: nosniff** - prevents MIME sniffing
|
|
81
|
+
- ✅ **X-Frame-Options: DENY** - prevents clickjacking
|
|
82
|
+
|
|
83
|
+
### **Session Management (Stateful Mode)**
|
|
84
|
+
|
|
85
|
+
- ✅ **UUID-based session IDs** (cryptographically random)
|
|
86
|
+
- ✅ **30-minute session timeout** - idle sessions automatically expired
|
|
87
|
+
- ✅ **5-minute sweep interval** - periodic cleanup of abandoned sessions
|
|
88
|
+
- ✅ **Explicit session termination** via `DELETE /mcp`
|
|
89
|
+
|
|
90
|
+
### **Request Size Limits**
|
|
91
|
+
|
|
92
|
+
- ✅ **1MB body limit** on JSON requests (prevents memory exhaustion DoS)
|
|
93
|
+
|
|
94
|
+
## 🐙 **GitHub Token Security**
|
|
95
|
+
|
|
96
|
+
### **Token Handling**
|
|
97
|
+
|
|
98
|
+
- ✅ **Environment variables only** - tokens never stored in config files
|
|
99
|
+
- ✅ **Error message scrubbing** - Authorization headers stripped from error logs
|
|
100
|
+
- ✅ **Optional integration** - server works fully offline without GitHub token
|
|
101
|
+
- ✅ **Minimal scopes** - only requires `repo`, `project`, `read:org`
|
|
102
|
+
|
|
103
|
+
### **Environment Variables**
|
|
104
|
+
|
|
105
|
+
```bash
|
|
106
|
+
# Required for GitHub features
|
|
107
|
+
GITHUB_TOKEN=ghp_... # GitHub personal access token
|
|
108
|
+
|
|
109
|
+
# Optional
|
|
110
|
+
GITHUB_ORG_TOKEN=ghp_... # For organization projects
|
|
111
|
+
GITHUB_REPO_PATH=/path/to/repo # For auto-detecting owner/repo
|
|
112
|
+
DEFAULT_PROJECT_NUMBER=1 # Default project for issue assignment
|
|
113
|
+
MCP_CORS_ORIGIN=* # CORS origin (default: *)
|
|
114
|
+
MCP_HOST=localhost # Server bind host
|
|
115
|
+
AUTO_REBUILD_INDEX=true # Rebuild vector index on startup
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
## 🐳 **Docker Security**
|
|
119
|
+
|
|
120
|
+
### **Non-Root User**
|
|
121
|
+
|
|
122
|
+
- ✅ **Dedicated user**: `appuser` (UID 1001) with minimal privileges
|
|
123
|
+
- ✅ **Restricted group**: `appgroup` (GID 1001)
|
|
124
|
+
- ✅ **Restricted data directory**: `700` permissions
|
|
125
|
+
|
|
126
|
+
### **Container Hardening**
|
|
127
|
+
|
|
128
|
+
- ✅ **Minimal base image**: `node:24-alpine`
|
|
129
|
+
- ✅ **Multi-stage build**: Build dependencies not in production image
|
|
130
|
+
- ✅ **Process isolation** from host system
|
|
131
|
+
- ✅ **No shell access needed** for production
|
|
132
|
+
|
|
133
|
+
### **Volume Mounting Security**
|
|
134
|
+
|
|
135
|
+
```bash
|
|
136
|
+
# Secure volume mounting
|
|
137
|
+
docker run -v ./data:/app/data:rw,noexec,nosuid,nodev memory-journal-mcp
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
### **Resource Limits**
|
|
141
|
+
|
|
142
|
+
```bash
|
|
143
|
+
# Apply resource limits
|
|
144
|
+
docker run --memory=1g --cpus=1 memory-journal-mcp
|
|
145
|
+
```
|
|
146
|
+
|
|
147
|
+
## 🔍 **Data Privacy**
|
|
148
|
+
|
|
149
|
+
### **Local-First Architecture**
|
|
150
|
+
|
|
151
|
+
- ✅ **No external services**: All processing happens locally
|
|
152
|
+
- ✅ **No telemetry**: No data sent to external servers
|
|
153
|
+
- ✅ **Full data ownership**: SQLite database stays on your machine
|
|
154
|
+
- ✅ **Semantic search**: ML model runs locally via `@xenova/transformers`
|
|
155
|
+
|
|
156
|
+
### **Context Security**
|
|
157
|
+
|
|
158
|
+
- ✅ **Git context**: Only reads local repository information
|
|
159
|
+
- ✅ **No sensitive data**: Doesn't access private keys or credentials
|
|
160
|
+
- ✅ **Optional GitHub integration**: Only if explicitly configured with token
|
|
161
|
+
|
|
162
|
+
## 🔄 **CI/CD Security**
|
|
163
|
+
|
|
164
|
+
- ✅ **CodeQL analysis** - automated static analysis on push/PR
|
|
165
|
+
- ✅ **Trivy container scanning** - Docker image vulnerability detection
|
|
166
|
+
- ✅ **TruffleHog + Gitleaks** - secret scanning on push/PR
|
|
167
|
+
- ✅ **npm audit** - dependency vulnerability checking
|
|
168
|
+
- ✅ **Dependabot** - automated dependency update PRs
|
|
169
|
+
|
|
170
|
+
## 🚨 **Security Best Practices**
|
|
171
|
+
|
|
172
|
+
### **For Users**
|
|
173
|
+
|
|
174
|
+
1. **Set a CORS origin** when exposing the HTTP transport on a network
|
|
175
|
+
2. **Keep Node.js updated**: Use Node.js 24+ (LTS)
|
|
176
|
+
3. **Secure host system**: Ensure your host machine is secure
|
|
177
|
+
4. **Regular backups**: Use the `backup_journal` tool or back up your `.db` file
|
|
178
|
+
5. **Limit network access**: Don't expose the HTTP transport to untrusted networks
|
|
179
|
+
6. **Use resource limits**: Apply Docker `--memory` and `--cpus` limits
|
|
180
|
+
|
|
181
|
+
### **For Developers**
|
|
182
|
+
|
|
183
|
+
1. **Regular updates**: Keep Node.js and npm dependencies updated
|
|
184
|
+
2. **Security scanning**: Regularly scan Docker images for vulnerabilities
|
|
185
|
+
3. **Code review**: All database operations use parameterized queries
|
|
186
|
+
4. **Input validation**: All tool inputs validated via Zod schemas
|
|
187
|
+
|
|
188
|
+
## 📋 **Security Checklist**
|
|
189
|
+
|
|
190
|
+
- [x] WAL mode enabled for database consistency
|
|
191
|
+
- [x] Proper file permissions (600/700)
|
|
192
|
+
- [x] Input validation and length limits (Zod schemas)
|
|
193
|
+
- [x] Parameterized SQL queries
|
|
194
|
+
- [x] SQL injection detection heuristics
|
|
195
|
+
- [x] Path traversal protection
|
|
196
|
+
- [x] LIKE pattern sanitization
|
|
197
|
+
- [x] Date format whitelisting
|
|
198
|
+
- [x] HTTP body size limit (1MB)
|
|
199
|
+
- [x] Configurable CORS origin
|
|
200
|
+
- [x] Security headers (X-Content-Type-Options, X-Frame-Options)
|
|
201
|
+
- [x] Session timeout (30 minutes)
|
|
202
|
+
- [x] Non-root Docker user
|
|
203
|
+
- [x] Multi-stage Docker build
|
|
204
|
+
- [x] Local-first data architecture
|
|
205
|
+
- [x] GitHub token error scrubbing
|
|
206
|
+
- [x] CI/CD security pipeline (CodeQL, Trivy, secret scanning)
|
|
207
|
+
- [x] Comprehensive security documentation
|
|
208
|
+
|
|
209
|
+
## 🚨 **Reporting Security Issues**
|
|
210
|
+
|
|
211
|
+
If you discover a security vulnerability, please:
|
|
212
|
+
|
|
213
|
+
1. **Do not** open a public GitHub issue
|
|
214
|
+
2. **Contact** the maintainers privately
|
|
215
|
+
3. **Provide** detailed information about the vulnerability
|
|
216
|
+
4. **Allow** time for the issue to be addressed before public disclosure
|
|
217
|
+
|
|
218
|
+
## 🔄 **Security Updates**
|
|
219
|
+
|
|
220
|
+
- **Container updates**: Rebuild Docker images when base images are updated
|
|
221
|
+
- **Dependency updates**: Keep npm packages updated via `npm audit` and Dependabot
|
|
222
|
+
- **Database maintenance**: Run `ANALYZE` and `PRAGMA optimize` regularly
|
|
223
|
+
- **Security patches**: Apply host system security updates
|
|
224
|
+
|
|
225
|
+
The Memory Journal MCP server is designed with **security-first principles** to protect your personal journal data while maintaining excellent performance and usability.
|
package/dist/cli.js
CHANGED
|
@@ -12,25 +12,31 @@ program
|
|
|
12
12
|
.version(pkg.version)
|
|
13
13
|
.option('--transport <type>', 'Transport type: stdio or http', 'stdio')
|
|
14
14
|
.option('--port <number>', 'HTTP port (for http transport)', '3000')
|
|
15
|
+
.option('--server-host <host>', 'Server bind host for HTTP transport (default: localhost)')
|
|
15
16
|
.option('--stateless', 'Use stateless HTTP mode (no session management)')
|
|
16
17
|
.option('--db <path>', 'Database path', './memory_journal.db')
|
|
17
18
|
.option('--tool-filter <filter>', 'Tool filter string (e.g., "starter", "core,search")')
|
|
18
19
|
.option('--default-project <number>', 'Default GitHub Project number')
|
|
19
20
|
.option('--auto-rebuild-index', 'Rebuild vector index on server startup')
|
|
21
|
+
.option('--cors-origin <origin>', 'CORS allowed origin for HTTP transport (default: *)')
|
|
20
22
|
.option('--log-level <level>', 'Log level: debug, info, warning, error', 'info')
|
|
21
23
|
.action(async (options) => {
|
|
22
24
|
// Set log level
|
|
23
25
|
logger.setLevel(options.logLevel);
|
|
26
|
+
// Resolve host: CLI flag > env var > default (localhost)
|
|
27
|
+
const host = options.serverHost ?? process.env['MCP_HOST'] ?? process.env['HOST'] ?? undefined;
|
|
24
28
|
logger.info('Starting Memory Journal MCP Server', {
|
|
25
29
|
module: 'CLI',
|
|
26
30
|
transport: options.transport,
|
|
27
31
|
stateless: options.stateless ?? false,
|
|
28
32
|
db: options.db,
|
|
33
|
+
...(host ? { host } : {}),
|
|
29
34
|
});
|
|
30
35
|
try {
|
|
31
36
|
await createServer({
|
|
32
37
|
transport: options.transport,
|
|
33
38
|
port: parseInt(options.port, 10),
|
|
39
|
+
host,
|
|
34
40
|
statelessHttp: options.stateless === true,
|
|
35
41
|
dbPath: options.db,
|
|
36
42
|
toolFilter: options.toolFilter,
|
|
@@ -40,6 +46,7 @@ program
|
|
|
40
46
|
? parseInt(process.env['DEFAULT_PROJECT_NUMBER'], 10)
|
|
41
47
|
: undefined,
|
|
42
48
|
autoRebuildIndex: options.autoRebuildIndex ?? process.env['AUTO_REBUILD_INDEX'] === 'true',
|
|
49
|
+
corsOrigin: options.corsOrigin,
|
|
43
50
|
});
|
|
44
51
|
}
|
|
45
52
|
catch (error) {
|
package/dist/cli.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AACnC,O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Q,CAAC,OAAO,CAAC,IAAI,EAAE,EAAE,CAAC;YAChC,IAAI;YACJ,aAAa,EAAE,OAAO,CAAC,SAAS,KAAK,IAAI;YACzC,MAAM,EAAE,OAAO,CAAC,EAAE;YAClB,UAAU,EAAE,OAAO,CAAC,UAAU;YAC9B,oBAAoB,EAAE,OAAO,CAAC,cAAc;gBACxC,CAAC,CAAC,QAAQ,CAAC,OAAO,CAAC,cAAc,EAAE,EAAE,CAAC;gBACtC,CAAC,CAAC,OAAO,CAAC,GAAG,CAAC,wBAAwB,CAAC;oBACrC,CAAC,CAAC,QAAQ,CAAC,OAAO,CAAC,GAAG,CAAC,wBAAwB,CAAC,EAAE,EAAE,CAAC;oBACrD,CAAC,CAAC,SAAS;YACjB,gBAAgB,EACZ,OAAO,CAAC,gBAAgB,IAAI,OAAO,CAAC,GAAG,CAAC,oBAAoB,CAAC,KAAK,MAAM;YAC5E,UAAU,EAAE,OAAO,CAAC,UAAU;SACjC,CAAC,CAAA;IACN,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACb,MAAM,CAAC,KAAK,CAAC,wBAAwB,EAAE;YACnC,MAAM,EAAE,KAAK;YACb,KAAK,EAAE,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC;SAChE,CAAC,CAAA;QACF,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAA;IACnB,CAAC;AACL,CAAC,CACJ,CAAA;AAEL,OAAO,CAAC,KAAK,EAAE,CAAA"}
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* These instructions are automatically sent to MCP clients during initialization,
|
|
5
5
|
* providing guidance for AI agents on tool usage.
|
|
6
6
|
*
|
|
7
|
-
*
|
|
7
|
+
* Unreleased: Optimized for token efficiency with tiered instruction levels.
|
|
8
8
|
*/
|
|
9
9
|
/**
|
|
10
10
|
* Resource definition for instruction generation
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ServerInstructions.d.ts","sourceRoot":"","sources":["../../src/constants/ServerInstructions.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAKH;;GAEG;AACH,MAAM,WAAW,kBAAkB;IAC/B,GAAG,EAAE,MAAM,CAAA;IACX,IAAI,EAAE,MAAM,CAAA;IACZ,WAAW,CAAC,EAAE,MAAM,CAAA;CACvB;AAED;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC7B,IAAI,EAAE,MAAM,CAAA;IACZ,WAAW,CAAC,EAAE,MAAM,CAAA;CACvB;AAED;;GAEG;AACH,MAAM,WAAW,mBAAmB;IAChC,EAAE,EAAE,MAAM,CAAA;IACV,SAAS,EAAE,MAAM,CAAA;IACjB,SAAS,EAAE,MAAM,CAAA;IACjB,OAAO,EAAE,MAAM,CAAA;CAClB;AAED;;;;;GAKG;AACH,MAAM,MAAM,gBAAgB,GAAG,WAAW,GAAG,UAAU,GAAG,MAAM,CAAA;
|
|
1
|
+
{"version":3,"file":"ServerInstructions.d.ts","sourceRoot":"","sources":["../../src/constants/ServerInstructions.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAKH;;GAEG;AACH,MAAM,WAAW,kBAAkB;IAC/B,GAAG,EAAE,MAAM,CAAA;IACX,IAAI,EAAE,MAAM,CAAA;IACZ,WAAW,CAAC,EAAE,MAAM,CAAA;CACvB;AAED;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC7B,IAAI,EAAE,MAAM,CAAA;IACZ,WAAW,CAAC,EAAE,MAAM,CAAA;CACvB;AAED;;GAEG;AACH,MAAM,WAAW,mBAAmB;IAChC,EAAE,EAAE,MAAM,CAAA;IACV,SAAS,EAAE,MAAM,CAAA;IACjB,SAAS,EAAE,MAAM,CAAA;IACjB,OAAO,EAAE,MAAM,CAAA;CAClB;AAED;;;;;GAKG;AACH,MAAM,MAAM,gBAAgB,GAAG,WAAW,GAAG,UAAU,GAAG,MAAM,CAAA;AAmOhE;;;;;;;;GAQG;AACH,wBAAgB,oBAAoB,CAChC,YAAY,EAAE,GAAG,CAAC,MAAM,CAAC,EACzB,UAAU,EAAE,kBAAkB,EAAE,EAChC,OAAO,EAAE,gBAAgB,EAAE,EAC3B,WAAW,CAAC,EAAE,mBAAmB,EACjC,KAAK,GAAE,gBAA6B,GACrC,MAAM,CAuCR;AAkBD;;;GAGG;AACH,eAAO,MAAM,mBAAmB,QAA+C,CAAA"}
|