Coffee: a Markdown notes app for Mac built on AppKit and TextKit 2, with an MCP server in Swift

Hi all. I'm Pedro, and for the past few months I've been building Coffee on my own in Portugal: a Markdown notes app for Mac, iPhone and iPad, written in Swift. It isn't open source, but a few of the choices behind it may be interesting here, and I'm happy to go into detail on any of them.

The editor is AppKit on TextKit 2. No web view. The Markdown stays in the text storage exactly as written, and the styling (headings, hidden markup, tables, folded sections) is done with attributes and custom layout fragments. The one rule I learned the hard way: never touch layoutManager on the text view, or it quietly falls back to TextKit 1. Long notes open by styling what's on screen first and the rest on the next turn of the run loop, so a 250 KB note shows at once.

A shared core package. Parsing, search, file handling, sums and the MCP server live in a SwiftPM package with no UI, kept iOS-clean, so the iPhone and iPad app use the same code. The Mac app is built with SwiftPM and the Command Line Tools rather than an Xcode project.

Sums beside the line. Rent 950 + Food 400 or 2:30 pm Lisbon in Tokyo get their answer drawn at the end of the line, without going into the file. The evaluator is plain Swift, with currencies, units, dates and time zones; every line is worked out again as you type, so it has to stay quick even in long notes.

Diagrams drawn natively. Mermaid flowcharts, sequence, gantt, ER, mind maps and others are laid out and drawn in Swift with Core Graphics, no JavaScript, and say which line is wrong when they can't be drawn.

An MCP server in Swift. A small helper executable inside the app speaks newline-delimited JSON-RPC over stdio, hand-rolled, so Claude and other apps can list, search, read and write notes. Settings are re-read on every request, so turning access off in the app applies at once, and a version is kept before any AI app replaces a note.

Search across 5,000 notes takes about 14 ms, and the app sits at around 50 MB of memory with next to no CPU at rest.

If you're curious: https://coffeetext.app (there's a 14-day trial). I'd love to hear from anyone else doing serious TextKit 2 work, especially around custom layout fragments and large documents.

1 Like