Skip to content

Commit 72fd8a3

Browse files
committed
feat: add create and delete note commands
- Add src/applescript.ts for AppleScript automation - Add 'notes create' and 'notes delete' CLI commands - Add create_note and delete_note MCP tools - Add /notes:create and /notes:delete slash commands - Update skill triggers for create/delete - Update documentation
1 parent c3be22c commit 72fd8a3

10 files changed

Lines changed: 431 additions & 23 deletions

File tree

CLAUDE.md

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -18,17 +18,18 @@ make clean # Remove dist/ and node_modules/
1818

1919
## Architecture
2020

21-
Dual-mode CLI/MCP tool for searching Apple Notes:
21+
Dual-mode CLI/MCP tool for searching and managing Apple Notes:
2222

2323
```
2424
src/
25-
├── index.ts # Entry point - routes to CLI or MCP mode based on --mcp flag
26-
├── cli.ts # Commander-based CLI (search, recent, folders, read commands)
27-
├── mcp.ts # MCP server exposing tools via @modelcontextprotocol/sdk
28-
├── indexer.ts # Builds search indexes from Apple Notes database
29-
├── searcher.ts # Queries indexes with fuzzy matching via MiniSearch
30-
├── formatter.ts # Terminal output formatting with chalk
31-
└── types.ts # Shared types and Apple date conversion utilities
25+
├── index.ts # Entry point - routes to CLI or MCP mode based on --mcp flag
26+
├── cli.ts # Commander-based CLI (search, recent, folders, read, create, delete commands)
27+
├── mcp.ts # MCP server exposing tools via @modelcontextprotocol/sdk
28+
├── applescript.ts # AppleScript automation for create/delete operations
29+
├── indexer.ts # Builds search indexes from Apple Notes database
30+
├── searcher.ts # Queries indexes with fuzzy matching via MiniSearch
31+
├── formatter.ts # Terminal output formatting with chalk
32+
└── types.ts # Shared types and Apple date conversion utilities
3233
```
3334

3435
**Data flow:**
@@ -57,7 +58,9 @@ commands/
5758
├── recent.md # /notes:recent slash command
5859
├── folders.md # /notes:folders slash command
5960
├── folder.md # /notes:folder slash command
60-
└── read.md # /notes:read slash command
61+
├── read.md # /notes:read slash command
62+
├── create.md # /notes:create slash command
63+
└── delete.md # /notes:delete slash command
6164
```
6265

6366
## Releasing

README.md

Lines changed: 112 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,22 +6,72 @@ CLI and MCP server to search and browse Apple Notes with fuzzy matching.
66

77
- **Fuzzy search** - Find notes even with typos using MiniSearch
88
- **Full-text search** - Searches note titles, snippets, and body content
9+
- **Create & delete notes** - Manage notes via AppleScript automation
910
- **PDF text extraction** - Automatically extracts and indexes text from PDF attachments
1011
- **Folder browsing** - List and filter notes by folder
1112
- **Fast indexing** - SQLite FTS5 + MiniSearch for quick searches across thousands of notes
1213
- **Dual mode** - Use as CLI tool or MCP server for Claude Code integration
1314

1415
## Installation
1516

17+
### Homebrew
18+
19+
```bash
20+
brew install cardmagic/tap/notes
21+
```
22+
23+
### npm
24+
1625
```bash
17-
# Install globally
1826
npm install -g @cardmagic/notes
27+
```
1928

20-
# Or with pnpm
21-
pnpm add -g @cardmagic/notes
29+
### Claude Code Plugin (recommended)
30+
31+
Install as a plugin to get skills (auto-invoked) and slash commands:
32+
33+
```bash
34+
# Add the marketplace
35+
claude plugin marketplace add cardmagic/notes
36+
37+
# Install the plugin
38+
claude plugin install notes@cardmagic
2239
```
2340

24-
### Requirements
41+
This gives you:
42+
- **Skill**: Claude automatically searches notes when you ask about notes
43+
- **Slash commands**: `/notes:search`, `/notes:recent`, `/notes:folders`, and more
44+
45+
### MCP Server
46+
47+
For direct MCP tool access without the plugin:
48+
49+
```bash
50+
claude mcp add --transport stdio notes -- npx -y @cardmagic/notes --mcp
51+
```
52+
53+
Or install globally first:
54+
55+
```bash
56+
npm install -g @cardmagic/notes
57+
claude mcp add --transport stdio notes -- notes --mcp
58+
```
59+
60+
### From source
61+
62+
```bash
63+
git clone https://github.com/cardmagic/notes.git
64+
cd notes
65+
make install
66+
67+
# Then add as plugin OR MCP server:
68+
claude plugin marketplace add cardmagic/notes
69+
claude plugin install notes@cardmagic
70+
# OR
71+
claude mcp add --transport stdio notes -- notes --mcp
72+
```
73+
74+
## Requirements
2575

2676
- **macOS** - Reads from Apple Notes database
2777
- **Full Disk Access** - Terminal/IDE needs access to `~/Library/Group Containers/`
@@ -32,6 +82,14 @@ pnpm add -g @cardmagic/notes
3282
brew install poppler
3383
```
3484

