Chromatophore

A remote MCP server that lets AI assistants search and carefully edit my notes, from any device.

Live and in daily use. Tested with Claude, Grok Bot and MCP Inspector. A backup failure alert and a restore drill are next.

An OAuth-secured Model Context Protocol server on Cloudflare Workers. It gives AI assistants scoped, audited access to my Obsidian vaults, which sync from my laptop to object storage.

  • TypeScript
  • Cloudflare Workers
  • Durable Objects
  • R2
  • D1 (SQLite FTS5)
  • Queues
  • KV
  • OAuth 2.1
  • Model Context Protocol
  • rclone
  • Vitest + Miniflare

My work and university notes live in Obsidian on my laptop. I wanted AI assistants on my phone and desktop to read, search and add to those notes without copying the vaults onto every device, and without handing an AI unrestricted write access to years of notes.

  • A Cloudflare Worker that speaks MCP over Streamable HTTP, with the MCP server running in a Durable Object.
  • Eight tools: list vaults, list, read and search notes, list recent AI writes, append to an inbox note, create a note (never overwrites), and edit a note.
  • Its own OAuth provider in front of the MCP endpoint, with GitHub as the upstream sign-in. Only an allowlisted account can finish consent, and there's deliberately no static API token.
  • A sync path from the laptop: each vault is mirrored to its own object-storage bucket by an rclone bisync job every 60 seconds.
  • R2 is the hub. The laptop and the Worker read and write the same objects. The bucket format matches what the sync clients write: vault-relative keys and mtime metadata.
  • Search: D1 with one FTS5 table per vault, kept current from R2 event notifications through a Queue, with a nightly full reconcile as a backstop.
  • Audit: every AI write is logged to D1 with the path, tool, client, etags and size change. Note text is never logged.
  • Ops: Workers rate limiting (about 60 calls a minute per user and client), Workers Logs, and a separate snapshot Worker that copies the buckets nightly with 44-day lifecycle rules.
  • Least privilege by default. Scopes are per vault and per action (read and write are separate, and write doesn't imply read). Every call checks them, the consent page never pre-ticks anything, and the Worker takes the bucket from its own bindings, never from the client.
  • Safe edits. Edits are find-and-replace or append-to-section, guarded by an etag check so a stale AI view can't overwrite newer changes, and they make a backup first. Editing is switched on per vault.
  • Conflict policy written down as an ADR: the laptop wins sync conflicts, because it's the source of truth and the place I actually write.
  • Defensive reads. The Worker only reads markdown. It hides tooling folders, and it skips notes over 1 MiB for reading and indexing.
  • Tests run against real local R2, D1 and KV through Miniflare rather than mocks of my own code. Every dependency is pinned to an exact version.
  • Decisions, the runbook and the cost limits are documented alongside the code: three ADRs, a runbook, and design docs for auth, tools, writes, search and the audit log.
  • Live with both vaults, and used every day by my AI assistants.
  • Next: a failure alert for the nightly snapshots and a rehearsed restore drill.