foldnotes-mcp 2.3.1__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.3.1
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.3.1"
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:
@@ -826,6 +835,47 @@ def daily_append(
826
835
  return json.dumps(run_fn(args, collection), indent=2)
827
836
 
828
837
 
838
+ @mcp.tool()
839
+ def daily_overdue(
840
+ date: str | None = None,
841
+ collection: str | None = None,
842
+ ) -> str:
843
+ """Insert or refresh the overdue / due-today task block in a daily note.
844
+
845
+ Rewrites the block in place if it is already present, so repeated calls
846
+ are safe. Creates the daily note if it doesn't exist.
847
+
848
+ Args:
849
+ date: Date for the daily note (default: today).
850
+ collection: Collection name, UUID, or path.
851
+ """
852
+ args = ["daily", "overdue"]
853
+ if date:
854
+ args += [date]
855
+ return json.dumps(run_fn(args, collection), indent=2)
856
+
857
+
858
+ @mcp.tool()
859
+ def daily_summary(
860
+ date: str | None = None,
861
+ collection: str | None = None,
862
+ ) -> str:
863
+ """Insert or refresh the activity summary block in a daily note.
864
+
865
+ Summarises the notes touched on that day. Rewrites the block in place if
866
+ it is already present, so repeated calls are safe. Creates the daily note
867
+ if it doesn't exist.
868
+
869
+ Args:
870
+ date: Date for the daily note (default: today).
871
+ collection: Collection name, UUID, or path.
872
+ """
873
+ args = ["daily", "summary"]
874
+ if date:
875
+ args += [date]
876
+ return json.dumps(run_fn(args, collection), indent=2)
877
+
878
+
829
879
  # ---- Collections ----
830
880
 
831
881
  @mcp.tool()
@@ -1108,7 +1158,10 @@ def strip_context(name: str, collection: str | None = None) -> str:
1108
1158
 
1109
1159
  @mcp.tool()
1110
1160
  def list_attachments(collection: str | None = None) -> str:
1111
- """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.
1112
1165
 
1113
1166
  Args:
1114
1167
  collection: Collection name, UUID, or path.
@@ -1118,7 +1171,9 @@ def list_attachments(collection: str | None = None) -> str:
1118
1171
 
1119
1172
  @mcp.tool()
1120
1173
  def orphan_attachments(collection: str | None = None) -> str:
1121
- """List images that no note references.
1174
+ """List attachments that no note references.
1175
+
1176
+ Covers documents and audio as well as images.
1122
1177
 
1123
1178
  Args:
1124
1179
  collection: Collection name, UUID, or path.
@@ -1128,10 +1183,14 @@ def orphan_attachments(collection: str | None = None) -> str:
1128
1183
 
1129
1184
  @mcp.tool()
1130
1185
  def prune_attachments(force: bool = False, collection: str | None = None) -> str:
1131
- """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.
1132
1191
 
1133
1192
  Args:
1134
- force: Actually delete the orphaned images (default: dry-run).
1193
+ force: Actually delete the orphaned attachments (default: dry-run).
1135
1194
  collection: Collection name, UUID, or path.
1136
1195
  """
1137
1196
  args = ["attachments", "prune"]
File without changes
File without changes
File without changes