foldnotes-mcp 2.4.1__tar.gz → 2.5.0__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
1
  Metadata-Version: 2.5
2
2
  Name: foldnotes-mcp
3
- Version: 2.4.1
3
+ Version: 2.5.0
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.1"
29
+ __version__ = "2.5.0"
30
30
 
31
31
  import json
32
32
  import os
@@ -126,6 +126,11 @@ def _task_selector(text: str | None, task_id: str | None) -> list[str] | None:
126
126
  return None
127
127
 
128
128
 
129
+ def _note_args(note: str | None) -> list[str]:
130
+ """`--note` only when a note was named; `fn` then searches every note."""
131
+ return ["--note", note] if note else []
132
+
133
+
129
134
  # ---------------------------------------------------------------------------
130
135
  # MCP Server
131
136
  # ---------------------------------------------------------------------------
@@ -264,18 +269,25 @@ def create_note(
264
269
  content: str | None = None,
265
270
  tags: list[str] | None = None,
266
271
  properties: list[str] | None = None,
272
+ favourite: bool = False,
267
273
  collection: str | None = None,
268
274
  ) -> str:
269
275
  """Create a new note with optional content, tags, and properties.
270
276
 
277
+ The title is the note's name and is locked, so the note is never renamed
278
+ to follow its first heading.
279
+
271
280
  Args:
272
281
  title: Note title (becomes the filename).
273
282
  content: Note body content (markdown).
274
283
  tags: Tags to add (without #).
275
284
  properties: User properties as key=value strings.
285
+ favourite: Mark the new note as a favourite.
276
286
  collection: Collection name, UUID, or path.
277
287
  """
278
288
  args = ["create", title]
289
+ if favourite:
290
+ args.append("--favourite")
279
291
  if content:
280
292
  args += ["--content", content]
281
293
  for t in tags or []:
