foldnotes-mcp 2.2.0__tar.gz → 2.3.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.
@@ -0,0 +1,9 @@
1
+ venv/
2
+ __pycache__/
3
+ *.pyc
4
+ .DS_Store
5
+
6
+ # Python build artifacts
7
+ build/
8
+ dist/
9
+ *.egg-info/
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: foldnotes-mcp
3
- Version: 2.2.0
3
+ Version: 2.3.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.2.0"
29
+ __version__ = "2.3.1"
30
30
 
31
31
  import json
32
32
  import os
@@ -456,6 +456,9 @@ def list_tasks(
456
456
  priority: str | None = None,
457
457
  note: str | None = None,
458
458
  project: str | None = None,
459
+ context: str | None = None,
460
+ no_project: bool = False,
461
+ no_context: bool = False,
459
462
  all: bool = False,
460
463
  collection: str | None = None,
461
464
  ) -> str:
@@ -469,6 +472,9 @@ def list_tasks(
469
472
  priority: Filter by priority: high, medium, low.
470
473
  note: Filter by note title.
471
474
  project: Filter by project name.
475
+ context: Filter by context (tasks carrying this context).
476
+ no_project: Only tasks with no project assigned (inline or inherited).
477
+ no_context: Only tasks with no context assigned.
472
478
  all: Include done and cancelled tasks.
473
479
  collection: Collection name, UUID, or path.
474
480
  """
@@ -487,6 +493,12 @@ def list_tasks(
487
493
  args += ["--note", note]
488
494
  if project:
489
495
  args += ["--project", project]
496
+ if context:
497
+ args += ["--context", context]
498
+ if no_project:
499
+ args.append("--no-project")
500
+ if no_context:
501
+ args.append("--no-context")
490
502
  if all:
491
503
  args.append("--all")
492
504
  return json.dumps(run_fn(args, collection), indent=2)
@@ -501,6 +513,7 @@ def add_task(
501
513
  due: str | None = None,
502
514
  priority: str | None = None,
503
515
  project: str | None = None,
516
+ context: str | None = None,
504
517
  collection: str | None = None,
505
518
  ) -> str:
506
519
  """Add a new task to a note.
@@ -511,6 +524,7 @@ def add_task(
511
524
  due: Due date (YYYY-MM-DD, 'today', 'tomorrow', 'next monday', etc.).
512
525
  priority: Priority level: high, medium, low.
513
526
  project: Project name for the task.
527
+ context: Context(s) for the task; comma-separate for several (e.g. "errand,phone").
514
528
  collection: Collection name, UUID, or path.
515
529
  """
516
530
  args = ["tasks", "add", text, "--note", note]
@@ -520,6 +534,8 @@ def add_task(
520
534
  args += ["--priority", priority]
521
535
  if project:
522
536
  args += ["--project", project]
537
+ if context:
538
+ args += ["--context", context]
523
539
  return json.dumps(run_fn(args, collection), indent=2)
524
540
 
525
541
 
@@ -644,9 +660,11 @@ def set_task(
644
660
  clear_priority: bool = False,
645
661
  project: str | None = None,
646
662
  clear_project: bool = False,
663
+ context: str | None = None,
664
+ clear_context: bool = False,
647
665
  collection: str | None = None,
648
666
  ) -> str:
649
- """Amend an existing task's due date, priority, or project.
667
+ """Amend an existing task's due date, priority, project, or context.
650
668
 
651
669
  Identify the task by `task_id` (exact, preferred) or `text` (substring),
652
670
  then pass at least one field to change. Amending metadata preserves the
@@ -663,6 +681,8 @@ def set_task(
663
681
  clear_priority: Remove the priority.
664
682
  project: New project name.
665
683
  clear_project: Remove the project.
684
+ context: New context(s), replacing any existing; comma-separate for several.
685
+ clear_context: Remove all contexts.
666
686
  collection: Collection name, UUID, or path.
667
687
  """
668
688
  sel = _task_selector(text, task_id)
@@ -681,6 +701,10 @@ def set_task(
681
701
  args += ["--project", project]
682
702
  if clear_project:
683
703
  args += ["--clear-project"]
704
+ if context:
705
+ args += ["--context", context]
706
+ if clear_context:
707
+ args += ["--clear-context"]
684
708
  return json.dumps(run_fn(args, collection), indent=2)
685
709
 
686
710
 
@@ -725,6 +749,16 @@ def list_projects(collection: str | None = None) -> str:
725
749
  return json.dumps(run_fn(["tasks", "projects"], collection), indent=2)
726
750
 
727
751
 
752
+ @mcp.tool()
753
+ def list_contexts(collection: str | None = None) -> str:
754
+ """List all task contexts with task counts (derived from task metadata).
755
+
756
+ Args:
757
+ collection: Collection name, UUID, or path.
758
+ """
759
+ return json.dumps(run_fn(["tasks", "contexts"], collection), indent=2)
760
+
761
+
728
762
  # ---- Backlinks ----
729
763
 
730
764
  @mcp.tool()
@@ -1039,6 +1073,39 @@ def strip_project(name: str, collection: str | None = None) -> str:
1039
1073
  return json.dumps(run_fn(["projects", "strip", name], collection), indent=2)
1040
1074
 
1041
1075
 
1076
+ @mcp.tool()
1077
+ def rename_context(
1078
+ old_name: str,
1079
+ new_name: str,
1080
+ collection: str | None = None,
1081
+ ) -> str:
1082
+ """Rename a task context across the whole collection.
1083
+
1084
+ Renames the one entry within each task's context list, deduping if the new
1085
+ name is already present, and leaves any other contexts on the line intact.
1086
+
1087
+ Args:
1088
+ old_name: Existing context name.
1089
+ new_name: New context name.
1090
+ collection: Collection name, UUID, or path.
1091
+ """
1092
+ return json.dumps(run_fn(["contexts", "rename", old_name, new_name], collection), indent=2)
1093
+
1094
+
1095
+ @mcp.tool()
1096
+ def strip_context(name: str, collection: str | None = None) -> str:
1097
+ """Remove a task context across the whole collection.
1098
+
1099
+ Removes the one entry from each task's context list, dropping the token
1100
+ entirely only when it was the last context on the line.
1101
+
1102
+ Args:
1103
+ name: Context name to strip.
1104
+ collection: Collection name, UUID, or path.
1105
+ """
1106
+ return json.dumps(run_fn(["contexts", "strip", name], collection), indent=2)
1107
+
1108
+
1042
1109
  @mcp.tool()
1043
1110
  def list_attachments(collection: str | None = None) -> str:
1044
1111
  """List images with size and reference count.
@@ -1,4 +0,0 @@
1
- venv/
2
- __pycache__/
3
- *.pyc
4
- .DS_Store
File without changes
File without changes