foldnotes-mcp 2.2.0__tar.gz → 2.3.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.
@@ -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.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.2.0"
29
+ __version__ = "2.3.0"
30
30
 
31
31
  import json
32
32
  import os
@@ -456,6 +456,7 @@ 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,
459
460
  all: bool = False,
460
461
  collection: str | None = None,
461
462
  ) -> str:
@@ -469,6 +470,7 @@ def list_tasks(
469
470
  priority: Filter by priority: high, medium, low.
470
471
  note: Filter by note title.
471
472
  project: Filter by project name.
473
+ context: Filter by context (tasks carrying this context).
472
474
  all: Include done and cancelled tasks.
473
475
  collection: Collection name, UUID, or path.
474
476
  """
@@ -487,6 +489,8 @@ def list_tasks(
487
489
  args += ["--note", note]
488
490
  if project:
489
491
  args += ["--project", project]
492
+ if context:
493
+ args += ["--context", context]
490
494
  if all:
491
495
  args.append("--all")
492
496
  return json.dumps(run_fn(args, collection), indent=2)
@@ -501,6 +505,7 @@ def add_task(
501
505
  due: str | None = None,
502
506
  priority: str | None = None,
503
507
  project: str | None = None,
508
+ context: str | None = None,
504
509
  collection: str | None = None,
505
510
  ) -> str:
506
511
  """Add a new task to a note.
@@ -511,6 +516,7 @@ def add_task(
511
516
  due: Due date (YYYY-MM-DD, 'today', 'tomorrow', 'next monday', etc.).
512
517
  priority: Priority level: high, medium, low.
513
518
  project: Project name for the task.
519
+ context: Context(s) for the task; comma-separate for several (e.g. "errand,phone").
514
520
  collection: Collection name, UUID, or path.
515
521
  """
516
522
  args = ["tasks", "add", text, "--note", note]
@@ -520,6 +526,8 @@ def add_task(
520
526
  args += ["--priority", priority]
521
527
  if project:
522
528
  args += ["--project", project]
529
+ if context:
530
+ args += ["--context", context]
523
531
  return json.dumps(run_fn(args, collection), indent=2)
524
532
 
525
533
 
@@ -644,9 +652,11 @@ def set_task(
644
652
  clear_priority: bool = False,
645
653
  project: str | None = None,
646
654
  clear_project: bool = False,
655
+ context: str | None = None,
656
+ clear_context: bool = False,
647
657
  collection: str | None = None,
648
658
  ) -> str:
649
- """Amend an existing task's due date, priority, or project.
659
+ """Amend an existing task's due date, priority, project, or context.
650
660
 
651
661
  Identify the task by `task_id` (exact, preferred) or `text` (substring),
652
662
  then pass at least one field to change. Amending metadata preserves the
@@ -663,6 +673,8 @@ def set_task(
663
673
  clear_priority: Remove the priority.
664
674
  project: New project name.
665
675
  clear_project: Remove the project.
676
+ context: New context(s), replacing any existing; comma-separate for several.
677
+ clear_context: Remove all contexts.
666
678
  collection: Collection name, UUID, or path.
667
679
  """
668
680
  sel = _task_selector(text, task_id)
@@ -681,6 +693,10 @@ def set_task(
681
693
  args += ["--project", project]
682
694
  if clear_project:
683
695
  args += ["--clear-project"]
696
+ if context:
697
+ args += ["--context", context]
698
+ if clear_context:
699
+ args += ["--clear-context"]
684
700
  return json.dumps(run_fn(args, collection), indent=2)
685
701
 
686
702
 
@@ -725,6 +741,16 @@ def list_projects(collection: str | None = None) -> str:
725
741
  return json.dumps(run_fn(["tasks", "projects"], collection), indent=2)
726
742
 
727
743
 
744
+ @mcp.tool()
745
+ def list_contexts(collection: str | None = None) -> str:
746
+ """List all task contexts with task counts (derived from task metadata).
747
+
748
+ Args:
749
+ collection: Collection name, UUID, or path.
750
+ """
751
+ return json.dumps(run_fn(["tasks", "contexts"], collection), indent=2)
752
+
753
+
728
754
  # ---- Backlinks ----
729
755
 
730
756
  @mcp.tool()
@@ -1039,6 +1065,39 @@ def strip_project(name: str, collection: str | None = None) -> str:
1039
1065
  return json.dumps(run_fn(["projects", "strip", name], collection), indent=2)
1040
1066
 
1041
1067
 
1068
+ @mcp.tool()
1069
+ def rename_context(
1070
+ old_name: str,
1071
+ new_name: str,
1072
+ collection: str | None = None,
1073
+ ) -> str:
1074
+ """Rename a task context across the whole collection.
1075
+
1076
+ Renames the one entry within each task's context list, deduping if the new
1077
+ name is already present, and leaves any other contexts on the line intact.
1078
+
1079
+ Args:
1080
+ old_name: Existing context name.
1081
+ new_name: New context name.
1082
+ collection: Collection name, UUID, or path.
1083
+ """
1084
+ return json.dumps(run_fn(["contexts", "rename", old_name, new_name], collection), indent=2)
1085
+
1086
+
1087
+ @mcp.tool()
1088
+ def strip_context(name: str, collection: str | None = None) -> str:
1089
+ """Remove a task context across the whole collection.
1090
+
1091
+ Removes the one entry from each task's context list, dropping the token
1092
+ entirely only when it was the last context on the line.
1093
+
1094
+ Args:
1095
+ name: Context name to strip.
1096
+ collection: Collection name, UUID, or path.
1097
+ """
1098
+ return json.dumps(run_fn(["contexts", "strip", name], collection), indent=2)
1099
+
1100
+
1042
1101
  @mcp.tool()
1043
1102
  def list_attachments(collection: str | None = None) -> str:
1044
1103
  """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