85+
## Granting Full Disk Access
86+
87+
The tool needs to read your Notes database at `~/Library/Group Containers/group.com.apple.notes/`:
88+
89+
1. Open **System Settings** > **Privacy & Security** > **Full Disk Access**
90+
2. Click **+** and add your terminal app (Terminal.app, iTerm, Warp, etc.)
91+
3. Restart your terminal
92+
3593
## CLI Usage
3694

3795
### Search notes
@@ -72,6 +130,26 @@ notes folder "Work" --limit 20
72130
notes read 12345
73131
```
74132

133+
### Create a note
134+
135+
```bash
136+
# Create a new note in the default "Notes" folder
137+
notes create "Meeting Notes" --body "Agenda items for today..."
138+
139+
# Create in a specific folder
140+
notes create "Shopping List" --body "Milk, eggs, bread" --folder "Personal"
141+
```
142+
143+
### Delete a note
144+
145+
```bash
146+
# Delete a note by title
147+
notes delete "Old Meeting Notes"
148+
149+
# Delete from a specific folder (useful if multiple notes have the same title)
150+
notes delete "Draft" --folder "Work"
151+
```
152+
75153
### Manage index
76154

77155
```bash
@@ -91,6 +169,28 @@ The index uses **incremental updates** by default:
91169
- Detects and removes deleted notes
92170
- Much faster than full rebuild for small changes
93171

172+
## Claude Code Plugin
173+
174+
When installed as a plugin, you get:
175+
176+
**Skill** (auto-invoked): Claude automatically searches notes when you ask things like:
177+
- "What's in my notes about recipes?"
178+
- "Find my notes about the project"
179+
- "Create a note about the meeting"
180+
- "Delete my draft notes"
181+
182+
**Slash Commands**:
183+
184+
| Command | Description |
185+
|---------|-------------|
186+
| `/notes:search <query>` | Fuzzy search with optional filters |
187+
| `/notes:recent` | Show recently modified notes |
188+
| `/notes:folders` | List all folders with note counts |
189+
| `/notes:folder "Name"` | List notes in a specific folder |
190+
| `/notes:read <id>` | Read full note content by ID |
191+
| `/notes:create <title>` | Create a new note |
192+
| `/notes:delete <title>` | Delete a note by title |
193+
94194
## MCP Server
95195

96196
Run as an MCP server for Claude Code integration:
@@ -109,17 +209,19 @@ notes --mcp
109209
| `list_folders` | List all folders with note counts |
110210
| `notes_in_folder` | List notes in a specific folder |
111211
| `get_note_stats` | Get index statistics |
212+
| `create_note` | Create a new note |
213+
| `delete_note` | Delete a note by title |
112214

113-
### Claude Code Configuration
215+
### Manual MCP Configuration
114216

115-
Add to your MCP settings:
217+
For Claude Desktop or VS Code, add to your MCP configuration:
116218

