foldnotes-mcp 2.4.0__tar.gz → 2.4.1__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
- Metadata-Version: 2.4
1
+ Metadata-Version: 2.5
2
2
  Name: foldnotes-mcp
3
- Version: 2.4.0
3
+ Version: 2.4.1
4
4
  Summary: MCP server exposing the FoldNotes CLI (fn) as tools for Claude Desktop, Claude Code, and other MCP clients.
5
5
  Project-URL: Homepage, https://foldnotes.io
6
6
  Project-URL: Documentation, https://foldnotes.io/advanced/ai-integration/
@@ -26,7 +26,7 @@ Configure in Claude Desktop's claude_desktop_config.json:
26
26
  }
27
27
  """
28
28
 
29
- __version__ = "2.4.0"
29
+ __version__ = "2.4.1"
30
30
 
31
31
  import json
32
32
  import os
@@ -54,6 +54,15 @@ def _find_fn() -> str:
54
54
 
55
55
  FN_BIN = _find_fn()
56
56
 
57
+ # Seconds before an `fn` invocation is abandoned. 60, not 30: the FIRST call
58
+ # in a session is far slower than the rest — the cold run resolves the iCloud
59
+ # container, opens the SwiftData cache and may create that day's daily note.
60
+ # Measured 2026-08-09: first call >30 s (timed out), second 12.6 s, then
61
+ # 0.06 s warm. 30 s failed only ever on that first call, and the retry always
62
+ # worked — which is a confusing way for a tool to behave.
63
+ FN_TIMEOUT = 60
64
+
65
+
57
66
 
58
67
  def run_fn(args: list[str], collection: str | None = None) -> dict:
59
68
  """Run an fn CLI command and return parsed JSON or raw text."""
@@ -64,11 +73,11 @@ def run_fn(args: list[str], collection: str | None = None) -> dict:
64
73
  cmd += ["--collection", collection]
65
74
 
66
75
  try:
67
- result = subprocess.run(cmd, capture_output=True, text=True, timeout=30)
76
+ result = subprocess.run(cmd, capture_output=True, text=True, timeout=FN_TIMEOUT)
68
77
  except FileNotFoundError:
69
78
  return {"error": f"fn CLI not found. Tried: {FN_BIN}"}
70
79
  except subprocess.TimeoutExpired:
71
- return {"error": "fn command timed out after 30 seconds"}
80
+ return {"error": f"fn command timed out after {FN_TIMEOUT} seconds"}
72
81
 
73
82
  output = result.stdout.strip()
74
83
  if result.returncode != 0:
@@ -90,7 +99,7 @@ def run_fn_raw(args: list[str], collection: str | None = None) -> str:
90
99
  cmd += ["--collection", collection]
91
100
 
92
101
  try:
93
- result = subprocess.run(cmd, capture_output=True, text=True, timeout=30)
102
+ result = subprocess.run(cmd, capture_output=True, text=True, timeout=FN_TIMEOUT)
94
103
  except FileNotFoundError:
95
104
  return f"Error: fn CLI not found at {FN_BIN}"
96
105
  except subprocess.TimeoutExpired:
@@ -1149,7 +1158,10 @@ def strip_context(name: str, collection: str | None = None) -> str:
1149
1158
 
1150
1159
  @mcp.tool()
1151
1160
  def list_attachments(collection: str | None = None) -> str:
1152
- """List images with size and reference count.
1161
+ """List attachments with size and reference count.
1162
+
1163
+ Covers every file in the collection's attachments folder — images, PDFs,
1164
+ Office and iWork documents, and audio — not images alone.
1153
1165
 
1154
1166
  Args:
1155
1167
  collection: Collection name, UUID, or path.
@@ -1159,7 +1171,9 @@ def list_attachments(collection: str | None = None) -> str:
1159
1171
 
1160
1172
  @mcp.tool()
1161
1173
  def orphan_attachments(collection: str | None = None) -> str:
1162
- """List images that no note references.
1174
+ """List attachments that no note references.
1175
+
1176
+ Covers documents and audio as well as images.
1163
1177
 
1164
1178
  Args:
1165
1179
  collection: Collection name, UUID, or path.
@@ -1169,10 +1183,14 @@ def orphan_attachments(collection: str | None = None) -> str:
1169
1183
 
1170
1184
  @mcp.tool()
1171
1185
  def prune_attachments(force: bool = False, collection: str | None = None) -> str:
1172
- """Delete orphaned images. Without force, only reports what would be deleted.
1186
+ """Delete orphaned attachments. Without force, only reports what would be deleted.
1187
+
1188
+ DESTRUCTIVE with force=True, and it deletes DOCUMENTS AND AUDIO as well as
1189
+ images — a PDF, spreadsheet or voice memo no note references is removed just
1190
+ the same. Run the dry-run first and read what it lists.
1173
1191
 
1174
1192
  Args:
1175
- force: Actually delete the orphaned images (default: dry-run).
1193
+ force: Actually delete the orphaned attachments (default: dry-run).
1176
1194
  collection: Collection name, UUID, or path.
1177
1195
  """
1178
1196
  args = ["attachments", "prune"]
File without changes
File without changes
File without changes