vault-cortex 0.10.4 → 0.10.6

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/README.md CHANGED
@@ -49,9 +49,9 @@ What it does:
49
49
  - **Remote** — a VPS with [Obsidian Sync](https://obsidian.md/sync),
50
50
  reachable from any device
51
51
  2. Offers the most common optional settings — memory layer and folder,
52
- daily notes folder and format, file tools, semantic search, port,
53
- timezone (plus sync direction for remote) — press enter to keep the
54
- defaults, or pick the ones you want to change
52
+ daily notes folder and format, file tools, read-only mode, semantic
53
+ search, port, timezone (plus sync direction for remote) — press enter
54
+ to keep the defaults, or pick the ones you want to change
55
55
  3. Generates a `.env` file with a securely generated `MCP_AUTH_TOKEN`
56
56
  4. Optionally starts the container and waits for the health check
57
57
  5. Prints your connection details — the MCP URL, your auth token, and how to
package/dist/env.js CHANGED
@@ -58,6 +58,15 @@ MEMORY_ENABLED=true
58
58
  # Enable or disable file tools — vault_read_file and vault_list_files (default: true).
59
59
  # Set to false when Obsidian Sync has attachment syncing disabled.
60
60
  FILE_TOOLS_ENABLED=true
61
+ # Run the server in read-only mode (default: false).
62
+ # Set to true to hide every tool that changes the vault — clients can only
63
+ # read and search. The memory folder is not auto-created in this mode.
64
+ READONLY_MODE=false
65
+ # Hide individual tools by name, comma-separated (default: none hidden).
66
+ # Names match the README tools table: https://github.com/aliasunder/vault-cortex#tools
67
+ # Subtractive only — it cannot re-enable a tool another setting hides; an
68
+ # unknown tool name stops the server at startup so typos surface immediately.
69
+ # DISABLED_TOOLS=vault_delete_note,vault_move_note
61
70
  # Memory folder name in your vault (default: About Me).
62
71
  MEMORY_DIR=About Me
63
72
 
@@ -85,6 +94,18 @@ MEMORY_DIR=About Me
85
94
  # Host port to expose (default: 8000).
86
95
  PORT=8000
87
96
 
97
+ # Client-IP trust for OAuth rate limiting and logs (defaults shown).
98
+ # With nothing in front of the server, leave both untouched — each visitor
99
+ # is identified by their own connection, and faked Forwarded/X-Forwarded-For
100
+ # headers are ignored.
101
+ # With a proxy or tunnel you control in front (Caddy, nginx, Cloudflare
102
+ # Tunnel), set TRUST_PROXY_HOPS=1 so visitors are told apart by their real
103
+ # IP — otherwise they all share one rate-limit budget.
104
+ # Set TRUST_FORWARDED_HEADER=true only if the proxy reports each visitor's
105
+ # IP in the RFC 7239 Forwarded header (e.g. AWS API Gateway).
106
+ # TRUST_PROXY_HOPS=0
107
+ # TRUST_FORWARDED_HEADER=false
108
+
88
109
  # Log verbosity: debug | info | warn | error (default: info).
89
110
  LOG_LEVEL=info
90
111
 
@@ -160,6 +181,15 @@ MEMORY_ENABLED=true
160
181
  # Enable or disable file tools — vault_read_file and vault_list_files (default: true).
161
182
  # Set to false when Obsidian Sync has attachment syncing disabled.
162
183
  FILE_TOOLS_ENABLED=true
184
+ # Run the server in read-only mode (default: false).
185
+ # Set to true to hide every tool that changes the vault — clients can only
186
+ # read and search. The memory folder is not auto-created in this mode.
187
+ READONLY_MODE=false
188
+ # Hide individual tools by name, comma-separated (default: none hidden).
189
+ # Names match the README tools table: https://github.com/aliasunder/vault-cortex#tools
190
+ # Subtractive only — it cannot re-enable a tool another setting hides; an
191
+ # unknown tool name stops the server at startup so typos surface immediately.
192
+ # DISABLED_TOOLS=vault_delete_note,vault_move_note
163
193
  # Memory folder name in your vault (default: About Me).
164
194
  MEMORY_DIR=About Me
165
195
 
@@ -188,6 +218,18 @@ MEMORY_DIR=About Me
188
218
  # Host port to expose (default: 8000).
189
219
  PORT=8000
190
220
 
221
+ # Client-IP trust for OAuth rate limiting and logs (defaults shown).
222
+ # With nothing in front of the server, leave both untouched — each visitor
223
+ # is identified by their own connection, and faked Forwarded/X-Forwarded-For
224
+ # headers are ignored.
225
+ # With a proxy or tunnel you control in front (Caddy, nginx, Cloudflare
226
+ # Tunnel), set TRUST_PROXY_HOPS=1 so visitors are told apart by their real
227
+ # IP — otherwise they all share one rate-limit budget.
228
+ # Set TRUST_FORWARDED_HEADER=true only if the proxy reports each visitor's
229
+ # IP in the RFC 7239 Forwarded header (e.g. AWS API Gateway).
230
+ # TRUST_PROXY_HOPS=0
231
+ # TRUST_FORWARDED_HEADER=false
232
+
191
233
  # Log verbosity: debug | info | warn | error (default: info).
192
234
  LOG_LEVEL=info
193
235
 
@@ -37,6 +37,13 @@ const OPTIONAL_SETTINGS = [
37
37
  label: "File tools",
38
38
  question: "Enable file tools (read images, PDFs, and other non-Markdown files)?",
39
39
  },
40
+ {
41
+ kind: "toggle",
42
+ name: "READONLY_MODE",
43
+ label: "Read-only mode",
44
+ question: "Run the server in read-only mode (hide all tools that change the vault)?",
45
+ defaultEnabled: false,
46
+ },
40
47
  {
41
48
  kind: "toggle",
42
49
  name: "EMBEDDING_ENABLED",
@@ -127,11 +134,12 @@ export const derivePublicUrlOverride = (envContent, overrides) => {
127
134
  return { ...overrides, PUBLIC_URL: `http://localhost:${newPort}` };
128
135
  };
129
136
  /**
130
- * The .env spellings the server reads as "off" — env-var's asBool accepts
131
- * 0/1 alongside true/false. An absent or unrecognized value falls to the
132
- * server default, which is enabled for every curated toggle.
137
+ * True unless the .env value is an explicit "off" spelling — env-var's asBool
138
+ * accepts 0/1 alongside true/false. An absent or unrecognized value falls to
139
+ * the server default, declared per-toggle via defaultEnabled (enabled unless
140
+ * stated otherwise).
133
141
  */
134
- const isDisabledToggleValue = (value) => ["false", "0"].includes((value ?? "").toLowerCase());
142
+ const isEnabledToggleValue = (value) => !["false", "0"].includes((value ?? "").toLowerCase());
135
143
  /**
136
144
  * Plain digits in the TCP port range. Number() coercion is not enough:
137
145
  * it accepts "1e4"/"0x1F40"/"+9000", which readEnvPort's /^PORT=(\d+)/
@@ -222,7 +230,15 @@ const askSettingValue = async (params, prompts) => {
222
230
  const { setting, currentValue } = params;
223
231
  switch (setting.kind) {
224
232
  case "toggle": {
225
- const enabled = await prompts.confirm(setting.question, !isDisabledToggleValue(currentValue));
233
+ // An unset or empty var means the server default applies — seed the
234
+ // confirm from defaultEnabled, not from the enabled-unless-"false"
235
+ // heuristic (wrong for default-off toggles like READONLY_MODE).
236
+ // Empty string matters: `READONLY_MODE=` in .env is read as unset
237
+ // by Compose's `${VAR:-default}` and env-var's `.default()`.
238
+ const currentlyEnabled = !currentValue
239
+ ? (setting.defaultEnabled ?? true)
240
+ : isEnabledToggleValue(currentValue);
241
+ const enabled = await prompts.confirm(setting.question, currentlyEnabled);
226
242
  return String(enabled);
227
243
  }
228
244
  case "port":
@@ -258,7 +274,7 @@ export const askOptionalSettings = async (params, prompts) => {
258
274
  const currentValue = readOptionalValue(envContent, setting.name);
259
275
  const requiredToggle = OPTIONAL_SETTINGS.find((candidate) => candidate.name === setting.requiresToggle);
260
276
  const dependencyNote = requiredToggle &&
261
- isDisabledToggleValue(readOptionalValue(envContent, requiredToggle.name))
277
+ !isEnabledToggleValue(readOptionalValue(envContent, requiredToggle.name))
262
278
  ? ` · not used while ${requiredToggle.label} is off`
263
279
  : "";
264
280
  return {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vault-cortex",
3
- "version": "0.10.4",
3
+ "version": "0.10.6",
4
4
  "description": "Set up a Vault Cortex MCP server for your Obsidian vault in one command: npx vault-cortex@latest init",
5
5
  "license": "MIT",
6
6
  "type": "module",