@@ -454,12 +466,42 @@ def list_tags(
454
466
  return json.dumps(run_fn(args, collection), indent=2)
455
467
 
456
468
 
469
+ # ---- Tags: Rename ----
470
+
471
+ @mcp.tool()
472
+ def rename_tag(
473
+ old_tag: str,
474
+ new_tag: str,
475
+ merge: bool = False,
476
+ collection: str | None = None,
477
+ ) -> str:
478
+ """Rename a tag, or move it under another parent, in every note that uses it.
479
+
480
+ Child tags move with it (renaming `work` also renames `work/clients`), notes
481
+ in the Trash are updated too, and manual-sort order and the tag's icon are
482
+ kept. Renaming onto a tag that already exists merges the two, which is
483
+ refused unless `merge` is true.
484
+
485
+ Args:
486
+ old_tag: Existing tag path, e.g. "work/clients" (with or without #).
487
+ new_tag: New tag path, e.g. "clients".
488
+ merge: Allow merging into a tag that already exists.
489
+ collection: Collection name, UUID, or path.
490
+ """
491
+ args = ["tags", "rename", old_tag, new_tag]
492
+ if merge:
493
+ args.append("--merge")
494
+ return json.dumps(run_fn(args, collection), indent=2)
495
+
496
+
457
497
  # ---- Tasks: List ----
458
498
 
459
499
  @mcp.tool()
460
500
  def list_tasks(
461
501
  due_today: bool = False,
502
+ due_tomorrow: bool = False,
462
503
  due_this_week: bool = False,
504
+ days: int | None = None,
463
505
  overdue: bool = False,
464
506
  status: str | None = None,
465
507
  priority: str | None = None,
@@ -474,8 +516,11 @@ def list_tasks(
474
516
  """List tasks across all notes with filtering.
475
517
 
476
518
  Args:
477
- due_today: Show only tasks due today.
478
- due_this_week: Show tasks due this week.
519
+ due_today: Show tasks due today and not yet overdue (a task due today
520
+ becomes overdue at 5 PM). Several due filters combine as "any of".
521
+ due_tomorrow: Show tasks due tomorrow.
522
+ due_this_week: Show tasks due this week (today and the next six days).
523
+ days: Show tasks due in the next N days, counting today.
479
524
  overdue: Show only overdue tasks.
480
525
  status: Filter by status: not-started, in-progress, done, cancelled.
481
526
  priority: Filter by priority: high, medium, low.
@@ -490,8 +535,12 @@ def list_tasks(
490
535
  args = ["tasks"]
491
536
  if due_today:
492
537
  args.append("--due-today")
538
+ if due_tomorrow:
539
+ args.append("--due-tomorrow")
493
540
  if due_this_week:
494
541
  args.append("--due-this-week")
542
+ if days:
543
+ args += ["--days", str(days)]
495
544
  if overdue:
496
545
  args.append("--overdue")
497
546
  if status:
@@ -518,25 +567,26 @@ def list_tasks(
518
567
  @mcp.tool()
519
568
  def add_task(
520
569
  text: str,
521
- note: str,
570
+ note: str | None = None,
522
571
  due: str | None = None,
523
572
  priority: str | None = None,
524
573
  project: str | None = None,
525
574
  context: str | None = None,
526
575
  collection: str | None = None,
527
576
  ) -> str:
528
- """Add a new task to a note.
577
+ """Add a new task to a note, or to today's daily note.
529
578
 
530
579
  Args:
531
580
  text: Task description text.
532
- note: Target note title to add the task to.
581
+ note: Target note title. Omit to add the task to the end of today's
582
+ daily note (created if needed) — the same rule as Siri's Add Task.
533
583
  due: Due date (YYYY-MM-DD, 'today', 'tomorrow', 'next monday', etc.).
534
584
  priority: Priority level: high, medium, low.
535
585
  project: Project name for the task.
536
586
  context: Context(s) for the task; comma-separate for several (e.g. "errand,phone").
537
587
  collection: Collection name, UUID, or path.
538
588
  """
539
- args = ["tasks", "add", text, "--note", note]
589
+ args = ["tasks", "add", text] + _note_args(note)
540
590
  if due:
541
591
  args += ["--due", due]
542
592
  if priority:
@@ -552,7 +602,7 @@ def add_task(
552
602
 
553
603
  @mcp.tool()
554
604
  def complete_task(
555
- note: str,
605
+ note: str | None = None,
556
606
  text: str | None = None,
557
607
  task_id: str | None = None,
558
608
  collection: str | None = None,
@@ -562,7 +612,9 @@ def complete_task(
562
612
  Identify the task by `task_id` (exact, preferred) or `text` (substring).
563
613
 
564
614
  Args:
565
- note: Note title containing the task.
615
+ note: Note title containing the task. Optional — without it the task is
616
+ found across all notes, and a text match in more than one note is
617
+ refused (the error lists the candidates; pass task_id).
566
618
  text: Task text to match (case-insensitive substring). Must match exactly
567
619
  one task; if several match, the command is refused — pass task_id.
568
620
  task_id: Exact task UUID from `list_tasks`. Preferred — it targets the
@@ -572,14 +624,14 @@ def complete_task(
572
624
  sel = _task_selector(text, task_id)
573
625
  if sel is None:
574
626
  return json.dumps({"error": "Provide either text or task_id."}, indent=2)
575
- return json.dumps(run_fn(["tasks", "complete"] + sel + ["--note", note], collection), indent=2)
627
+ return json.dumps(run_fn(["tasks", "complete"] + sel + _note_args(note), collection), indent=2)
576
628
 
577
629
 
578
630
  # ---- Tasks: Cancel ----
579
631
 
580
632
  @mcp.tool()
581
633
  def cancel_task(
582
- note: str,
634
+ note: str | None = None,
583
635
  text: str | None = None,
584
636
  task_id: str | None = None,
585
637
  collection: str | None = None,
@@ -589,7 +641,9 @@ def cancel_task(
589
641
  Identify the task by `task_id` (exact, preferred) or `text` (substring).
590
642
 
591
643
  Args:
592
- note: Note title containing the task.
644
+ note: Note title containing the task. Optional — without it the task is
645
+ found across all notes, and a text match in more than one note is
646
+ refused (the error lists the candidates; pass task_id).
593
647
  text: Task text to match (case-insensitive substring). Must match exactly
594
648
  one task; if several match, the command is refused — pass task_id.
595
649
  task_id: Exact task UUID from `list_tasks`. Preferred — it targets the
@@ -599,14 +653,14 @@ def cancel_task(
599
653
  sel = _task_selector(text, task_id)
600
654
  if sel is None:
601
655
  return json.dumps({"error": "Provide either text or task_id."}, indent=2)
602
- return json.dumps(run_fn(["tasks", "cancel"] + sel + ["--note", note], collection), indent=2)
656
+ return json.dumps(run_fn(["tasks", "cancel"] + sel + _note_args(note), collection), indent=2)
603
657
 
604
658
 
605
659
  # ---- Tasks: Progress ----
606
660
 
607
661
  @mcp.tool()
608
662
  def start_task(
609
- note: str,
663
+ note: str | None = None,
610
664
  text: str | None = None,
611
665
  task_id: str | None = None,
612
666
  collection: str | None = None,
@@ -616,7 +670,9 @@ def start_task(
616
670
  Identify the task by `task_id` (exact, preferred) or `text` (substring).
617
671
 
618
672
  Args:
619
- note: Note title containing the task.
673
+ note: Note title containing the task. Optional — without it the task is
674
+ found across all notes, and a text match in more than one note is
675
+ refused (the error lists the candidates; pass task_id).
620
676
  text: Task text to match (case-insensitive substring). Must match exactly
621
677
  one task; if several match, the command is refused — pass task_id.
622
678
  task_id: Exact task UUID from `list_tasks`. Preferred — it targets the
@@ -626,14 +682,14 @@ def start_task(
626
682
  sel = _task_selector(text, task_id)
627
683
  if sel is None:
628
684
  return json.dumps({"error": "Provide either text or task_id."}, indent=2)
629
- return json.dumps(run_fn(["tasks", "progress"] + sel + ["--note", note], collection), indent=2)
685
+ return json.dumps(run_fn(["tasks", "progress"] + sel + _note_args(note), collection), indent=2)
630
686
 
631
687
 
632
688
  # ---- Tasks: Reset ----
633
689
 
634
690
  @mcp.tool()
635
691
  def reset_task(
636
- note: str,
692
+ note: str | None = None,
637
693
  text: str | None = None,
638
694
  task_id: str | None = None,
639
695
  collection: str | None = None,
@@ -643,7 +699,9 @@ def reset_task(
643
699
  Identify the task by `task_id` (exact, preferred) or `text` (substring).
644
700
 
645
701
  Args:
646
- note: Note title containing the task.
702
+ note: Note title containing the task. Optional — without it the task is
703
+ found across all notes, and a text match in more than one note is
704
+ refused (the error lists the candidates; pass task_id).
647
705
  text: Task text to match (case-insensitive substring). Must match exactly
648
706
  one task; if several match, the command is refused — pass task_id.
649
707
  task_id: Exact task UUID from `list_tasks`. Preferred — it targets the
@@ -653,14 +711,14 @@ def reset_task(
653
711
  sel = _task_selector(text, task_id)
654
712
  if sel is None:
655
713
  return json.dumps({"error": "Provide either text or task_id."}, indent=2)
656
- return json.dumps(run_fn(["tasks", "reset"] + sel + ["--note", note], collection), indent=2)
714
+ return json.dumps(run_fn(["tasks", "reset"] + sel + _note_args(note), collection), indent=2)
657
715
 
658
716
 
659
717
  # ---- Tasks: Set (amend due / priority / project) ----
660
718
 
661
719
  @mcp.tool()
662
720
  def set_task(
663
- note: str,
721
+ note: str | None = None,
664
722
  text: str | None = None,
665
723
  task_id: str | None = None,
666
724
  due: str | None = None,
@@ -680,7 +738,9 @@ def set_task(
680
738
  task's stable UUID (identity is hashed over the prose, not the metadata).
681
739
 
682
740
  Args:
683
- note: Note title containing the task.
741
+ note: Note title containing the task. Optional — without it the task is
742
+ found across all notes, and a text match in more than one note is
743
+ refused (the error lists the candidates; pass task_id).
684
744
  text: Task text to match (case-insensitive substring). Must match exactly
685
745
  one task; if several match, the command is refused — pass task_id.
686
746
  task_id: Exact task UUID from `list_tasks`. Preferred.
@@ -697,7 +757,7 @@ def set_task(
697
757
  sel = _task_selector(text, task_id)
698
758
  if sel is None:
699
759
  return json.dumps({"error": "Provide either text or task_id."}, indent=2)
700
- args = ["tasks", "set"] + sel + ["--note", note]
760
+ args = ["tasks", "set"] + sel + _note_args(note)
701
761
  if due:
702
762
  args += ["--due", due]
703
763
  if clear_due:
@@ -721,7 +781,7 @@ def set_task(
721
781
 
722
782
  @mcp.tool()
723
783
  def remove_task(
724
- note: str,
784
+ note: str | None = None,
725
785
  text: str | None = None,
726
786
  task_id: str | None = None,
727
787
  collection: str | None = None,
@@ -734,7 +794,9 @@ def remove_task(
734
794
  `list_tasks` first when matching by text. Surviving tasks keep their UUIDs.
735
795
 
736
796
  Args:
737
- note: Note title containing the task.
797
+ note: Note title containing the task. Optional — without it the task is
798
+ found across all notes, and a text match in more than one note is
799
+ refused (the error lists the candidates; pass task_id).
738
800
  text: Task text to match (case-insensitive substring). Must match exactly
739
801
  one task; if several match, the command is refused — pass task_id.
740
802
  task_id: Exact task UUID from `list_tasks`. Preferred.
@@ -743,7 +805,7 @@ def remove_task(
743
805
  sel = _task_selector(text, task_id)
744
806
  if sel is None:
745
807
  return json.dumps({"error": "Provide either text or task_id."}, indent=2)
746
- return json.dumps(run_fn(["tasks", "remove"] + sel + ["--note", note], collection), indent=2)
808
+ return json.dumps(run_fn(["tasks", "remove"] + sel + _note_args(note), collection), indent=2)
747
809
 
748
810
 
749
811
  # ---- Tasks: Projects ----
File without changes
File without changes
File without changes