Agents and MCP
Let AI coding agents read and edit Octarine notes through the CLI or its built-in MCP server.
The Octarine CLI is designed to be driven by AI agents such as Claude Code, Codex, or Cursor as well as by people. Agents can call the CLI from a shell, or connect to it as a Model Context Protocol (MCP) server. Both run the same commands, so behavior is identical either way.
Everything runs locally against your Markdown files. The desktop app does not need to be open.
agent-guide
Print a short guide that tells an agent how to find notes, read them before editing, make small revision-checked edits, recover from conflicts, and work with tasks and projects.
octarine agent-guide
Paste the output into your agent's instructions, such as a project CLAUDE.md or AGENTS.md, or ask the agent to run the command itself before working with your notes:
octarine agent-guide >> AGENTS.md
help --json
Describe commands in machine-readable form: every argument with its type, default, and allowed values, plus the global options, response envelopes, and error codes.
octarine help --json
octarine help note edit --json
{"schemaVersion":1,"ok":true,"data":{"name":"octarine","version":"0.1.0","commands":[{"command":"note edit","about":"Replace exact text in a note (one match unless --all)","arguments":[{"name":"path","positional":true,"required":true,"schema":{"type":"string"}},{"name":"find","flag":"--find","required":true,"schema":{"type":"string","description":"Exact text to find"}},…]}],"globalOptions":[…],"output":{…},"errors":[…]},"meta":{"truncated":false}}
Without --json, octarine help <command> prints the same help as octarine <command> --help.
octarine mcp
Serve the CLI as MCP tools over standard input and output, or over HTTP for clients that connect to a server by URL.
octarine mcp [--workspace <name, uuid, or path>] [--all-tools | --tools <names>] [--read-only]
[--allow-folder <folder>]... [--transport stdio|http] [--host <address>] [--port <port>]
[--token-file <path>]
Connect An MCP Client
Add Octarine to Claude Code:
claude mcp add octarine -- octarine mcp --workspace "Work Notes"
For clients configured with JSON, such as Claude Desktop or Cursor, add a server entry:
{
"mcpServers": {
"octarine": {
"command": "octarine",
"args": ["mcp", "--workspace", "Work Notes"]
}
}
}
If the client cannot find octarine, use the full path printed by which octarine (or where octarine on Windows).
--workspace fixes the workspace for the server. Without it, the server uses the default workspace. Every tool also accepts an optional workspace argument to target a different workspace for one call, except over HTTP or with --allow-folder (see Serve Over HTTP).
Available Tools
Tool names follow the command path, with spaces and hyphens replaced by underscores: note replace-section becomes note_replace_section. Each tool's input schema matches the command's arguments, and each result is the command's JSON response.
By default, the server exposes a curated set of everyday tools:
| Area | Tools |
|---|---|
| Workspaces | workspace_list, workspace_show, workspace_info, capabilities |
| Reading | note_list, note_read, note_context, note_info, note_outline, note_properties, search |
| Editing | note_create, note_edit, note_replace_section, note_insert, note_patch, note_append, note_prepend, note_update |
| Organizing | note_move, note_rename, note_duplicate, note_trash, folder_list, folder_create, folder_move |
| Links | link_list, link_backlinks, link_unresolved, link_orphans, link_deadends, link_mentions |
| Checkboxes, tags, and properties | note_task_list, note_task_set, checkbox_list, tag_list, property_list, property_get, property_set, property_unset |
| Tasks and projects | task_list, task_show, task_create, task_update, task_comment, task_statuses, task_labels, task_resource_list, task_resource_add, project_list, project_show, cycle_list, cycle_show |
| Inbox | inbox_capture, inbox_list |
Add --all-tools to expose every other command as well, including folder rename, duplicate, and trash, link_replace, views, note types, themes, property definitions, metadata, folder configuration, the rest of the Inbox commands, task and project settings (statuses, labels, buckets, templates, filters, cycle settings), spaces, archiving, schema, export, and doctor.
update, completion, config, workspace use, help, agent-guide, and mcp are never exposed as tools.
Read-only tools, such as note_read, search, and task_statuses, are marked as read-only. Tools that trash, delete, unset, or replace content, such as note_trash and note_update, are marked as destructive, so clients that ask before risky actions can prompt you.
Limit The Tools
Add --read-only to expose only tools that don't change the workspace:
octarine mcp --workspace "Work Notes" --read-only
Add --tools with a comma-separated list to expose exactly those tools. You can name any tool, including ones only available with --all-tools:
octarine mcp --workspace "Work Notes" --tools note_read,search,note_create,inbox_capture
The server refuses to start if a name is not a tool, or if you combine --read-only with a tool that changes the workspace.
Limit The Folders
Add --allow-folder to limit notes and folders to part of the workspace:
octarine mcp --workspace "Work Notes" --allow-folder Claude
To allow more than one folder, repeat --allow-folder once per folder. Comma-separated lists are not supported. Folders are workspace-relative paths, so you can allow a subfolder without its parent. For example, this allows everything in Claude and in Projects/Launch, but not other notes in Projects:
octarine mcp --workspace "Work Notes" --allow-folder Claude --allow-folder "Projects/Launch"
Quote folder names that contain spaces, such as --allow-folder "Reading List". In a JSON client configuration, each flag and folder is its own entry in args:
{
"mcpServers": {
"octarine": {
"command": "octarine",
"args": [
"mcp", "--workspace", "Work Notes",
"--allow-folder", "Claude",
"--allow-folder", "Projects/Launch"
]
}
}
}
With allowed folders:
- Reading, creating, editing, moving, or trashing a note or folder outside them fails with
OUT_OF_SCOPE. - Note and folder lists, search, tags, checkboxes, and backlinks only include notes inside them.
- The allowed folders themselves can't be moved or trashed.
- Moving a note that notes outside the folders link to fails, because the server can't update those links. Move it with
no_update_links, or move it in Octarine. - Links from inside the folders still resolve to notes elsewhere, so those notes' paths can appear in link results.
Tasks, projects, and the Inbox are not stored in folders, so --allow-folder does not limit them. Leave their tools out with --tools if the client shouldn't use them.
Each folder must already exist. The server refuses to start otherwise.
Serve Over HTTP
Some MCP clients connect to servers by URL instead of starting them. For those, serve the Streamable HTTP transport:
octarine mcp --workspace "Work Notes" --transport http --port 8765 --token-file ~/.octarine-mcp-token
The server listens on 127.0.0.1:8765 by default and answers at /mcp, so the URL to give your client is http://127.0.0.1:8765/mcp. Change the address with --host and the port with --port.
With --token-file, every request must include Authorization: Bearer <token>, where the token is the file's contents. Create a token with:
openssl rand -hex 32 > ~/.octarine-mcp-token
Add the server to Claude Code:
claude mcp add --transport http octarine http://127.0.0.1:8765/mcp --header "Authorization: Bearer <token>"
Anyone who can reach the server can use the tools it exposes. To use it from another machine, keep the server on 127.0.0.1, put an HTTPS reverse proxy in front of it, and set --token-file. Combine it with --read-only or --tools to expose only what the client needs.
Without a token, the server rejects requests that browsers send from other websites, so a web page cannot reach a server running on your computer.
Over HTTP, and whenever you use --allow-folder, the server only works on the workspace it started with. Tools don't take a workspace argument, arguments that read or write files on the server's computer (file and output) are removed, and of the workspace tools only workspace_info, workspace_show, and workspace_doctor remain. Pass content inline instead of as a file.
Recommended Agent Workflow
The CLI is built so agents can edit notes precisely without overwriting your changes:
- Find notes with
searchornote list --sort modified --limit 20. Followmeta.nextCursorwith--cursorto page through long searches. - Read before editing with
note context. It returns the content, itsrevision, the outline with line numbers, properties, links, and backlinks in one call. - Edit as little as possible with
note edit,note replace-section,note insert, ornote patch, always passing--revision. Usenote updateonly to rewrite a whole note. - Chain edits using the
revisioneach edit returns. - Handle conflicts. On
REVISION_CONFLICT, the note changed since it was read. Re-read it, re-apply the change, and retry witherror.currentRevision. OnAMBIGUOUS_MATCH, include more surrounding text.
To track work, agents can use the task commands: read a task with task show --activity, move it with task update --state, and record progress with task comment. Task IDs such as WEB-24 are stable and safe to mention in commit messages.
To link notes, write workspace-relative paths without .md, such as [[Projects/Launch]] or [[Projects/Launch#Goals|goals]]. Moving or renaming a note with the CLI updates links to it automatically.
Set JSON output once so the agent does not need --json on every call:
octarine config set format json