117219
```json
118220
{
119221
"mcpServers": {
120222
"notes": {
121-
"command": "notes",
122-
"args": ["--mcp"]
223+
"command": "npx",
224+
"args": ["-y", "@cardmagic/notes", "--mcp"]
123225
}
124226
}
125227
}
@@ -187,6 +289,7 @@ src/
187289
├── index.ts # Entry point - routes to CLI or MCP
188290
├── cli.ts # Commander-based CLI
189291
├── mcp.ts # MCP server implementation
292+
├── applescript.ts # AppleScript automation for create/delete
190293
├── indexer.ts # Builds search indexes from Notes database
191294
├── searcher.ts # Query engine with fuzzy matching
192295
├── attachments.ts # PDF text extraction
@@ -196,7 +299,7 @@ src/
196299

197300
## Privacy
198301

199-
This tool only reads your local Notes database. No data is sent externally. The search index is stored locally in `~/.notes/`.
302+
This tool accesses your local Notes database for reading and uses AppleScript to create/delete notes. No data is sent externally. The search index is stored locally in `~/.notes/`.
200303

201304
## License
202305

commands/create.md

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
---
2+
description: Create a new Apple Note
3+
allowed-tools: Bash(notes:*)
4+
argument-hint: <title> --body "content" [--folder "Folder"]
5+
---
6+
7+
# Create Note
8+
9+
Create a new note in Apple Notes.
10+
11+
## Instructions
12+
13+
1. Check if the notes CLI is installed:
14+
```bash
15+
command -v notes || pnpm add -g @cardmagic/notes
16+
```
17+
18+
2. Create the note:
19+
```bash
20+
notes create "$ARGUMENTS"
21+
```
22+
23+
## Examples
24+
25+
- `/notes:create "Meeting Notes" --body "Agenda items..."` - Create a note with content
26+
- `/notes:create "Shopping List" --body "Milk, Eggs" --folder "Personal"` - Create in specific folder

commands/delete.md

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
---
2+
description: Delete an Apple Note by title
3+
allowed-tools: Bash(notes:*)
4+
argument-hint: <title> [--folder "Folder"]
5+
---
6+
7+
# Delete Note
8+
9+
Delete a note from Apple Notes by its title.
10+
11+
## Instructions
12+
13+
1. Check if the notes CLI is installed:
14+
```bash
15+
command -v notes || pnpm add -g @cardmagic/notes
16+
```
17+
18+
2. Delete the note:
19+
```bash
20+
notes delete "$ARGUMENTS"
21+
```
22+
23+
## Examples
24+
25+
- `/notes:delete "Old Meeting Notes"` - Delete a note by title
26+
- `/notes:delete "Draft" --folder "Work"` - Delete from specific folder (useful if multiple notes have the same title)

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@cardmagic/notes",
3-
"version": "1.0.1",
3+
"version": "1.1.0",
44
"description": "CLI and MCP server to search and browse Apple Notes",
55
"author": {
66
"name": "Lucas Carlson"

server.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,12 @@
66
"url": "https://github.com/cardmagic/notes",
77
"source": "github"
88
},
9-
"version": "1.0.0",
9+
"version": "1.1.0",
1010
"packages": [
1111
{
1212
"registryType": "npm",
1313
"identifier": "@cardmagic/notes",
14-
"version": "1.0.0",
14+
"version": "1.1.0",
1515
"transport": {
1616
"type": "stdio"
1717
}

skills/notes/SKILL.md

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
name: notes
3-
description: Search and browse Apple Notes. Use when user asks about notes, wants to find something in notes, or list their notes.
3+
description: Search, browse, create, and delete Apple Notes. Use when user asks about notes, wants to find something in notes, create a new note, or delete notes.
44
triggers:
55
- "notes"
66
- "apple notes"
@@ -9,11 +9,16 @@ triggers:
99
- "my notes"
1010
- "list notes"
1111
- "read note"
12+
- "create note"
13+
- "add note"
14+
- "new note"
15+
- "delete note"
16+
- "remove note"
1217
---
1318

1419
# Apple Notes Skill
1520

16-
Search and browse Apple Notes with fuzzy matching.
21+
Search, browse, create, and delete Apple Notes with fuzzy matching.
1722

1823
## Prerequisites
1924

@@ -62,9 +67,21 @@ notes stats
6267
notes index [-f|--force]
6368
```
6469

70+
### Create a note
71+
```bash
72+
notes create "Title" --body "Content" [--folder "Folder"]
73+
```
74+
75+
### Delete a note
76+
```bash
77+
notes delete "Title" [--folder "Folder"]
78+
```
79+
6580
## Examples
6681

6782
- Search for "recipe": `notes search "recipe"`
6883
- Recent notes: `notes recent`
6984
- Notes in Taxes folder: `notes folder Taxes`
7085
- Read note ID 123: `notes read 123`
86+
- Create a note: `notes create "Meeting Notes" --body "Agenda items..."`
87+
- Delete a note: `notes delete "Old Draft"`

0 commit comments

Comments
 (0)