Skip to content

Add notes_create and notes_create_folder behind a Notes setting - #339

Closed
oliverames wants to merge 5 commits into
mattt:mainfrom
oliverames:feat/notes-create
Closed

oliverames wants to merge 5 commits into
mattt:mainfrom
oliverames:feat/notes-create

Conversation

@oliverames

@oliverames oliverames commented Nov 16, 2026 •

Copy link
Copy Markdown
Contributor

What it does and why

Notes is read-only in iMCP, so an agent can't save what it finds or drafts. This adds notes_create and notes_create_folder, using AppleScript and nothing else: no helper app, no Shortcuts, and no private APIs. It follows what Mattt suggested on #311, which is to start with creating notes and folders and discuss updates separately. sweetrb/apple-notes-mcp was the design reference for what a Notes MCP should cover.

What changed

  • Both tools are off by default. A switch on the Notes settings page, "Allow iMCP to create notes and folders", enables them and notifies clients of the tool list change. While it's off the tools are hidden, and a stale client that calls one gets an error and no script runs.
  • Both entitlements files (App/App.entitlements and App/App.Debug.entitlements) declare com.apple.security.automation.apple-events alongside com.apple.Notes in the Apple Events temporary exception list. App/Info.plist updates the Apple Events usage description. The entitlement was added after @lunaroja's signed-build test traced a failure to its absence.
  • Nothing the caller sends becomes script text. The script is fixed, and each value passes as a handler argument through an Apple event. Inputs are also checked for length, control characters, path depth, and the account name.
  • notes_create takes a title, a body in plaintext, Markdown, or HTML, an optional folder path like Parent/Child, an account, and createMissingFolders. notes_create_folder takes a name, a parent path, and an account. A missing folder is an error unless createMissingFolders is set.
  • Markdown goes through a small converter. As Notes: proposal for limited write support via AppleScript (with round-trip test results) #311 found, Notes drops some structure when written through AppleScript, so links become text (url) and checklists become ☐ and ☑ bullets. The README documents these limits.
  • The title goes only as the first line of body, never as name, which avoids a duplicated title.
  • The only change to existing Notes code is renaming tools to readTools in Notes.swift, so it will need a small rebase after Add Notes filters, accounts, stats, tags, and attachment listing #337.
  • Add an Allow writes setting for each service #342 is stacked on this PR and includes its commits.

Testing

  • Unit tests (NotesWriteTests and others) cover the generated body, the input checks, and a test that sends quotes, do shell script, and end tell in a title through a real handler call. CI lint, the Debug build, and the 204 tests passed when this was written.
  • On my Mac, the script created a folder and a note with quotes and <b> in the title, kept nested bullets, and raised the expected error for a missing subfolder.
  • CI: both builds (macOS 26 with Xcode 26.0, macOS 27 with Xcode 27.0) pass on the current head.

Not verified

  • The full signed, sandboxed path through the app, including the Automation prompt, has not been run by me. @lunaroja has offered to run a signed check on the current head: first-use consent, create and readback through notes_fetch and notes_read, and turning writes off on an existing connection.
  • An exact readback of the stored title and body needs a live Notes app, so no automated test asserts it.

Screenshots

Notes page in Settings

This is the Notes page in the current Settings window of my integration build, whose sidebar still says "Developer & Advanced" (since renamed "Advanced"). "Create Note" and "Create Note Folder" are this PR's. The "Private Notes features" section and the "Allow writes" row come from other work (#342 and a fork-only branch), not from this PR.

@lunaroja

Copy link
Copy Markdown

I tested ea177ab through imcp-server on macOS 27.0.1 with App Sandbox and Hardened Runtime enabled. With the creation switch off, both tools were hidden and direct calls were refused. After enabling them, a notes_create_folder call for a disposable folder in an explicit iCloud account failed before macOS showed a consent prompt. The TCC log identified the missing com.apple.security.automation.apple-events entitlement. A folder-filtered notes_fetch confirmed that the request created nothing.

Could you add com.apple.security.automation.apple-events set to true in both App/App.Debug.entitlements and App/App.entitlements, alongside the existing Notes sandbox exception? Our tested reference implementation includes both entries. In that signed build, a client created a synthetic folder and note and verified the exact title, body, and destination through notes_fetch and notes_read.

That round-trip also caught a title duplication bug in our first version. Passing name to make new note while putting the same title on the first line of body stored the title twice. Using the first line of body alone fixed it. Your draft already uses that form, so an exact readback assertion would help guard against a regression.

I’m happy to run the same signed check on the revised head, including first-use consent, creation and readback, and disabling writes on the existing connection.

Oliver Ames added 5 commits November 17, 2026 12:56
The Notes service is about to create notes and folders through Notes'
scripting interface, which the sandbox permits only for apps listed in
the apple-events exception.
A script built by interpolating text into its source can be changed by
that text. Calling a handler of a fixed script sends each argument as a
typed Apple event descriptor, so no value can alter the script.
Both tools create only. They run handlers of a fixed script in Notes and
pass every value as a parameter. Notes lists them, and runs them, only
while "Allow iMCP to create notes and folders" is on in Notes settings,
which is off by default. Markdown converts to the HTML that Notes keeps.
The README said iMCP never changes notes. Say what the opt-in tools do and
which formatting Notes loses when a note is created through scripting.
@oliverames

Copy link
Copy Markdown
Contributor Author

Thank you for the signed-build test, @lunaroja, and for tracing the failure to the TCC log.

com.apple.security.automation.apple-events is now set to true in both App/App.entitlements and App/App.Debug.entitlements (e0fbfaf), next to the existing Notes exception. The Notes AppleScript passes the title only as the first line of body and never as name, so the duplicated-title bug you hit doesn't apply here.

An exact readback assertion needs a live Notes app, so the unit tests in NotesWriteTests cover the generated body but not the stored note. I'd welcome your signed check on e0fbfaf: first-use consent, create and readback through notes_fetch and notes_read, and turning writes off on an existing connection.

@oliverames

Copy link
Copy Markdown
Contributor Author

Replaced by #384, the same change cut as one PR (on top of #377) so it can merge on its own.

@oliverames oliverames closed this Nov 18, 2026
@oliverames
oliverames deleted the feat/notes-create branch November 18, 2026 21:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants